fw/altos
12 years agoRevert "altos: Debugging TBT issues -- check pin configuration after boot"
Keith Packard [Sat, 7 May 2011 06:55:23 +0000 (23:55 -0700)]
Revert "altos: Debugging TBT issues -- check pin configuration after boot"

This reverts commit 514348055630edec12224c4b0964240b929759a3.

Looks like this was never a problem.

12 years agoaltos: clear CPU port 1 interrupt flag when handled
Keith Packard [Sat, 7 May 2011 06:12:47 +0000 (23:12 -0700)]
altos: clear CPU port 1 interrupt flag when handled

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Hook up the P1 ISR for TeleBT v0.1 bt_link line
Keith Packard [Sat, 7 May 2011 05:59:15 +0000 (22:59 -0700)]
altos: Hook up the P1 ISR for TeleBT v0.1 bt_link line

Otherwise, we're heading off into the weeds...

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Initialize beeper for telebt
Keith Packard [Sat, 7 May 2011 05:49:54 +0000 (22:49 -0700)]
altos: Initialize beeper for telebt

Needed to get sounds to come out

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Debugging TBT issues -- check pin configuration after boot
Keith Packard [Sat, 7 May 2011 05:42:58 +0000 (22:42 -0700)]
altos: Debugging TBT issues -- check pin configuration after boot

Make sure the serial pins are configured as peripherals
Make sure the ser_reset and bt_link pins are going the right direction.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Add beeper to TBT v0.1
Keith Packard [Sat, 7 May 2011 05:42:32 +0000 (22:42 -0700)]
altos: Add beeper to TBT v0.1

It's available, let's use it.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: pull TBT v0.1 ser_reset line low
Keith Packard [Sat, 7 May 2011 05:12:31 +0000 (22:12 -0700)]
altos: pull TBT v0.1 ser_reset line low

This line resets the BT module if held low for three seconds.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Fix BT link status pin for real TBT hardware
Keith Packard [Sat, 7 May 2011 04:13:19 +0000 (21:13 -0700)]
altos: Fix BT link status pin for real TBT hardware

The prototype used P2_1, while the real hardware uses P1_7. Lots of
defines to make this work...

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Use USART configuration 1 with flow control for TBT
Keith Packard [Sat, 7 May 2011 03:33:58 +0000 (20:33 -0700)]
altos: Use USART configuration 1 with flow control for TBT

It's just wired that way.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: Add telebt-v0.1 to Makefile
Keith Packard [Fri, 6 May 2011 23:57:38 +0000 (16:57 -0700)]
altos: Add telebt-v0.1 to Makefile

Doesn't get built without it.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agofirst cut at a telebt turn on script
Bdale Garbee [Fri, 6 May 2011 23:57:17 +0000 (17:57 -0600)]
first cut at a telebt turn on script

12 years agoaltos: Add preliminary telebt v0.1 defines
Keith Packard [Fri, 6 May 2011 22:44:56 +0000 (15:44 -0700)]
altos: Add preliminary telebt v0.1 defines

This should make the telebt v0.1 binary that works on the real hardware.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltosui: Fix BT manage dialog so that the device lists resize
Keith Packard [Tue, 26 Apr 2011 06:00:42 +0000 (23:00 -0700)]
altosui: Fix BT manage dialog so that the device lists resize

This makes the device scrolling lists fill any extra space when the
window is resized.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltosui: Move AltosIgniteUI device open out of Swing thread
Keith Packard [Tue, 26 Apr 2011 05:55:08 +0000 (22:55 -0700)]
altosui: Move AltosIgniteUI device open out of Swing thread

Eliminate more blocking code from the Swing thread.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltosui: Display reader name (usually the device) when an I/O error occurs
Keith Packard [Tue, 26 Apr 2011 05:28:40 +0000 (22:28 -0700)]
altosui: Display reader name (usually the device) when an I/O error occurs

