diff options
author | Keith Packard <keithp@keithp.com> | 2010-11-26 16:14:15 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-12-22 20:39:40 -0800 |
commit | 07213dc34fa20470a4b36a327a83d75b0f010ebb (patch) | |
tree | a85d444ab7d2ccf01153c15e6fb2adf8473b602f /src/ao_monitor.c | |
parent | b62580855c5144f5bc7e0172289bce08814d9472 (diff) |
altos: clean up radio abort paths. Share radio code.
Instead of aborting the DMA and radio operation and expecting that to
be handled reasonably by the radio receiving task, rewrite things so
that the abort function just wakes the receiving task while that
terminates the DMA and cleans up the radio.
This eliminates all kinds of nasty bugs dealing with radio abort
smashing the radio registers at the wrong time, or interrupting a
radio transmission.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_monitor.c')
-rw-r--r-- | src/ao_monitor.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ao_monitor.c b/src/ao_monitor.c index f019d3b4..1e7f5102 100644 --- a/src/ao_monitor.c +++ b/src/ao_monitor.c @@ -23,7 +23,7 @@ __pdata uint8_t ao_monitor_led; void ao_monitor(void) { - __xdata struct ao_radio_recv recv; + __xdata struct ao_telemetry_recv recv; __xdata char callsign[AO_MAX_CALLSIGN+1]; uint8_t state; int16_t rssi; @@ -31,7 +31,7 @@ ao_monitor(void) for (;;) { __critical while (!ao_monitoring) ao_sleep(&ao_monitoring); - if (!ao_radio_recv(&recv)) + if (!ao_radio_recv(&recv, sizeof (recv))) continue; state = recv.telemetry.flight_state; @@ -85,7 +85,7 @@ ao_set_monitor(uint8_t monitoring) ao_monitoring = monitoring; ao_wakeup(&ao_monitoring); if (!ao_monitoring) - ao_radio_abort(); + ao_radio_recv_abort(); } static void |