summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-04-21 02:07:24 -0700
committerKeith Packard <keithp@keithp.com>2009-04-21 02:07:24 -0700
commitd87e9c25947d7cc2eba8894a524977f2c55a089a (patch)
tree0b9313408718497040b7290c8fd0415c353ff224
parent1b333def5052d2ed47fdeaef23a897fe326f6340 (diff)
Clean up telemetry now that all packets are the same
-rw-r--r--ao.h3
-rw-r--r--ao_radio.c4
-rw-r--r--ao_telemetry.c14
3 files changed, 5 insertions, 16 deletions
diff --git a/ao.h b/ao.h
index c2e83277..02810d05 100644
--- a/ao.h
+++ b/ao.h
@@ -696,9 +696,6 @@ struct ao_telemetry {
};
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
@@ -22,16 +22,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)
{
static __xdata struct ao_telemetry telemetry;
@@ -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));
}
}