Access the reader name directly from the reader object instead of a
local variable (which wasn't getting set anyways).

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltosui: Fix TeleBT name in flight monitor title
Keith Packard [Tue, 26 Apr 2011 04:26:21 +0000 (21:26 -0700)]
altosui: Fix TeleBT name in flight monitor title

Was getting the product number, not the product name.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltosui: Separate out flash debug code to separate thread
Keith Packard [Tue, 26 Apr 2011 04:17:07 +0000 (21:17 -0700)]
altosui: Separate out flash debug code to separate thread

This avoids blocking the Swing thread while waiting for the serial
device.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 years agoaltos: add telebt-v0.0 Makefile
Keith Packard [Sun, 24 Apr 2011 05:50:58 +0000 (22:50 -0700)]
altos: add telebt-v0.0 Makefile

Git doesn't like to add these.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Make flight data download work through TeleBT
Keith Packard [Tue, 19 Apr 2011 22:29:39 +0000 (15:29 -0700)]
altosui: Make flight data download work through TeleBT

This required flushing input before reading data blocks and adjusting
some delays.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoMerge branch 'telemini' into telebt
Keith Packard [Tue, 19 Apr 2011 21:06:39 +0000 (14:06 -0700)]
Merge branch 'telemini' into telebt

13 years agoaltosui: Eliminate ao_cmd_filter hook
Keith Packard [Tue, 19 Apr 2011 21:01:19 +0000 (14:01 -0700)]
altosui: Eliminate ao_cmd_filter hook

Disabling status messages means we don't need to filter them out of
the input stream.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: remove BT logging code
Keith Packard [Tue, 19 Apr 2011 20:42:30 +0000 (13:42 -0700)]
altos: remove BT logging code

This was used to debug the serial line startup.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Remove bt debug command
Keith Packard [Tue, 19 Apr 2011 20:31:10 +0000 (13:31 -0700)]
altos: Remove bt debug command

This will permit some additional cleanups.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Simplify BT communications
Keith Packard [Tue, 19 Apr 2011 20:27:40 +0000 (13:27 -0700)]
altos: Simplify BT communications

Eliminate stdio I/O wrappers

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Solidify BT connections
Keith Packard [Tue, 19 Apr 2011 20:20:19 +0000 (13:20 -0700)]
altos: Solidify BT connections

Use delays while sending commands to BT module.
Don't use BT for stdio until the module is initialized.
Add \r to name setting command
Don't require 'connected' signal for command input.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Wait two seconds after bluetooth connect XXX
Keith Packard [Tue, 19 Apr 2011 17:41:28 +0000 (10:41 -0700)]
altosui: Wait two seconds after bluetooth connect XXX

"something" isn't quite ready to communicate right after the device is
connected, so we stick a delay in. There should be a better fix.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Add delays to bt startup sequence
Keith Packard [Tue, 19 Apr 2011 17:25:47 +0000 (10:25 -0700)]
altos: Add delays to bt startup sequence

The BT device takes a few seconds after power-up before it is ready to
receive commands.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Use persistent list of bluetooth devices for device dialogs
Keith Packard [Tue, 19 Apr 2011 15:43:40 +0000 (08:43 -0700)]
altosui: Use persistent list of bluetooth devices for device dialogs

Store a list of known bluetooth devices as preferences. Always include
those in device dialogs with an option to go browse for more devices
in both the device dialog and the Configure AltosUI dialog.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Make bluetooth dialog modal
Keith Packard [Mon, 18 Apr 2011 23:16:38 +0000 (18:16 -0500)]
altosui: Make bluetooth dialog modal

This allows it to be displayed correctly while the device dialog box
(also modal) is up.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Make AltosBTDevice implement AltosDevice interface
Keith Packard [Thu, 14 Apr 2011 17:22:30 +0000 (10:22 -0700)]
altosui: Make AltosBTDevice implement AltosDevice interface

This will allow the use of either USB or BT devices through the
AltosDevice interface.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Create abstract AltosDevice class
Keith Packard [Thu, 14 Apr 2011 17:12:29 +0000 (10:12 -0700)]
altosui: Create abstract AltosDevice class

This will wrap either USB or BT devices. The USB device constants have
been moved to Altos.java

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Add primitive bluetooth device manager UI.
Keith Packard [Sat, 9 Apr 2011 02:46:15 +0000 (19:46 -0700)]
altosui: Add primitive bluetooth device manager UI.

This isn't useful, but does inquire for available bluetooth devices
and show them in a list.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Write a few pre-launch samples for Tm/Tn devices
Keith Packard [Thu, 14 Apr 2011 16:38:48 +0000 (09:38 -0700)]
altos: Write a few pre-launch samples for Tm/Tn devices

Record pre-launch samples in a small ring and flush that to flash when
launch is detected. This provides a complete record of the flight,
rather than simply starting after launch detect.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: oops - lost state changes when downloading eeprom data.
Keith Packard [Thu, 14 Apr 2011 03:27:38 +0000 (20:27 -0700)]
altosui: oops - lost state changes when downloading eeprom data.

This would cause the reader to just keep reading past the end of the
flight.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos/altosui: Log averaged baro sensor data in Tm/Tn
Keith Packard [Sun, 10 Apr 2011 05:53:12 +0000 (22:53 -0700)]
altos/altosui: Log averaged baro sensor data in Tm/Tn

Instead of logging the best height guess from the kalman filter, log
barometer data. The logged data consists of the average value betwen
log points to reduce noise.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Add low-level Bluetooth APIs
Keith Packard [Fri, 8 Apr 2011 17:13:55 +0000 (10:13 -0700)]
altosui: Add low-level Bluetooth APIs

Adds the JNI functions to query and connect to arbitrary
bluetooth devices.

Adds Java wrappers to construct a list of proximate bluetooth devices.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Add TeleBT USB device support
Keith Packard [Fri, 8 Apr 2011 17:12:50 +0000 (10:12 -0700)]
altosui: Add TeleBT USB device support

TeleBT can work just like a TeleDongle over USB.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Use PIO(6) on BTM to monitor BT connection. Fix BTM init.
Keith Packard [Fri, 8 Apr 2011 05:00:38 +0000 (22:00 -0700)]
altos: Use PIO(6) on BTM to monitor BT connection. Fix BTM init.

PIo(6) appears to be an active-low indication of the Bluetooth
connection status. Hook this up using an interrupt to track the
link state instead of using in-band status messages.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoMerge branch 'telemini' into telebt
Keith Packard [Sat, 2 Apr 2011 02:35:22 +0000 (19:35 -0700)]
Merge branch 'telemini' into telebt

13 years agoaltosui: Add missing AltosTelemetryMap.java file
Keith Packard [Sat, 2 Apr 2011 02:35:00 +0000 (19:35 -0700)]
altosui: Add missing AltosTelemetryMap.java file

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Clean up BT serial communcations
Keith Packard [Sat, 2 Apr 2011 00:26:08 +0000 (17:26 -0700)]
altos: Clean up BT serial communcations

Disable echo on both ends in command mode to eliminate looping error
values.

Switch to 57600 baud to improve performance.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Make cmd echo per-connection instead of global
Keith Packard [Sat, 2 Apr 2011 00:25:07 +0000 (17:25 -0700)]
altos: Make cmd echo per-connection instead of global

Allow different connections to use different echo values, permitting
the packet link to turn off echo while the USB link still has it on.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Clean up serial initialization
Keith Packard [Fri, 1 Apr 2011 23:48:12 +0000 (16:48 -0700)]
altos: Clean up serial initialization

Flush serial input buffers when switching speeds.
Ensure pin configuration is correct.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Clean up usage of serial port for stdio
Keith Packard [Fri, 1 Apr 2011 21:12:56 +0000 (14:12 -0700)]
altos: Clean up usage of serial port for stdio

Code wanting to use this must invoke ao_add_stdio; that way
the link can be configured before command processing starts.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Make ao_serial_drain public
Keith Packard [Fri, 1 Apr 2011 21:11:44 +0000 (14:11 -0700)]
altos: Make ao_serial_drain public

Allow external code to discard serial input

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Remove serial monitor command
Keith Packard [Fri, 1 Apr 2011 21:10:37 +0000 (14:10 -0700)]
altos: Remove serial monitor command

This takes up space and isn't that useful these days

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Allow any stdio to be used with packet forwarding
Keith Packard [Fri, 1 Apr 2011 21:08:37 +0000 (14:08 -0700)]
altos: Allow any stdio to be used with packet forwarding

There's no reason to restrict packet forwarding to work only from
USB.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Provide for a pre-filter on commands
Keith Packard [Fri, 1 Apr 2011 21:07:23 +0000 (14:07 -0700)]
altos: Provide for a pre-filter on commands

This allows for external code to see each command line before it is
processed and potentially skip it.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: expose set of available stdio values
Keith Packard [Fri, 1 Apr 2011 21:04:58 +0000 (14:04 -0700)]
altos: expose set of available stdio values

This lets external code manipulate which connection to communicate
over.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Add P2SEL_*_MASK defines to cc1111.h
Keith Packard [Fri, 1 Apr 2011 21:03:25 +0000 (14:03 -0700)]
altos: Add P2SEL_*_MASK defines to cc1111.h

These are used to avoid having the code "know" which selections are 1
and which are 0 bits.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Add initial TeleBT code
Keith Packard [Fri, 1 Apr 2011 03:58:14 +0000 (20:58 -0700)]
altos: Add initial TeleBT code

Prototyping with a TeleMetrum v0.1 board and a serial link to a
bluetooth module.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Make ao_flight_test show true height but report saturated height
Keith Packard [Fri, 1 Apr 2011 03:55:18 +0000 (20:55 -0700)]
altos: Make ao_flight_test show true height but report saturated height

To simulate a saturated baro sensor, clip baro data at a specified
altitude. Continue to report the 'true' altitude in the output so that
the resulting graphs are useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Baro useful ceiling is MSL, not AGL
Keith Packard [Fri, 1 Apr 2011 03:53:12 +0000 (20:53 -0700)]
altos: Baro useful ceiling is MSL, not AGL

Use MSL instead of AGL for detecting over-range baro sensor values.
Always trust baro sensor during descent; it'll get there eventually.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Reflect ao_flight split in ao_flight_test dependencies
Keith Packard [Fri, 1 Apr 2011 03:51:15 +0000 (20:51 -0700)]
altos: Reflect ao_flight split in ao_flight_test dependencies

Need to rebuild ao_flight_test when any of the flight sources change

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Only plot acceleration when present in data file
Keith Packard [Wed, 30 Mar 2011 18:48:03 +0000 (11:48 -0700)]
altosui: Only plot acceleration when present in data file

Eliminates a bogus axis and data line for devices which do not have an
accelerometer.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Parse and export Max flight log value
Keith Packard [Wed, 30 Mar 2011 18:47:07 +0000 (11:47 -0700)]
altosui: Parse and export Max flight log value

New configuration field might as well get dumped to the .csv files.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Enable logging during nano flights
Keith Packard [Wed, 30 Mar 2011 01:11:47 +0000 (18:11 -0700)]
altos: Enable logging during nano flights

Not having logging wasn't very useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Run RDF beacon after apogee instead of waiting for landing
Keith Packard [Wed, 30 Mar 2011 01:10:46 +0000 (18:10 -0700)]
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>
13 years agoaltos: ao_sample_preflight was exiting preflight mode immediately
Keith Packard [Tue, 29 Mar 2011 17:08:46 +0000 (10:08 -0700)]
altos: ao_sample_preflight was exiting preflight mode immediately

Need to stay in pre-flight mode until we've gotten enough sensor data
to calibrate things appropriately. The conversion from a unified
ao_flight.c file was just broken here.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Don't display 0000-00-00 for missing flight log dates
Keith Packard [Tue, 29 Mar 2011 16:39:27 +0000 (09:39 -0700)]
altosui: Don't display 0000-00-00 for missing flight log dates

With Tm/Tn not having GPS to get the current date, it's no longer
unusual to have no date for a flight log, so don't show the 0000-00-00
piece in that case.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Display exception messages from swing thread
Keith Packard [Tue, 29 Mar 2011 16:38:23 +0000 (09:38 -0700)]
altosui: Display exception messages from swing thread

Flight log management exceptions were getting displayed from the log
serial I/O thread instead of the swing thread. That's a bad plan.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Make deployment testing handle Connecting... dialog
Keith Packard [Tue, 29 Mar 2011 16:37:11 +0000 (09:37 -0700)]
altosui: Make deployment testing handle Connecting... dialog

Supporting the Connecting... dialog requires moving all serial
communication to a separate thread. This was done by creating a worker
thread and command queue to communicate between the UI and the serial line.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Make flight log downloading handle 'Connecting...' dialog
Keith Packard [Tue, 29 Mar 2011 06:38:02 +0000 (23:38 -0700)]
altosui: Make flight log downloading handle 'Connecting...' dialog

This required moving all of the serial communication to a separate
thread and making the bulk of the download operation run after that
has finished.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Clean up packet link connecting dialog
Keith Packard [Tue, 29 Mar 2011 06:35:05 +0000 (23:35 -0700)]
altosui: Clean up packet link connecting dialog

Make sure the dialog is destroyed after use (otherwise, it hangs
around on the screen sometimes).

Switch timeout before showing dialog to 500ms -- that brings the
dialog up less often when unnecessary.

Use 'timeout_started' boolean to indicate whether the I/O thread has
queued the dialog for display and whether it needs to queue a call to
close it down.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Create custom nano flight code
Keith Packard [Tue, 29 Mar 2011 01:18:50 +0000 (18:18 -0700)]
altos: Create custom nano flight code

No igniters, just 'pad/drogue/landed' modes (where 'drogue' ==
'flying'). A constant 1Hz telemetry and RDF rate.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Split up flight code into separate flight/sample/kalman bits
Keith Packard [Tue, 29 Mar 2011 00:54:44 +0000 (17:54 -0700)]
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>
13 years agoaltosui: Handle serial calls from swing thread
Keith Packard [Sun, 27 Mar 2011 07:48:07 +0000 (00:48 -0700)]
altosui: Handle serial calls from swing thread

Calls from the swing thread cannot be canceled as there's no way to
put up the cancel dialog. In this case, simply use the 5 second
timeout and fail if no communication occurs within that amount of time.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Tell serial device which frame to use for timeout dialogs
Keith Packard [Sun, 27 Mar 2011 07:46:19 +0000 (00:46 -0700)]
altosui: Tell serial device which frame to use for timeout dialogs

For the timeout dialog to appear, a frame must be configured for it to
appear near. This patch sends the frame from the eeprom download
functions to the serial code. That path doesn't yet work as the eeprom
download is still trying to talk to the serial device from the swing
event thread, which prevents the cancel dialog from working.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Allow radio channel to be configured over the radio link
Keith Packard [Sun, 27 Mar 2011 07:13:38 +0000 (00:13 -0700)]
altosui: Allow radio channel to be configured over the radio link

TeleMini/TeleNano can't be configured via USB, so we need to allow
the radio channel to be set over the radio link.

This change carefully sets the new radio channel, disables the remote
link and then sets the teledongle channel to the new value and brings
the link back up.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Off-by-one error in telemetry format configuration UI
Keith Packard [Sun, 27 Mar 2011 07:12:01 +0000 (00:12 -0700)]
altosui: Off-by-one error in telemetry format configuration UI

The telemetry format menu uses 0 for full and 1 for tiny, but the
telemetry configuration uses 1 for full and 2 for tiny. One direction
(config to UI) was right, the other (UI to config) was wrong.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: full logging must flush pending data before checking state
Keith Packard [Sun, 27 Mar 2011 06:38:54 +0000 (23:38 -0700)]
altos: full logging must flush pending data before checking state

Flight state must be checked only after any pending data have been
written to the log as the 'current' flight state is only valid when
the pending data values have been processed. This ensures that the
'boost' state is not marked until the full ring of data is
written. This ensures that the data processing code can find the
barometer values from before boost to get an idea of the ground
pressure value.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Variable log rate in full logging code too
Keith Packard [Sun, 27 Mar 2011 06:15:36 +0000 (23:15 -0700)]
altos: Variable log rate in full logging code too

With the fixed ADC rate used to get better data during flight, the
logging code now needs to vary the data storage rate so that descent
data is recorded at 10 samples/second while ascent data is recorded at
1 sample per second. Having the logging code do this itself eliminates
any interaction with the flight code.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Allow TM config connection to be canceled.
Keith Packard [Sat, 26 Mar 2011 07:01:22 +0000 (00:01 -0700)]
altosui: Allow TM config connection to be canceled.

This leaves the config UI connection attempt running and pops up a
dialog box when it takes 'too long' in the remote case so that users
with Tm or Tn devices can bring up the UI, and then boot the Tm/Tn
without needing to time things carefully.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: swing hide/show methods are deprecated
Keith Packard [Sat, 26 Mar 2011 05:04:09 +0000 (22:04 -0700)]
altosui: swing hide/show methods are deprecated

I don't know why, but they are, so just replace them with
setVisible calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Remove extra AltosEepromBlock layer
Keith Packard [Sat, 26 Mar 2011 05:01:18 +0000 (22:01 -0700)]
altosui: Remove extra AltosEepromBlock layer

This was interposed between the download layer and the eeprom layer to
hold a eeprom block full of flight log records. The addition of the tiny
log format required reworking the code to hold chunks full of eeprom
data without regard to their content, so this content-specific layer
didn't seem useful anymore.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Add support for downloading TeleMini/TeleNano flight logs
Keith Packard [Sat, 26 Mar 2011 04:34:31 +0000 (21:34 -0700)]
altosui: Add support for downloading TeleMini/TeleNano flight logs

Splits the eeprom downloading code into eeprom block downloading and
separate eeprom data parsing so that the new data logging format can
share the data downloading code.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Remove a bunch of debug printfs from the eeprom manager code
Keith Packard [Sat, 26 Mar 2011 04:29:50 +0000 (21:29 -0700)]
altosui: Remove a bunch of debug printfs from the eeprom manager code

Just noise on stdout.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Add telemetry format menu and preferences
Keith Packard [Wed, 23 Mar 2011 23:08:43 +0000 (08:08 +0900)]
altosui: Add telemetry format menu and preferences

Switches the TeleDongle between full and tiny telemetry packet
formats, saving the last used format for each teledongle in the
application preferences.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltosui: Add support for telemetry version 4
Keith Packard [Wed, 23 Mar 2011 20:27:57 +0000 (05:27 +0900)]
altosui: Add support for telemetry version 4

New telemetry format needed to support TeleNano and TeleMini

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoAdd description to test flights
Keith Packard [Wed, 23 Mar 2011 01:42:31 +0000 (10:42 +0900)]
Add description to test flights

13 years agoAdd ao_kalman.h to .gitignore
Keith Packard [Wed, 23 Mar 2011 01:40:05 +0000 (10:40 +0900)]
Add ao_kalman.h to .gitignore

13 years agoaltos: Exit flight test at landing. Allow description in test flight list
Keith Packard [Wed, 23 Mar 2011 01:37:39 +0000 (10:37 +0900)]
altos: Exit flight test at landing. Allow description in test flight list

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Ignore alt error for fast->coast. Allow larger error for baro apogee.
Keith Packard [Wed, 23 Mar 2011 01:33:38 +0000 (10:33 +0900)]
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>
13 years agoaltos: Restore sensible kalman values
Keith Packard [Tue, 22 Mar 2011 07:55:08 +0000 (16:55 +0900)]
altos: Restore sensible kalman values

Now that the kalman code seems to work correctly, restore the sensor
errors and model errors to match reality

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Fix up flight code testing
Keith Packard [Tue, 22 Mar 2011 12:51:52 +0000 (21:51 +0900)]
altos: Fix up flight code testing

This automates flight code testing by reporting mis-detected apogee or
main events.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Missing parens and some bad arithmetic in the kalman code
Keith Packard [Tue, 22 Mar 2011 12:50:29 +0000 (21:50 +0900)]
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>
13 years agoaltos: Add ao_flight_debug code
Keith Packard [Tue, 22 Mar 2011 12:29:05 +0000 (21:29 +0900)]
altos: Add ao_flight_debug code

Trace the kalman filter to make sure it's working.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Clean up some debug stuff in ao_flight.c
Keith Packard [Tue, 22 Mar 2011 08:04:07 +0000 (17:04 +0900)]
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>
13 years agoaltos/kalman: Kalman terms can be > 1, use 32-bit fixed point
Keith Packard [Tue, 22 Mar 2011 07:51:04 +0000 (16:51 +0900)]
altos/kalman: Kalman terms can be > 1, use 32-bit fixed point

Because speed and acceleration are scaled by 16, it's fairly common
for the kalman terms to end up larger than 1. Instead of trying to
fuss with 16-bit values and shifts, just use 32-bit values.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Compute a 'trust' value for the barometer
Keith Packard [Mon, 21 Mar 2011 23:51:23 +0000 (08:51 +0900)]
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>
13 years agoaltos: Switch telemetrum over to kalman filter
Keith Packard [Mon, 21 Mar 2011 20:42:51 +0000 (05:42 +0900)]
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>
13 years agoaltos: Add nickle kalman implementation.
Keith Packard [Mon, 21 Mar 2011 10:59:27 +0000 (19:59 +0900)]
altos: Add nickle kalman implementation.

This generates the constants needed to implement Kalman filtering in
the flight firmware.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Add .sdcdbrc file for teledongle
Keith Packard [Sun, 20 Mar 2011 06:55:39 +0000 (23:55 -0700)]
altos: Add .sdcdbrc file for teledongle

My sdcdb script uses this to set command line options automatically

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: New telemetry report format (version 4). Supports tiny telemetry.
Keith Packard [Sun, 20 Mar 2011 06:53:08 +0000 (23:53 -0700)]
altos: New telemetry report format (version 4). Supports tiny telemetry.

This completely replaces the version 3 format with a much simpler and
easier to parse scheme. It's described in detail in ao_telem.h, but
the basic idea is that the whole line is split into name/value pairs,
separated by whitespace. Every name is unique, and the values are
either strings or integers. No extraneous formatting or units are
provided.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: The kalman code requires a constant sample rate
Keith Packard [Sun, 20 Mar 2011 06:51:02 +0000 (23:51 -0700)]
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>
13 years agoaltos: Split telenano main from telemini
Keith Packard [Sun, 20 Mar 2011 06:49:41 +0000 (23:49 -0700)]
altos: Split telenano main from telemini

Eventually, telenano will run different code; prepare for this by
creating a telenano-specific main routine.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Split out tiny telemetry from full telemetry
Keith Packard [Sun, 20 Mar 2011 06:46:18 +0000 (23:46 -0700)]
altos: Split out tiny telemetry from full telemetry

The TeleMini and TeleNano boards do not have either GPS or
accelermeters, and they also run the kalman filter which produces
standard unit measurements for the flight height/speed/accel
values. This makes the telemetry significantly
different. ao_telemetry_tiny.c sends the required data.

Note that TeleNano sends the same telemetry as telemini at this point;
there are a couple of values which are not useful, but the overhead of
sending them is small enough that the hassle of having three telemetry
formats seemed excessive.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Make telemetry interval more consistent
Keith Packard [Sun, 20 Mar 2011 06:41:44 +0000 (23:41 -0700)]
altos: Make telemetry interval more consistent

Instead of using a delay between telemetry packets, use a telemetry
period and compute an appropriate delay each time. This requires
changing the ascent telemetry from a 50ms delay to a 100ms interval,
to provide a regular 10 packets-per-second rate. Before, we counted on
the telemetry packet taking about 50ms to send so that we would
receive about 10 per second.

This also eliminates delays during descent for RDF tones -- those will
get transmitted in the interval between telemetry packets without
interrupting the spacing of those packets.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Configure packet size from send/recv parameters.
Keith Packard [Sun, 20 Mar 2011 06:31:20 +0000 (23:31 -0700)]
altos: Configure packet size from send/recv parameters.

Instead of setting the packet size at configuration time, use the
provided packet size to the send/recv functions to configure the
radio. This eliminates many configuration calls, leaving us with 'RDF'
mode and 'packet' mode, the latter working for telemetry and the
bi-directional link.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoaltos: Don't init packet slave on TD. Make slave start optional
Keith Packard [Sun, 20 Mar 2011 06:27:15 +0000 (23:27 -0700)]
altos: Don't init packet slave on TD. Make slave start optional

Oops. TeleDongle was starting the packet slave code, which kinda
wrecked its ability to receive telemetry packets. This patch simply
removes the packet slave code from teledongle as it cannot be used
(yet), it also makes the packet slave code initialization take a
parameter which controls whether to start that by default; in the
future, perhaps TeleDongle will gain a command to start packet slave mode.

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