fw/altos
2 years agoaltoslib: Handle eeprom tick wrapping
Keith Packard [Sun, 28 May 2017 21:33:28 +0000 (14:33 -0700)]
altoslib: Handle eeprom tick wrapping

Need to deal with eeprom files with tick values that cross the 16-bit
barrier.
Use 'wide_tick' to order eeprom record.
Remeber 'prev_tick' to order cal data time sequence.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosuilib: Display product/firmware version in stats table
Keith Packard [Sun, 28 May 2017 21:03:51 +0000 (14:03 -0700)]
altosuilib: Display product/firmware version in stats table

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Adjust boost/landed time in flight series for display
Keith Packard [Sun, 28 May 2017 21:02:51 +0000 (14:02 -0700)]
altoslib: Adjust boost/landed time in flight series for display

Makes the presented values match those used in the stats computation.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add constants for speed/accel filtering
Keith Packard [Sun, 28 May 2017 21:02:11 +0000 (14:02 -0700)]
altoslib: Add constants for speed/accel filtering

With an eye towards letting the user pick.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Create data file open helper in AltosLib
Keith Packard [Sun, 28 May 2017 21:00:15 +0000 (14:00 -0700)]
altoslib: Create data file open helper in AltosLib

Use InputStream everywhere, instead of Reader.
Create private string input stream as java one is deprecated.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Extract a few more values from config to cal_data
Keith Packard [Sun, 28 May 2017 20:58:05 +0000 (13:58 -0700)]
altoslib: Extract a few more values from config to cal_data

Make it possible to display model/version data in the flight stats table.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Recover from a couple of API changes
Keith Packard [Sun, 28 May 2017 06:42:52 +0000 (23:42 -0700)]
altoslib: Recover from a couple of API changes

Nothing serious.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agomicropeak: Use altoslib/altosuilib flight analysis bits
Keith Packard [Sun, 28 May 2017 06:35:02 +0000 (23:35 -0700)]
micropeak: Use altoslib/altosuilib flight analysis bits

Remove custom graph and stats bits and share bits with altosui.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosuilib: Remove 'cal_data' param from AltosGraphNew constructor
Keith Packard [Sun, 28 May 2017 06:34:18 +0000 (23:34 -0700)]
altosuilib: Remove 'cal_data' param from AltosGraphNew constructor

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosuilib: Make AltosFlightStatsTable neater
Keith Packard [Sun, 28 May 2017 06:33:37 +0000 (23:33 -0700)]
altosuilib: Make AltosFlightStatsTable neater

Elide missing data, change titles when data are simpler

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Provide consistent cal_data from idle and replay readers
Keith Packard [Sun, 28 May 2017 06:33:07 +0000 (23:33 -0700)]
altoslib: Provide consistent cal_data from idle and replay readers

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Return AltosTimeValue from min/max funcs
Keith Packard [Sun, 28 May 2017 06:32:29 +0000 (23:32 -0700)]
altoslib: Return AltosTimeValue from min/max funcs

Allowing the user to have both value and time.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Publish boost_time and landed_time from AltosFlightStats
Keith Packard [Sun, 28 May 2017 06:31:48 +0000 (23:31 -0700)]
altoslib: Publish boost_time and landed_time from AltosFlightStats

Nice to be able to use these when displaying data.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Allow for other tick sizes
Keith Packard [Sun, 28 May 2017 06:30:54 +0000 (23:30 -0700)]
altoslib: Allow for other tick sizes

Use 1/100 sec by default, but provide for MicroPeak which uses a
different step.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Change how speed/accel are computed from pressure
Keith Packard [Sun, 28 May 2017 06:30:13 +0000 (23:30 -0700)]
altoslib: Change how speed/accel are computed from pressure

Filter *then* differentiate. This works way better that doing things
in the other order.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agotelegps: Get telegps application working again
Keith Packard [Sat, 27 May 2017 23:12:31 +0000 (16:12 -0700)]
telegps: Get telegps application working again

