From: Keith Packard Date: Sun, 5 Aug 2018 03:09:34 +0000 (+0800) Subject: altos: Add separate 'ao_launch_tick'. Use in pyro and lockout. X-Git-Tag: 1.8.6~1^2~1 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=0d57c78dde3c6e61576a4769b0e0fae7e88c107d altos: Add separate 'ao_launch_tick'. Use in pyro and lockout. Prior to this, there was only ao_boost_tick, which got reset at each motor burn start. That meant there wasn't any way to measure total flight time for pyro channels and 'apogee lockout' was based on time since most recent motor start instead of total flight time. Now pyro channels and apogee lockout both use total flight time, while motor burn length still uses time since most recent motor burn start (as it should). Docs and UI updated to use 'launch' instead of 'boost' to try and make the change clear. Signed-off-by: Keith Packard --- diff --git a/altoslib/AltosPyro.java b/altoslib/AltosPyro.java index 18f0da56..fea4fd59 100644 --- a/altoslib/AltosPyro.java +++ b/altoslib/AltosPyro.java @@ -61,8 +61,8 @@ public class AltosPyro { public static final int pyro_time_greater = 0x00000200; public static final String pyro_time_less_string = "t<"; public static final String pyro_time_greater_string = "t>"; - public static final String pyro_time_less_name = "Time since boost less than (s)"; - public static final String pyro_time_greater_name = "Time since boost greater than (s)"; + public static final String pyro_time_less_name = "Time since launch less than (s)"; + public static final String pyro_time_greater_name = "Time since launch greater than (s)"; public static final double pyro_time_scale = 100.0; public static final int pyro_ascending = 0x00000400; diff --git a/altosui/AltosConfigFCUI.java b/altosui/AltosConfigFCUI.java index 1e875dec..9bd265f0 100644 --- a/altosui/AltosConfigFCUI.java +++ b/altosui/AltosConfigFCUI.java @@ -440,7 +440,7 @@ public class AltosConfigFCUI apogee_lockout_value.setEditable(true); apogee_lockout_value.addItemListener(this); pane.add(apogee_lockout_value, c); - apogee_lockout_value.setToolTipText("Time after boost while apogee detection is locked out"); + apogee_lockout_value.setToolTipText("Time after launch while apogee detection is locked out"); row++; /* Frequency */ diff --git a/doc/config-device.inc b/doc/config-device.inc index 99d5c008..0ca6afff 100644 --- a/doc/config-device.inc +++ b/doc/config-device.inc @@ -23,7 +23,7 @@ ifdef::altusmetrum[] ==== Apogee Lockout - Apogee lockout is the number of seconds after boost + Apogee lockout is the number of seconds after launch where the flight computer will not fire the apogee charge, even if the rocket appears to be at apogee. This is often called 'Mach Delay', as it is @@ -35,6 +35,12 @@ ifdef::altusmetrum[] pressure increase, and so this setting should be left at the default value of zero to disable it. + [WARNING] + Firmware versions older than 1.8.6 have a + bug which resets the time since launch to zero each + time a motor starts burning. Update firmware to get + the correct behavior. + endif::altusmetrum[] ifdef::radio[] diff --git a/doc/pyro-channels.inc b/doc/pyro-channels.inc index 68bbf910..ab5baef0 100644 --- a/doc/pyro-channels.inc +++ b/doc/pyro-channels.inc @@ -42,9 +42,13 @@ launch pad and initialize the system. of less than that value. ==== -Flight Time:: Time since boost was detected. Select a value and choose -whether to activate the pyro channel before or after that amount of -time. +Flight Time:: Time since launch. Select a value and choose whether to +activate the pyro channel before or after that amount of time. + +[WARNING] +Firmware versions older than 1.8.6 have a bug which resets the time +since launch to zero each time a motor starts burning. Update firmware +to get the correct behavior. Ascending:: A deprecated configuration value which was the same as setting Ascent rate > 0. Existing configurations using this will be diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c index 7b3cb9fa..c2700d20 100644 --- a/src/kernel/ao_flight.c +++ b/src/kernel/ao_flight.c @@ -48,7 +48,8 @@ /* Main flight thread. */ __pdata enum ao_flight_state ao_flight_state; /* current flight state */ -__pdata uint16_t ao_boost_tick; /* time of launch detect */ +__pdata uint16_t ao_boost_tick; /* time of most recent boost detect */ +__pdata uint16_t ao_launch_tick; /* time of first boost detect */ __pdata uint16_t ao_motor_number; /* number of motors burned so far */ #if HAS_SENSOR_ERRORS @@ -199,7 +200,7 @@ ao_flight(void) ) { ao_flight_state = ao_flight_boost; - ao_boost_tick = ao_sample_tick; + ao_launch_tick = ao_boost_tick = ao_sample_tick; /* start logging data */ ao_log_start(); @@ -269,7 +270,7 @@ ao_flight(void) * number of seconds. */ if (ao_config.apogee_lockout) { - if ((int16_t) (ao_sample_tick - ao_boost_tick) < + if ((int16_t) (ao_sample_tick - ao_launch_tick) < AO_SEC_TO_TICKS(ao_config.apogee_lockout)) break; } diff --git a/src/kernel/ao_flight.h b/src/kernel/ao_flight.h index 6894fe59..005c7e84 100644 --- a/src/kernel/ao_flight.h +++ b/src/kernel/ao_flight.h @@ -40,6 +40,7 @@ enum ao_flight_state { extern __pdata enum ao_flight_state ao_flight_state; extern __pdata uint16_t ao_boost_tick; +extern __pdata uint16_t ao_launch_tick; extern __pdata uint16_t ao_motor_number; #if HAS_IMU || HAS_MMA655X diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index 3c872354..527112ac 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -160,14 +160,14 @@ ao_pyro_ready(struct ao_pyro *pyro) #endif case ao_pyro_time_less: - if ((int16_t) (ao_time() - ao_boost_tick) <= pyro->time_less) + if ((int16_t) (ao_time() - ao_launch_tick) <= pyro->time_less) continue; - DBG("time %d > %d\n", (int16_t)(ao_time() - ao_boost_tick), pyro->time_less); + DBG("time %d > %d\n", (int16_t)(ao_time() - ao_launch_tick), pyro->time_less); break; case ao_pyro_time_greater: - if ((int16_t) (ao_time() - ao_boost_tick) >= pyro->time_greater) + if ((int16_t) (ao_time() - ao_launch_tick) >= pyro->time_greater) continue; - DBG("time %d < %d\n", (int16_t)(ao_time() - ao_boost_tick), pyro->time_greater); + DBG("time %d < %d\n", (int16_t)(ao_time() - ao_launch_tick), pyro->time_greater); break; case ao_pyro_ascending: