fw/altos
3 years agoaltoslib: Clip accelerometer-based speed to >= 0 easymotor
Keith Packard [Sat, 17 Oct 2020 22:29:11 +0000 (15:29 -0700)]
altoslib: Clip accelerometer-based speed to >= 0

Negative vertical speeds computed by axial acceleration aren't
sensible, so just clip them to zero so that plots are more useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Limit .csv file output to valid fields for EasyMotor
Keith Packard [Sat, 17 Oct 2020 03:54:32 +0000 (20:54 -0700)]
altoslib: Limit .csv file output to valid fields for EasyMotor

EasyMotor doesn't have a baro sensor, gyros, mag sensor or igniters.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Easy Motor v2 x axis is inverted
Keith Packard [Sat, 17 Oct 2020 03:53:56 +0000 (20:53 -0700)]
altoslib: Easy Motor v2 x axis is inverted

Provide positive accel values along rocket axis

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Correct ADXL counts_per_g
Keith Packard [Sat, 17 Oct 2020 03:52:48 +0000 (20:52 -0700)]
altoslib: Correct ADXL counts_per_g

When ADXL 375 is used as a 3d accel (as on EasyMotor), need the right
counts_per_g to do conversions.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Reset 3d-accel and motor pressure sums each ground interval
Keith Packard [Sat, 17 Oct 2020 03:48:55 +0000 (20:48 -0700)]
altos: Reset 3d-accel and motor pressure sums each ground interval

We're repeatedly averaging 512 ground samples to get up-to-date values
for all of the sensors, but we need to clear the sums after each
sample interval. The 3d accel values were only cleared if there was a
full IMU, not for devices with only an accelerometer like
EasyMotor. The motor pressure sum was never cleared.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: use motor pressure calibration data for EasyMotor
Keith Packard [Fri, 16 Oct 2020 22:30:35 +0000 (15:30 -0700)]
altoslib: use motor pressure calibration data for EasyMotor

EasyMotor stores an average sensor value for motor pressure, use that
to report pressure above that value.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Report metric pressure in kPa instead of Pa
Keith Packard [Fri, 16 Oct 2020 22:29:12 +0000 (15:29 -0700)]
altoslib: Report metric pressure in kPa instead of Pa

Reduces the magnitude of pressure data when displayed.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoturn debugging off for pre-flight swing test and test flight
Bdale Garbee [Sat, 17 Oct 2020 00:41:05 +0000 (18:41 -0600)]
turn debugging off for pre-flight swing test and test flight

3 years agoaltos: Add motor pressure calibration data to easy motor log
Keith Packard [Fri, 16 Oct 2020 19:59:48 +0000 (12:59 -0700)]
altos: Add motor pressure calibration data to easy motor log

Compute an average of ground motor pressure values and store those in
the log data in the AO_FLIGHT record.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Shorten accel-only integration ground interval
Keith Packard [Fri, 16 Oct 2020 19:58:57 +0000 (12:58 -0700)]
altos: Shorten accel-only integration ground interval

Set interval to 64 samples for resetting the accumulated speed/height
on the ground in accel-only configurations.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Support negative decimal values on command line
Keith Packard [Fri, 16 Oct 2020 19:57:07 +0000 (12:57 -0700)]
altos: Support negative decimal values on command line

Add support for leading unary minus for decimal constants.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Enable accel-only speed debugging
Keith Packard [Fri, 16 Oct 2020 19:46:33 +0000 (12:46 -0700)]
altos: Enable accel-only speed debugging

This dumps accel/speed data in idle mode for validating the speed data.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Disable accel-only debug for test flights
Keith Packard [Fri, 16 Oct 2020 18:50:35 +0000 (11:50 -0700)]
altos: Disable accel-only debug for test flights

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Enable debugging of accel-only speed management
Keith Packard [Wed, 14 Oct 2020 17:37:36 +0000 (10:37 -0700)]
altos: Enable debugging of accel-only speed management

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/test: Clean up easy motor test jig
Keith Packard [Mon, 12 Oct 2020 23:55:23 +0000 (16:55 -0700)]
altos/test: Clean up easy motor test jig

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Comment out EasyMotor test bits
Keith Packard [Mon, 12 Oct 2020 23:55:02 +0000 (16:55 -0700)]
altos: Comment out EasyMotor test bits

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Log motor pressure and battery voltage for EasyMotor
Keith Packard [Mon, 12 Oct 2020 23:54:34 +0000 (16:54 -0700)]
altos: Log motor pressure and battery voltage for EasyMotor

