Keith Packard [Fri, 28 Jan 2022 23:11:07 +0000 (15:11 -0800)]
ao_log: Fix sensor time triggers to use AO_TICK_TYPE
These values were used to determine when various log information would
be recorded. Using the wrong type meant that they would always
trigger, causing the log to fill up rapidly with data that should be
sampled at a lower rate.
Keith Packard [Fri, 28 Jan 2022 23:06:18 +0000 (15:06 -0800)]
ao_log: Change flight type to uint16_t, widen APIs dealing with flight numbers to int32_t
Real Flight numbers are 16-bit unsigned values, but APIs using them
pass values that areoverloaded to also represent broken log slots
using negative numbers. This means that these APIs need to be able to
represent all 65535 possible flight numbers *and* all possible log
slots as negative values. Switch the variables holding only flight
numbers to uint16_t and those holding either a flight number or log
slot to int32_t.
Keith Packard [Fri, 28 Jan 2022 22:50:58 +0000 (14:50 -0800)]
ao_flight: ao_interval_end type was too small, could cause premature landing state
ao_interval_end is used to provide a window of time during which the
max/min values for sensors are measured. After that time expires,
those bounds are compared to see if the airframe has been stable and
should be moved to landing state. With a type that is too small, that
could happen immediately after transitioning to main (for baro-enabled
devices) or coast (for accel-only devices). For baro devices, this
would disable any redundant main firing events. For accel-only
devices, this could disable all events occuring after coast, including
firing separation charges or motor igniters.
There are also a couple of additional changes to reduce -Wconversion
messages.
Keith Packard [Fri, 28 Jan 2022 22:06:25 +0000 (14:06 -0800)]
drivers/ao_pad: Convert from/to 16-bit times over the air
The radio protocol sends only 16 bits of time, make sure we translate
from/to those correctly. No bugs detected, just casts added to
clarify. Also fix other -Wconversion warnings.
Keith Packard [Fri, 28 Jan 2022 17:33:17 +0000 (09:33 -0800)]
drivers/ao_lco: Fix box types to be uint16_t. Also clean other -Wconversion messages
Old LCO code uses 0x1000 as magic value for "DRAG" box, so we need 16
bits. Switch all box variables to 16 bits, use int32_t when switching
box numbers to deal with negative values and still hold the whole
possible range (even though 16 bits "should" be plenty).
Keith Packard [Thu, 17 Feb 2022 01:00:59 +0000 (17:00 -0800)]
altos: Re-enable apogee delay
When the igniter code was changed to support booster mode, the code
which delayed apogee firing based on the configure apogee delay value
was lost. Re-enable that by sticking a delay before firing the drogue
charge when the ignite mode is not redundant apogee.
Keith Packard [Fri, 28 Jan 2022 23:27:02 +0000 (15:27 -0800)]
ao_pyro: Move delay_done out of pyro structure
The pyro structure should be read-only in flight operations. Move the
'delay_done' element to a parallel array as that gets written. Change
types to pointers to const structs to enforce this in the future.
Keith Packard [Thu, 27 Jan 2022 23:49:15 +0000 (15:49 -0800)]
altos: AES code was storing bytes in an int array
The only operations using these values are logic using bytes, not
arithmetic, so shrinking the size of the elements should have no
effect on operation.
This saves space *and* eliminates a type conversion warning from
-Wconversion.
Keith Packard [Tue, 11 Jan 2022 22:32:55 +0000 (14:32 -0800)]
altosdroid: Add BLUETOOTH_CONNECT permission, handle its lack
Android 12 switched how bluetooth permissions work, so now we need a
new one to talk to devices. Also deal with a lack of that by not
crashing when we can't get the name of a BT device.
Keith Packard [Thu, 16 Dec 2021 21:39:33 +0000 (13:39 -0800)]
altos: Switch all tick variables to AO_TICK_TYPE/AO_TICK_SIGNED
Instead of trying to pick and choose which work as 16-bit values,
change everything that doesn't affect external values (log, companion,
radio) to AO_TICK_TYPE.
Keith Packard [Sat, 16 Oct 2021 22:48:22 +0000 (15:48 -0700)]
altosdroid: Fix tab updates on Android 11 after rotate
Android 11 appears to have "optimized" application rotation by
regenerating fragments automatically. This means the tab fragments
aren't getting created by TabsAdapter.getItem, so that code didn't
know about them, which caused it to not know which tab was active so
all of the application state wasn't getting updated in the tabs after
rotation.
Fix this by telling TabsAdapter about fragments that are already
created -- altosdroid hears about them in the registerTab hook.
Keith Packard [Sun, 10 Oct 2021 03:58:26 +0000 (20:58 -0700)]
altosdroid: Switch storage to media dir
Even with the WRITE_EXTERNAL_STORAGE permission, we appear to no
longer have permission to write to a random external storage
dir. Instead, we only have permission to write to an app-specific dir,
buried deep in the directory tree. We can get that directory name with
getExternalMediaDirs()[0].
Keith Packard [Fri, 24 Sep 2021 16:43:15 +0000 (09:43 -0700)]
altos: Fix config upgrade from 1.24 to 1.25
Alignment of pyro field changed due to increased size of fields which
shifted the whole struct by two bytes, leading to mis-updating the struct.
Fix that by creating a mirror of the ao_config type for version 1.24 and
then using that to fetch the old data.
Keith Packard [Mon, 20 Sep 2021 04:04:41 +0000 (21:04 -0700)]
altos: Deal with cc1201 limitations
The CC1201 works fine at higher data rates, but at lower rates it
can't crank the RX bandwidth as tight as the CC1200. Deal with this by
checking the part number and using the correct settings for each one
when running at 9600 or 2400 baud.
Keith Packard [Sun, 19 Sep 2021 21:50:28 +0000 (14:50 -0700)]
altos: Support normalized axes in mpu6000 and mmc5983
For monitor idle, devices selecting 'normalized' log format also
get 'normalized' command mode. This reports data in a standard format,
along/across/through instead of raw device axes which depend on how the
part is mounted.