altos: Ensure low-rate telem packets interleave with sensor telem packets
authorKeith Packard <keithp@keithp.com>
Wed, 6 Jul 2011 23:43:17 +0000 (16:43 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 6 Jul 2011 23:43:17 +0000 (16:43 -0700)
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 <keithp@keithp.com>
src/ao_telemetry.c

index 603a67913b9bd829e76c47ea4990824a7ea8d0f5..172b6f1756f47654ba5602d67d0990f6112f7258 100644 (file)
@@ -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);