These were not logged at all.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Add EasyMotor EEPROM support
Keith Packard [Mon, 12 Oct 2020 23:48:42 +0000 (16:48 -0700)]
altoslib: Add EasyMotor EEPROM support

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltosuilib: Graph motor pressure
Keith Packard [Mon, 12 Oct 2020 23:47:54 +0000 (16:47 -0700)]
altosuilib: Graph motor pressure

Use a separate axis from atmospheric pressure as the range will be
rather different.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Add 'motor_pressure' data value
Keith Packard [Mon, 12 Oct 2020 23:46:28 +0000 (16:46 -0700)]
altoslib: Add 'motor_pressure' data value

This value tracks the internal pressure of a motor in Pa.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Add conversion for motor pressure sensor
Keith Packard [Mon, 12 Oct 2020 23:40:41 +0000 (16:40 -0700)]
altoslib: Add conversion for motor pressure sensor

This assumes a standard 0.5-4.5 range 1600PSI sensor.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Initialize gyro offset values to MISSING
Keith Packard [Mon, 12 Oct 2020 23:40:03 +0000 (16:40 -0700)]
altoslib: Initialize gyro offset values to MISSING

This lets us detect a device without a gyro sensor.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: De-bias height/speed data while on pad
Keith Packard [Sun, 11 Oct 2020 19:31:17 +0000 (12:31 -0700)]
altos: De-bias height/speed data while on pad

Save speed/height values from 128 samples ago and subtract them from
the current value. This reduces the effect of systematic accelerometer
error causing these values to slowly creep when there's no barometric
sensor to keep them in check.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Change adxl375 self test parameters
Keith Packard [Sun, 11 Oct 2020 05:54:00 +0000 (22:54 -0700)]
altos: Change adxl375 self test parameters

Try to make it not fail self test while horizontal

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: More easy motor invalid mode debug
Keith Packard [Sun, 11 Oct 2020 05:48:31 +0000 (22:48 -0700)]
altos: More easy motor invalid mode debug

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: debug invalid state for easymotor
Keith Packard [Sun, 11 Oct 2020 05:42:39 +0000 (22:42 -0700)]
altos: debug invalid state for easymotor

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: oops. Fix syntax
Keith Packard [Sun, 11 Oct 2020 05:37:17 +0000 (22:37 -0700)]
altos: oops. Fix syntax

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Use only accel for boost detect without baro
Keith Packard [Sun, 11 Oct 2020 05:26:38 +0000 (22:26 -0700)]
altos: Use only accel for boost detect without baro

Without baro, speed will integrate accel 'forever' and cause speed to
be wildly inaccurate at boost time. Would be awesome to reset speed to
zero at some point.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Dump more values in idle/invalid mode
Keith Packard [Sun, 11 Oct 2020 05:17:00 +0000 (22:17 -0700)]
altos: Dump more values in idle/invalid mode

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Also dump data in invalid mode
Keith Packard [Sun, 11 Oct 2020 05:02:59 +0000 (22:02 -0700)]
altos: Also dump data in invalid mode

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Hack to dump kalman values during idle mode
Keith Packard [Sun, 11 Oct 2020 05:00:56 +0000 (22:00 -0700)]
altos: Hack to dump kalman values during idle mode

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/easymotor-v2: Add 'through' axis definition
Keith Packard [Sun, 11 Oct 2020 04:56:38 +0000 (21:56 -0700)]
altos/easymotor-v2: Add 'through' axis definition

This is used by the ao_flight_test_code

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/test: Build ao_flight_test_motor
Keith Packard [Sun, 11 Oct 2020 04:56:06 +0000 (21:56 -0700)]
altos/test: Build ao_flight_test_motor

This tests the flight code in easymotor mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Let ao_data.c be used by ao_flight_test
Keith Packard [Sun, 11 Oct 2020 04:55:36 +0000 (21:55 -0700)]
altos: Let ao_data.c be used by ao_flight_test

Just skip the ao headers in that case.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/easymotor-v2: Beep out 'pad mode' repeatedly
Keith Packard [Mon, 24 Aug 2020 00:32:41 +0000 (18:32 -0600)]
altos/easymotor-v2: Beep out 'pad mode' repeatedly

