Fixed bug in error handling causing good commands to be discarded after an error

master 0.0.3
Ondřej Hruška 9 years ago
parent 195132e829
commit 19bdb56748
  1. 2
      scpi.pro
  2. 2
      scpi.pro.user
  3. 5
      source/scpi_parser.c

@ -3,6 +3,8 @@ CONFIG += console
CONFIG -= app_bundle CONFIG -= app_bundle
CONFIG -= qt CONFIG -= qt
INCLUDEPATH += source/
SOURCES += \ SOURCES += \
main.c \ main.c \
source/scpi_parser.c \ source/scpi_parser.c \

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-12-05T21:07:16. --> <!-- Written by QtCreator 3.5.1, 2015-12-05T23:10:56. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

@ -73,7 +73,7 @@ static struct {
SCPI_argval_t args[SCPI_MAX_PARAM_COUNT]; SCPI_argval_t args[SCPI_MAX_PARAM_COUNT];
uint8_t arg_i; // next free argument slot index uint8_t arg_i; // next free argument slot index
} pst = {0}; // initialized by all zeros } pst = {/*EMPTY*/}; // initialized by all zeros
// buffer for error messages // buffer for error messages
@ -220,6 +220,7 @@ void scpi_handle_byte(const uint8_t b)
if (c == '\r' || c == '\n') { if (c == '\r' || c == '\n') {
pars_reset_cmd(); pars_reset_cmd();
} }
break; break;
case PARS_TRAILING_WHITE: case PARS_TRAILING_WHITE:
@ -510,7 +511,7 @@ static void pars_cmd_newline(void)
} else { } else {
err_no_such_command(); err_no_such_command();
pst.state = PARS_DISCARD_LINE; pars_reset_cmd();
} }
} }

Loading…
Cancel
Save