Many minor API tweaks

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosdroid: Deal with AltosState changes
Keith Packard [Sat, 27 May 2017 07:27:04 +0000 (00:27 -0700)]
altosdroid: Deal with AltosState changes

cal data split out from altos state.
altos state needed to have no-arguments constructor for JSON code.
Also messed with voice to make it stay quiet during app startup.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Use cal data temp gps for telemetry data too
Keith Packard [Sat, 27 May 2017 02:05:51 +0000 (19:05 -0700)]
altoslib: Use cal data temp gps for telemetry data too

This avoids bouncing the location data during flight

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosui: Remove debug printf.
Keith Packard [Sat, 27 May 2017 01:47:18 +0000 (18:47 -0700)]
altosui: Remove debug printf.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Trim stale bits of AltosState
Keith Packard [Sat, 27 May 2017 01:46:46 +0000 (18:46 -0700)]
altoslib: Trim stale bits of AltosState

Much of this is now in AltosCalData.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Preserve old GPS data during operation
Keith Packard [Sat, 27 May 2017 01:46:00 +0000 (18:46 -0700)]
altoslib: Preserve old GPS data during operation

This avoids having the lat/lon values blank out when the GPS receiver
looses lock.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Get KML export working again
Keith Packard [Sat, 27 May 2017 01:22:02 +0000 (18:22 -0700)]
altoslib: Get KML export working again

Even annotate the states with avg speed/accel for fun.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Make sure AltosFlightSeries is filled in before use
Keith Packard [Sat, 27 May 2017 00:14:29 +0000 (17:14 -0700)]
altoslib: Make sure AltosFlightSeries is filled in before use

After all of the raw data is captured, the derived data needs to be
computed by calling the 'finish' function.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosui: Remove --cat mode
Keith Packard [Sat, 27 May 2017 00:13:43 +0000 (17:13 -0700)]
altosui: Remove --cat mode

Wasn't documented, didn't do much useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Make AltosReplayReader start synchronously enough to track states
Keith Packard [Fri, 26 May 2017 07:51:37 +0000 (00:51 -0700)]
altoslib: Make AltosReplayReader start synchronously enough to track states

The Altos UI needs to see 'pad' state and then 'boost' state so that
it will automatically switch tabs during the flight. When reading from
eeprom files, the only way that is going to happen is if the reader
thread waits until the UI has definitely seen 'pad' state, which we do
by simply delaying the reader thread until after that has happened.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib,altosuilib,altosui: Get stats and replay working again.
Keith Packard [Fri, 26 May 2017 07:20:17 +0000 (00:20 -0700)]
altoslib,altosuilib,altosui: Get stats and replay working again.

Stats are really easy with all of the data in memory.
Replay takes a special thread to run the data and dump it into a
single state.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib/altosuilib/altosui: More work towards using AltosFlightSeries for analysis
Keith Packard [Fri, 26 May 2017 05:36:05 +0000 (22:36 -0700)]
altoslib/altosuilib/altosui: More work towards using AltosFlightSeries for analysis

Graphing and CSV seem complete now; stats still missing lots of stuff.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosui: Adapt to AltosFlightSeries for data analysis
Keith Packard [Fri, 26 May 2017 00:29:31 +0000 (17:29 -0700)]
altosui: Adapt to AltosFlightSeries for data analysis

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosuilib: Adapt to AltosFlightSeries data processing plan
Keith Packard [Fri, 26 May 2017 00:26:49 +0000 (17:26 -0700)]
altosuilib: Adapt to AltosFlightSeries data processing plan

Replace use of list of AltosState with AltosFlightSeries to improve
data analysis.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Do data analysis on raw values rather than AltosState
Keith Packard [Fri, 26 May 2017 00:24:14 +0000 (17:24 -0700)]
altoslib: Do data analysis on raw values rather than AltosState

