From: Keith Packard Date: Wed, 6 Jul 2011 23:43:17 +0000 (-0700) Subject: altos: Ensure low-rate telem packets interleave with sensor telem packets X-Git-Tag: 0.9.4.3~5 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=81cf2e833bedbc1ace8fd310e9e94bfb7673d428;hp=5ca6400fd8a360b64d8f96f50d5595a7fd17762d altos: Ensure low-rate telem packets interleave with sensor telem packets To avoid over-committing the radio link, we want to send only one low rate packet after each sensor packet. However, the initializations for this were incorrect, causing the configuration and location packets to be sent at the same time. Signed-off-by: Keith Packard --- diff --git a/src/ao_telemetry.c b/src/ao_telemetry.c index 603a6791..172b6f17 100644 --- a/src/ao_telemetry.c +++ b/src/ao_telemetry.c @@ -194,13 +194,13 @@ ao_telemetry_set_interval(uint16_t interval) { ao_telemetry_interval = interval; ao_telemetry_config_max = AO_SEC_TO_TICKS(1) / interval; - ao_telemetry_config_cur = 0; + ao_telemetry_config_cur = 1; #if HAS_GPS - ao_telemetry_loc_cur = 0; - if (ao_telemetry_config_max - 1 > ao_telemetry_loc_cur) + ao_telemetry_loc_cur = 1; + if (ao_telemetry_config_max > ao_telemetry_loc_cur) ao_telemetry_loc_cur++; ao_telemetry_sat_cur = ao_telemetry_loc_cur; - if (ao_telemetry_config_max - 1 > ao_telemetry_sat_cur) + if (ao_telemetry_config_max > ao_telemetry_sat_cur) ao_telemetry_sat_cur++; #endif ao_wakeup(&telemetry);