Easymotor doesn't have igniters, so it would have been silent on the
pad, which seems bad. Add HAS_PAD_REPORT code which beeps out 'pad'
once every five seconds.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/easymotor-v2: ADXL375 is upside-down compared with other boards
Keith Packard [Mon, 24 Aug 2020 00:31:25 +0000 (18:31 -0600)]
altos/easymotor-v2: ADXL375 is upside-down compared with other boards

Clear AO_ADXL375_INVERT to make it work

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Fixup for SPI mode support
Keith Packard [Mon, 24 Aug 2020 00:15:14 +0000 (18:15 -0600)]
altos/stmf0: Fixup for SPI mode support

The desired SPI mode comes in 'spi_index' and needs
to be split out before spi_index is used for pin configuration.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/easymotor-v2: Fix beeper config
Keith Packard [Mon, 24 Aug 2020 00:13:42 +0000 (18:13 -0600)]
altos/easymotor-v2: Fix beeper config

The beeper changed pins at some point during the design

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/easymotor-v2: Use same init order as easymini
Keith Packard [Mon, 24 Aug 2020 00:12:10 +0000 (18:12 -0600)]
altos/easymotor-v2: Use same init order as easymini

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agorecover easymotor-v2/flash-loader/ao_pins.h from backups
Bdale Garbee [Sat, 22 Aug 2020 02:40:44 +0000 (20:40 -0600)]
recover easymotor-v2/flash-loader/ao_pins.h from backups

3 years agoaltos/easymotor-v2: Get easy motor building
Keith Packard [Sun, 2 Aug 2020 20:11:39 +0000 (13:11 -0700)]
altos/easymotor-v2: Get easy motor building

Add some missing files and adjust configuration.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/easymotor-v2: Add .gitignore
Keith Packard [Sun, 2 Aug 2020 20:11:16 +0000 (13:11 -0700)]
altos/easymotor-v2: Add .gitignore

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Add spi format configuration options
Keith Packard [Sun, 2 Aug 2020 20:09:17 +0000 (13:09 -0700)]
altos/stmf0: Add spi format configuration options

This lets different SPI devices use different SPI formats

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Support accel-only IMU configurations
Keith Packard [Sun, 2 Aug 2020 20:07:01 +0000 (13:07 -0700)]
altos: Support accel-only IMU configurations

This doesn't compute orientation, just allows for calibrating and recording
3-axis acceleration data.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add EasyMotor logging support
Keith Packard [Sun, 2 Aug 2020 20:06:01 +0000 (13:06 -0700)]
altos: Add EasyMotor logging support

Log EasyMotor sensor data.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Allow use of ADXL375 as IMU
Keith Packard [Sun, 2 Aug 2020 20:04:27 +0000 (13:04 -0700)]
altos: Allow use of ADXL375 as IMU

This lets EasyMotor report all three axes of acceleration and use
that for idle detection.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/drivers: Add ao_adxl375_accel_to_sample macro
Keith Packard [Sun, 2 Aug 2020 19:51:16 +0000 (12:51 -0700)]
altos/drivers: Add ao_adxl375_accel_to_sample macro

This converts from acceleration levels to sample counts for use in
detecting stability of airframe after landing when no other IMU is
present.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoeasymotor: override .gitignore to store Makefiles
Bdale Garbee [Mon, 27 Jul 2020 20:52:50 +0000 (14:52 -0600)]
easymotor: override .gitignore to store Makefiles

3 years agofirst cut at EasyMotor v2 .. not compiling yet
Bdale Garbee [Sun, 26 Jul 2020 00:07:36 +0000 (18:07 -0600)]
first cut at EasyMotor v2 .. not compiling yet

3 years agofix broken TeleBT turnon script
Bdale Garbee [Wed, 19 Aug 2020 20:38:04 +0000 (14:38 -0600)]
fix broken TeleBT turnon script

3 years agoaltoslib: Flush output when disabling remote
Keith Packard [Sat, 8 Aug 2020 04:51:39 +0000 (21:51 -0700)]
altoslib: Flush output when disabling remote

This speeds up sending data to the other end.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Don't fetch config data for every idle status
Keith Packard [Sat, 8 Aug 2020 04:50:38 +0000 (21:50 -0700)]
altoslib: Don't fetch config data for every idle status

This makes fetching data during idle monitor much faster, especially
now that fetching the list of stored flights takes so long.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Allow multiple manual firing of main/drogue channels
Keith Packard [Sat, 8 Aug 2020 04:49:37 +0000 (21:49 -0700)]
altos: Allow multiple manual firing of main/drogue channels

