fw/altos
11 years agoaltosui: Abstract remote connection timeout stuff
Keith Packard [Thu, 12 Jul 2012 02:15:32 +0000 (19:15 -0700)]
altosui: Abstract remote connection timeout stuff

This moves some of the logic for managing when to present the 'cancel'
dialog for remote operations to altoslib.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Remove a bunch of debugging printfs
Keith Packard [Wed, 11 Jul 2012 21:28:53 +0000 (14:28 -0700)]
altosui: Remove a bunch of debugging printfs

These aren't useful at this point.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoReport RSSI values in monitor idle UI (trac #44)
Keith Packard [Wed, 11 Jul 2012 20:53:30 +0000 (13:53 -0700)]
Report RSSI values in monitor idle UI (trac #44)

This adds a new 's' command to TeleDongle to report RSSI value from last
received packet, and then has AltosUI request that value when closing
the remote link.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Fix gcc compiler warnings in GPS code
Keith Packard [Wed, 11 Jul 2012 20:52:32 +0000 (13:52 -0700)]
altos: Fix gcc compiler warnings in GPS code

unused variables and mis-matches in printf format codes.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Create macros to convert from/to radio RSSI representation
Keith Packard [Wed, 11 Jul 2012 20:50:56 +0000 (13:50 -0700)]
altos: Create macros to convert from/to radio RSSI representation

AO_RSSI_FROM_RADIO and AO_RADIO_FROM_RSSI.

Removes a bunch of open-coded versions of the same function.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Have 'make clean' remove all programs, even old ones
Keith Packard [Wed, 11 Jul 2012 20:49:26 +0000 (13:49 -0700)]
altos: Have 'make clean' remove all programs, even old ones

This makes sure that changing version numbers doesn't leave old
compiled output lying around.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: remove optimization for 'help' that confuses cc1111 compiler
Keith Packard [Wed, 11 Jul 2012 20:47:25 +0000 (13:47 -0700)]
altos: remove optimization for 'help' that confuses cc1111 compiler

The cc1111 compiler gets this very wrong and prints piles of garbage

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoAdd megametrum outline to doc dir
Keith Packard [Wed, 11 Jul 2012 20:40:54 +0000 (13:40 -0700)]
Add megametrum outline to doc dir

And install it alongside telemetrum-outline

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Ignore megametrum built files
Keith Packard [Wed, 11 Jul 2012 20:40:07 +0000 (13:40 -0700)]
altos: Ignore megametrum built files

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoGet AltOS version numbers into Mac 'about' dialog
Keith Packard [Wed, 11 Jul 2012 07:35:21 +0000 (00:35 -0700)]
Get AltOS version numbers into Mac 'about' dialog

Generate Info.plist from Info.plist.in to correctly set the VERSION
information. This also changes some strings around to make them look better

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Force 434.550Mhz by connecting debug gnd and clk (trac #41)
Keith Packard [Wed, 11 Jul 2012 05:41:59 +0000 (22:41 -0700)]
altos: Force 434.550Mhz by connecting  debug gnd and clk (trac #41)

Check for pin P2_2 low at startup and set the frequency to
434.550MHz. This value won't get written to flash, so rebooting again
will restore the configured frequency.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Continuously update ground state while on pad (trac #42)
Keith Packard [Wed, 11 Jul 2012 05:09:44 +0000 (22:09 -0700)]
altos: Continuously update ground state while on pad (trac #42)

Average data for 5 seconds, wait 5 seconds and if still in pad mode,
replace the existing data with the new data. This should avoid
averaging in boost data while still keeping things reasonably current.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Set HAS_FLIGHT_DEBUG=1 to include the flight debugging commands
Keith Packard [Wed, 11 Jul 2012 05:08:28 +0000 (22:08 -0700)]
altos: Set HAS_FLIGHT_DEBUG=1 to include the flight debugging commands

This leaves USB enabled, and adds the 'F' command to dump
internal flight state.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Signal continuity over radio in pad mode (trac #40)
Keith Packard [Wed, 11 Jul 2012 03:35:19 +0000 (20:35 -0700)]
altos: Signal continuity over radio in pad mode (trac #40)

This is especially useful for telemini which has no beeper, allowing
you to hear the continuity signal while at the pad over the air.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add 'void' parameter to ao_fec_decode callback parameter
Keith Packard [Wed, 11 Jul 2012 03:34:02 +0000 (20:34 -0700)]
altos: Add 'void' parameter to ao_fec_decode callback parameter

This keeps the compiler from whinging about the lack of a prototype.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Save some memory.
Keith Packard [Wed, 11 Jul 2012 03:32:31 +0000 (20:32 -0700)]
altos: Save some memory.

A few minor space savings in ao_cmd.c and ao_config.c.  Don't build
unused conversion functions ao_altitude_to_pres and ao_temp_to_dC

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Improve ao_flight_test a bit
Keith Packard [Tue, 10 Jul 2012 22:15:00 +0000 (15:15 -0700)]
altos: Improve ao_flight_test a bit

Add -i flag to include flight description
Have run-tests know how many failures to expect
Add run_baro to plot a single flight using the baro-only mode

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: add some (unused) test code for different soft-decision sizes
Keith Packard [Tue, 10 Jul 2012 22:13:55 +0000 (15:13 -0700)]
altos: add some (unused) test code for different soft-decision sizes

This lets us experiment with hard-decision and other possible
soft_decision bit depths.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Eliminate compiler warnings when building ao_flight_test
Keith Packard [Tue, 10 Jul 2012 22:13:18 +0000 (15:13 -0700)]
altos: Eliminate compiler warnings when building ao_flight_test

We turn on a pile of warnings for that.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Rename *_mm.c back to *.c
Keith Packard [Tue, 10 Jul 2012 22:11:36 +0000 (15:11 -0700)]
altos: Rename *_mm.c back to *.c

Was just a temporary hack to keep cc1111 products building during MM development.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: remove stale ao_flight.c and ao_sample.c
Keith Packard [Tue, 10 Jul 2012 22:07:34 +0000 (15:07 -0700)]
altos: remove stale ao_flight.c and ao_sample.c

The mega-metrum versions are now the official versions

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Move profiling settings to Makefile
Keith Packard [Wed, 4 Jul 2012 04:02:20 +0000 (21:02 -0700)]
altos: Move profiling settings to Makefile

Instead of splitting the changes across Makefile and ao_pins.h, put
them both in Makefile to simplify enabling profiling.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Crank up the gaussian noise in the FEC test
Keith Packard [Wed, 4 Jul 2012 04:01:01 +0000 (21:01 -0700)]
altos: Crank up the gaussian noise in the FEC test

This lets us check to make sure our receive performance isn't
degrading at all, instead of just making sure we can receive
perfect packets well.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Viterbi performance improvments. Down to 5.7ms for command decode
Keith Packard [Wed, 4 Jul 2012 03:59:35 +0000 (20:59 -0700)]
altos: Viterbi performance improvments. Down to 5.7ms for command decode

Stealing more of Phil's good ideas, decoding a command mode packet has
been reduced from 9ms to 5.7ms. Lots more comments to help future-me
figure out how this code works.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Fix flight data download for TM. Look for MM flights when graphing
Keith Packard [Tue, 3 Jul 2012 07:29:43 +0000 (00:29 -0700)]
altosui: Fix flight data download for TM. Look for MM flights when graphing

A couple of minor fixes, the first to not force the log format so that
TM/Tm data will be downloaded correctly and the second to expand the
set of files to include '.mega' files when plotting data.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Do not block igniters on the radio mutex.
Keith Packard [Tue, 3 Jul 2012 06:44:10 +0000 (23:44 -0700)]
altos: Do not block igniters on the radio mutex.

Blocking igniters on the radio mutex fails when doing igniter testing
over the RF link; the packet receiver task will never release the
mutex and the CPU at the same time, causing the system to lock up.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoextend cross-compiler availability logic to all target CPUs, not just ARM
Bdale Garbee [Mon, 2 Jul 2012 05:24:20 +0000 (23:24 -0600)]
extend cross-compiler availability logic to all target CPUs, not just ARM

11 years agoconditionalize build of ARM binaries on presence of arm-none-eabi-gcc in PATH
Bdale Garbee [Sat, 30 Jun 2012 19:00:33 +0000 (13:00 -0600)]
conditionalize build of ARM binaries on presence of arm-none-eabi-gcc in PATH

11 years agoaltos: Declare cc1111 accel_ref as unsigned so the math works 1.0.9.6
Keith Packard [Fri, 29 Jun 2012 00:43:36 +0000 (17:43 -0700)]
altos: Declare cc1111 accel_ref as unsigned so the math works

If accel_ref is signed, then the careful shifting and dividing dance
necessary to correct for changes in the relationship between the 5V
and 3.3V supplies always generates zero.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoUpdate version to 1.0.9.6
Keith Packard [Thu, 28 Jun 2012 23:42:59 +0000 (16:42 -0700)]
Update version to 1.0.9.6

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Disable MS5607 interrupt in the handler altosdroid
Keith Packard [Thu, 28 Jun 2012 23:05:56 +0000 (16:05 -0700)]
altos: Disable MS5607 interrupt in the handler

Avoids having the interrupt re-raised multiple times until the reading
task finally wakes up.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Track missed HMC5883 interrupts
Keith Packard [Thu, 28 Jun 2012 06:11:27 +0000 (23:11 -0700)]
altos: Track missed HMC5883 interrupts

When it fails to signal conversion complete to the CPU, keep track of
that and report it with the rest of the current data.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Increase default STM stack to 648 bytes
Keith Packard [Thu, 28 Jun 2012 06:09:16 +0000 (23:09 -0700)]
altos: Increase default STM stack to 648 bytes

512 seems cozy given the printf implementation we're using and the
extensive interrupts.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: panic if MPU6000 self test fails
Keith Packard [Thu, 28 Jun 2012 06:05:36 +0000 (23:05 -0700)]
altos: panic if MPU6000 self test fails

Don't try to fly if the board isn't working right.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Disable mag sensor for megametrum
Keith Packard [Thu, 28 Jun 2012 06:04:25 +0000 (23:04 -0700)]
altos: Disable mag sensor for megametrum

It doesn't work unless USB is connected or occasionally while the
debug port is enabled. It's mystic.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Allow megametrum to be built without using the mag sensor
Keith Packard [Thu, 28 Jun 2012 06:03:33 +0000 (23:03 -0700)]
altos: Allow megametrum to be built without using the mag sensor

I'm having trouble getting it working reliably, so we'll like disable it
for now. This patch makes that possible.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Make profiling Viterbi decoder more useful
Keith Packard [Thu, 28 Jun 2012 02:47:52 +0000 (19:47 -0700)]
altos: Make profiling Viterbi decoder more useful

This blocks starting the decoder until all of the data have arrived so
that the time spent in the decoder is easily computed.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Unroll viterbi state loop for >30% performance boost
Keith Packard [Thu, 28 Jun 2012 02:45:22 +0000 (19:45 -0700)]
altos: Unroll viterbi state loop for >30% performance boost

9.3ms vs 14.7ms, a clear win.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Clean up STM I2C clock computations
Keith Packard [Thu, 28 Jun 2012 00:18:57 +0000 (17:18 -0700)]
altos: Clean up STM I2C clock computations

Fix both clock time and rise time.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Clean up radio CRC handling
Keith Packard [Thu, 28 Jun 2012 00:17:44 +0000 (17:17 -0700)]
altos: Clean up radio CRC handling

Make the FEC code just set the CRC_OK bit like the cc1111 radio does;
eliminates a bunch of weird conventions across the FEC API.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: get MPU6000 I2C link working reliably
Keith Packard [Wed, 27 Jun 2012 21:38:35 +0000 (14:38 -0700)]
altos: get MPU6000 I2C link working reliably

This slows the i2c bus to 100kHz (yuck), sets the rise time to spec
(it was way off) and adds more delays during bus setup. I've run this
for hours now without trouble. Will try to adjust things back to fast
mode and see if I can make that work as 100kHz isn't fast enough to
reliably get data at 100 samples/sec.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: reorder stm USB state stores to avoid races
Keith Packard [Wed, 27 Jun 2012 21:35:56 +0000 (14:35 -0700)]
altos: reorder stm USB state stores to avoid races

Must set ao_usb_in_pending before telling USB about new data or an
interrupt could arrive at the wrong time to clear it.

Same for ao_usb_in_flushed.

Without these changes, I've seen the USB bus lock up on occasion,
waiting for an IN packet to consume data, but with no IN data pending
in the hardware.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: include targe SPI speed in get request
Keith Packard [Wed, 27 Jun 2012 21:34:53 +0000 (14:34 -0700)]
altos: include targe SPI speed in get request

STM needs it to be provided when enabling the SPI device, so just fix
AVR and cc1111 to do the same.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Wait for i2c START condition before setting interrupt bits
Keith Packard [Wed, 27 Jun 2012 09:46:27 +0000 (02:46 -0700)]
altos: Wait for i2c START condition before setting interrupt bits

This seems better than the random loop that it replaces, but I still
have no idea why this is required; it doesn't coorespond to the docs
at all...

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: disable FEC debug on MM
Keith Packard [Wed, 27 Jun 2012 08:22:32 +0000 (01:22 -0700)]
altos: disable FEC debug on MM

Seems to work; we'll leave the code around in case something bad
happens later.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Clean up cc1120 driver a bit
Keith Packard [Wed, 27 Jun 2012 08:22:00 +0000 (01:22 -0700)]
altos: Clean up cc1120 driver a bit

Make some variables static, remove stale debug code

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Don't try to grab radio while firing MM igniters
Keith Packard [Wed, 27 Jun 2012 08:20:43 +0000 (01:20 -0700)]
altos: Don't try to grab radio while firing MM igniters

If you're in idle mode, you stop forever as the packet mode receiver
will own the radio mutex forever.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: stm i2c debug code was calling flush() even when disabled
Keith Packard [Wed, 27 Jun 2012 08:19:05 +0000 (01:19 -0700)]
altos: stm i2c debug code was calling flush() even when disabled

The fancy stm i2c debugging code had calls to flush() that were
invoked outside of the conditionals leading to all kinds of fun --
flush() may re-enable interrupts, yield or do all kinds of wacky
stuff, none of which is appropriate from the middle of a device driver

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: mpu6000 requires a delay during start
Keith Packard [Wed, 27 Jun 2012 08:17:51 +0000 (01:17 -0700)]
altos: mpu6000 requires a delay during start

I have no idea why this is required, but the mpu6000 will not come up
and run if this isn't present.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: ao_ignite.c is no longer cc1111 specific
Keith Packard [Wed, 27 Jun 2012 06:25:00 +0000 (23:25 -0700)]
altos: ao_ignite.c is no longer cc1111 specific

Move it to core

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add debugging code to check for stack overflow
Keith Packard [Wed, 27 Jun 2012 06:21:04 +0000 (23:21 -0700)]
altos: Add debugging code to check for stack overflow

Stack overflow often happens from interrupt handlers sitting on top of
a task stack. Check for this during ao_wakeup as that is often called
during interrupt processing.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Enable full flight computer functionality in MegaMetrum
Keith Packard [Wed, 27 Jun 2012 06:20:17 +0000 (23:20 -0700)]
altos: Enable full flight computer functionality in MegaMetrum

This turns on everything that currently works

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Create a 32-bit 1MHz timer for use in profiling execution
Keith Packard [Wed, 27 Jun 2012 06:18:44 +0000 (23:18 -0700)]
altos: Create a 32-bit 1MHz timer for use in profiling execution

This provides a simple method for getting high-resolution timer data
to use in performance tuning code. It's not used by default anywhere.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Abort radio receive when using flash memory on megametrum
Keith Packard [Wed, 27 Jun 2012 06:17:00 +0000 (23:17 -0700)]
altos: Abort radio receive when using flash memory on megametrum

Radio receive camps on the SPI bus, making it impossible to access
flash memory. Abort any pending receive operation when trying to get
to the flash part.

Yes, this is a total hack.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Make gcc happy with ao_telemetry_set_interval
Keith Packard [Wed, 27 Jun 2012 06:15:54 +0000 (23:15 -0700)]
altos: Make gcc happy with ao_telemetry_set_interval

Using unsigned locals made GCC sad as it was compared with a signed value.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Turn radio-related bits of ao_flight_mm.c
Keith Packard [Wed, 27 Jun 2012 06:14:13 +0000 (23:14 -0700)]
altos: Turn radio-related bits of ao_flight_mm.c

Now that MM has full radio functionality, we can make it work right.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: custom hex printer for telemetry packets
Keith Packard [Wed, 27 Jun 2012 06:13:14 +0000 (23:13 -0700)]
altos: custom hex printer for telemetry packets

Using printf is way too slow with pdclib; just hand-write hex byte output.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Optimize FEC encode and decode
Keith Packard [Wed, 27 Jun 2012 06:11:10 +0000 (23:11 -0700)]
altos: Optimize FEC encode and decode

Integrate interleaving, CRC and padding within the decode/encode
functions.

Provide for ISR priorities so that the 1120 RX interrupt takes
precedence over the other interrupts or we risk losing bits.

Optimize the viterbi decoder a bit (goes from 10ms per packet to 7ms
per packet).

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add GPS logging code for MegaMetrum
Keith Packard [Wed, 27 Jun 2012 06:07:38 +0000 (23:07 -0700)]
altos: Add GPS logging code for MegaMetrum

MM uses a different logging format with larger log blocks, so
restructure the GPS logging code to fill them up

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Make cc1111 radio control functions static
Keith Packard [Wed, 27 Jun 2012 06:05:42 +0000 (23:05 -0700)]
altos: Make cc1111 radio control functions static

No need to publish these; they're all private to cc1111

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Clean up usage of port parameters
Keith Packard [Wed, 27 Jun 2012 06:01:58 +0000 (23:01 -0700)]
altos: Clean up usage of port parameters

Make stm port parameters always be pointers; this avoids the confusion
where some macros took '&port' and others took a bare 'port', and also
unifies code to run on other processors in a consistent fashion.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Make libaltos recognise new USB ids
Keith Packard [Wed, 27 Jun 2012 05:20:50 +0000 (22:20 -0700)]
altosui: Make libaltos recognise new USB ids

libaltos has a small range of 'AltusMetrum' products to avoid opening
other devices. We've got more IDs, so open up the range.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: AltosSerial and AltosLink both tried to provide frequency setting
Keith Packard [Wed, 27 Jun 2012 05:19:01 +0000 (22:19 -0700)]
altosui: AltosSerial and AltosLink both tried to provide frequency setting

AltosLink owns all of the device configuration, so remove that from
AltosSerial and make sure that AltosLink provides the right function
signatures (wasn't using the new direct frequency setting command).

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: rename ao_viterbi.c to ao_fec_rx.c
Keith Packard [Wed, 27 Jun 2012 05:16:44 +0000 (22:16 -0700)]
altos: rename ao_viterbi.c to ao_fec_rx.c

Keep it parallel with ao_fec_tx.c

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Incremental viterbi decode
Keith Packard [Mon, 25 Jun 2012 13:51:36 +0000 (06:51 -0700)]
altos: Incremental viterbi decode

Decode radio input one interleave block at a time. This overlaps the
decode computation with the packet reception, leading to lower latency
in an attempt to keep up with the transmitter.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: decode cc1120 received packets
Keith Packard [Mon, 25 Jun 2012 13:38:34 +0000 (06:38 -0700)]
altos: decode cc1120 received packets

Call the fec decode function, compute RSSI and check CRC

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Get cc1120 packet reception working
Keith Packard [Mon, 25 Jun 2012 12:03:34 +0000 (05:03 -0700)]
altos: Get cc1120 packet reception working

Interrupt-per-bit, but it seems to work

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Forgot ao_telemetry.h
Keith Packard [Mon, 25 Jun 2012 12:03:16 +0000 (05:03 -0700)]
altos: Forgot ao_telemetry.h

Not much builds without this...

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: improve FEC apis to reduce data copying
Keith Packard [Sat, 23 Jun 2012 23:05:42 +0000 (16:05 -0700)]
altos: improve FEC apis to reduce data copying

Integrate interleaving and whitening into encode and decode steps.
Add CRC checking function for receive.

Make ao_fec_test program round-trip the data and verify correctness.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add ao_viterbi.c to megametrum build
Keith Packard [Sat, 23 Jun 2012 09:24:30 +0000 (02:24 -0700)]
altos: Add ao_viterbi.c to megametrum build

It's not used yet, just wanted to see how big the resulting object
file was (492 bytes).

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: fix comment about decoding last byte of FEC data
Keith Packard [Sat, 23 Jun 2012 09:23:08 +0000 (02:23 -0700)]
altos: fix comment about decoding last byte of FEC data

There aren't *any* forward bits to use when decoding the last byte.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Make ao_fec_tx_test build cleanly with -Wall
Keith Packard [Sat, 23 Jun 2012 09:13:52 +0000 (02:13 -0700)]
altos: Make ao_fec_tx_test build cleanly with -Wall

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: optimize Viterbi implementation
Keith Packard [Sat, 23 Jun 2012 09:12:58 +0000 (02:12 -0700)]
altos: optimize Viterbi implementation

Minimize data usage, make data arrays static

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: incremental viterbi decode
Keith Packard [Sat, 23 Jun 2012 07:54:42 +0000 (00:54 -0700)]
altos: incremental viterbi decode

Decode bits incrementally. Don't bother decoding the last byte; it's
always a pad byte.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Start optimizing viterbi decoder
Keith Packard [Sat, 23 Jun 2012 06:31:11 +0000 (23:31 -0700)]
altos: Start optimizing viterbi decoder

Only need two cost arrays (previous and next). Create constant
full-width decoder table instead of expanding bits into bytes for each
decode step.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add the simplest possible viterbi decoder
Keith Packard [Sat, 23 Jun 2012 06:12:02 +0000 (23:12 -0700)]
altos: Add the simplest possible viterbi decoder

I think I understand how it works now. It's not exactly speedy, and it
uses a lot of memory.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Move FEC code to core
Keith Packard [Thu, 21 Jun 2012 16:52:37 +0000 (09:52 -0700)]
altos: Move FEC code to core

It's not a driver as it's not specific to the 1120 chip

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoao-tools: Support MM telemetry packets in ao-telem
Keith Packard [Thu, 21 Jun 2012 16:51:17 +0000 (09:51 -0700)]
ao-tools: Support MM telemetry packets in ao-telem

Parse the new packet formats

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Support MM telemetry packets
Keith Packard [Thu, 21 Jun 2012 16:50:18 +0000 (09:50 -0700)]
altosui: Support MM telemetry packets

Required restructuring the whole telemetry system to provide abstract
interfaces to flight data.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Crank down STM SPI speed for MM
Keith Packard [Thu, 21 Jun 2012 16:46:50 +0000 (09:46 -0700)]
altos: Crank down STM SPI speed for MM

The cc1120 is noisy enough to break SPI data transfers at 4MHz, so
crank things down to 1MHz. It's "stable" now, but clearly needs a
filter and shorter traces.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add full MM telemetry
Keith Packard [Thu, 21 Jun 2012 16:45:42 +0000 (09:45 -0700)]
altos: Add full MM telemetry

Create two new telemetry packets to hold all of the MM data.

This patch also splits the telemetry structures out of ao.h

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Configure STM LCD driver for giant LCD digits
Keith Packard [Thu, 21 Jun 2012 16:39:10 +0000 (09:39 -0700)]
altos: Configure STM LCD driver for giant LCD digits

These devices require static mode.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Make sure ao_storage_config is set before reading config block
Keith Packard [Mon, 18 Jun 2012 02:11:35 +0000 (19:11 -0700)]
altos: Make sure ao_storage_config is set before reading config block

ao_storage_read does in fact call ao_storage_setup, but we need the
value of ao_storage_config *before* calling ao_storage_read, so call
ao_storage_setup first.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: hack STM serial number to 58
Keith Packard [Mon, 18 Jun 2012 02:06:08 +0000 (19:06 -0700)]
altos: hack STM serial number to 58

otherwise altosui won't record telemetry

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: make cc1120 ao_radio_send re-entrant
Keith Packard [Mon, 18 Jun 2012 02:04:53 +0000 (19:04 -0700)]
altos: make cc1120 ao_radio_send re-entrant

It gets called from multiple tasks, so put local data on the stack.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Add telemetry to megametrum
Keith Packard [Mon, 18 Jun 2012 02:04:22 +0000 (19:04 -0700)]
altos: Add telemetry to megametrum

Now that the radio works

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoao-tools: add rudimentary support for MM telemetry to ao-telem
Keith Packard [Mon, 18 Jun 2012 02:02:50 +0000 (19:02 -0700)]
ao-tools: add rudimentary support for MM telemetry to ao-telem

Just pretends they're TM packets for now

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Add rudimentary MM support to altosui
Keith Packard [Mon, 18 Jun 2012 02:01:24 +0000 (19:01 -0700)]
altosui: Add rudimentary MM support to altosui

Decoded the MM sensor packets as if they were TM packets.
Add the USB ids.
Add class of 'altimeter' devices and match those instead of just
telemetrum as appropriate.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Move product definitions from AltosUI to AltosLib
Keith Packard [Mon, 18 Jun 2012 01:58:56 +0000 (18:58 -0700)]
altosui: Move product definitions from AltosUI to AltosLib

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Software implemenation of CC1111 radio encoding
Keith Packard [Sun, 17 Jun 2012 23:17:00 +0000 (16:17 -0700)]
altos: Software implemenation of CC1111 radio encoding

Add CRC, whitening, FEC and interleaving routines for transmission
path to allow cc1120 to send telem packets to cc1111.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Be more careful about register save/restore in ao_yield
Keith Packard [Sun, 17 Jun 2012 23:14:33 +0000 (16:14 -0700)]
altos: Be more careful about register save/restore in ao_yield

Make sure the general registers are all saved before messing with any
of them. Then, explicitly use r0 to save/restore apsr and primask.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Don't lose IRQ disabled state in ao_sleep
Keith Packard [Sun, 17 Jun 2012 23:12:18 +0000 (16:12 -0700)]
altos: Don't lose IRQ disabled state in ao_sleep

Using ao_arch_critical around the wchan setting will force interrupts
to be re-enabled before ao_yield records the state of that bit,
potentially causing problems with functions not atomically testing and
sleeping.

Tasks that need to set wchan with interrupts disabled should have
interrupts disabled when entering ao_sleep already.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: ao_storage_read already calls ao_storage_setup
Keith Packard [Sun, 17 Jun 2012 23:11:23 +0000 (16:11 -0700)]
altos: ao_storage_read already calls ao_storage_setup

No need to call twice.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltosui: Catch timeout errors when setting up TD telem monitoring
Keith Packard [Sun, 17 Jun 2012 23:09:43 +0000 (16:09 -0700)]
altosui: Catch timeout errors when setting up TD telem monitoring

Close the port in this case so it can be used for other things.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Use interrupts to wake up after RDF transmission.
Keith Packard [Sun, 17 Jun 2012 19:43:43 +0000 (12:43 -0700)]
altos: Use interrupts to wake up after RDF transmission.

Also clean up the debug output

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Crank cc1120 power down to 0dBm to avoid crashing CPU
Keith Packard [Sun, 17 Jun 2012 19:42:32 +0000 (12:42 -0700)]
altos: Crank cc1120 power down to 0dBm to avoid crashing CPU

Looks like RFI from the transmitter is confusing the CPU; lower the
1120 power output from +14dBm to +0dBm to keep the CPU happy.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Reduce STM SPI data rate to 4MHz
Keith Packard [Sat, 16 Jun 2012 05:41:17 +0000 (22:41 -0700)]
altos: Reduce STM SPI data rate to 4MHz

cc1120 doesn't want more than 6.1MHz, otherwise it gets very angry.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Start making cc1120 radio work
Keith Packard [Sat, 16 Jun 2012 05:40:30 +0000 (22:40 -0700)]
altos: Start making cc1120 radio work

RDF tones and radio calibration work now.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Fix cc1120 packet mode datarate and config
Keith Packard [Sat, 16 Jun 2012 05:38:37 +0000 (22:38 -0700)]
altos: Fix cc1120 packet mode datarate and config

Was using the wrong function

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoaltos: Make sure cc1120 is initialized correctly at startup time
Keith Packard [Sat, 16 Jun 2012 05:32:10 +0000 (22:32 -0700)]
altos: Make sure cc1120 is initialized correctly at startup time

Check to make sure it pulls down MISO when CS is enabled.

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