Skip to content

Commit

Permalink
indicate unknown message codes to the GUI
Browse files Browse the repository at this point in the history
git-svn-id: http://multiwii.googlecode.com/svn/trunk/MultiWii_shared@907 02679b44-d973-9852-f2fa-63770883b36c
  • Loading branch information
stefan@pico.ruhr.de committed Jun 11, 2012
1 parent db8d1e7 commit e3479f1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Serial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,24 @@ uint16_t read16() {
}
uint8_t read8() {return inBuf[indRX++]&0xff;}

void headSerialReply(uint8_t c,uint8_t s) {
void headSerialResponse(uint8_t err, uint8_t c,uint8_t s) {
serialize8('$');
serialize8('M');
serialize8('>');
serialize8(err ? '!' : '>');
/* start calculating a new checksum */
checksum = 0;
serialize8(s);
serialize8(c);
}

void headSerialReply(uint8_t c,uint8_t s) {
headSerialResponse(0, c, s);
}

void headSerialError(uint8_t c,uint8_t s) {
headSerialResponse(1, c, s);
}

void tailSerialReply() {
serialize8(checksum);UartSendData();
}
Expand Down Expand Up @@ -290,6 +298,11 @@ void evaluateCommand(uint8_t c, uint8_t dataSize) {
serialize16(debug3);
serialize16(debug4);
tailSerialReply();break;
default:
/* we do not know how to handle the (valid) message, indicate error */
headSerialError(c,0);
tailSerialReply();
break;
}
}

Expand Down

0 comments on commit e3479f1

Please sign in to comment.