Reset the 'fired' status so that you can trigger these multiple times
without needing to reboot.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Don't report inhibited pyro channels as fired
Keith Packard [Sat, 8 Aug 2020 04:48:09 +0000 (21:48 -0700)]
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>
3 years agomicropeak: Add support for MicroPeak v2.0
Keith Packard [Sat, 8 Aug 2020 03:20:59 +0000 (20:20 -0700)]
micropeak: Add support for MicroPeak v2.0

MicroPeak v2.0 sends a 'unique id' with the log data; capture that and
included it in the file name.

MicroPeak v2.0 can be directly connected to the host using the µP I/O
board. Handle that case by sending the 'l' command which will cause
the device to dump the log.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agomicropeak: Fix top-level window building
Keith Packard [Sat, 8 Aug 2020 03:19:28 +0000 (20:19 -0700)]
micropeak: Fix top-level window building

The menu wasn't actually working, and the application would randomly
start at the wrong size or crash.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agomicropeak: Check for empty data when fetching log
Keith Packard [Sat, 8 Aug 2020 03:18:10 +0000 (20:18 -0700)]
micropeak: Check for empty data when fetching log

Don't pop up the graph window and don't save data from an erased
device.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/mpusb-v3.0: Make this build again
Keith Packard [Sat, 8 Aug 2020 03:16:55 +0000 (20:16 -0700)]
altos/mpusb-v3.0: Make this build again

It's not built by default and the requirements in the Makefile have
changed.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/micropeak-v2.0: Functionally complete.
Keith Packard [Sat, 8 Aug 2020 03:15:32 +0000 (20:15 -0700)]
altos/micropeak-v2.0: Functionally complete.

Get flight mode working correctly.
Offer log dumping from serial link.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add MicroPeak v2.0 support to ao_log_micro
Keith Packard [Sat, 8 Aug 2020 03:13:50 +0000 (20:13 -0700)]
altos: Add MicroPeak v2.0 support to ao_log_micro

Support 4-byte sample count (required for stm32l0 flash storage
limitations).

Mix in log ID on-the-fly so that erased flash parts still report
device type.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Big update in functionality
Keith Packard [Sat, 8 Aug 2020 03:12:22 +0000 (20:12 -0700)]
altos/stm32l0: Big update in functionality

Fix baud rate setting in LPUART
Add code to turn everything off.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Remove support for !HAS_TASK_QUEUE
Keith Packard [Thu, 6 Aug 2020 18:05:03 +0000 (11:05 -0700)]
altos: Remove support for !HAS_TASK_QUEUE

This uses a bit more memory, but the amount can be controlled by
setting the size of the sleep hash table, which makes this fit on even
the smaller devices like the early EasyMini boards.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Remove ao_led_toggle API from general code
Keith Packard [Sat, 8 Aug 2020 01:17:07 +0000 (18:17 -0700)]
altos: Remove ao_led_toggle API from general code

The generic implementation would need to record LED status as it
cannot be read back from the device on most hardware. Just get rid of
it and let attiny keep its implementation (which does work).

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-tools: Add TeleGPS log parsing to ao-eeprom
Keith Packard [Sat, 8 Aug 2020 01:15:47 +0000 (18:15 -0700)]
ao-tools: Add TeleGPS log parsing to ao-eeprom

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: add noreturn attribute to ao_panic
Keith Packard [Thu, 6 Aug 2020 17:44:49 +0000 (10:44 -0700)]
altos: add noreturn attribute to ao_panic

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Add LPUART driver
Keith Packard [Thu, 6 Aug 2020 05:32:14 +0000 (22:32 -0700)]
altos/stm32l0: Add LPUART driver

This is a simpler UART which micropeak has connected to the LED and
we'll use for transmitting the log on power up

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Provide ao_spi_speed inline as per new clocking API
Keith Packard [Thu, 6 Aug 2020 00:17:47 +0000 (17:17 -0700)]
altos/stm32l0: Provide ao_spi_speed inline as per new clocking API

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/micropeak-v2.0: Finish hardware bring-up
Keith Packard [Tue, 23 Jun 2020 23:22:21 +0000 (16:22 -0700)]
altos/micropeak-v2.0: Finish hardware bring-up

All of the hardware is working:

 * serial
 * SPI
 * ms56067
 * ADC
 * flash
 * clocking
 * timer

