diff --git a/example/example.c b/example/example.c index 19bf01b..60f8af5 100644 --- a/example/example.c +++ b/example/example.c @@ -32,6 +32,9 @@ int main(void) // test chardata send_cmd("CHARD FOOBAR123_MOO_abcdef_HELLO, 12\n"); + + + send_cmd("SYST:ERR:ALL?\n"); } diff --git a/source/scpi_builtins.c b/source/scpi_builtins.c index 831799f..022d62b 100644 --- a/source/scpi_builtins.c +++ b/source/scpi_builtins.c @@ -158,14 +158,18 @@ static void builtin_SYST_ERR_ALLq(const SCPI_argval_t *args) { (void)args; - int cnt = 0; - while (scpi_error_count()) { - scpi_read_error(sbuf); - if (cnt++ > 0) scpi_send_string_raw(","); - scpi_send_string_raw(sbuf); + if (scpi_error_count()) { + int cnt = 0; + while (scpi_error_count()) { + scpi_read_error(sbuf); + if (cnt++ > 0) scpi_send_string_raw(","); + scpi_send_string_raw(sbuf); + scpi_send_string_raw(scpi_eol); + } + } else { + scpi_read_error(sbuf); // O,"No error" + scpi_send_string(sbuf); } - - scpi_send_string_raw(scpi_eol); }