X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fdrivers%2Fao_btm.c;fp=src%2Fdrivers%2Fao_btm.c;h=2930d00e4c26ab48d6e99f01ae097c5c137f8099;hp=3591f8f25b1ca3f478010e9e537acf2b4f8fa718;hb=e208b600fbef395c1b329ded7c0cc5aa7b353550;hpb=ce3d531e0e1ceab03a25c8a5e4a2b4ce6b11a2cf diff --git a/src/drivers/ao_btm.c b/src/drivers/ao_btm.c index 3591f8f2..2930d00e 100644 --- a/src/drivers/ao_btm.c +++ b/src/drivers/ao_btm.c @@ -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;