Use AltosFlightSeries instead of a sequence of AltosState records when
processing saved data. This provides a better way of doing filtering
and plotting.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Don't store computed telemetry fields
Keith Packard [Tue, 23 May 2017 21:53:55 +0000 (14:53 -0700)]
altoslib: Don't store computed telemetry fields

These values are only needed once, so there's no reason to save them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agodoc: Add telegps outline
Keith Packard [Mon, 22 May 2017 21:36:46 +0000 (14:36 -0700)]
doc: Add telegps outline

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoadd thrust as a graphable time series type
Bdale Garbee [Fri, 12 May 2017 18:58:18 +0000 (12:58 -0600)]
add thrust as a graphable time series type

2 years agoaltosui: Hacks to plug into the new graph stuff
Keith Packard [Fri, 12 May 2017 07:01:14 +0000 (00:01 -0700)]
altosui: Hacks to plug into the new graph stuff

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosuilib: Start creating new graph interface that takes time series data
Keith Packard [Fri, 12 May 2017 00:16:56 +0000 (17:16 -0700)]
altosuilib: Start creating new graph interface that takes time series data

Replace the AltosState interface so the graph can get better data, and
can be used for more stuff.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Create new abstraction underneath AltosState for recording values
Keith Packard [Fri, 12 May 2017 00:14:51 +0000 (17:14 -0700)]
altoslib: Create new abstraction underneath AltosState for recording values

Provides a way for the graph API to see raw data values, instead of
those cooked by AltosState.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: include TimeSeries code in build
Bdale Garbee [Thu, 11 May 2017 18:14:41 +0000 (12:14 -0600)]
altoslib: include TimeSeries code in build

2 years agoaltosuilib: Add time series subclass with data for generating a plot
Keith Packard [Wed, 10 May 2017 22:18:13 +0000 (15:18 -0700)]
altosuilib: Add time series subclass with data for generating a plot

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add initial time series functions
Keith Packard [Wed, 10 May 2017 22:16:34 +0000 (15:16 -0700)]
altoslib: Add initial time series functions

Provides the basis for offering a sequence of time/value datasets for
graphing instead of using AltosState.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telebt-v3.0: Add send_packet command
Keith Packard [Sat, 20 May 2017 04:36:01 +0000 (21:36 -0700)]
altos/telebt-v3.0: Add send_packet command

Useful for doing host-based RF protocols.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telebt-v4.0: Remove HAS_POLLCHAR
Keith Packard [Sat, 20 May 2017 04:35:05 +0000 (21:35 -0700)]
altos/telebt-v4.0: Remove HAS_POLLCHAR

This isn't being used anymore.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoao-bringup: turnon_chaoskey: search for ao-usbload in PATH
Keith Packard [Sat, 20 May 2017 04:31:52 +0000 (21:31 -0700)]
ao-bringup: turnon_chaoskey: search for ao-usbload in PATH

Don't assume it's in /usr/bin

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telefireone-v1.0: Fix confusing defines about config storage
Keith Packard [Sat, 20 May 2017 04:30:29 +0000 (21:30 -0700)]
altos/telefireone-v1.0: Fix confusing defines about config storage

USE_INTERNAL_FLASH is about storing config data in internal flash, and
should be on for telefireone.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Set default accel cal for old TeleMetrum v1 files
Keith Packard [Mon, 15 May 2017 19:13:35 +0000 (12:13 -0700)]
altoslib: Set default accel cal for old TeleMetrum v1 files

Before we stashed the config data in the log file, altoslib had to
"known" what the accelerometer calibration values should be set
to.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Set default log format to FULL until we learn different
Keith Packard [Mon, 15 May 2017 19:12:57 +0000 (12:12 -0700)]
altoslib: Set default log format to FULL until we learn different

Ancient log files don't even have a product name in them, so we'll
guess TeleMetrum v1.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Mark AltosConfigData fields as MISSING until set
Keith Packard [Mon, 15 May 2017 19:11:31 +0000 (12:11 -0700)]
altoslib: Mark AltosConfigData fields as MISSING until set

