Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

indicate unknown message codes to the GUI

git-svn-id: http://multiwii.googlecode.com/svn/trunk/MultiWii_shared@907 02679b44-d973-9852-f2fa-63770883b36c
  • Loading branch information...
commit e3479f150ec54e55b85b080d6b4152add9158e56 1 parent db8d1e7
stefan@pico.ruhr.de authored
Showing with 15 additions and 2 deletions.
  1. +15 −2 Serial.ino
View
17 Serial.ino
@@ -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();
}
@@ -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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.