Skip to content

Commit

Permalink
corrected the handling of status codes so that 'ok' will not be defau…
Browse files Browse the repository at this point in the history
…lt response in the event of an undefined error code (untested)
  • Loading branch information
simen committed Feb 11, 2011
1 parent 33f014a commit dce597b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion serial_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ static uint8_t char_counter;
void status_message(int status_code) {
if (status_code) {
switch(status_code) {
case GCSTATUS_OK:
printPgmString(PSTR("ok\r\n")); break;
case GCSTATUS_BAD_NUMBER_FORMAT:
printPgmString(PSTR("error: Bad number format\n\r")); break;
case GCSTATUS_EXPECTED_COMMAND_LETTER:
Expand All @@ -44,7 +46,9 @@ void status_message(int status_code) {
case GCSTATUS_FLOATING_POINT_ERROR:
printPgmString(PSTR("error: Floating point error\n\r")); break;
default:
printPgmString(PSTR("ok\r\n"));
printPgmString(PSTR("error: "));
printInteger(status_code);
printPgmString(PSTR("\n\r"));
}
}
}
Expand Down

0 comments on commit dce597b

Please sign in to comment.