altos: Make cmd number parsing functions return value
authorKeith Packard <keithp@keithp.com>
Thu, 16 Aug 2018 02:13:45 +0000 (19:13 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 13 Oct 2018 15:22:50 +0000 (08:22 -0700)
Don't use a global variable to hold the result.

Signed-off-by: Keith Packard <keithp@keithp.com>
35 files changed:
src/cortexelf-v1/ao_cortexelf.c
src/drivers/ao_btm.c
src/drivers/ao_cc1120.c
src/drivers/ao_cc115l.c
src/drivers/ao_cc1200.c
src/drivers/ao_gps_ublox.c
src/drivers/ao_lco.c
src/drivers/ao_lco_cmd.c
src/drivers/ao_lco_two.c
src/drivers/ao_mpu9250.c
src/drivers/ao_pad.c
src/drivers/ao_pca9922.c
src/drivers/ao_quadrature.c
src/drivers/ao_seven_segment.c
src/drivers/ao_watchdog.c
src/kernel/ao.h
src/kernel/ao_cmd.c
src/kernel/ao_config.c
src/kernel/ao_fake_flight.c
src/kernel/ao_log.c
src/kernel/ao_log_single.c
src/kernel/ao_monitor.c
src/kernel/ao_pyro.c
src/kernel/ao_radio_cmac_cmd.c
src/kernel/ao_send_packet.c
src/kernel/ao_storage.c
src/kernel/ao_tracker.c
src/stm-vga/ao_demo.c
src/stm/ao_lcd_stm.c
src/stm/ao_pwm_stm.c
src/stmf0/ao_adc_stm.c
src/telefireone-v1.0/ao_telefireone.c
src/telelco-v2.0/ao_lco_v2.c
src/usbrelay-v0.1/ao_usbrelay.c
src/vidtime/ao_vidtime.c

index 6bc2624fb06e1a006ff1f1c92a8b77b6ff099bd1..1c30cd85dda20a768642261c9a2d826c186ba07f 100644 (file)
@@ -149,17 +149,16 @@ ao_fb_init(void)
 static void
 ao_video_toggle(void)
 {
-       ao_cmd_decimal();
-       if (ao_cmd_lex_i)
+       uint16_t r = ao_cmd_decimal();
+       if (r)
                ao_fb_init();
-       ao_vga_enable(ao_cmd_lex_i);
+       ao_vga_enable(r)
 }
 
 static void
 ao_ball_toggle(void)
 {
-       ao_cmd_decimal();
-       ball_enable = ao_cmd_lex_i;
+       ball_enable = ao_cmd_decimal();
        ao_wakeup(&ball_enable);
 }
 
@@ -208,11 +207,9 @@ led_cmd(void)
 {
        uint8_t start;
        uint8_t value;
-       ao_cmd_decimal();
 
-       start = ao_cmd_lex_i;
-       ao_cmd_hex();
-       value = ao_cmd_lex_i;
+       start = ao_cmd_decimal();
+       value = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
        ao_as1107_write_8(start, value);
index 3591f8f25b1ca3f478010e9e537acf2b4f8fa718..2930d00e4c26ab48d6e99f01ae097c5c137f8099 100644 (file)
@@ -32,7 +32,7 @@
 int8_t                 ao_btm_stdio;
 uint8_t                ao_btm_connected;
 
-#define BT_DEBUG 0
+#define BT_DEBUG 1
 
 #if BT_DEBUG
 char           ao_btm_buffer[256];
@@ -76,6 +76,7 @@ ao_btm_dump(void)
 {
        int i;
        char c;
+       uint16_t r;
 
        for (i = 0; i < ao_btm_ptr; i++) {
                c = ao_btm_buffer[i];
@@ -85,8 +86,8 @@ ao_btm_dump(void)
                        putchar(ao_btm_buffer[i]);
        }
        putchar('\n');
-       ao_cmd_decimal();
-       if (ao_cmd_status == ao_cmd_success && ao_cmd_lex_i)
+       r = ao_cmd_decimal();
+       if (ao_cmd_status == ao_cmd_success && r)
                ao_btm_ptr = 0;
        ao_cmd_status = ao_cmd_success;
 }
@@ -94,13 +95,17 @@ ao_btm_dump(void)
 static void
 ao_btm_speed(void)
 {
-       ao_cmd_decimal();
-       if (ao_cmd_lex_u32 == 57600)
+       switch (ao_cmd_decimal()) {
+       case 57600:
                ao_serial_btm_set_speed(AO_SERIAL_SPEED_57600);
-       else if (ao_cmd_lex_u32 == 19200)
+               break;
+       case 19200:
                ao_serial_btm_set_speed(AO_SERIAL_SPEED_19200);
-       else
+               break;
+       default:
                ao_cmd_status = ao_cmd_syntax_error;
+               break;
+       }
 }
 
 static uint8_t ao_btm_enable;
index d581c246af292b4068d3e25e34ab19a83a3174e9..aea0a3fe0cd49e1a93b86993da1afdff6badc6b9 100644 (file)
@@ -805,8 +805,7 @@ ao_radio_test_cmd(void)
        static uint8_t radio_on;
        ao_cmd_white();
        if (ao_cmd_lex_c != '\n') {
-               ao_cmd_decimal();
-               mode = (uint8_t) ao_cmd_lex_u32;
+               mode = ao_cmd_decimal();
        }
        mode++;
        if ((mode & 2) && !radio_on) {
index c1c21e0d404e2a0259dd3b20ae23e5a0ad464c77..a8f2c4f5102e2acf0bc7ca8d269d5de243508613 100644 (file)
@@ -700,10 +700,8 @@ ao_radio_test_cmd(void)
        uint8_t mode = 2;
        static uint8_t radio_on;
        ao_cmd_white();
-       if (ao_cmd_lex_c != '\n') {
-               ao_cmd_decimal();
-               mode = (uint8_t) ao_cmd_lex_u32;
-       }
+       if (ao_cmd_lex_c != '\n')
+               mode = ao_cmd_decimal();
        mode++;
        if ((mode & 2) && !radio_on) {
 #if HAS_MONITOR
index f2f9c3727152416f3fcc34e3ba37deda8b499396..45f5711ee3e465c18176543c8c1d58b5d97d98fb 100644 (file)
@@ -858,10 +858,8 @@ ao_radio_test_cmd(void)
 {
        uint8_t mode = 2;
        ao_cmd_white();
-       if (ao_cmd_lex_c != '\n') {
-               ao_cmd_decimal();
-               mode = (uint8_t) ao_cmd_lex_u32;
-       }
+       if (ao_cmd_lex_c != '\n')
+               mode = ao_cmd_decimal();
        mode++;
        if ((mode & 2))
                ao_radio_test_on();
@@ -1362,14 +1360,15 @@ ao_radio_aprs(void)
 static void
 ao_radio_strobe_test(void)
 {
+       uint8_t addr;
        uint8_t r;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       r = ao_radio_strobe(ao_cmd_lex_i);
+       r = ao_radio_strobe(addr);
        printf ("Strobe %02x -> %02x (rdy %d state %d)\n",
-               ao_cmd_lex_i,
+               addr,
                r,
                r >> 7,
                (r >> 4) & 0x7);
@@ -1381,14 +1380,12 @@ ao_radio_write_test(void)
        uint16_t        addr;
        uint8_t         data;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       addr = ao_cmd_lex_i;
-       ao_cmd_hex();
+       data = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       data = ao_cmd_lex_i;
        printf ("Write %04x = %02x\n", addr, data);
        ao_radio_reg_write(addr, data);
 }
@@ -1399,10 +1396,9 @@ ao_radio_read_test(void)
        uint16_t        addr;
        uint8_t         data;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       addr = ao_cmd_lex_i;
        data = ao_radio_reg_read(addr);
        printf ("Read %04x = %02x\n", addr, data);
 }
index f5268aa7c7cee3d47f99ea66e0299c142f6ded02..a6d930835baed49a70d619073b84349242b0a806 100644 (file)
@@ -783,12 +783,12 @@ ao_gps(void)
 #if AO_UBLOX_DEBUG
 static void ao_gps_option(void)
 {
-       ao_cmd_hex();
+       uint16_t r = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success) {
                ao_cmd_status = ao_cmd_success;
                ao_gps_show();
        } else {
-               ao_gps_dbg_enable = ao_cmd_lex_i;
+               ao_gps_dbg_enable = r;
                printf ("gps debug set to %d\n", ao_gps_dbg_enable);
        }
 }
index 86635200fbfe9c9c67eedb3e1f4b8c1e6ccdb5d3..5f5db572c31eb29aa1596d00f34f502e5c8039fd 100644 (file)
@@ -319,9 +319,9 @@ ao_lco_main(void)
 void
 ao_lco_set_debug(void)
 {
-       ao_cmd_decimal();
+       uint16_t r  = ao_cmd_decimal();
        if (ao_cmd_status == ao_cmd_success)
-               ao_lco_debug = ao_cmd_lex_i != 0;
+               ao_lco_debug = r != 0;
 }
 
 const struct ao_cmds ao_lco_cmds[] = {
index 3fcdc859f1ad0ccbe0bc08b9400294d538257c27..6f195e550cfc909063984a0115a9163807038da5 100644 (file)
@@ -33,10 +33,8 @@ static uint16_t      tick_offset;
 static void
 lco_args(void) 
 {
-       ao_cmd_decimal();
-       lco_box = ao_cmd_lex_i;
-       ao_cmd_hex();
-       lco_channels = ao_cmd_lex_i;
+       lco_box = ao_cmd_decimal();
+       lco_channels = ao_cmd_hex();
 }
 
 static struct ao_pad_query     ao_pad_query;
@@ -129,8 +127,7 @@ lco_fire_cmd(void)
        int8_t          r;
 
        lco_args();
-       ao_cmd_decimal();
-       secs = ao_cmd_lex_i;
+       secs = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        r = lco_query();
@@ -163,8 +160,7 @@ lco_static_cmd(void)
        int8_t          r;
 
        lco_args();
-       ao_cmd_decimal();
-       secs = ao_cmd_lex_i;
+       secs = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        r = lco_query();
index 12c02e8847002714ca6a33a78a81935687d4035d..49ea123678714f65d46841cc581bcdfb96817867 100644 (file)
@@ -124,9 +124,9 @@ ao_lco_main(void)
 void
 ao_lco_set_debug(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status == ao_cmd_success)
-               ao_lco_debug = ao_cmd_lex_i;
+               ao_lco_debug = r;
 }
 
 const struct ao_cmds ao_lco_cmds[] = {
index ae8dacd0a2eee8544e6de5e8061c316ffaacf17b..9dce9f1a5a0d4f79f241c50e2a238a09d2b2e906 100644 (file)
@@ -472,10 +472,9 @@ ao_mpu9250_read(void)
        uint8_t addr;
        uint8_t val;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       addr = ao_cmd_lex_i;
        ao_mpu9250_spi_get();
        val = _ao_mpu9250_reg_read(addr);
        ao_mpu9250_spi_put();
@@ -488,14 +487,12 @@ ao_mpu9250_write(void)
        uint8_t addr;
        uint8_t val;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       addr = ao_cmd_lex_i;
-       ao_cmd_hex();
+       val = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       val = ao_cmd_lex_i;
        printf("Addr %02x val %02x\n", addr, val);
        ao_mpu9250_spi_get();
        _ao_mpu9250_reg_write(addr, val);
@@ -508,10 +505,9 @@ ao_mpu9250_mag_read(void)
        uint8_t addr;
        uint8_t val;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       addr = ao_cmd_lex_i;
        ao_mpu9250_spi_get();
        val = _ao_mpu9250_mag_reg_read(addr);
        ao_mpu9250_spi_put();
@@ -524,14 +520,12 @@ ao_mpu9250_mag_write(void)
        uint8_t addr;
        uint8_t val;
 
-       ao_cmd_hex();
+       addr = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       addr = ao_cmd_lex_i;
-       ao_cmd_hex();
+       val = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       val = ao_cmd_lex_i;
        printf("Addr %02x val %02x\n", addr, val);
        ao_mpu9250_spi_get();
        _ao_mpu9250_mag_reg_write(addr, val);
index 7e139c7808d1504f09f375e2e39245aab9fa7197..c08798ac795db6da1555e3a164d09b443397a14e 100644 (file)
@@ -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);
index 3516f03ae89a26e7e3044167c873ca2c090de630..91d62026712deb1f7f7b6a8e3866ea52e2c9c106 100644 (file)
@@ -72,11 +72,11 @@ ao_led_set_mask(uint8_t colors, uint8_t mask)
 static void
 ao_led_test(void)
 {
-       ao_cmd_hexbyte();
+       AO_LED_TYPE r = ao_cmd_hexbyte();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       ao_led_set(ao_cmd_lex_i);
-       printf("LEDs set to %02x\n", ao_cmd_lex_i);
+       ao_led_set(r);
+       printf("LEDs set to %x\n", r);
 }
 
 static const struct ao_cmds ao_led_cmds[] = {
index 20781c407374b9f5a5d41947ba8ea66774951e4d..a5fbd1daaa43e30340a066373a8221cdb6d19b34 100644 (file)
@@ -170,8 +170,7 @@ ao_quadrature_test(void)
        int8_t t = 0;
 #endif
 
-       ao_cmd_decimal();
-       q = ao_cmd_lex_i;
+       q = ao_cmd_decimal();
        if (q >= AO_QUADRATURE_COUNT)
                ao_cmd_status = ao_cmd_syntax_error;
        if (ao_cmd_status != ao_cmd_success)
index d2e1248f70f61e12f9fc3dee48005700ca5f8f8c..1be305e57e16ac5955bedca84ad634edeb731f4d 100644 (file)
@@ -209,10 +209,8 @@ static void
 ao_seven_segment_show(void)
 {
        uint8_t digit, value;
-       ao_cmd_decimal();
-       digit = ao_cmd_lex_i;
-       ao_cmd_decimal();
-       value = ao_cmd_lex_i;
+       digit = ao_cmd_decimal();
+       value = ao_cmd_decimal();
        ao_seven_segment_set(digit, value);
 }
 
index 01c3cd0e7eb3ce7da67d95e7039004f5e0725155..c0582c12cbc1cd1ff4dc48e5d2b478aaf115f7b8 100644 (file)
@@ -38,9 +38,9 @@ ao_watchdog(void)
 static void
 ao_watchdog_set(void)
 {
-       ao_cmd_hex();
+       uint32_t r = ao_cmd_hex();
        if (ao_cmd_status == ao_cmd_success) {
-               ao_watchdog_enabled = ao_cmd_lex_i != 0;
+               ao_watchdog_enabled = r != 0;
                ao_wakeup(&ao_watchdog_enabled);
        }
 }
index fd1d12765a5d3513240514f8184b18cf00fd779b..3beeb8800ded9d83b23d48677004507cd29dcbdc 100644 (file)
@@ -160,8 +160,6 @@ enum ao_cmd_status {
        ao_cmd_syntax_error = 2,
 };
 
-extern uint16_t ao_cmd_lex_i;
-extern uint32_t ao_cmd_lex_u32;
 extern char    ao_cmd_lex_c;
 extern enum ao_cmd_status ao_cmd_status;
 
@@ -189,13 +187,13 @@ ao_cmd_white(void);
 int8_t
 ao_cmd_hexchar(char c);
 
-void
+uint8_t
 ao_cmd_hexbyte(void);
 
-void
+uint32_t
 ao_cmd_hex(void);
 
-void
+uint32_t
 ao_cmd_decimal(void);
 
 /* Read a single hex nibble off stdin. */
index d28db5b7ec06cbd2abc9b31868e123dc3d4cf598..a72192f4665f268bdab7b4dbb23b38ab5d936c01 100644 (file)
@@ -19,8 +19,6 @@
 #include "ao.h"
 #include "ao_task.h"
 
-uint16_t ao_cmd_lex_i;
-uint32_t ao_cmd_lex_u32;
 char   ao_cmd_lex_c;
 enum ao_cmd_status ao_cmd_status;
 
@@ -174,55 +172,49 @@ ao_cmd_hexchar(char c)
        return -1;
 }
 
-void
-ao_cmd_hexbyte(void)
+static
+uint32_t
+_ao_cmd_hex(uint8_t lim)
 {
+       uint32_t result = 0;
        uint8_t i;
-       int8_t  n;
 
-       ao_cmd_lex_i = 0;
        ao_cmd_white();
-       for (i = 0; i < 2; i++) {
-               n = ao_cmd_hexchar(ao_cmd_lex_c);
+       for (i = 0; i < lim; i++) {
+               int8_t n = ao_cmd_hexchar(ao_cmd_lex_c);
                if (n < 0) {
-                       ao_cmd_status = ao_cmd_syntax_error;
+                       if (i == 0 || lim != 0xff)
+                               ao_cmd_status = ao_cmd_lex_error;
                        break;
                }
-               ao_cmd_lex_i = (ao_cmd_lex_i << 4) | n;
+               result = (result << 4) | n;
                ao_cmd_lex();
        }
+       return result;
 }
 
-void
-ao_cmd_hex(void)
+uint8_t
+ao_cmd_hexbyte(void)
 {
-       uint8_t r = ao_cmd_lex_error;
-       int8_t  n;
+       return _ao_cmd_hex(2);
+}
 
-       ao_cmd_lex_i = 0;
-       ao_cmd_white();
-       for(;;) {
-               n = ao_cmd_hexchar(ao_cmd_lex_c);
-               if (n < 0)
-                       break;
-               ao_cmd_lex_i = (ao_cmd_lex_i << 4) | n;
-               r = ao_cmd_success;
-               ao_cmd_lex();
-       }
-       if (r != ao_cmd_success)
-               ao_cmd_status = r;
+uint32_t
+ao_cmd_hex(void)
+{
+       return _ao_cmd_hex(0xff);
 }
 
-void
+uint32_t
 ao_cmd_decimal(void) 
 {
+       uint32_t result = 0;
        uint8_t r = ao_cmd_lex_error;
 
-       ao_cmd_lex_u32 = 0;
        ao_cmd_white();
        for(;;) {
                if ('0' <= ao_cmd_lex_c && ao_cmd_lex_c <= '9')
-                       ao_cmd_lex_u32 = (ao_cmd_lex_u32 * 10) + (ao_cmd_lex_c - '0');
+                       result = result * 10 + (ao_cmd_lex_c - '0');
                else
                        break;
                r = ao_cmd_success;
@@ -230,7 +222,7 @@ ao_cmd_decimal(void)
        }
        if (r != ao_cmd_success)
                ao_cmd_status = r;
-       ao_cmd_lex_i = (uint16_t) ao_cmd_lex_u32;
+       return result;
 }
 
 uint8_t
@@ -250,9 +242,9 @@ ao_match_word(const char *word)
 static void
 echo(void)
 {
-       ao_cmd_hex();
+       uint32_t v = ao_cmd_hex();
        if (ao_cmd_status == ao_cmd_success)
-               ao_stdios[ao_cur_stdio].echo = ao_cmd_lex_i != 0;
+               ao_stdios[ao_cur_stdio].echo = v != 0;
 }
 
 static void
index 277dddd9fe8b2665e2ec8cce1dfa5d273185e68e..596a0410623774f68f68e1c3bf3a239c369141d8 100644 (file)
@@ -318,11 +318,11 @@ ao_config_frequency_show(void)
 void
 ao_config_frequency_set(void) 
 {
-       ao_cmd_decimal();
+       uint32_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.frequency = ao_cmd_lex_u32;
+       ao_config.frequency = r;
        ao_config_set_radio();
        _ao_config_edit_finish();
 #if HAS_RADIO_RECV
@@ -369,11 +369,11 @@ ao_config_main_deploy_show(void)
 void
 ao_config_main_deploy_set(void) 
 {
-       ao_cmd_decimal();
+       uint32_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.main_deploy = ao_cmd_lex_i;
+       ao_config.main_deploy = r;
        _ao_config_edit_finish();
 }
 
@@ -445,16 +445,17 @@ void
 ao_config_accel_calibrate_set(void) 
 {
        int16_t up, down;
+       uint16_t r;
 #if HAS_GYRO
        int16_t accel_along_up = 0, accel_along_down = 0;
        int16_t accel_across_up = 0, accel_across_down = 0;
        int16_t accel_through_up = 0, accel_through_down = 0;
 #endif
 
-       ao_cmd_decimal();
+       r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       if (ao_cmd_lex_i == 0) {
+       if (r == 0) {
                up = ao_config_accel_calibrate_auto("up");
 #if HAS_GYRO
                accel_along_up = accel_cal_along;
@@ -468,11 +469,11 @@ ao_config_accel_calibrate_set(void)
                accel_through_down = accel_cal_through;
 #endif
        } else {
-               up = ao_cmd_lex_i;
-               ao_cmd_decimal();
+               up = r;
+               r = ao_cmd_decimal();
                if (ao_cmd_status != ao_cmd_success)
                        return;
-               down = ao_cmd_lex_i;
+               down = r;
        }
        if (up >= down) {
                printf("Invalid accel: up (%d) down (%d)\n",
@@ -483,7 +484,7 @@ ao_config_accel_calibrate_set(void)
        ao_config.accel_plus_g = up;
        ao_config.accel_minus_g = down;
 #if HAS_GYRO
-       if (ao_cmd_lex_i == 0) {
+       if (r == 0) {
                ao_config.accel_zero_along = (accel_along_up + accel_along_down) / 2;
                ao_config.accel_zero_across = (accel_across_up + accel_across_down) / 2;
                ao_config.accel_zero_through = (accel_through_up + accel_through_down) / 2;
@@ -503,11 +504,11 @@ ao_config_apogee_delay_show(void)
 void
 ao_config_apogee_delay_set(void) 
 {
-       ao_cmd_decimal();
+       uint32_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.apogee_delay = ao_cmd_lex_i;
+       ao_config.apogee_delay = r;
        _ao_config_edit_finish();
 }
 
@@ -521,11 +522,11 @@ ao_config_apogee_lockout_show(void)
 void
 ao_config_apogee_lockout_set(void) 
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.apogee_lockout = ao_cmd_lex_i;
+       ao_config.apogee_lockout = r;
        _ao_config_edit_finish();
 }
 
@@ -541,11 +542,11 @@ ao_config_radio_cal_show(void)
 void
 ao_config_radio_cal_set(void) 
 {
-       ao_cmd_decimal();
+       uint32_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.radio_cal = ao_cmd_lex_u32;
+       ao_config.radio_cal = r;
        ao_config_set_radio();
        _ao_config_edit_finish();
 }
@@ -566,15 +567,15 @@ ao_config_radio_rate_show(void)
 void
 ao_config_radio_rate_set(void) 
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       if (AO_RADIO_RATE_MAX < ao_cmd_lex_i) {
+       if (AO_RADIO_RATE_MAX < r) {
                ao_cmd_status = ao_cmd_lex_error;
                return;
        }
        _ao_config_edit_start();
-       ao_config.radio_rate = ao_cmd_lex_i;
+       ao_config.radio_rate = r;
        _ao_config_edit_finish();
 #if HAS_TELEMETRY
        ao_telemetry_reset_interval();
@@ -618,19 +619,20 @@ ao_config_log_set(void)
 #else
        uint16_t        block = (uint16_t) (ao_storage_block >> 10);
        uint16_t        log_max = (uint16_t) (ao_storage_log_max >> 10);
+       uint32_t        r;
 
-       ao_cmd_decimal();
+       r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        if (ao_log_present())
                printf("Storage must be empty before changing log size\n");
-       else if (block > 1024 && (ao_cmd_lex_i & (block - 1)))
+       else if (block > 1024 && (r & (block - 1)))
                printf("Flight log size must be multiple of %d kB\n", block);
-       else if (ao_cmd_lex_i > log_max)
+       else if (r > log_max)
                printf("Flight log max %d kB\n", log_max);
        else {
                _ao_config_edit_start();
-               ao_config.flight_log_max = (uint32_t) ao_cmd_lex_i << 10;
+               ao_config.flight_log_max = r << 10;
                _ao_config_edit_finish();
        }
 #endif
@@ -647,11 +649,11 @@ ao_config_ignite_mode_show(void)
 void
 ao_config_ignite_mode_set(void) 
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.ignite_mode = ao_cmd_lex_i;
+       ao_config.ignite_mode = r;
        _ao_config_edit_finish();
 }
 #endif
@@ -670,18 +672,17 @@ ao_config_pad_orientation_show(void)
 void
 ao_config_pad_orientation_set(void) 
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal() & 1;
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_cmd_lex_i &= 1;
-       if (ao_config.pad_orientation != ao_cmd_lex_i) {
+       if (ao_config.pad_orientation != r) {
                int16_t t;
                t = ao_config.accel_plus_g;
                ao_config.accel_plus_g = AO_ACCEL_INVERT - ao_config.accel_minus_g;
                ao_config.accel_minus_g = AO_ACCEL_INVERT - t;
        }
-       ao_config.pad_orientation = ao_cmd_lex_i;
+       ao_config.pad_orientation = r;
        _ao_config_edit_finish();
 }
 #endif
@@ -696,11 +697,11 @@ ao_config_radio_enable_show(void)
 void
 ao_config_radio_enable_set(void) 
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.radio_enable = ao_cmd_lex_i;
+       ao_config.radio_enable = r;
        _ao_config_edit_finish();
 #if HAS_TELEMETRY && HAS_RADIO_RATE
        ao_telemetry_reset_interval();
@@ -729,10 +730,10 @@ ao_config_key_set(void)
 
        _ao_config_edit_start();
        for (i = 0; i < AO_AES_LEN; i++) {
-               ao_cmd_hexbyte();
+               uint8_t b = ao_cmd_hexbyte();
                if (ao_cmd_status != ao_cmd_success)
                        break;
-               ao_config.aes_key[i] = ao_cmd_lex_i;
+               ao_config.aes_key[i] = b;
        }
        ++ao_config_aes_seq;
        _ao_config_edit_finish();
@@ -750,11 +751,11 @@ ao_config_aprs_show(void)
 void
 ao_config_aprs_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.aprs_interval = ao_cmd_lex_i;
+       ao_config.aprs_interval = r;
        _ao_config_edit_finish();
        ao_telemetry_reset_interval();
 }
@@ -772,11 +773,11 @@ ao_config_radio_amp_show(void)
 void
 ao_config_radio_amp_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.radio_amp = ao_cmd_lex_i;
+       ao_config.radio_amp = r;
        _ao_config_edit_finish();
 }
 
@@ -793,11 +794,11 @@ ao_config_radio_power_show(void)
 void
 ao_config_radio_power_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.radio_power = ao_cmd_lex_i;
+       ao_config.radio_power = r;
        _ao_config_edit_finish();
 }
 
@@ -813,11 +814,11 @@ ao_config_beep_show(void)
 void
 ao_config_beep_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.mid_beep = ao_cmd_lex_i;
+       ao_config.mid_beep = r;
        _ao_config_edit_finish();
 }
 #endif
@@ -835,14 +836,12 @@ void
 ao_config_tracker_set(void)
 {
        uint16_t        m, i;
-       ao_cmd_decimal();
+       m = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       m = ao_cmd_lex_i;
-       ao_cmd_decimal();
+       i = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       i = ao_cmd_lex_i;
        _ao_config_edit_start();
        ao_config.tracker_motion = m;
        ao_config.tracker_interval = i;
@@ -863,11 +862,11 @@ ao_config_pyro_time_show(void)
 void
 ao_config_pyro_time_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.pyro_time = ao_cmd_lex_i;
+       ao_config.pyro_time = r;
        _ao_config_edit_finish();
 }
 #endif
@@ -883,26 +882,26 @@ ao_config_aprs_ssid_show(void)
 void
 ao_config_aprs_ssid_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       if (15 < ao_cmd_lex_i) {
+       if (15 < r) {
                ao_cmd_status = ao_cmd_lex_error;
                return;
        }
        _ao_config_edit_start();
-       ao_config.aprs_ssid = ao_cmd_lex_i;
+       ao_config.aprs_ssid = r;
        _ao_config_edit_finish();
 }
 
 void
 ao_config_aprs_format_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.aprs_format = ao_cmd_lex_i != 0;
+       ao_config.aprs_format = r != 0;
        _ao_config_edit_finish();
 }
 
@@ -923,11 +922,11 @@ ao_config_pad_box_show(void)
 void
 ao_config_pad_box_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.pad_box = ao_cmd_lex_i;
+       ao_config.pad_box = r;
        _ao_config_edit_finish();
 }
 
@@ -940,11 +939,11 @@ ao_config_pad_idle_show(void)
 void
 ao_config_pad_idle_set(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       ao_config.pad_idle = ao_cmd_lex_i;
+       ao_config.pad_idle = r;
        _ao_config_edit_finish();
 }
 #endif
index 5880cf2b607eeb335edb19ed7b467cc230770dd1..8da0141c4883afffd2417817200f446f335e8f08 100644 (file)
@@ -133,14 +133,12 @@ ao_fake_flight(void)
        enum ao_flight_state    my_state = ao_flight_invalid;
        int                     i;
 
-       ao_cmd_hex();
+       calib_size = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       calib_size = ao_cmd_lex_i;
-       ao_cmd_hex();
+       data_size = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       data_size = ao_cmd_lex_i;
        if ((unsigned) calib_size != sizeof (struct ao_fake_calib)) {
                printf ("calib size %d larger than actual size %d\n",
                        calib_size, sizeof (struct ao_fake_calib));
index 1119cce41f6aeb7378427e400b5dafb871484734..fac211cf32549362b8380f55739c2b2e29a07565 100644 (file)
@@ -437,10 +437,9 @@ ao_log_delete(void)
                cmd_flight = -1;
                ao_cmd_lex();
        }
-       ao_cmd_decimal();
+       cmd_flight *= ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       cmd_flight *= (int16_t) ao_cmd_lex_i;
 
        slots = ao_log_slots();
        /* Look for the flight log matching the requested flight */
index da62738709451c15bff06ad70899d152949d724e..a2b63c8d68084d6ac286ede8e92131fd4ebe51be 100644 (file)
@@ -118,10 +118,11 @@ ao_log_single_restart(void)
 void
 ao_log_single_set(void)
 {
+       uint16_t r;
        printf("Logging currently %s\n", ao_log_running ? "on" : "off");
-       ao_cmd_hex();
+       r = ao_cmd_hex();
        if (ao_cmd_status == ao_cmd_success) {
-               if (ao_cmd_lex_i) {
+               if (r) {
                        printf("Logging from %ld to %ld\n", ao_log_current_pos, ao_log_end_pos);
                        ao_log_single_start();
                } else {
@@ -136,13 +137,12 @@ void
 ao_log_single_delete(void)
 {
        uint32_t        pos;
-
-       ao_cmd_hex();
+       uint16_t        r = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       if (ao_cmd_lex_i != 1) {
+       if (r != 1) {
                ao_cmd_status = ao_cmd_syntax_error;
-               printf("No such flight: %d\n", ao_cmd_lex_i);
+               printf("No such flight: %d\n", r);
                return;
        }
        ao_log_single_stop();
@@ -153,7 +153,7 @@ ao_log_single_delete(void)
        }
        ao_log_current_pos = ao_log_start_pos = 0;
        if (pos == 0)
-               printf("No such flight: %d\n", ao_cmd_lex_i);
+               printf("No such flight: %d\n", r);
        else
                printf ("Erased\n");
 }
index b6b8d88860b2d86a9cf0684cc43d710fb3f30fc8..3f1ff217b18d2b4336eb2baba1befc1033d216f8 100644 (file)
@@ -296,8 +296,7 @@ ao_monitor_enable(void)
 static void
 set_monitor(void)
 {
-       ao_cmd_hex();
-       ao_external_monitoring = ao_cmd_lex_i;
+       ao_external_monitoring = ao_cmd_hex();
        ao_wakeup(&ao_external_monitoring);
        ao_wakeup(&ao_monitor_head);
        _ao_monitor_adjust();
index e24ab46b41a8959f21161a9614d41051aaf0245d..173cf8a3254f4b523d1633b2aa295fca08792a43 100644 (file)
@@ -484,10 +484,9 @@ ao_pyro_set(void)
        }
 #endif
 
-       ao_cmd_decimal();
+       p = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       p = ao_cmd_lex_i;
        if (AO_PYRO_NUM <= p) {
                printf ("invalid pyro channel %d\n", p);
                return;
@@ -516,25 +515,23 @@ ao_pyro_set(void)
                }
                pyro_tmp.flags |= ao_pyro_values[v].flag;
                if (ao_pyro_values[v].offset != NO_VALUE) {
-                       uint8_t negative = 0;
+                       int16_t r = 1;
                        ao_cmd_white();
                        if (ao_cmd_lex_c == '-') {
-                               negative = 1;
+                               r = -1;
                                ao_cmd_lex();
                        }
-                       ao_cmd_decimal();
+                       r *= ao_cmd_decimal();
                        if (ao_cmd_status != ao_cmd_success)
                                return;
                        if (ao_pyro_values[v].flag & AO_PYRO_8_BIT_VALUE) {
-                               if (negative) {
+                               if (r < 0) {
                                        ao_cmd_status = ao_cmd_syntax_error;
                                        return;
                                }
-                               *((uint8_t *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = ao_cmd_lex_i;
+                               *((uint8_t *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = r;
                        } else {
-                               if (negative)
-                                       ao_cmd_lex_i = -ao_cmd_lex_i;
-                               *((int16_t *) (void *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = ao_cmd_lex_i;
+                               *((int16_t *) (void *) ((char *) &pyro_tmp + ao_pyro_values[v].offset)) = r;
                        }
                }
        }
index e5b4ffdf1cd14563b6a049e1d78860ca8aa6cd5c..1433e96d84523ceb9e5bcbadc491482305a27c4d 100644 (file)
@@ -50,16 +50,14 @@ radio_cmac_send_cmd(void)
        uint8_t i;
        uint8_t len;
 
-       ao_cmd_decimal();
+       len = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       len = ao_cmd_lex_i;
        if (len > AO_CMAC_MAX_LEN) {
                ao_cmd_status = ao_cmd_syntax_error;
                return;
        }
        flush();
-       len = ao_cmd_lex_i;
        for (i = 0; i < len; i++) {
                cmac_data[i] = getbyte();
                if (ao_cmd_status != ao_cmd_success)
@@ -74,14 +72,12 @@ radio_cmac_recv_cmd(void)
        uint8_t         len, i;
        uint16_t        timeout;
 
-       ao_cmd_decimal();
+       len = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       len = ao_cmd_lex_i;
-       ao_cmd_decimal();
+       timeout = AO_MS_TO_TICKS(ao_cmd_decimal());
        if (ao_cmd_status != ao_cmd_success)
                return;
-       timeout = AO_MS_TO_TICKS(ao_cmd_lex_i);
        i = ao_radio_cmac_recv(cmac_data, len, timeout);
        if (i == AO_RADIO_CMAC_OK) {
                printf ("PACKET ");
index 3206b2d6d1cd4f2ad4f0fb8fa0c6a161cb454d66..cae25151f4db99077a061123f2bb69792bba3c3a 100644 (file)
@@ -29,8 +29,7 @@ ao_send_packet(void)
        uint8_t b;
        uint8_t i;
 
-       ao_cmd_hex();
-       count = ao_cmd_lex_i;
+       count = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
        if (count > AO_MAX_SEND - 2) {
index 5292e12095c2be18e3441b3caffe9c9e6310ce60..890bdcae9af991b457d018b69b179d5d72828de4 100644 (file)
@@ -92,15 +92,16 @@ static uint8_t storage_data[128];
 static void
 ao_storage_dump(void) 
 {
+       uint32_t block;
        uint8_t i, j;
 
-       ao_cmd_hex();
+       block = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
        for (i = 0; ; i += 8) {
-               if (ao_storage_read(((uint32_t) (ao_cmd_lex_i) << 8) + i,
-                                 storage_data,
-                                 8)) {
+               if (ao_storage_read((block << 8) + i,
+                                   storage_data,
+                                   8)) {
                        ao_cmd_put16((uint16_t) i);
                        for (j = 0; j < 8; j++) {
                                putchar(' ');
@@ -123,23 +124,19 @@ ao_storage_store(void)
        uint16_t block;
        uint8_t i;
        uint16_t len;
-       static uint8_t b;
+       uint8_t b;
        uint32_t addr;
 
-       ao_cmd_hex();
-       block = ao_cmd_lex_i;
-       ao_cmd_hex();
-       i = ao_cmd_lex_i;
+       block = ao_cmd_hex();
+       i = ao_cmd_hex();
        addr = ((uint32_t) block << 8) | i;
-       ao_cmd_hex();
-       len = ao_cmd_lex_i;
+       len = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
        while (len--) {
-               ao_cmd_hex();
+               b = ao_cmd_hexbyte();
                if (ao_cmd_status != ao_cmd_success)
                        return;
-               b = ao_cmd_lex_i;
                ao_storage_write(addr, &b, 1);
                addr++;
        }
@@ -149,10 +146,10 @@ ao_storage_store(void)
 void
 ao_storage_zap(void) 
 {
-       ao_cmd_hex();
+       uint32_t v = ao_cmd_hex();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       ao_storage_erase((uint32_t) ao_cmd_lex_i << 8);
+       ao_storage_erase((uint32_t) v << 8);
 }
 
 void
index 46278530843cf36d527297acc0b93e1be1004bdd..f79bd18ae957d4e1d1516c6e1971a1a208e66be0 100644 (file)
@@ -211,9 +211,9 @@ static struct ao_task ao_tracker_task;
 static void
 ao_tracker_set_telem(void)
 {
-       ao_cmd_hex();
+       uint16_t r = ao_cmd_hex();
        if (ao_cmd_status == ao_cmd_success)
-               ao_tracker_force_telem = ao_cmd_lex_i;
+               ao_tracker_force_telem = r;
        ao_cmd_status = ao_cmd_success;
        printf ("flight: %d\n", ao_flight_number);
        printf ("force_telem: %d\n", ao_tracker_force_telem);
index 63740f8e9f35e2a8e784695fcaf44561668ccbb3..593a87439a93ba75b79e813114df72032763de99 100644 (file)
@@ -159,17 +159,16 @@ ao_fb_init(void)
 static void
 ao_video_toggle(void)
 {
-       ao_cmd_decimal();
-       if (ao_cmd_lex_i)
+       uint16_t r = ao_cmd_decimal();
+       if (r)
                ao_fb_init();
-       ao_vga_enable(ao_cmd_lex_i);
+       ao_vga_enable(r);
 }
 
 static void
 ao_ball_toggle(void)
 {
-       ao_cmd_decimal();
-       ball_enable = ao_cmd_lex_i;
+       ball_enable = ao_cmd_decimal();
        ao_wakeup(&ball_enable);
 }
 
index 10d5d620731497c599610fca601d9f5348d664b1..1947012b86000357445af1ce739a7616cbb03fbf 100644 (file)
@@ -326,12 +326,9 @@ ao_lcd_stm_seg_set(void)
 {
        int     com, seg, val;
        int     n, bit;
-       ao_cmd_decimal();
-       com = ao_cmd_lex_i;
-       ao_cmd_decimal();
-       seg = ao_cmd_lex_u32;
-       ao_cmd_decimal();
-       val = ao_cmd_lex_i;
+       com = ao_cmd_decimal();
+       seg = ao_cmd_decimal();
+       val = ao_cmd_decimal();
        printf ("com: %d seg: %d val: %d\n", com, seg, val);
        ao_lcd_set(com, seg, val);
        ao_lcd_flush();
index 53000a170f19564ab1d5689559c40ad981099852..341f8887a6ab753237d50f7a6c8eeb0673ff4820 100644 (file)
@@ -107,10 +107,8 @@ ao_pwm_cmd(void)
        uint8_t ch;
        uint16_t val;
 
-       ao_cmd_decimal();
-       ch = ao_cmd_lex_u32;
-       ao_cmd_decimal();
-       val = ao_cmd_lex_u32;
+       ch = ao_cmd_decimal();
+       val = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
 
index 571830bbe93dfe52fe3d3072d1eb94b4f6b75868..e62bb16e23be38ae4c53759cbc0fb0ab521990fe 100644 (file)
@@ -103,10 +103,9 @@ ao_adc_one(void)
        int             ch;
        uint16_t        value;
 
-       ao_cmd_decimal();
+       ch = ao_cmd_decimal();
        if (ao_cmd_status != ao_cmd_success)
                return;
-       ch = ao_cmd_lex_i;
        if (ch < 0 || AO_NUM_ADC <= ch) {
                ao_cmd_status = ao_cmd_syntax_error;
                return;
index 790d7a411b7174e7598e3fbed417fc712c401c08..6506235a975be2c596c401cd254498a5f783c76e 100644 (file)
@@ -26,8 +26,7 @@
 static void
 set_logging(void)
 {
-       ao_cmd_hex();
-       ao_log_running = ao_cmd_lex_i;
+       ao_log_running = ao_cmd_hex();
        ao_wakeup(&ao_log_running);
 }
 
index 428b1a7c9594566814ff49865e14540b1b50ca12..90324cc89e93c28534ecd42a8f50f70e38b0ec04 100644 (file)
@@ -282,9 +282,9 @@ ao_lco_main(void)
 void
 ao_lco_set_debug(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status == ao_cmd_success)
-               ao_lco_debug = ao_cmd_lex_i != 0;
+               ao_lco_debug = r != 0;
 }
 
 const struct ao_cmds ao_lco_cmds[] = {
index 0eacdf5a71b788cee8677754a153a6286faaf4ba..946f4b12985b66cc8567ea84e8c39859c3063074 100644 (file)
@@ -49,10 +49,9 @@ ao_relay_select(void)
 {
        uint8_t output;
 
-       ao_cmd_decimal();
+       output = ao_cmd_decimal();
         if (ao_cmd_status != ao_cmd_success)
                 return;
-       output = ao_cmd_lex_i;
        if (output > 1) 
                printf ("Invalid relay position %u\n", output);
        else
index 1b9b9e1c71e432a8c4b6b2a203e9a79b520d5425..e9f8b218ced6f1a6aa9f6bc429f1a9538ee485f1 100644 (file)
@@ -63,9 +63,9 @@ ao_init_vidtime(void)
 static void
 ao_set_vidtime(void)
 {
-       ao_cmd_decimal();
+       uint16_t r = ao_cmd_decimal();
        if (ao_cmd_status == ao_cmd_success) {
-               vidtime_monitor = ao_cmd_lex_i != 0;
+               vidtime_monitor = r != 0;
                ao_wakeup(&vidtime_monitor);
        }
 }