Instead of using -1 or 0 randomly, use MISSING consistently.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agore-brand current telefiretwo product as telefireone
Bdale Garbee [Mon, 15 May 2017 16:16:33 +0000 (10:16 -0600)]
re-brand current telefiretwo product as telefireone

2 years agoaltos/ao_rn4678: Send '$$$' for new devices. Fix name setting code.
Keith Packard [Mon, 15 May 2017 15:59:52 +0000 (08:59 -0700)]
altos/ao_rn4678: Send '$$$' for new devices. Fix name setting code.

New devices won't respond to the cmd pin we have configured, so get
them to command mode by sending the $$$ string. Somehow I'd botched
the name setting code and hadn't caught it as I hadn't tried a new
device...

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stmf: Fix up serial port flow control configuration bits
Keith Packard [Mon, 15 May 2017 15:58:21 +0000 (08:58 -0700)]
altos/stmf: Fix up serial port flow control configuration bits

Compute whether any sw/hw flow control is in use.
Compute whether hw flow control is in use as a separate value.

These make the code a bit easier to follow.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agolibaltos: Add support for TeleBT-v4.0 bluetooth channel change
Keith Packard [Sat, 13 May 2017 22:24:20 +0000 (15:24 -0700)]
libaltos: Add support for TeleBT-v4.0 bluetooth channel change

The RN4678 in TeleBT v4.0 uses channel 6 instead of channel 1.
There is code in the linux bits which discovers this value, but that
crashes when run under java for unknown reasons.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Handle TeleBT v4.0 battery voltage
Keith Packard [Sat, 13 May 2017 22:21:40 +0000 (15:21 -0700)]
altoslib: Handle TeleBT v4.0 battery voltage

The device reports raw ADC values, which mean AltosLib needs to
translate them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telebt-v4.0: Hook up RN4678 module
Keith Packard [Sat, 13 May 2017 22:19:25 +0000 (15:19 -0700)]
altos/telebt-v4.0: Hook up RN4678 module

We've switched from the BM70 to this module which offers a virtual
serial channel over both BT and BTLE.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Add RN4678 Bluetooth module driver
Keith Packard [Sat, 13 May 2017 22:17:41 +0000 (15:17 -0700)]
altos: Add RN4678 Bluetooth module driver

This works much like the old BTM module, but supports both bluetooth
and bluetooth LE. I've poked at it briefly over BTLE to see that it
appears to have the right name, but haven't attempted to communicate
over BTLE yet.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoUse SDP to locate the service channel on Linux
Keith Packard [Fri, 12 May 2017 08:35:52 +0000 (01:35 -0700)]
Use SDP to locate the service channel on Linux

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Another bit of altoslib for the old eeprom stuff
Keith Packard [Wed, 10 May 2017 21:47:15 +0000 (14:47 -0700)]
altoslib: Another bit of altoslib for the old eeprom stuff

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agohave AltosGraph use new AltosPressure to get imperial_units working
Bdale Garbee [Thu, 11 May 2017 17:27:30 +0000 (11:27 -0600)]
have AltosGraph use new AltosPressure to get imperial_units working

2 years agoinitial tests made using Terry's stand with a 2500psi sensor
Bdale Garbee [Thu, 27 Apr 2017 21:27:49 +0000 (15:27 -0600)]
initial tests made using Terry's stand with a 2500psi sensor

2 years agotelefiretwo: don't try to record pre-burn sensor values in FLIGHT record
Bdale Garbee [Thu, 27 Apr 2017 18:57:49 +0000 (12:57 -0600)]
telefiretwo: don't try to record pre-burn sensor values in FLIGHT record

2 years agohave git ignore ao-bringup/cal_values
Bdale Garbee [Thu, 27 Apr 2017 21:21:53 +0000 (15:21 -0600)]
have git ignore ao-bringup/cal_values

2 years agotelegps: use new eeprom reading code
Bdale Garbee [Thu, 11 May 2017 04:19:38 +0000 (22:19 -0600)]
telegps: use new eeprom reading code

