Skip to content

Commit

Permalink
fix checksum calculation
Browse files Browse the repository at this point in the history
git-svn-id: http://multiwii.googlecode.com/svn/trunk/MultiWiiConf_shared@865 02679b44-d973-9852-f2fa-63770883b36c
  • Loading branch information
stefan@pico.ruhr.de committed Jun 8, 2012
1 parent 52dc9ee commit 6283b5a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MultiWiiConf.pde
Expand Up @@ -580,9 +580,11 @@ void draw() {
inBuf[offset++] = (byte)(c&0xFF);
} else if (c_state == HEADER_CMD && offset >= dataSize) {
/* compare calculated and transferred checksum */
if (checksum == (c&0xFF)) {
if ((checksum&0xFF) == (c&0xFF)) {
/* we got a valid response packet, evaluate it */
evaluateCommand(cmd, (int)dataSize);
} else {
System.out.println("invalid checksum for command "+((int)(cmd&0xFF))+": "+(checksum&0xFF)+" expected, got "+(int)(c&0xFF));
}
c_state = IDLE;
}
Expand Down

0 comments on commit 6283b5a

Please sign in to comment.