Now we just need an application

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Add adc and flash drivers
Keith Packard [Tue, 23 Jun 2020 23:21:57 +0000 (16:21 -0700)]
altos/stm32l0: Add adc and flash drivers

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Remove some unused code in ao_timer.c
Keith Packard [Tue, 23 Jun 2020 23:21:26 +0000 (16:21 -0700)]
altos/stm32l0: Remove some unused code in ao_timer.c

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Remove some unused code in USART driver
Keith Packard [Tue, 23 Jun 2020 23:20:56 +0000 (16:20 -0700)]
altos/stm32l0: Remove some unused code in USART driver

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Get exti working
Keith Packard [Tue, 23 Jun 2020 23:20:26 +0000 (16:20 -0700)]
altos/stm32l0: Get exti working

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Get SPI driver working
Keith Packard [Tue, 23 Jun 2020 23:19:47 +0000 (16:19 -0700)]
altos/stm32l0: Get SPI driver working

This isn't using DMA, but it seems to work now.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: Some device addrs were wrong
Keith Packard [Tue, 23 Jun 2020 23:19:11 +0000 (16:19 -0700)]
altos/stm32l0: Some device addrs were wrong

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm32l0: More DMA fixes
Keith Packard [Tue, 23 Jun 2020 23:18:27 +0000 (16:18 -0700)]
altos/stm32l0: More DMA fixes

This code still doesn't work, but it should be closer'

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Micropeak v2.0 doesn't have a flash loader anymore
Keith Packard [Tue, 23 Jun 2020 23:17:03 +0000 (16:17 -0700)]
altos: Micropeak v2.0 doesn't have a flash loader anymore

The current version doesn't have USB, so the existing flash loader
protocol won't work anyways.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/ao_storage: Allow apps to #define storage parameters
Keith Packard [Tue, 23 Jun 2020 23:16:28 +0000 (16:16 -0700)]
altos/ao_storage: Allow apps to #define storage parameters

This avoids placing them in RAM.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/ao_storage: allow erased byte value to be set by application
Keith Packard [Tue, 23 Jun 2020 23:15:28 +0000 (16:15 -0700)]
altos/ao_storage: allow erased byte value to be set by application

External flash is usually 0xff for erased bytes, but other memory may
use different values

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoremove ao_delay_until from ao.h
Keith Packard [Tue, 23 Jun 2020 23:15:14 +0000 (16:15 -0700)]
remove ao_delay_until from ao.h

3 years agoaltos: Add ao_delay_until to ao_notask
Keith Packard [Tue, 23 Jun 2020 00:42:03 +0000 (17:42 -0700)]
altos: Add ao_delay_until to ao_notask

Used on micropeak

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Move empty ao_mutex_get/put to ao_notask.h
Keith Packard [Tue, 23 Jun 2020 00:41:11 +0000 (17:41 -0700)]
altos: Move empty ao_mutex_get/put to ao_notask.h

Make it work on any no-task project.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Declare ao_delay_until API in ao.h
Keith Packard [Sat, 20 Jun 2020 22:15:35 +0000 (15:15 -0700)]
altos: Declare ao_delay_until API in ao.h

This uses AO_TICK_TYPE which isn't defined until we get to ao.h

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Switch micropeak v2.0 to stm32l0
Keith Packard [Sat, 20 Jun 2020 22:14:26 +0000 (15:14 -0700)]
altos: Switch micropeak v2.0 to stm32l0

The stm32f042 takes too much power for micropeak. Try the stm32l0
instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add initial stm32l0 support
Keith Packard [Sat, 20 Jun 2020 22:13:09 +0000 (15:13 -0700)]
altos: Add initial stm32l0 support

A low-power cortex M0 chip for MicroPeak v2.0

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Fix a bunch of time variables to be AO_TICK_TYPE
Keith Packard [Sat, 20 Jun 2020 22:00:28 +0000 (15:00 -0700)]
altos: Fix a bunch of time variables to be AO_TICK_TYPE

The default tick type is now 32 bits, so all of these
variables were mis-typed at 16 bits.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Fix stack validation code
Keith Packard [Sat, 8 Aug 2020 03:08:34 +0000 (20:08 -0700)]
altos/stm: Fix stack validation code

This is not included by default, and broke at some point.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agodoc: EasyMotor and EasyTimer have the same mounting geometry as EasyMini
Bdale Garbee [Mon, 3 Aug 2020 18:43:22 +0000 (12:43 -0600)]
doc: EasyMotor and EasyTimer have the same mounting geometry as EasyMini