2 years agoaltoslib: Remove older eeprom handling code
Keith Packard [Tue, 9 May 2017 09:31:04 +0000 (02:31 -0700)]
altoslib: Remove older eeprom handling code

The new code appears to work in minor testing; time to try it all the time.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Save eeprom data in new .eeprom format
Keith Packard [Tue, 9 May 2017 09:11:25 +0000 (02:11 -0700)]
altoslib: Save eeprom data in new .eeprom format

A chunk of json for the config values followed by hex numbers for the data.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltosui: Use new eeprom reading code
Keith Packard [Tue, 9 May 2017 07:22:35 +0000 (00:22 -0700)]
altosui: Use new eeprom reading code

This just means using different file opening functions, which then
get matched by AltosEepromFile and sent off to the new eeprom code.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Hack up AltosEepromFile to support new eeprom code
Keith Packard [Tue, 9 May 2017 07:20:23 +0000 (00:20 -0700)]
altoslib: Hack up AltosEepromFile to support new eeprom code

Redirect when asked to read an eeprom file using the "Reader" type.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Compile AltosForce and AltosPressure
Keith Packard [Tue, 9 May 2017 07:19:51 +0000 (00:19 -0700)]
altoslib: Compile AltosForce and AltosPressure

Useful if you want to actually use these.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add new eeprom management code
Keith Packard [Tue, 9 May 2017 07:19:05 +0000 (00:19 -0700)]
altoslib: Add new eeprom management code

Generic .eeprom file parsing, simpler per-type eeprom data extraction.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add set_config_data to AltosState
Keith Packard [Tue, 9 May 2017 07:17:40 +0000 (00:17 -0700)]
altoslib: Add set_config_data to AltosState

Initialize all config-data related state values.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add empty constructor for AltosPyro for JSON
Keith Packard [Tue, 9 May 2017 07:17:11 +0000 (00:17 -0700)]
altoslib: Add empty constructor for AltosPyro for JSON

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add Ms5607 constructor that just takes config_data
Keith Packard [Tue, 9 May 2017 07:16:36 +0000 (00:16 -0700)]
altoslib: Add Ms5607 constructor that just takes config_data

Use for making Ms5607 from eeprom files.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Add AltosForce and AltosPressure units
Keith Packard [Tue, 9 May 2017 07:14:33 +0000 (00:14 -0700)]
altoslib: Add AltosForce and AltosPressure units

Useful for TeleFireTwo.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Hide members from json by prefixing with __
Keith Packard [Tue, 9 May 2017 07:13:16 +0000 (00:13 -0700)]
altoslib: Hide members from json by prefixing with __

This lets some structures which would otherwise recurse (and crash)
get converted to json, assuming the hidden members aren't relevant.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telemini-v3.0: Use dbg connector pin 5 for force bootloader
Keith Packard [Fri, 5 May 2017 05:09:31 +0000 (22:09 -0700)]
altos/telemini-v3.0: Use dbg connector pin 5 for force bootloader

This works way better than attempting to use the beeper pin.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telemini-v3.0: Add 'recovery mode' on PA14 (pin 6 on dbg header)
Keith Packard [Fri, 5 May 2017 05:07:51 +0000 (22:07 -0700)]
altos/telemini-v3.0: Add 'recovery mode' on PA14 (pin 6 on dbg header)

Connect this pin to GND (pin 3) and TeleMini will come up with N0CALL
at 434.550MHz using the original frequency calibration. Helps recover
from accidental mis-configuration.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Move 'ao_force_freq' to ao_config.c
Keith Packard [Fri, 5 May 2017 05:06:16 +0000 (22:06 -0700)]
altos: Move 'ao_force_freq' to ao_config.c

Instead of having to add it to each product using this variable.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Make CDC ACM 'line coding' public
Keith Packard [Fri, 5 May 2017 05:04:57 +0000 (22:04 -0700)]
altos: Make CDC ACM 'line coding' public

