altos: Time out reading packet data from cc1120 after 100ms
[fw/altos] / src / drivers / ao_cc1120.c
index 3e894f762b6809493bee519fa34cf2276504568b..35be54a46ffffa89e7e1b385d01d0b486c8e9a44 100644 (file)
@@ -862,6 +862,7 @@ ao_radio_rx_wait(void)
        do {
                if (ao_radio_mcu_wake)
                        ao_radio_check_marc_status();
+               ao_alarm(AO_MS_TO_TICKS(100));
                ao_arch_block_interrupts();
                rx_waiting = 1;
                while (rx_data_cur - rx_data_consumed < AO_FEC_DECODE_BLOCK &&
@@ -873,6 +874,7 @@ ao_radio_rx_wait(void)
                }
                rx_waiting = 0;
                ao_arch_release_interrupts();
+               ao_clear_alarm();
        } while (ao_radio_mcu_wake);
        if (ao_radio_abort)
                return 0;
@@ -1195,7 +1197,7 @@ static void ao_radio_show(void) {
 }
 
 static void ao_radio_beep(void) {
-       ao_radio_rdf(RDF_PACKET_LEN);
+       ao_radio_rdf();
 }
 
 static void ao_radio_packet(void) {
@@ -1231,6 +1233,7 @@ ao_radio_test_recv()
        }
 }
 
+#if HAS_APRS
 #include <ao_aprs.h>
 
 static void
@@ -1239,13 +1242,16 @@ ao_radio_aprs()
        ao_packet_slave_stop();
        ao_aprs_send();
 }
+#endif
 
 #endif
 
 static const struct ao_cmds ao_radio_cmds[] = {
        { ao_radio_test_cmd,    "C <1 start, 0 stop, none both>\0Radio carrier test" },
 #if CC1120_DEBUG
+#if HAS_APRS
        { ao_radio_aprs,        "G\0Send APRS packet" },
+#endif
        { ao_radio_show,        "R\0Show CC1120 status" },
        { ao_radio_beep,        "b\0Emit an RDF beacon" },
        { ao_radio_packet,      "p\0Send a test packet" },