diff options
| author | Keith Packard <keithp@keithp.com> | 2018-08-15 19:13:45 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2018-10-13 08:22:50 -0700 |
| commit | c417ab1de2a083b5fcff2e081e4feb2a65887903 (patch) | |
| tree | 614c7564321ea38402883992daeaea8f30bfe6b1 /src/drivers/ao_pad.c | |
| parent | c6e57291d91f1f6c4de5c54a5cfd3eef66d9f830 (diff) | |
altos: Make cmd number parsing functions return value
Don't use a global variable to hold the result.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_pad.c')
| -rw-r--r-- | src/drivers/ao_pad.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index 7e139c78..c08798ac 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -509,16 +509,14 @@ ao_pad_manual(void) ao_cmd_white(); if (!ao_match_word("DoIt")) return; - ao_cmd_decimal(); + ignite = 1 << ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - ignite = 1 << ao_cmd_lex_i; - ao_cmd_decimal(); + repeat = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) { repeat = 1; ao_cmd_status = ao_cmd_success; - } else - repeat = ao_cmd_lex_i; + } while (repeat-- > 0) { ao_pad_ignite = ignite; ao_wakeup(&ao_pad_ignite); @@ -534,9 +532,9 @@ static struct ao_task ao_pad_monitor_task; void ao_pad_set_debug(void) { - ao_cmd_decimal(); + uint16_t r = ao_cmd_decimal(); if (ao_cmd_status == ao_cmd_success) - ao_pad_debug = ao_cmd_lex_i != 0; + ao_pad_debug = r != 0; } @@ -544,14 +542,12 @@ static void ao_pad_alarm_debug(void) { uint8_t which, value; - ao_cmd_decimal(); + which = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - which = ao_cmd_lex_i; - ao_cmd_decimal(); + value = ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) return; - value = ao_cmd_lex_i; printf ("Set %s to %d\n", which ? "siren" : "strobe", value); if (which) ao_siren(value); |