This allows other systems to see what baud rate the host has requested.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Fix MS5607 raw data to pressure conversion function
Miguel Benavidez [Thu, 4 May 2017 18:29:33 +0000 (11:29 -0700)]
altoslib: Fix MS5607 raw data to pressure conversion function

The MS5607 sensor provides raw 24-bit ADC outputs to the host along
with calibration constants necessary to convert those into temperature
and pressure values. The datasheet has a flow chart indicating how to
perform this computation. There are two parts of the algorithm which
adjust the result based on the ambient temperature, temperatures below
20°C get one compensation factor and temperatures below -15°C get an
additional factor.

The ground station version of this function mistakenly applied the
second compensation factor for all temperatures below +15°C. The
result was that the pressure computed on the ground when the measured
temperature was between -15°C and +15°C was incorrect, resulting in
altitudes which were several hundred meters off in some situations.

This can be seen when displaying any .eeprom (or .mpd) data
files for flights with temperatures in that range. The datafiles
themselves are not corrupted, only the display operation.

This is not seen for telemetry data, where the pressure and associated
altitude is computed in the airframe using the correct algorithm.

Thanks much to Miguel and the rest of the Vanguard School TARC team
for identifying the problem and providing this fix.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telebt-v4.0 Set CPU clock to 48Mhz instead of 96Mhz
Bdale Garbee [Wed, 3 May 2017 17:47:33 +0000 (11:47 -0600)]
altos/telebt-v4.0 Set CPU clock to 48Mhz instead of 96Mhz

2 years agoaltos/telegps-v2.0: Disable external serial port to save ROM
Keith Packard [Tue, 2 May 2017 18:49:21 +0000 (11:49 -0700)]
altos/telegps-v2.0: Disable external serial port to save ROM

We'll have to rewrite some of the serial code to avoid sucking memory here.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stmf0: Add code to use SoC flash as storage
Keith Packard [Tue, 2 May 2017 18:35:18 +0000 (11:35 -0700)]
altos/stmf0: Add code to use SoC flash as storage

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: Reorder initialization sequence
Keith Packard [Mon, 1 May 2017 00:42:23 +0000 (17:42 -0700)]
altos/telegps-v2.0: Reorder initialization sequence

This tries to be a bit more logical about the board initialization
sequence, starting with the OS, then the support hardware, internal
drivers, external drivers and finally services.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: CC1200 CS is PA1, not PA5.
Keith Packard [Mon, 1 May 2017 00:41:21 +0000 (17:41 -0700)]
altos/telegps-v2.0: CC1200 CS is PA1, not PA5.

Also remove some unneeded config of an additional pin for MCU wakeup,
which the CC1120 needs but the CC1200 does not.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: GPS chip is connected to serial 2, not serial 1
Keith Packard [Mon, 1 May 2017 00:40:26 +0000 (17:40 -0700)]
altos/telegps-v2.0: GPS chip is connected to serial 2, not serial 1

Turn on serial 2 and use it for GPS.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: Remove some unneeded defines
Keith Packard [Mon, 1 May 2017 00:39:54 +0000 (17:39 -0700)]
altos/telegps-v2.0: Remove some unneeded defines

HAS_MS5607 and HAS_RADIO_RECV aren't useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: Battery ADC input is on PB1, not PA0
Keith Packard [Mon, 1 May 2017 00:39:03 +0000 (17:39 -0700)]
altos/telegps-v2.0: Battery ADC input is on PB1, not PA0

Rewire as needed.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: Set CPU clock to 48MHz instread of 96MHz
Keith Packard [Mon, 1 May 2017 00:38:21 +0000 (17:38 -0700)]
altos/telegps-v2.0: Set CPU clock to 48MHz instread of 96MHz

Turns out the CPU doesn't run well at that speed. Who would have guessed?

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/telegps-v2.0: Adjust LED config
Keith Packard [Mon, 1 May 2017 00:37:45 +0000 (17:37 -0700)]
altos/telegps-v2.0: Adjust LED config

