From 377ee7e90ecd028f984cd1abce96b2efc3b5b977 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 21 Nov 2010 14:03:17 -0800 Subject: altos: Add on/off modes to 'C' command This lets the user turn the radio on/off and then invoke other commands. Signed-off-by: Keith Packard --- src/ao_radio.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ao_radio.c b/src/ao_radio.c index f4a9d3b2..3fb4afd7 100644 --- a/src/ao_radio.c +++ b/src/ao_radio.c @@ -448,19 +448,32 @@ ao_radio_rdf_abort(void) void ao_radio_test(void) { - ao_set_monitor(0); - ao_packet_slave_stop(); - ao_radio_get(); - printf ("Hit a character to stop..."); flush(); - RFST = RFST_STX; - getchar(); - ao_radio_idle(); - ao_radio_put(); - putchar('\n'); + uint8_t mode = 2; + ao_cmd_white(); + if (ao_cmd_lex_c != '\n') { + ao_cmd_decimal(); + mode = (uint8_t) ao_cmd_lex_u32; + } + mode++; + if (mode & 2) { + ao_set_monitor(0); + ao_packet_slave_stop(); + ao_radio_get(); + RFST = RFST_STX; + } + if (mode == 3) { + printf ("Hit a character to stop..."); flush(); + getchar(); + putchar('\n'); + } + if (mode & 1) { + ao_radio_idle(); + ao_radio_put(); + } } __code struct ao_cmds ao_radio_cmds[] = { - { 'C', ao_radio_test, "C Radio carrier test" }, + { 'C', ao_radio_test, "C <1 start, 0 stop, none both> Radio carrier test" }, { 0, ao_radio_test, NULL }, }; -- cgit v1.2.3 From b27327a05d249eaf969b67d2a8d12fc6a93841f0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 22 Nov 2010 15:56:04 -0800 Subject: altos: assume igniter worked. Many igniters don't go open when fired, so there's no way to know if they worked. Assume they did as a failed igniter is unlikely to do anything when fired again anyways. Signed-off-by: Keith Packard --- src/ao_ignite.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/ao_ignite.c b/src/ao_ignite.c index 4093b6a7..58d340d9 100644 --- a/src/ao_ignite.c +++ b/src/ao_ignite.c @@ -113,9 +113,7 @@ ao_igniter(void) ao_igniter_fire(igniter); ao_delay(AO_IGNITER_CHARGE_TIME); - status = ao_igniter_status(igniter); - if (status == ao_igniter_open) - ao_ignition[igniter].fired = 1; + ao_ignition[igniter].fired = 1; } } } -- cgit v1.2.3 From d873dc28f0752aeb58a6263e42bdd5b9095bd392 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 23 Nov 2010 18:56:46 -0800 Subject: altos: remove unused variable from ao_igniter The 'status' variable used to hold a reported status value from the igniter after firing, but we ignore that now. Signed-off-by: Keith Packard --- src/ao_ignite.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/ao_ignite.c b/src/ao_ignite.c index 58d340d9..f2b15dd2 100644 --- a/src/ao_ignite.c +++ b/src/ao_ignite.c @@ -101,7 +101,6 @@ void ao_igniter(void) { __xdata enum ao_ignter igniter; - __xdata enum ao_igniter_status status; ao_config_get(); for (;;) { -- cgit v1.2.3 From 54468e5dc567aaac5c5c20e921859b7cec28bb88 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 23 Nov 2010 18:57:49 -0800 Subject: altos: Don't abort radio transmissions with ao_radio_abort We only want to abort pending radio reception to release the radio for other use, or to change the radio channel. Let radio transmission proceed. This fixes a problem with using packet mode to configure the radio channel; if the packet transmission is aborted, the TM ends up wedged. Signed-off-by: Keith Packard --- src/ao_radio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ao_radio.c b/src/ao_radio.c index 3fb4afd7..b2105ff8 100644 --- a/src/ao_radio.c +++ b/src/ao_radio.c @@ -432,8 +432,11 @@ ao_radio_rdf(int ms) void ao_radio_abort(void) { - ao_dma_abort(ao_radio_dma); - ao_radio_idle(); + /* Only abort if a task is waiting to receive data */ + if (RFST == RFST_SRX) { + ao_dma_abort(ao_radio_dma); + ao_radio_idle(); + } } void -- cgit v1.2.3 From 3b9db8c82d26a6a2e43d4ca40742fc1bdc502380 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 23 Nov 2010 19:02:54 -0800 Subject: altos: Make radio test command careful with the radio mutex. Remember whether the radio test mode is on or off and don't try to do either of them twice to prevent the mutex from being acquired or released twice. Signed-off-by: Keith Packard --- src/ao_radio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ao_radio.c b/src/ao_radio.c index b2105ff8..67d5f6ba 100644 --- a/src/ao_radio.c +++ b/src/ao_radio.c @@ -452,26 +452,29 @@ void ao_radio_test(void) { uint8_t mode = 2; + static __xdata radio_on; ao_cmd_white(); if (ao_cmd_lex_c != '\n') { ao_cmd_decimal(); mode = (uint8_t) ao_cmd_lex_u32; } mode++; - if (mode & 2) { + if ((mode & 2) && !radio_on) { ao_set_monitor(0); ao_packet_slave_stop(); ao_radio_get(); RFST = RFST_STX; + radio_on = 1; } if (mode == 3) { printf ("Hit a character to stop..."); flush(); getchar(); putchar('\n'); } - if (mode & 1) { + if ((mode & 1) && radio_on) { ao_radio_idle(); ao_radio_put(); + radio_on = 0; } } -- cgit v1.2.3