altos: Respond to telemetry rate changes immediately
authorKeith Packard <keithp@keithp.com>
Sun, 9 Oct 2011 16:21:56 +0000 (10:21 -0600)
committerKeith Packard <keithp@keithp.com>
Sun, 9 Oct 2011 16:21:56 +0000 (10:21 -0600)
Instead of waiting for the previous telemetry interval to expire,
immediately switch to the new telemetry rate. This will provide
more telemetry data early in the boost.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao_telemetry.c

index 95e53917152c176c6dabc9067ab8ef659a7aa1e3..d909bea56178d47eb7ce45a5b86d6faa6dea0804 100644 (file)
@@ -240,8 +240,11 @@ ao_telemetry(void)
 #endif
                        time += ao_telemetry_interval;
                        delay = time - ao_time();
-                       if (delay > 0)
-                               ao_delay(delay);
+                       if (delay > 0) {
+                               ao_alarm(delay);
+                               ao_sleep(&telemetry);
+                               ao_clear_alarm();
+                       }
                        else
                                time = ao_time();
                }