The LED is green, not red. Use it for panic and GPS lock.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/kernel: Allow TeleGPS v2 to scale battery in telem
Keith Packard [Mon, 1 May 2017 00:35:28 +0000 (17:35 -0700)]
altos/kernel: Allow TeleGPS v2 to scale battery in telem

TeleGPS v2 uses the STMF0 processor instead of the LPC11, which means
the ADC range is different. As the raw ADC value was getting sent to
represent battery voltage in the config packet, we need to scale that
for the different processor. This patch allows that to happen.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agosrc/kernel: Add GPS lock blink LED to tracker code
Keith Packard [Mon, 1 May 2017 00:34:08 +0000 (17:34 -0700)]
src/kernel: Add GPS lock blink LED to tracker code

Blinks an LED briefly once every three seconds when GPS is locked.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Build MicroPeak-v2.0 by default
Keith Packard [Fri, 28 Apr 2017 07:08:51 +0000 (00:08 -0700)]
altos: Build MicroPeak-v2.0 by default

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/micropeak-v2.0: Add initial MicroPeak v2 support
Keith Packard [Fri, 28 Apr 2017 07:07:03 +0000 (00:07 -0700)]
altos/micropeak-v2.0: Add initial MicroPeak v2 support

stm32f042 processor replaces the attiny85 and adds USB support along
with more storage.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stmf0: Add support for HSI clocked applications
Keith Packard [Fri, 28 Apr 2017 07:05:01 +0000 (00:05 -0700)]
altos/stmf0: Add support for HSI clocked applications

And allow application space to be limited to less than available flash.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stmf0: Fix HSI clock rate.
Keith Packard [Fri, 28 Apr 2017 07:04:33 +0000 (00:04 -0700)]
altos/stmf0: Fix HSI clock rate.

It's 8MHz, not 16MHz

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stmf0: Make sure systick is off before programming
Keith Packard [Fri, 28 Apr 2017 07:04:14 +0000 (00:04 -0700)]
altos/stmf0: Make sure systick is off before programming

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stmf0: Compute serial baud rate registers at runtime
Keith Packard [Fri, 28 Apr 2017 07:02:54 +0000 (00:02 -0700)]
altos/stmf0: Compute serial baud rate registers at runtime

This allows the system clock to vary at runtime, instead of requiring
a fixed value.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/micropeak: Update ao_micropeak.h for MicroPeak v2
Keith Packard [Fri, 28 Apr 2017 07:02:02 +0000 (00:02 -0700)]
altos/micropeak: Update ao_micropeak.h for MicroPeak v2

Allow different sample times, add constant for MicroPeak v2 log files.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/micropeak: Use existing ao_ms5607_current variable
Keith Packard [Fri, 28 Apr 2017 07:01:18 +0000 (00:01 -0700)]
altos/micropeak: Use existing ao_ms5607_current variable

Instead of defining another.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Add header file for ao_report_micro.c
Keith Packard [Fri, 28 Apr 2017 07:00:11 +0000 (00:00 -0700)]
altos: Add header file for ao_report_micro.c

Defines the functions in this file.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Add 100ms constants for baro Kalman filter
Keith Packard [Fri, 28 Apr 2017 06:59:27 +0000 (23:59 -0700)]
altos: Add 100ms constants for baro Kalman filter

MicroPeak v2 uses this rate.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Adapt micro log to MicroPeak V3
Keith Packard [Fri, 28 Apr 2017 06:52:29 +0000 (23:52 -0700)]
altos: Adapt micro log to MicroPeak V3

Allow use of regular serial API for sending data.
Allow application to specify different storage size.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/ms5607: Allow applications to not use the normal data ring and thread
Keith Packard [Fri, 28 Apr 2017 06:51:21 +0000 (23:51 -0700)]
altos/ms5607: Allow applications to not use the normal data ring and thread

MicroPeak V2 has tasks, but doesn't want to use another thread just
for the MS5607.

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