From: Keith Packard Date: Tue, 21 Apr 2009 09:07:24 +0000 (-0700) Subject: Clean up telemetry now that all packets are the same X-Git-Tag: 0.1~42 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=d87e9c25947d7cc2eba8894a524977f2c55a089a;hp=1b333def5052d2ed47fdeaef23a897fe326f6340 Clean up telemetry now that all packets are the same --- diff --git a/ao.h b/ao.h index c2e83277..02810d05 100644 --- a/ao.h +++ b/ao.h @@ -695,9 +695,6 @@ struct ao_telemetry { struct ao_gps_data gps; }; -void -ao_telemetry_send(__xdata struct ao_telemetry *telemetry) __reentrant; - void ao_telemetry_init(void); diff --git a/ao_radio.c b/ao_radio.c index 5ff6f9bf..13362d3e 100644 --- a/ao_radio.c +++ b/ao_radio.c @@ -217,7 +217,7 @@ ao_radio_send(__xdata struct ao_telemetry *telemetry) __reentrant DMA_CFG1_PRIORITY_HIGH); ao_dma_start(ao_radio_dma); RFST = RFST_STX; - while (!ao_radio_dma_done) + __critical while (!ao_radio_dma_done) ao_sleep(&ao_radio_dma_done); ao_mutex_put(&ao_radio_mutex); } @@ -239,7 +239,7 @@ ao_radio_recv(__xdata struct ao_radio_recv *radio) __reentrant DMA_CFG1_PRIORITY_HIGH); ao_dma_start(ao_radio_dma); RFST = RFST_SRX; - while (!ao_radio_dma_done) + __critical while (!ao_radio_dma_done) ao_sleep(&ao_radio_dma_done); ao_mutex_put(&ao_radio_mutex); } diff --git a/ao_telemetry.c b/ao_telemetry.c index b46f03c7..90cf2e4e 100644 --- a/ao_telemetry.c +++ b/ao_telemetry.c @@ -21,16 +21,6 @@ uint8_t ao_serial_number = 2; -void -ao_telemetry_send(__xdata struct ao_telemetry *telemetry) __reentrant -{ - if (ao_flight_state != ao_flight_idle && ao_flight_state != ao_flight_startup) { - telemetry->addr = ao_serial_number; - telemetry->flight_state = ao_flight_state; - ao_radio_send(telemetry); - } -} - void ao_telemetry(void) { @@ -41,11 +31,13 @@ ao_telemetry(void) ao_sleep(DATA_TO_XDATA(&ao_flight_state)); for (;;) { + telemetry.addr = ao_serial_number; + telemetry.flight_state = ao_flight_state; ao_adc_get(&telemetry.adc); ao_mutex_get(&ao_gps_mutex); memcpy(&telemetry.gps, &ao_gps_data, sizeof (struct ao_gps_data)); ao_mutex_put(&ao_gps_mutex); - ao_telemetry_send(&telemetry); + ao_radio_send(&telemetry); ao_delay(AO_MS_TO_TICKS(1000)); } }