Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virmata rohkost #99

Merged
merged 63 commits into from
Feb 7, 2013
Merged
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
ba7f19b
Moving the old, string based plugin to Legacy files
Jan 7, 2013
f0c64d2
Added Firmata Legacy amppings to diffff.xml
Jan 7, 2013
b099399
First working draft Encode with RAW
Jan 7, 2013
3d556cd
Merge remote-tracking branch 'upstream/develop' into virmata-rohkost
Jan 12, 2013
aaf925b
Adding Rakefile for easier building
Jan 12, 2013
98c279a
Adding Solution file to build via rake
Jan 12, 2013
040b752
Working Draft using Raw Stream data type
Jan 12, 2013
276e35b
Updated the module for new raw data type
Jan 12, 2013
93d00c8
Fixed wrong param name in :test task
Jan 12, 2013
8263411
Minor cleanups
Jan 15, 2013
e23a994
Updating from upstream, resolved diffff conflict
Jan 17, 2013
3ee649d
Supporting generic PORT count
Jan 17, 2013
9a7d851
Bumped Patch version to 29.1 to match difff.xml changes
Jan 17, 2013
83439a1
Merge branch 'virmata-rohkost' into virmata-develop
Jan 17, 2013
66fcd44
Fixed faulty input stream handling
Jan 17, 2013
13b669b
Removed unused string encoder
Jan 17, 2013
4c2dfa0
Cleaning up unused property
Jan 17, 2013
f39fdd6
Added a defaults section to the Firmata namespace
Jan 19, 2013
92f7fa4
Fixed command filter method in FirmataUtils
Jan 19, 2013
57e3948
Using new Defaults in pin configuration
Jan 19, 2013
e5fc160
Adding region tags on CS file of decoder. Nothing fancy...
Jan 19, 2013
f5c5f85
Reordering the command buffer building + small cleanups
Jan 19, 2013
bb25e8d
Removing unused vairables and fixed regarding uses
Jan 19, 2013
ba347fe
Forgotten PinMode change
Jan 20, 2013
3672298
Correcting SHIFTOUT to SHIFT as PinMode, added missing RESET command
Jan 20, 2013
82567ba
Cleaning up UpdatePinConfiguration method
Jan 20, 2013
49387ea
Cleaning up SetPinStates method
Jan 20, 2013
92fbdc2
Fixed: The RESET command is not a SySex command
Jan 20, 2013
14a8ccb
Cleaning up UpdatePinCount method
Jan 20, 2013
872afe3
Minor improvements on pin mode setting
Jan 20, 2013
4c2aa4e
Introducing a command to string builder for debugging
Jan 20, 2013
ff6cf39
It's all about whitespace...
Jan 20, 2013
4627397
Some trailing white lines...
Jan 20, 2013
d2cbd1f
Moving Legacy code to own folder
Jan 20, 2013
16c70b5
Fixed formatting flaws in command printer
Jan 20, 2013
136df6b
Added region for pin definitions
Jan 20, 2013
0b489ee
Deleting one blank line too much in command printer
Jan 20, 2013
6c596b8
Improved ShouldReset to recon startup too
Jan 20, 2013
38d220b
Adding complete collection of SysEx commands and fixed naming old ones
Jan 20, 2013
b3b9cf1
Adding full support for up 127 analog pins
Jan 20, 2013
db6c2f7
Small refactoring of SetPinStates method
Jan 20, 2013
924893b
Reflecting new SysEx commands in Legacy nodes
Jan 20, 2013
e23fa42
Fixed version number in help file and fixed up some small cosmetic ch…
Jan 27, 2013
a62d4b9
Fixed faulty input stream handling
Jan 17, 2013
3ef1449
Using analog pin modes according to spec
Jan 29, 2013
a1c8475
Adding working I2C decoding support, adjusted module and help file
Feb 1, 2013
32f915f
Merge remote-tracking branch 'upstream/develop' into virmata-rohkost
Feb 1, 2013
d95331e
Old I2C Node is properly set Legacy
Feb 1, 2013
c7d17b7
Merge remote-tracking branch 'upstream/develop' into virmata-develop
Feb 1, 2013
7efce1f
Merging changes from rohkost with latest I2C and one forgotten Legacy…
Feb 1, 2013
ce7daa3
Whitespace cleanups
Feb 1, 2013
8c5d9f0
Removing Debug Pin and cleaning up bracketing
Feb 1, 2013
5f1a722
Merge remote-tracking branch 'upstream/develop' into virmata-develop
Feb 4, 2013
1a28b00
Removing left overs from merging diffff.xml
Feb 4, 2013
7a41cbe
Adding olf i2c decoder to difff.xml
Feb 4, 2013
247a921
Cleaning up abandoned io boxes
Feb 4, 2013
fe834af
Bumped version number to 1.1.x
Feb 4, 2013
ce01b2b
Cleaning up unused dependencies and removing automatic local copies
Feb 4, 2013
8e878a7
Updating from upstream
Feb 6, 2013
3597594
Fixed pin naming
Feb 6, 2013
ab16aa7
Reflecting pin renaming in diffff.xml
Feb 6, 2013
27e71e9
Adding more short hand build commands to Rakefile
Feb 6, 2013
b7daea2
Taking out String from version string + skipping renaming old pin
Feb 7, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed faulty input stream handling
  • Loading branch information
jens-a-e committed Jan 27, 2013
commit a62d4b9aa26d35cde653b157a4dbef46f3ecae56
30 changes: 18 additions & 12 deletions vvvv45/addonpack/src/nodes/plugins/Devices/Virmata/VirmataDecode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class FirmataDecode : IPluginEvaluate
{
#region fields & pins
/// Inputs
[Input("Firmata Message")]
[Input("Firmata Message", IsSingle = true)]
IInStream<Stream> FirmataIn;

[Input("Analog Input Count",DefaultValue = 6, Visibility = PinVisibility.OnlyInspector, IsSingle = true)]
Expand Down Expand Up @@ -108,11 +108,9 @@ public class FirmataDecode : IPluginEvaluate

[Output("I2C Data",Visibility = PinVisibility.OnlyInspector)]
ISpread<byte> FI2CData;

#endregion fields & pins

private Queue<byte> Buffer = new Queue<byte>();

//called when data for any output pin is requested
public void Evaluate(int SpreadMax)
{
Expand All @@ -125,18 +123,26 @@ public void Evaluate(int SpreadMax)

/// Read in the stream
try {
using (IStreamReader<Stream> InputReader = FirmataIn.GetCyclicReader())
using (IStreamReader<Stream> InputReader = FirmataIn.GetReader())
{
while (!InputReader.Eos) {
Stream InStream = InputReader.Read();
if(InStream != null && InStream.CanRead){
Buffer.Enqueue((byte)InStream.ReadByte());
}
}
while (!InputReader.Eos) {
HandleStream(InputReader.Read());
}
}
} catch (Exception e) {
// If we encounter an error there is also nothing to decode
return;
}
}

private Queue<byte> Buffer = new Queue<byte>();

private void HandleStream(Stream InStream) {
// Check, if the incoming Stream is usable
if(InStream == null || InStream.Length == 0 || !InStream.CanRead) return;

// Read the incoming bytes to the internal stream buffer
while (InStream.Position < InStream.Length) {
Buffer.Enqueue((byte)InStream.ReadByte());
}

// A cache for sysex data
Expand Down