summaryrefslogtreecommitdiff
path: root/src/kernel/ao_config.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-10-25 19:56:25 -0700
committerKeith Packard <keithp@keithp.com>2014-10-25 19:56:25 -0700
commit4d51570ed8776461d084726149923c5be43d622e (patch)
treed99254e629b098d77e19f5fac81319ce5cfe85e7 /src/kernel/ao_config.c
parentc831f1ffb378c20b7513d209d60cdd5dee9db85b (diff)
altos: Fix up telemetry delay computations
With RDF, APRS and telemetry all being sent at varying rates, computing when to send the next radio data is not as simple as sending telemetry and then figuring out whether to send RDF and/or APRS. Fix this by computing times for the next telemetry/rdf/aprs packet, and only sending each when that time has passed. Compute the delay until the next radio activity as the minimum time to any transmission. This also adds code to the config bits to reset the radio times whenever something changes that might affect which radio data to send next. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/kernel/ao_config.c')
-rw-r--r--src/kernel/ao_config.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c
index 6b8a1813..8dab7c42 100644
--- a/src/kernel/ao_config.c
+++ b/src/kernel/ao_config.c
@@ -557,10 +557,10 @@ ao_config_radio_rate_set(void) __reentrant
}
_ao_config_edit_start();
ao_config.radio_rate = ao_cmd_lex_i;
+ _ao_config_edit_finish();
#if HAS_TELEMETRY
ao_telemetry_reset_interval();
#endif
- _ao_config_edit_finish();
#if HAS_RADIO_RECV
ao_radio_recv_abort();
#endif
@@ -684,6 +684,9 @@ ao_config_radio_enable_set(void) __reentrant
_ao_config_edit_start();
ao_config.radio_enable = ao_cmd_lex_i;
_ao_config_edit_finish();
+#if HAS_TELEMETRY && HAS_RADIO_RATE
+ ao_telemetry_reset_interval();
+#endif
}
#endif /* HAS_RADIO */
@@ -735,6 +738,7 @@ ao_config_aprs_set(void)
_ao_config_edit_start();
ao_config.aprs_interval = ao_cmd_lex_i;
_ao_config_edit_finish();
+ ao_telemetry_reset_interval();
}
#endif /* HAS_APRS */
@@ -825,6 +829,9 @@ ao_config_tracker_set(void)
ao_config.tracker_motion = m;
ao_config.tracker_interval = i;
_ao_config_edit_finish();
+#if HAS_TELEMETRY
+ ao_telemetry_reset_interval();
+#endif
}
#endif /* HAS_TRACKER */