summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-07-27 13:26:22 -0700
committerKeith Packard <keithp@keithp.com>2016-07-27 13:26:22 -0700
commitfe13426daff08f2beface2c1906f9a6184f6b987 (patch)
treecb803bca2dc097dbd0dbc18ec9570788ba1b8376
parent71ddb973ff75680e78fbbef7978ab3893c367629 (diff)
altos: Don't switch to flight 0 when log fills in flight
If the log is full at startup, we want to transmit flight 0 to let the ground station know. However, we don't want to switch to flight 0 in flight, so save the initial telemetry flight number (0 or the real flight number) at startup and use that throughout the flight. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/kernel/ao_telemetry.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c
index e7079179..15085bf4 100644
--- a/src/kernel/ao_telemetry.c
+++ b/src/kernel/ao_telemetry.c
@@ -294,6 +294,7 @@ ao_send_mini(void)
static __pdata int8_t ao_telemetry_config_max;
static __pdata int8_t ao_telemetry_config_cur;
+static __pdata uint16_t ao_telemetry_flight_number;
static void
ao_send_configuration(void)
@@ -302,11 +303,7 @@ ao_send_configuration(void)
{
telemetry.generic.type = AO_TELEMETRY_CONFIGURATION;
telemetry.configuration.device = AO_idProduct_NUMBER;
-#if HAS_LOG
- telemetry.configuration.flight = ao_log_full() ? 0 : ao_flight_number;
-#else
- telemetry.configuration.flight = ao_flight_number;
-#endif
+ telemetry.configuration.flight = ao_telemetry_flight_number;
telemetry.configuration.config_major = AO_CONFIG_MAJOR;
telemetry.configuration.config_minor = AO_CONFIG_MINOR;
#if AO_idProduct_NUMBER == 0x25 && HAS_ADC
@@ -406,6 +403,11 @@ ao_telemetry(void)
while (!ao_flight_number)
ao_sleep(&ao_flight_number);
+ ao_telemetry_flight_number = ao_flight_number;
+#if HAS_LOG
+ if (ao_log_full())
+ ao_telemetry_flight_number = 0;
+#endif
telemetry.generic.serial = ao_serial_number;
for (;;) {
while (ao_telemetry_interval == 0)