Skip to content

Commit

Permalink
Merge pull request #24 from MajorDOOM/patch-1
Browse files Browse the repository at this point in the history
serialport parser change the way the residual buffer is calculated.
  • Loading branch information
bigkevmcd committed Feb 13, 2014
2 parents d16c804 + e1003f1 commit 5388890
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rfxcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ function RfxCom(device, options) {
// Collect data
data.push.apply(data, buffer);
if (requiredBytes === 0) {
requiredBytes = buffer[0] + 1;
requiredBytes = data[0] + 1;
}
if (data.length >= requiredBytes) {
emitter.emit("data", data.slice(0, requiredBytes + 1));
emitter.emit("data", data.slice(0, requiredBytes));
data = data.slice(requiredBytes);
requiredBytes = 0;
}
Expand Down

0 comments on commit 5388890

Please sign in to comment.