3 years agoaltos/stmf0, stm32f0: Call ao_boot_chain to start application
Keith Packard [Mon, 3 Aug 2020 00:29:44 +0000 (17:29 -0700)]
altos/stmf0, stm32f0: Call ao_boot_chain to start application

This used to be done inside ao_boot_check_chain or ao_boot_check_pin,
but it made more sense to have it done in _start instead. stm and lpc
were adjusted, but stmf0 and stm32f4 were missed.

This caused boards using this process to wedge in the boot loader.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltosui: Re-set pad orientation labels after product name is set
Keith Packard [Sun, 2 Aug 2020 20:31:58 +0000 (13:31 -0700)]
altosui: Re-set pad orientation labels after product name is set

We don't know what product is being configured until after we query
the configuration, which means we need to re-set the orientation label
once that has been fetched.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Use new ao_spi_speed inline to set SPI speeds using spec'd frequencies
Keith Packard [Wed, 29 Jul 2020 17:53:39 +0000 (10:53 -0700)]
altos: Use new ao_spi_speed inline to set SPI speeds using spec'd frequencies

Instead of hand-adjusting SPI speeds for each driver and product based
on processor supported rates, create an inline function that takes the
maximum frequency supported by the device and maps that to a value
supported by the SoC. This ensures that we don't accidentally drive devices
faster than they want (as could happen with AO_SPI_SPEED_FAST), but do go
as fast as possible in every configuration. Using an inline function means
the value is computed at compile time.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Support flash parts > 8MB
Keith Packard [Wed, 29 Jul 2020 06:44:33 +0000 (23:44 -0700)]
altos: Support flash parts > 8MB

The number of sectors (64kB) units in the connected flash
part can be larger than 255, so switch from 8-bits to 32-bits for
holding this value.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Protect shared storage_data with mutex
Keith Packard [Wed, 29 Jul 2020 06:43:04 +0000 (23:43 -0700)]
altos: Protect shared storage_data with mutex

As storage_data is shared between all threads, protect it
with a mutex to avoid collisions.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Increase MISO DMA priority to very high
Keith Packard [Wed, 29 Jul 2020 06:40:36 +0000 (23:40 -0700)]
altos/stm: Increase MISO DMA priority to very high

We're still losing incoming bytes in full duplex mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoMerge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Bdale Garbee [Wed, 22 Jul 2020 21:23:02 +0000 (15:23 -0600)]
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos

3 years agoao-bringup: ensure TeleMega turnon scripts are using the right test versions
Bdale Garbee [Wed, 22 Jul 2020 21:22:21 +0000 (15:22 -0600)]
ao-bringup: ensure TeleMega turnon scripts are using the right test versions

3 years agoaltos: Add 'booster' mode for dual-deploy igniters
Keith Packard [Wed, 22 Jul 2020 16:04:30 +0000 (09:04 -0700)]
altos: Add 'booster' mode for dual-deploy igniters

Booster mode triggers the 'main' channel at first motor burnout
allowing the use of a simple flight computer in the booster while
providing both a separation charge and an apogee event for recovery.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Use state transitions to directly drive igniters
Keith Packard [Wed, 22 Jul 2020 15:57:05 +0000 (08:57 -0700)]
altos: Use state transitions to directly drive igniters

Instead of a separate igniter API, have the igniter code monitor
flight state changes to trigger igniter events. This simplifes the
code while allowing further changes in the igniter code.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoReleasing: save .map files too
Keith Packard [Wed, 22 Jul 2020 15:56:10 +0000 (08:56 -0700)]
Releasing: save .map files too

These are useful to debug issues with linker scripts or library problems

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoAdd support for TLS if needed
Keith Packard [Thu, 16 Jul 2020 17:23:34 +0000 (10:23 -0700)]
Add support for TLS if needed

Define USE_TLS if you want TLS support from altos.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltosui: Spurious ; in altos-windows.nsi.in kept out TM v3.0 ihx
Keith Packard [Thu, 16 Jul 2020 16:29:52 +0000 (09:29 -0700)]
altosui: Spurious ; in altos-windows.nsi.in kept out TM v3.0 ihx

Looks like a semicolon got stuck in this file, which commented out the
TeleMetrum v3.0 firmware from being included in the windows build

Signed-off-by: Keith Packard <keithp@keithp.com>