altos: Updating pyro format tried to copy entries with no value Need to check for NO_VALUE before attempting to copy data, otherwise things will go badly. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Use pyro voltage to check igniters Instead of using an absolute value for the igniter continuity good voltage, use 15/16 of the pyro voltage instead. This ensures we scale with the pyro voltage to find marginal igniters even with high voltage pyro systems. This doesn't work on TeleMetrum where we have no pyro voltage value. On these boards, continue to use a fixed 3.5V value. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Document how delay_done is used in ao_pyro.c delay_done is the time at which the delay finishes, but non-zero values also indicate that some delay is pending. Add a comment about why the value is set to 1 when it is zero, and switch the tests of this value to comparisons against zero. Signed-off-by: Keith Packard <keithp@keithp.com>
ao_pyro: Move delay_done out of pyro structure The pyro structure should be read-only in flight operations. Move the 'delay_done' element to a parallel array as that gets written. Change types to pointers to const structs to enforce this in the future. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Switch all tick variables to AO_TICK_TYPE/AO_TICK_SIGNED Instead of trying to pick and choose which work as 16-bit values, change everything that doesn't affect external values (log, companion, radio) to AO_TICK_TYPE. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Fix config upgrade from 1.24 to 1.25 Alignment of pyro field changed due to increased size of fields which shifted the whole struct by two bytes, leading to mis-updating the struct. Fix that by creating a mirror of the ao_config type for version 1.24 and then using that to fetch the old data. Signed-off-by: Keith Packard <keithp@keithp.com>
kernel: Widen pyro time values to 32 bits This lets time values of greater than 327 seconds be used. 99% of this code is to adjust existing configurations to the new structure, which is wider than the old. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Don't report inhibited pyro channels as fired Inhibiting channels happens when the channel conditions change during the delay period and was done by marking them as already fired. This worked, but the log file would then indicate that the channel had fired when in fact it was inhibited instead. Separate out the inhibited status so that the correct data appears in the log. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Eliminate 'pin' field from GPIO functions This was used with the 8051 bit-addressing mode to provide single-instruction access to GPIO pins. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Use stdbool true/false instead of TRUE/FALSE Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Make cmd number parsing functions return value Don't use a global variable to hold the result. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Remove 8051 address space specifiers Signed-off-by: Keith Packard <keithp@keithp.com>
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 <keithp@keithp.com>
altos: Change 'after motor' pyro check to be >= instead of == This makes after motor stay valid even if further motors burn. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Use max of 64 previous orient values when checking pyro limits Instead of checking just a single measurement to see if the orientation is outside of the desired limits, use the maximum of 64 previous values to that rapidly changing orientation won't accidentally enable a pyro channel if sampled at the 'wrong time'. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Stop storing pyro fired status in config block We already have the fired status saved in the ao_pyro_fired variable, so just use that to detect whether a channel has already been fired. Fixes possible cases where the pyro config data gets written back to eeprom with the fired bit set, which then inhibits the channel during flight. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Allow pyro config name to end with newline, not just space/tab A pyro config like 'Descending' has no value associated. When it is at the end of the line, allow a newline to terminate the name instead of just a space. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Fix debug printf in ao_pyro for state >= Signed-off-by: Keith Packard <keithp@keithp.com>
altos/arm: Align data so that gcc 5.4 doesn't do byte-accesses. Add -Wcast-align Gcc 5.4.1 tracks alignment of data through assignments, so that a uint32_t pointer which comes from byte-aligned uint8_t data: extern uint8_t foo[]; uint32_t *q = (void *) foo; Fetches and stores through this pointer are done bytewise. This is slow (meh), but if q references a device register, things to bad very quickly. This patch works around this bug in the compiler by adding __attribute__((aligned(4))) tags to some variables, or changing them from uint8_t to uint32_t. Places doing this will now be caught as I've added -Wcast-align to the compiler flags. That required adding (void *) casts, after the relevant code was checked to make sure the compiler could tell that the addresses were aligned. Signed-off-by: Keith Packard <keithp@keithp.com>
altos/test: Fix tests A couple of fixups for ao_flight_test to dump pyro info only when running in debug mode, and to change the aprs testing Signed-off-by: Keith Packard <keithp@keithp.com>