From: Keith Packard Date: Wed, 27 Jul 2016 20:26:22 +0000 (-0700) Subject: altos: Don't switch to flight 0 when log fills in flight X-Git-Tag: 1.6.8~1^2~35 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=fe13426daff08f2beface2c1906f9a6184f6b987;p=fw%2Faltos 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 --- 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)