altos: Restructure altos build to prepare for multi-arch support Split out sources into separate directories: core: architecture and product independent bits cc1111: cc1111-specific code drivers: architecture independent drivers product: product-specific sources and Makefile fragments util: scripts for building stuff This should have no effect on the built products, but testing is encouraged Signed-off-by: Keith Packard <keithp@keithp.com>
altos: use raw height while waiting for landing This avoids any noise introduced by the kalman filter, making landing detection much more reliable. This patch also changes the interval to 10s so that the height bounds can be increased to 4m. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Require sequencing through 'main' state before landing The old version of the code would permit the flight to go straight from 'drogue' to 'landed' without passing through 'main' at all. This meant that a false landing detection would leave the main charge unfired, potentially causing the airframe to land on drogue alone. Requiring that the flight sequence pass through main ensures that the main charge will get fired at the right time, although if the airframe lands higher than that altitude, it will not go to 'landed' mode ever. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Average height values for landing detection Instead of using the direct output of the kalman filter and hoping that is quiet enough to detect landing, filter that with a long exponential decay filter and then check to make sure that doesn't change more than 2m in 5 seconds as a trigger for landing detection. Tested with existing telemetrum flight logs and it correctly detects landing in all cases. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Switch ao_flight and ao_flight_nano __xdata to __pdata Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Run RDF beacon after apogee instead of waiting for landing This provides tracking when GPS fails, or on TeleMini. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Split up flight code into separate flight/sample/kalman bits The flight code mashed together data processing, filtering and actual flight managament into one giant pile. Split things up so that we have: ao_sample.c: Sensor data processing. Reads the ring, handles calibration ao_kalman.c: Filter the data to track the accel/speed/height values ao_flight.c: Flight state management, specific to rocketry. The plan is to re-use ao_sample.c and ao_kalman.c for hardware not specifically designed for rocketry, like TeleNano. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Ignore alt error for fast->coast. Allow larger error for baro apogee. With the fixed kalman filter, transitions across mach don't cause bumps in the merged filter. And, with working kalman bits, the signal for broken baro detection is stronger and so we can allow for baro apogee detection in cases where noise occurs close to apogee. Bump the kalman filter to trust the baro less so that the model tracks across mach. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Missing parens and some bad arithmetic in the kalman code Fixed point computations are a pain. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Add ao_flight_debug code Trace the kalman filter to make sure it's working. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Clean up some debug stuff in ao_flight.c Remove some spurious printf debugging. Remove an attempt at discovering broken accelerometer code. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Compute a 'trust' value for the barometer Instead of making the baro use/don't-use decision binary, use a 'trust value' which slowly migrates from baro+accel to accel-only mode. This eliminates bumps in the data from a rapid shift. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Switch telemetrum over to kalman filter This changes the full telemetry stream to include kalman data instead of the old ad-hoc flight data. It's compatible in that the packet sizes are the same so teledongle can receive either and figure out which it has received. A few plotting and testing tools are added to make validating the new code easier. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: The kalman code requires a constant sample rate The kalman function can't handle a variable sample rate, so keep the ADC running at full speed for the whole flight instead of slowing it down after apogee. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Baro-only boards must not detect launch on accel or speed data The baro sensor generates too much noise to use small changes in computed speed or acceleration to cause a false launch detect. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Add kalman filters for baro-only boards This adds a baro-only kalman filter to track the state of the rocket, and then uses it to control flight events instead of the existing ad-hoc mechanisms. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Start with packet slave running. Turn off in pad mode. Instead of turning slave mode on in idle mode, start with it running and disable it in pad mode instead. This means packet mode is available in startup mode too. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Make serial, usb, beeper and accelerometer optional components Not all boards will have these, so fix places that use them to deal with that. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Use 5V reference data to correct accelerometer measurements. When the 3.3V and 5V values shift relative to each other (usually due to changes in power consumption), the measured acceleration will appear to shift. This patch converts the 3.3V referenced acceleration value into a 5V referenced acceleration, eliminating this error. Signed-off-by: Keith Packard <keithp@keithp.com>
altos: Optimize fetching of ADC data in flight code This stores the address of the desired sample in a local variable and then fetches through that. Saves quite a few instructions. Signed-off-by: Keith Packard <keithp@keithp.com>