Merge branch 'branch-1.9' into debian
authorBdale Garbee <bdale@gag.com>
Thu, 22 Oct 2020 22:20:30 +0000 (16:20 -0600)
committerBdale Garbee <bdale@gag.com>
Thu, 22 Oct 2020 22:20:30 +0000 (16:20 -0600)
95 files changed:
ChangeLog
Makefile.am
Releasing
altoslib/AltosCSV.java
altoslib/AltosCalData.java
altoslib/AltosConvert.java
altoslib/AltosDataListener.java
altoslib/AltosEepromDownload.java
altoslib/AltosEepromRecordMotor.java [new file with mode: 0644]
altoslib/AltosEepromRecordSet.java
altoslib/AltosFlightSeries.java
altoslib/AltosIMU.java
altoslib/AltosLib.java
altoslib/AltosPressure.java
altoslib/AltosReplayReader.java
altoslib/AltosState.java
altoslib/AltosTelemetryFile.java
altoslib/AltosTelemetryLocation.java
altoslib/AltosTimeSeries.java
altoslib/Makefile.am
altosui/Makefile.am
altosui/altos-windows.nsi.in
altosuilib/AltosGraph.java
configure.ac
doc/Makefile.am
doc/easymini-release-notes.inc
doc/release-notes-1.9.6.inc [new file with mode: 0644]
doc/release-notes.inc
doc/telegps-release-notes.inc
libaltos/Makefile.am
libaltos/altos.dll [new file with mode: 0755]
libaltos/altos64.dll [new file with mode: 0755]
libaltos/libaltos_windows.c
src/chaoskey-v1.0/Makefile
src/drivers/ao_adxl375.c
src/drivers/ao_adxl375.h
src/easymega-v1.0/Makefile
src/easymega-v2.0/Makefile
src/easymini-v1.0/Makefile
src/easymini-v2.0/Makefile
src/easymotor-v2/.gitignore [new file with mode: 0644]
src/easymotor-v2/Makefile [new file with mode: 0644]
src/easymotor-v2/ao_easymotor.c [new file with mode: 0644]
src/easymotor-v2/ao_pins.h [new file with mode: 0644]
src/easymotor-v2/flash-loader/Makefile [new file with mode: 0644]
src/easymotor-v2/flash-loader/ao_pins.h [new file with mode: 0644]
src/easytimer-v1/Makefile
src/kernel/ao_cmd.c
src/kernel/ao_data.c
src/kernel/ao_data.h
src/kernel/ao_flight.c
src/kernel/ao_kalman.c
src/kernel/ao_log.h
src/kernel/ao_log_motor.c [new file with mode: 0644]
src/kernel/ao_report.c
src/kernel/ao_sample.c
src/kernel/ao_sample.h
src/lpc/Makefile-flash.defs
src/microkite/Makefile
src/micropeak-v2.0/Makefile
src/micropeak/Makefile
src/microsplash/Makefile
src/stm/Makefile-flash.defs
src/stm32f4/Makefile-flash.defs
src/stm32l0/Makefile-flash.defs
src/stmf0/Makefile-flash.defs
src/stmf0/ao_arch_funcs.h
src/stmf0/ao_spi_stm.c
src/teleballoon-v2.0/Makefile
src/telebt-v3.0/Makefile
src/telebt-v4.0/Makefile
src/teledongle-v3.0/Makefile
src/telefireeight-v1.0/Makefile
src/telefireeight-v2.0/Makefile
src/telefireone-v1.0/Makefile
src/telefiretwo-v0.1/Makefile
src/telegps-v0.3/Makefile
src/telegps-v1.0/Makefile
src/telegps-v2.0/Makefile
src/telelco-v0.2-cc1200/Makefile
src/telelco-v0.2/Makefile
src/telelco-v0.3/Makefile
src/telelco-v2.0/Makefile
src/telelcotwo-v0.1/Makefile
src/telemega-v0.1/Makefile
src/telemega-v1.0/Makefile
src/telemega-v2.0/Makefile
src/telemega-v3.0/Makefile
src/telemega-v4.0/Makefile
src/telemetrum-v2.0/Makefile
src/telemetrum-v3.0/Makefile
src/telemini-v3.0/Makefile
src/test/.gitignore
src/test/Makefile
src/test/ao_flight_test.c

index 39adbf91d39a690a0bcb0e831450fc58faecf00a..f7f62ff34fd66c08c8882d6d2da97c5f7ef2ce89 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,475 @@
+commit 38bcc2b8b2b560271902eb8a3eba467866a38628
+Merge: 628da1fe c16cb712
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Thu Oct 22 16:17:33 2020 -0600
+
+    Merge branch 'master' into branch-1.9
+
+commit c16cb712f5dc2ad42a9bccbfc28f6b70704ccd55
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Thu Oct 22 16:17:04 2020 -0600
+
+    update configure.ac for 1.9.6 release
+
+commit 837ef5987a71a51cc42c3410bd440043a34fdd8c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Oct 21 22:11:18 2020 -0700
+
+    doc: Mention BMX-160 self-test fix in 1.9.6 release notes
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f2f10bf2c85ca7ec0cfb71c75a5bf77512072ba8
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Oct 21 22:01:47 2020 -0700
+
+    libaltos: Add pre-built windows dll binaries
+    
+    Current Debian unstable builds versions that don't run on all Windows
+    10 machines.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit edd50c5397764c8c8091e337f4045c806ff513ea
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Oct 21 21:45:53 2020 -0700
+
+    doc: 1.9.6 release notes
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 3ace827de5907ee77ffdfcf54b0822a1e65570ea
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Oct 6 18:54:27 2020 -0700
+
+    altoslib: Don't pass along GPS information when the GPS device is busted
+    
+    If the telemetry packet indicates that there's no functioning GPS receiver,
+    then don't pass along those packets so that the UI displays things more accurately.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 29c5336f775eacbfee354000c8b28de1813ede81
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Oct 6 18:53:38 2020 -0700
+
+    altoslib: Add defines for EasyMotor
+    
+    Just USB ids and product names.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit c507e143aac0bc251b02bbe3c812bf81b7026ff7
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Oct 17 15:29:11 2020 -0700
+
+    altoslib: Clip accelerometer-based speed to >= 0
+    
+    Negative vertical speeds computed by axial acceleration aren't
+    sensible, so just clip them to zero so that plots are more useful.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 2a0a683b06fefbf1b17cba2dc1bbe877a19ce9f4
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 20:54:32 2020 -0700
+
+    altoslib: Limit .csv file output to valid fields for EasyMotor
+    
+    EasyMotor doesn't have a baro sensor, gyros, mag sensor or igniters.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 17ad31dcc24c66a9f4b3f1a1cd3689fbe5f16874
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 20:53:56 2020 -0700
+
+    altoslib: Easy Motor v2 x axis is inverted
+    
+    Provide positive accel values along rocket axis
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 02c7bb11a8a4270e40bd1f42abd00ae849ff7539
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 20:52:48 2020 -0700
+
+    altoslib: Correct ADXL counts_per_g
+    
+    When ADXL 375 is used as a 3d accel (as on EasyMotor), need the right
+    counts_per_g to do conversions.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 85e22ee20974792c2376bf11a9f79e17e4008da9
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 15:30:35 2020 -0700
+
+    altoslib: use motor pressure calibration data for EasyMotor
+    
+    EasyMotor stores an average sensor value for motor pressure, use that
+    to report pressure above that value.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 6f3e0411acffa7ff8b4b92b68abbe05482f9bf65
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 15:29:12 2020 -0700
+
+    altoslib: Report metric pressure in kPa instead of Pa
+    
+    Reduces the magnitude of pressure data when displayed.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 42ff9c7c096ad2b8e9a6152292ab12d315985aff
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:48:42 2020 -0700
+
+    altoslib: Add EasyMotor EEPROM support
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 76b595f2daafe10941b380fe74fd12d1467ba029
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:47:54 2020 -0700
+
+    altosuilib: Graph motor pressure
+    
+    Use a separate axis from atmospheric pressure as the range will be
+    rather different.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 6ac469fb46e9fabfd473b9a3d8bcd92db00b98b2
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:46:28 2020 -0700
+
+    altoslib: Add 'motor_pressure' data value
+    
+    This value tracks the internal pressure of a motor in Pa.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 41538b1b600eef242d1ede9fe9039d1079f6891a
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:40:41 2020 -0700
+
+    altoslib: Add conversion for motor pressure sensor
+    
+    This assumes a standard 0.5-4.5 range 1600PSI sensor.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 109e39eb88e5f1fd897d0b818c7654b367ee8522
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:40:03 2020 -0700
+
+    altoslib: Initialize gyro offset values to MISSING
+    
+    This lets us detect a device without a gyro sensor.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit c5796f686b1bf9e4effd7f9d8dca2ee5d7a38a16
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 20:48:55 2020 -0700
+
+    altos: Reset 3d-accel and motor pressure sums each ground interval
+    
+    We're repeatedly averaging 512 ground samples to get up-to-date values
+    for all of the sensors, but we need to clear the sums after each
+    sample interval. The 3d accel values were only cleared if there was a
+    full IMU, not for devices with only an accelerometer like
+    EasyMotor. The motor pressure sum was never cleared.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f10009b07b651f69014ac5608f3ca29bce874c24
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 12:59:48 2020 -0700
+
+    altos: Add motor pressure calibration data to easy motor log
+    
+    Compute an average of ground motor pressure values and store those in
+    the log data in the AO_FLIGHT record.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a7f1925b81a429d9f387f7e26433326e37c43d4f
+Author: Keith Packard <keithp@keithp.com>
+Date:   Fri Oct 16 12:57:07 2020 -0700
+
+    altos: Support negative decimal values on command line
+    
+    Add support for leading unary minus for decimal constants.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 6e69377ef31ecff5443177b51d7cd2b084e63523
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:55:23 2020 -0700
+
+    altos/test: Clean up easy motor test jig
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit c66f494160bd2e99c01510acdd7e2d6624fc017a
+Author: Keith Packard <keithp@keithp.com>
+Date:   Mon Oct 12 16:54:34 2020 -0700
+
+    altos: Log motor pressure and battery voltage for EasyMotor
+    
+    These were not logged at all.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4370b7e7bc48d3f3f3ec94665449f1fde4e9567c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Oct 10 22:00:56 2020 -0700
+
+    altos: De-bias height/speed data while on pad
+    
+    Save speed/height values from 64 samples ago and subtract them from
+    the current value. This reduces the effect of systematic accelerometer
+    error causing these values to slowly creep when there's no barometric
+    sensor to keep them in check.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit a7d8a0f8b26bf62b63f12110d6d66a4f9da76eae
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Oct 10 22:54:00 2020 -0700
+
+    altos: Change adxl375 self test parameters
+    
+    Try to make it not fail self test while horizontal
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 01b89c384e80990505a5abea18489360052beb70
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Oct 10 21:56:38 2020 -0700
+
+    altos/easymotor-v2: Add 'through' axis definition
+    
+    This is used by the ao_flight_test_code
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 32e0a6e3ee51f3c9bc150bb1a6890a82bcdd050f
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Oct 10 21:56:06 2020 -0700
+
+    altos/test: Build ao_flight_test_motor
+    
+    This tests the flight code in easymotor mode.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 291eddc6376dc414a32aab51d4ee7c4212e3e69d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Oct 10 21:55:36 2020 -0700
+
+    altos: Let ao_data.c be used by ao_flight_test
+    
+    Just skip the ao headers in that case.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit e48b6689527f51cc589ccd0ee88e2c7bc05747e0
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 23 18:32:41 2020 -0600
+
+    altos/easymotor-v2: Beep out 'pad mode' repeatedly
+    
+    Easymotor doesn't have igniters, so it would have been silent on the
+    pad, which seems bad. Add HAS_PAD_REPORT code which beeps out 'pad'
+    once every five seconds.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 48c8efaae7ce8de8bb0727009436813cd4b560e7
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 23 18:31:25 2020 -0600
+
+    altos/easymotor-v2: ADXL375 is upside-down compared with other boards
+    
+    Clear AO_ADXL375_INVERT to make it work
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f1ea931ca808b120b5f378269aa9a6e38e90b8af
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 23 18:15:14 2020 -0600
+
+    altos/stmf0: Fixup for SPI mode support
+    
+    The desired SPI mode comes in 'spi_index' and needs
+    to be split out before spi_index is used for pin configuration.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit c1ed5c2249abb7bd1bc85091179d5d208e776da6
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 23 18:13:42 2020 -0600
+
+    altos/easymotor-v2: Fix beeper config
+    
+    The beeper changed pins at some point during the design
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4cdef1d311d5cdc18550fb51b31c3becf1dd86fa
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 23 18:12:10 2020 -0600
+
+    altos/easymotor-v2: Use same init order as easymini
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit c2dbbf99e503b9e3cde37af35a8ba33220be187c
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Fri Aug 21 20:40:44 2020 -0600
+
+    recover easymotor-v2/flash-loader/ao_pins.h from backups
+
+commit fa4bb77064a2606e82091e3e533dac897912c627
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 13:11:39 2020 -0700
+
+    altos/easymotor-v2: Get easy motor building
+    
+    Add some missing files and adjust configuration.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 80a7cdfe3d6256cc86861195a78f422828b4ecc1
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 13:11:16 2020 -0700
+
+    altos/easymotor-v2: Add .gitignore
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 48e0da4b2d1568f9f29058def12dc32d1cff3586
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 13:09:17 2020 -0700
+
+    altos/stmf0: Add spi format configuration options
+    
+    This lets different SPI devices use different SPI formats
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 18e24df0353c78ada8cc1d2439729bc2f2676205
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 13:07:01 2020 -0700
+
+    altos: Support accel-only IMU configurations
+    
+    This doesn't compute orientation, just allows for calibrating and recording
+    3-axis acceleration data.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4006bf474f4fee1e2d47fdc930b3b08b4fecbe24
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 13:06:01 2020 -0700
+
+    altos: Add EasyMotor logging support
+    
+    Log EasyMotor sensor data.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 3a3fb807394a534b6d44aa089f3b72a95ff9085d
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 13:04:27 2020 -0700
+
+    altos: Allow use of ADXL375 as IMU
+    
+    This lets EasyMotor report all three axes of acceleration and use
+    that for idle detection.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 8ddade934e965e19b760cdde4eb8ecadf6abf70c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sun Aug 2 12:51:16 2020 -0700
+
+    altos/drivers: Add ao_adxl375_accel_to_sample macro
+    
+    This converts from acceleration levels to sample counts for use in
+    detecting stability of airframe after landing when no other IMU is
+    present.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit e5e240e764d3bf8196a3f5b5fb1a639ad0723138
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Mon Jul 27 14:52:50 2020 -0600
+
+    easymotor: override .gitignore to store Makefiles
+
+commit a0aad75a2a54cd9d478cc44159d7d01b549f806e
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Sat Jul 25 18:07:36 2020 -0600
+
+    first cut at EasyMotor v2 .. not compiling yet
+
+commit a8ced69631415e26329594f7f0ae98dec577d1ae
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Sep 30 15:53:38 2020 -0700
+
+    libaltos: Avoid using strcmp and strchr on windows
+    
+    At least one of these caused the library to not load on Windows
+    10. Work around that by changing the code to use vid/pid instead of
+    matching on the name provided back by the OS.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 2d44477f5ab4ad82ba658eb327c25c61c8056035
+Author: Keith Packard <keithp@keithp.com>
+Date:   Wed Sep 30 00:20:24 2020 -0700
+
+    altosui: Include telelco and telefireeight firmware in FAT builds
+    
+    AltosUI can reflash these devices, so best to include the firmware
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 2a6c0e80f64e793b68e29a18fafad730b55a06b6
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Sep 29 23:58:10 2020 -0700
+
+    altos: Fix flash loader map file names
+    
+    Make sure these include the product name too.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 6846db985d77c25b4deb5f8a763eec245a0a3a71
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Sep 29 23:57:26 2020 -0700
+
+    altos: Remove linker map files during 'make clean'
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit f4448213efbafe2df53ad8d62d5be74473b794a2
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Wed Sep 30 00:49:14 2020 -0600
+
+    Releasing: updated with changes from 1.9.5 release
+
+commit 628da1fe429045c7c687f8bb96ded7da9f437706
+Author: Bdale Garbee <bdale@gag.com>
+Date:   Wed Sep 30 00:18:31 2020 -0600
+
+    releasing 1.9.5
+
 commit f763dfe6a684a16ec40503149adefdc074a63ad0
 Merge: bfe338d1 a1779f94
 Author: Bdale Garbee <bdale@gag.com>
index 3793d71741d44588a2f8f8c5785ee189b58b23e5..328d5700cfd1fbbdc74d2b8a8be8ec7d3bc194e2 100644 (file)
@@ -64,7 +64,10 @@ fat_altos = \
        src/telemega-v3.0/telemega-v3.0-$(VERSION).ihx \
        src/telemega-v4.0/telemega-v4.0-$(VERSION).ihx \
        src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx \
-       src/telemetrum-v3.0/telemetrum-v3.0-$(VERSION).ihx
+       src/telemetrum-v3.0/telemetrum-v3.0-$(VERSION).ihx \
+       src/telelco-v2.0/telelco-v2.0-$(VERSION).ihx \
+       src/telefireeight-v1.0/telefireeight-v1.0-$(VERSION).ihx \
+       src/telefireeight-v2.0/telefireeight-v2.0-$(VERSION).ihx
 
 keithp-fat: fat
        ssh keithp.com mkdir -p public_html/altos-$(VERSION)
index e9ceb4084162203a1213a9b443b34074b1e2c2c3..c29e61c31182da3680380cdae3d308b7b1d3fbe9 100644 (file)
--- a/Releasing
+++ b/Releasing
@@ -125,7 +125,7 @@ These are Bdale's notes on how to do a release.
           src/easymega-v2.0/flash-loader/*.elf \
           src/easymini-v1.0/flash-loader/*.elf \
           src/easymini-v2.0/flash-loader/{*.elf,*.bin,*.map} \
-          src/easytimer-v1/flash-loader/{*.elf,*.bin,*.map} \
+          src/easytimer-v1/flash-loader/*.elf \
           src/telebt-v3.0/flash-loader/*.elf \
           src/telebt-v4.0/flash-loader/{*.elf,*.bin,*.map} \
           src/teledongle-v3.0/flash-loader/*.elf \
index d09ad93b11ac6ce9a88eb1d76cc21a92219415c3..765eb44598f337b6fd9e58da4413c5346a021ebf 100644 (file)
@@ -28,15 +28,21 @@ public class AltosCSV implements AltosWriter {
        boolean                 seen_boost;
        int                     boost_tick;
 
+       boolean                 has_call;
        boolean                 has_basic;
+       boolean                 has_accel;
+       boolean                 has_baro;
+       boolean                 has_pyro;
        boolean                 has_radio;
        boolean                 has_battery;
        boolean                 has_flight_state;
-       boolean                 has_advanced;
+       boolean                 has_3d_accel;
+       boolean                 has_imu;
        boolean                 has_igniter;
        boolean                 has_gps;
        boolean                 has_gps_sat;
        boolean                 has_companion;
+       boolean                 has_motor_pressure;
 
        AltosFlightSeries       series;
        int[]                   indices;
@@ -126,7 +132,10 @@ public class AltosCSV implements AltosWriter {
         */
 
        void write_general_header() {
-               out.printf("version,serial,flight,call,time");
+               out.printf("version,serial,flight");
+               if (series.cal_data().callsign != null)
+                       out.printf(",call");
+               out.printf(",time");
        }
 
        double time() {
@@ -134,12 +143,13 @@ public class AltosCSV implements AltosWriter {
        }
 
        void write_general() {
-               out.printf("%s, %d, %d, %s, %8.2f",
+               out.printf("%s, %d, %d",
                           ALTOS_CSV_VERSION,
                           series.cal_data().serial,
-                          series.cal_data().flight,
-                          series.cal_data().callsign,
-                          time());
+                          series.cal_data().flight);
+               if (series.cal_data().callsign != null)
+                       out.printf(",%s", series.cal_data().callsign);
+               out.printf(", %8.2f", time());
        }
 
        void write_radio_header() {
@@ -173,7 +183,15 @@ public class AltosCSV implements AltosWriter {
        }
 
        void write_basic_header() {
-               out.printf("acceleration,pressure,altitude,height,accel_speed,baro_speed,temperature,drogue_voltage,main_voltage");
+               if (has_accel)
+                       out.printf("acceleration,");
+               if (has_baro)
+                       out.printf("pressure,altitude,");
+               out.printf("height,speed");
+               if (has_baro)
+                       out.printf(",temperature");
+               if (has_pyro)
+                       out.printf(",drogue_voltage,main_voltage");
        }
 
        double acceleration() { return series.value(AltosFlightSeries.accel_name, indices); }
@@ -186,16 +204,19 @@ public class AltosCSV implements AltosWriter {
        double main_voltage() { return series.value(AltosFlightSeries.main_voltage_name, indices); }
 
        void write_basic() {
-               out.printf("%8.2f,%10.2f,%8.2f,%8.2f,%8.2f,%8.2f,%5.1f,%5.2f,%5.2f",
-                          acceleration(),
-                          pressure(),
-                          altitude(),
-                          height(),
-                          speed(),
-                          speed(),
-                          temperature(),
-                          apogee_voltage(),
-                          main_voltage());
+               if (has_accel)
+                       out.printf("%8.2f,", acceleration());
+               if (has_baro)
+                       out.printf("%10.2f,%8.2f,",
+                                  pressure(), altitude());
+               out.printf("%8.2f,%8.2f",
+                          height(), speed());
+               if (has_baro)
+                       out.printf(",%5.1f", temperature());
+               if (has_pyro)
+                       out.printf(",%5.2f,%5.2f",
+                                  apogee_voltage(),
+                                  main_voltage());
        }
 
        void write_battery_header() {
@@ -208,14 +229,33 @@ public class AltosCSV implements AltosWriter {
                out.printf("%5.2f", battery_voltage());
        }
 
-       void write_advanced_header() {
-               out.printf("accel_x,accel_y,accel_z,gyro_roll,gyro_pitch,gyro_yaw,mag_x,mag_y,mag_z,tilt");
+       void write_motor_pressure_header() {
+               out.printf("motor_pressure");
+       }
+
+       double motor_pressure() { return series.value(AltosFlightSeries.motor_pressure_name, indices); }
+
+       void write_motor_pressure() {
+               out.printf("%10.1f", motor_pressure());
+       }
+
+       void write_3d_accel_header() {
+               out.printf("accel_x,accel_y,accel_z");
        }
 
        double accel_along() { return series.value(AltosFlightSeries.accel_along_name, indices); }
        double accel_across() { return series.value(AltosFlightSeries.accel_across_name, indices); }
        double accel_through() { return series.value(AltosFlightSeries.accel_through_name, indices); }
 
+       void write_3d_accel() {
+               out.printf("%7.2f,%7.2f,%7.2f",
+                          accel_along(), accel_across(), accel_through());
+       }
+
+       void write_imu_header() {
+               out.printf("gyro_roll,gyro_pitch,gyro_yaw,mag_x,mag_y,mag_z,tilt");
+       }
+
        double gyro_roll() { return series.value(AltosFlightSeries.gyro_roll_name, indices); }
        double gyro_pitch() { return series.value(AltosFlightSeries.gyro_pitch_name, indices); }
        double gyro_yaw() { return series.value(AltosFlightSeries.gyro_yaw_name, indices); }
@@ -226,9 +266,8 @@ public class AltosCSV implements AltosWriter {
 
        double tilt() { return series.value(AltosFlightSeries.orient_name, indices); }
 
-       void write_advanced() {
-               out.printf("%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f",
-                          accel_along(), accel_across(), accel_through(),
+       void write_imu() {
+               out.printf("%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f",
                           gyro_roll(), gyro_pitch(), gyro_yaw(),
                           mag_along(), mag_across(), mag_through(),
                           tilt());
@@ -361,9 +400,13 @@ public class AltosCSV implements AltosWriter {
                        out.printf(",");
                        write_battery_header();
                }
-               if (has_advanced) {
+               if (has_motor_pressure) {
                        out.printf(",");
-                       write_advanced_header();
+                       write_motor_pressure_header();
+               }
+               if (has_3d_accel) {
+                       out.printf(",");
+                       write_3d_accel_header();
                }
                if (has_igniter) {
                        out.printf(",");
@@ -402,9 +445,17 @@ public class AltosCSV implements AltosWriter {
                        out.printf(",");
                        write_battery();
                }
-               if (has_advanced) {
+               if (has_motor_pressure) {
                        out.printf(",");
-                       write_advanced();
+                       write_motor_pressure();
+               }
+               if (has_3d_accel) {
+                       out.printf(",");
+                       write_3d_accel();
+               }
+               if (has_imu) {
+                       out.printf(",");
+                       write_imu();
                }
                if (has_igniter) {
                        out.printf(",");
@@ -453,8 +504,13 @@ public class AltosCSV implements AltosWriter {
                has_radio = false;
                has_flight_state = false;
                has_basic = false;
+               has_accel = false;
+               has_baro = false;
+               has_pyro = false;
                has_battery = false;
-               has_advanced = false;
+               has_motor_pressure = false;
+               has_3d_accel = false;
+               has_imu = false;
                has_igniter = false;
                has_gps = false;
                has_gps_sat = false;
@@ -464,12 +520,24 @@ public class AltosCSV implements AltosWriter {
                        has_radio = true;
                if (series.has_series(AltosFlightSeries.state_name))
                        has_flight_state = true;
-               if (series.has_series(AltosFlightSeries.accel_name) || series.has_series(AltosFlightSeries.pressure_name))
+               if (series.has_series(AltosFlightSeries.accel_name)) {
+                       has_basic = true;
+                       has_accel = true;
+               }
+               if (series.has_series(AltosFlightSeries.pressure_name)) {
                        has_basic = true;
+                       has_baro = true;
+               }
+               if (series.has_series(AltosFlightSeries.apogee_voltage_name))
+                       has_pyro = true;
                if (series.has_series(AltosFlightSeries.battery_voltage_name))
                        has_battery = true;
+               if (series.has_series(AltosFlightSeries.motor_pressure_name))
+                       has_motor_pressure = true;
                if (series.has_series(AltosFlightSeries.accel_across_name))
-                       has_advanced = true;
+                       has_3d_accel = true;
+               if (series.has_series(AltosFlightSeries.gyro_roll_name))
+                       has_imu = true;
                if (series.has_series(AltosFlightSeries.pyro_voltage_name))
                        has_igniter = true;
 
index 6667d926ed91229a0597c099b5eb53cab972c235..8bca92291757a42c695985c23bb5337334c9b4e4 100644 (file)
@@ -120,6 +120,13 @@ public class AltosCalData {
                        this.ground_accel = ground_accel;
        }
 
+       public double           ground_motor_pressure = AltosLib.MISSING;
+
+       public void set_ground_motor_pressure(double ground_motor_pressure) {
+               if (ground_motor_pressure != AltosLib.MISSING)
+                       this.ground_motor_pressure = ground_motor_pressure;
+       }
+
        /* Raw acceleration value */
        public double           accel = AltosLib.MISSING;
 
@@ -333,7 +340,9 @@ public class AltosCalData {
                return AltosIMU.convert_accel(counts - accel_zero_through, imu_type);
        }
 
-       public double   gyro_zero_roll, gyro_zero_pitch, gyro_zero_yaw;
+       public double   gyro_zero_roll = AltosLib.MISSING;
+       public double   gyro_zero_pitch = AltosLib.MISSING;
+       public double   gyro_zero_yaw = AltosLib.MISSING;
 
        public void set_gyro_zero(double roll, double pitch, double yaw) {
                if (roll != AltosLib.MISSING) {
index 83299632a3d3e5f38b094d3a8b18c9f264793e8f..099ea04859337bb14e0799df62d607eabc97f9d8 100644 (file)
@@ -280,11 +280,11 @@ public class AltosConvert {
                return 3.3 * mega_adc(sensor) * (100.0 + 27.0) / 27.0;
        }
 
-       static double easy_mini_2_adc(int raw) {
+       static double easy_mini_2_adc(double raw) {
                return raw / 4095.0;
        }
 
-       static double easy_mini_1_adc(int raw) {
+       static double easy_mini_1_adc(double raw) {
                return raw / 32767.0;
        }
 
@@ -311,6 +311,26 @@ public class AltosConvert {
                return easy_mini_2_adc(sensor) * supply * 127/27;
        }
 
+       static double motor_pressure(double voltage) {
+               double  base = 0.5;
+               double  max = 4.5;
+               double  full_scale_pressure = psi_to_pa(1600);
+
+               if (voltage < base)
+                       voltage = base;
+               if (voltage > max)
+                       voltage = max;
+               return (voltage - base) / (max - base) * full_scale_pressure;
+       }
+
+       static double easy_motor_2_motor_pressure(int sensor, double ground_sensor) {
+               double  supply = 3.3;
+               double  ground_voltage = easy_mini_2_adc(ground_sensor) * supply * 15.6 / 10.0;
+               double  voltage = easy_mini_2_adc(sensor) * supply * 15.6 / 10.0;
+
+               return motor_pressure(voltage) - motor_pressure(ground_voltage);
+       }
+
        public static double radio_to_frequency(int freq, int setting, int cal, int channel) {
                double  f;
 
index ad76f833456fc0985572774f097134776bbe486d..db2c14faba1e11f17b735b65388c358679273c4c 100644 (file)
@@ -140,6 +140,7 @@ public abstract class AltosDataListener {
        public abstract void set_igniter_voltage(double[] voltage);
        public abstract void set_pyro_fired(int pyro_mask);
        public abstract void set_companion(AltosCompanion companion);
+       public abstract void set_motor_pressure(double motor_pressure);
 
        public AltosDataListener() {
        }
index 8d0738dc941ee0618aa65e8c1b388959b2966ed4..a3c15112318c7cae3c4503ba3ce1d50849190c95 100644 (file)
@@ -71,6 +71,7 @@ class AltosEepromNameData extends AltosDataListener {
        public void set_companion(AltosCompanion companion) { }
        public void set_kalman(double height, double speed, double acceleration) { }
        public void set_orient(double new_orient) { }
+       public void set_motor_pressure(double motor_pressure) { }
 
        public AltosEepromNameData(AltosCalData cal_data) {
                super(cal_data);
diff --git a/altoslib/AltosEepromRecordMotor.java b/altoslib/AltosEepromRecordMotor.java
new file mode 100644 (file)
index 0000000..a8f35db
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright Â© 2020 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+package org.altusmetrum.altoslib_14;
+
+public class AltosEepromRecordMotor extends AltosEepromRecord {
+       public static final int record_length = 16;
+
+       private int log_format;
+
+       /* AO_LOG_FLIGHT elements */
+       private int flight() { return data16(0); }
+       private int ground_accel() { return data16(2); }
+       private int ground_accel_along() { return data16(4); }
+       private int ground_accel_across() { return data16(6); }
+       private int ground_accel_through() { return data16(8); }
+       private int ground_motor_pressure() { return data16(10); }
+
+       /* AO_LOG_STATE elements */
+       private int state() { return data16(0); }
+       private int reason() { return data16(2); }
+
+       /* AO_LOG_SENSOR elements */
+       private int motor_pres() { return data16(0); }
+       private int v_batt() { return data16(2); }
+       private int accel() { return data16(4); }
+       private int accel_across() { return data16(6); }
+       private int accel_along() { return -data16(8); }
+       private int accel_through() { return data16(10); }
+
+       private int imu_type() {
+               switch (log_format) {
+               case AltosLib.AO_LOG_FORMAT_EASYMOTOR:
+                       return AltosIMU.imu_type_easymotor_v2;
+               default:
+                       return AltosLib.MISSING;
+               }
+       }
+
+       public void provide_data(AltosDataListener listener, AltosCalData cal_data) {
+               super.provide_data(listener, cal_data);
+
+               cal_data.set_imu_type(imu_type());
+
+               switch (cmd()) {
+               case AltosLib.AO_LOG_FLIGHT:
+                       cal_data.set_flight(flight());
+                       cal_data.set_ground_accel(ground_accel());
+                       listener.set_accel_ground(cal_data.accel_along(ground_accel_along()),
+                                                 cal_data.accel_across(ground_accel_across()),
+                                                 cal_data.accel_through(ground_accel_through()));
+                       cal_data.set_ground_motor_pressure(ground_motor_pressure());
+                       break;
+               case AltosLib.AO_LOG_STATE:
+                       listener.set_state(state());
+                       break;
+               case AltosLib.AO_LOG_SENSOR:
+                       AltosConfigData config_data = eeprom.config_data();
+
+                       listener.set_battery_voltage(AltosConvert.easy_mini_2_voltage(v_batt()));
+                       double pa = AltosConvert.easy_motor_2_motor_pressure(motor_pres(), cal_data.ground_motor_pressure);
+                       listener.set_motor_pressure(pa);
+
+                       int     accel_along = accel_along();
+                       int     accel_across = accel_across();
+                       int     accel_through = accel_through();
+
+                       listener.set_accel(cal_data.accel_along(accel_along),
+                                          cal_data.accel_across(accel_across),
+                                          cal_data.accel_through(accel_through));
+
+                       listener.set_acceleration(cal_data.acceleration(accel()));
+                       break;
+               }
+       }
+
+       public AltosEepromRecord next() {
+               int     s = next_start();
+               if (s < 0)
+                       return null;
+               return new AltosEepromRecordMotor(eeprom, s);
+       }
+
+       public AltosEepromRecordMotor(AltosEeprom eeprom, int start) {
+               super(eeprom, start, record_length);
+               log_format = eeprom.config_data().log_format;
+       }
+
+       public AltosEepromRecordMotor(AltosEeprom eeprom) {
+               this(eeprom, 0);
+       }
+}
index 689eaea67553f725aa3fc8b598af8d354309d00b..2a7d97e3002dc93b662452ed255f912f0f3043cf 100644 (file)
@@ -106,6 +106,9 @@ public class AltosEepromRecordSet implements AltosRecordSet {
                case AltosLib.AO_LOG_FORMAT_MICROPEAK2:
                        record = new AltosEepromRecordMicroPeak2(eeprom);
                        break;
+               case AltosLib.AO_LOG_FORMAT_EASYMOTOR:
+                       record = new AltosEepromRecordMotor(eeprom);
+                       break;
                }
 
                ordered = new TreeSet<AltosEepromRecord>();
index ef4ef4dfc6dcebb8432a5192b793e06b0b650006..d9d59f1bbf25ab5afc4d3ed7a614737f88569d75 100644 (file)
@@ -286,11 +286,16 @@ public class AltosFlightSeries extends AltosDataListener {
        }
 
        private void compute_height() {
-               double ground_altitude = cal_data().ground_altitude;
-               if (height_series == null && ground_altitude != AltosLib.MISSING && altitude_series != null) {
-                       height_series = add_series(height_name, AltosConvert.height);
-                       for (AltosTimeValue alt : altitude_series)
-                               height_series.add(alt.time, alt.value - ground_altitude);
+               if (height_series == null) {
+                       double ground_altitude = cal_data().ground_altitude;
+                       if (ground_altitude != AltosLib.MISSING && altitude_series != null) {
+                               height_series = add_series(height_name, AltosConvert.height);
+                               for (AltosTimeValue alt : altitude_series)
+                                       height_series.add(alt.time, alt.value - ground_altitude);
+                       } else if (speed_series != null) {
+                               height_series = add_series(height_name, AltosConvert.height);
+                               speed_series.integrate(height_series);
+                       }
                }
 
                if (gps_height == null && cal_data().gps_pad != null && cal_data().gps_pad.alt != AltosLib.MISSING && gps_altitude != null) {
@@ -343,8 +348,12 @@ public class AltosFlightSeries extends AltosDataListener {
                        else
                                accel_series.integrate(temp_series);
 
+                       AltosTimeSeries clip_series = make_series(speed_name, AltosConvert.speed);
+
+                       temp_series.clip(clip_series, 0, Double.POSITIVE_INFINITY);
+
                        accel_speed_series = make_series(speed_name, AltosConvert.speed);
-                       temp_series.filter(accel_speed_series, 0.1);
+                       clip_series.filter(accel_speed_series, 0.1);
                }
 
                if (alt_speed_series != null && accel_speed_series != null) {
@@ -401,6 +410,9 @@ public class AltosFlightSeries extends AltosDataListener {
                if (cal_data.accel_zero_across == AltosLib.MISSING)
                        return;
 
+               if (cal_data.gyro_zero_roll == AltosLib.MISSING)
+                       return;
+
                AltosRotation rotation = new AltosRotation(accel_ground_across,
                                                           accel_ground_through,
                                                           accel_ground_along,
@@ -758,6 +770,16 @@ public class AltosFlightSeries extends AltosDataListener {
        public void set_companion(AltosCompanion companion) {
        }
 
+       public static final String motor_pressure_name = "Motor Pressure";
+
+       public AltosTimeSeries motor_pressure_series;
+
+       public void set_motor_pressure(double motor_pressure) {
+               if (motor_pressure_series == null)
+                       motor_pressure_series = add_series(motor_pressure_name, AltosConvert.pressure);
+               motor_pressure_series.add(time(), motor_pressure);
+       }
+
        public void finish() {
                compute_orient();
                if (speed_series == null) {
index 7f8be40328faa7d848965d233727a08c90dcc05b..2944a2a5e1131035b74eb21f2bca7a4cf0420406 100644 (file)
@@ -36,6 +36,7 @@ public class AltosIMU implements Cloneable {
 
        public static final double      counts_per_g_mpu = 2048.0;
        public static final double      counts_per_g_bmx = 2048.0;
+       public static final double      counts_per_g_adxl = 20.5;
 
        private static double counts_per_g(int imu_type) {
                switch (imu_type) {
@@ -47,6 +48,8 @@ public class AltosIMU implements Cloneable {
                case  imu_type_telemega_v4:
                case imu_type_easytimer_v1:
                        return counts_per_g_bmx;
+               case imu_type_easymotor_v2:
+                       return counts_per_g_adxl;
                default:
                        return AltosLib.MISSING;
                }
@@ -161,6 +164,8 @@ public class AltosIMU implements Cloneable {
 
        public static final int imu_type_easytimer_v1 = 5;      /* BMX160 */
 
+       public static final int imu_type_easymotor_v2 = 6;      /* ADXL375 (accel only) */
+
        private int accel_across(int imu_type) {
                switch (imu_type) {
                case imu_type_telemega_v1_v2:
@@ -172,6 +177,8 @@ public class AltosIMU implements Cloneable {
                case imu_type_telemega_v4:
                case imu_type_easytimer_v1:
                        return -accel_y;
+               case imu_type_easymotor_v2:
+                       return accel_y;
                default:
                        return AltosLib.MISSING;
                }
@@ -187,6 +194,8 @@ public class AltosIMU implements Cloneable {
                case imu_type_telemega_v4:
                case imu_type_easytimer_v1:
                        return accel_x;
+               case imu_type_easymotor_v2:
+                       return -accel_x;
                default:
                        return AltosLib.MISSING;
                }
@@ -308,9 +317,11 @@ public class AltosIMU implements Cloneable {
                        cal_data.set_imu_type(imu_type);
 
                        if (imu != null) {
-                               listener.set_gyro(cal_data.gyro_roll(imu.gyro_roll(imu_type)),
-                                                 cal_data.gyro_pitch(imu.gyro_pitch(imu_type)),
-                                                 cal_data.gyro_yaw(imu.gyro_yaw(imu_type)));
+                               if (imu.gyro_x != AltosLib.MISSING) {
+                                       listener.set_gyro(cal_data.gyro_roll(imu.gyro_roll(imu_type)),
+                                                         cal_data.gyro_pitch(imu.gyro_pitch(imu_type)),
+                                                         cal_data.gyro_yaw(imu.gyro_yaw(imu_type)));
+                               }
                                listener.set_accel_ground(cal_data.accel_along(imu.accel_along(imu_type)),
                                                          cal_data.accel_across(imu.accel_across(imu_type)),
                                                          cal_data.accel_through(imu.accel_through(imu_type)));
index a7f27830cd053a99484a70b793084f5cc6b39507..cf1fa1ed4e9b096949f83502a0fcdd67bd9210c0 100644 (file)
@@ -132,6 +132,7 @@ public class AltosLib {
        public final static int product_usbtrng = 0x0029;
        public final static int product_usbrelay = 0x002a;
        public final static int product_mpusb = 0x002b;
+       public final static int product_easymotor = 0x002c;
        public final static int product_altusmetrum_min = 0x000a;
        public final static int product_altusmetrum_max = 0x002c;
 
@@ -164,7 +165,8 @@ public class AltosLib {
                new Product("telegps", product_telegps),
                new Product("easymini", product_easymini),
                new Product("telemini", product_telemini),
-               new Product("easymega", product_easymega)
+               new Product("easymega", product_easymega),
+               new Product("easymotor", product_easymotor)
        };
 
        public static int name_to_product(String name) {
@@ -382,6 +384,7 @@ public class AltosLib {
        public static final int AO_LOG_FORMAT_TELESTATIC = 17;
        public static final int AO_LOG_FORMAT_MICROPEAK2 = 18;
        public static final int AO_LOG_FORMAT_TELEMEGA_4 = 19;
+       public static final int AO_LOG_FORMAT_EASYMOTOR = 20;
        public static final int AO_LOG_FORMAT_NONE = 127;
 
        public static boolean isspace(int c) {
@@ -601,6 +604,7 @@ public class AltosLib {
                case product_telegps: return "TeleGPS";
                case product_easymini: return "EasyMini";
                case product_telemini: return "TeleMini";
+               case product_easymotor: return "EasyMotor";
                default: return "unknown";
                }
        }
index e199bb1db7b44ea2c3f6416b8a989192b3520f90..97fd5de9dc22d5911045db7bc200cde379529d3b 100644 (file)
@@ -23,28 +23,28 @@ public class AltosPressure extends AltosUnits {
        public double value(double v, boolean imperial_units) {
                if (imperial_units)
                        return AltosConvert.pa_to_psi(v);
-               return v;
+               return v / 1000.0;
        }
 
        public double inverse(double v, boolean imperial_units) {
                if (imperial_units)
                        return AltosConvert.psi_to_pa(v);
-               return v;
+               return v * 1000.0;
        }
 
        public String show_units(boolean imperial_units) {
                if (imperial_units)
                        return "psi";
-               return "Pa";
+               return "kPa";
        }
 
        public String say_units(boolean imperial_units) {
                if (imperial_units)
                        return "p s i";
-               return "pascals";
+               return "kilopascals";
        }
 
        public int show_fraction(int width, boolean imperial_units) {
-               return width / 9;
+               return width / 5;
        }
 }
index 07f62427a3861ac92de1f433b9755e859d3e4f42..bcabf750c2b424fccfad3f34de8cb8b5d25e58d8 100644 (file)
@@ -86,6 +86,7 @@ class AltosReplay extends AltosDataListener implements Runnable {
        public void set_igniter_voltage(double[] voltage) { state.set_igniter_voltage(voltage); }
        public void set_pyro_fired(int pyro_mask) { state.set_pyro_fired(pyro_mask); }
        public void set_companion(AltosCompanion companion) { state.set_companion(companion); }
+       public void set_motor_pressure(double motor_pressure) { state.set_motor_pressure(motor_pressure); }
 
        public void run () {
                /* Run the flight */
index fc9727481201162bf636e6c4324b2d3140458310..28fdbb244c3afffd6da9e530da4c84fce71bafec 100644 (file)
@@ -703,6 +703,8 @@ public class AltosState extends AltosDataListener {
 
        public int      pyro_fired;
 
+       public double   motor_pressure;
+
        public void set_npad(int npad) {
                this.npad = npad;
                gps_waiting = MIN_PAD_SAMPLES - npad;
@@ -1047,6 +1049,10 @@ public class AltosState extends AltosDataListener {
                this.pyro_fired = fired;
        }
 
+       public void set_motor_pressure(double motor_pressure) {
+               this.motor_pressure = motor_pressure;
+       }
+
        public AltosState() {
                init();
        }
index 052b0fbad247c1af1b52b6134a9eeb839346dfec..6f01f51c180be81d53f54471401a14c328ef23bc 100644 (file)
@@ -49,6 +49,7 @@ class AltosTelemetryNullListener extends AltosDataListener {
        public void set_igniter_voltage(double[] voltage) { }
        public void set_pyro_fired(int pyro_mask) { }
        public void set_companion(AltosCompanion companion) { }
+       public void set_motor_pressure(double motor_pressure) { }
 
        public boolean cal_data_complete() {
                /* All telemetry packets */
index 7a281fdf7422f81253ea42fbca786f97f5486b44..60a1d68cbfd3fe47d68158066c12f7ede478e1d3 100644 (file)
@@ -50,7 +50,6 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard {
        }
 
        public void provide_data(AltosDataListener listener) {
-               super.provide_data(listener);
 
                AltosCalData    cal_data = listener.cal_data();
 
@@ -63,6 +62,8 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard {
                gps.pdop = pdop() / 10.0;
                gps.hdop = hdop() / 10.0;
                gps.vdop = vdop() / 10.0;
+               if (gps.connected)
+                       super.provide_data(listener);
 
                if (gps.locked) {
                        gps.lat = latitude() * 1.0e-7;
@@ -78,6 +79,7 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard {
                        gps.course = course() * 2;
                        gps.climb_rate = climb_rate() * 1.0e-2;
                }
-               listener.set_gps(gps, true, false);
+               if (gps.connected)
+                       listener.set_gps(gps, true, false);
        }
 }
index 80720f152c3bf3d232d6c8ae33d768fe1f1478fd..d12fbe701d67b83741010d29df4d6a53969f4dad 100644 (file)
@@ -342,6 +342,16 @@ public class AltosTimeSeries implements Iterable<AltosTimeValue>, Comparable<Alt
                return f;
        }
 
+       public AltosTimeSeries clip(AltosTimeSeries clip, double min, double max) {
+               for (AltosTimeValue v: values) {
+                       double value = v.value;
+                       if (value < min) value = min;
+                       if (value > max) value = max;
+                       clip.add(v.time, value);
+               }
+               return clip;
+       }
+
        public AltosTimeSeries(String label, AltosUnits units) {
                this.label = label;
                this.units = units;
index 0c9392d18a667110fc50b33aee01adfa6907816a..75af5252490281365643d976166c2f722400adb6 100644 (file)
@@ -49,6 +49,7 @@ altoslib_JAVA = \
        AltosEepromRecordGps.java \
        AltosEepromRecordFireTwo.java \
        AltosEepromRecordMicroPeak2.java \
+       AltosEepromRecordMotor.java \
        AltosEepromRecordSet.java \
        AltosEepromChunk.java \
        AltosEepromDownload.java \
index 6d4ed1bca79e4bfb5b4a150390f104f2f23c4e9c..78d3ec15b011adad2f5e87976ca1dfe3e36f8bc2 100644 (file)
@@ -153,7 +153,14 @@ FIRMWARE_TGPS_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx
 FIRMWARE_TGPS_2_0=$(top_srcdir)/src/telegps-v2.0/telegps-v2.0-$(VERSION).ihx
 FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0) $(FIRMWARE_TGPS_2_0)
 
-FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FIRMWARE_TMEGA) $(FIRMWARE_EMINI) $(FIRMWARE_TGPS) $(FIRMWARE_EMEGA) $(FIRMWARE_ETIMER)
+FIRMWARE_TLCO_2_0=$(top_srcdir)/src/telelco-v2.0/telelco-v2.0-$(VERSION).ihx
+FIRMWARE_TLCO=$(FIRMWARE_TLCO_2_0)
+
+FIRMWARE_TFIRE8_1_0=$(top_srcdir)/src/telefireeight-v1.0/telefireeight-v1.0-$(VERSION).ihx
+FIRMWARE_TFIRE8_2_0=$(top_srcdir)/src/telefireeight-v2.0/telefireeight-v2.0-$(VERSION).ihx
+FIRMWARE_TFIRE8=$(FIRMWARE_TFIRE8_1_0) $(FIRMWARE_TFIRE8_2_0)
+
+FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FIRMWARE_TMEGA) $(FIRMWARE_EMINI) $(FIRMWARE_TGPS) $(FIRMWARE_EMEGA) $(FIRMWARE_ETIMER) $(FIRMWARE_TLCO) $(FIRMWARE_TFIRE8)
 
 ALTUSMETRUM_DOC=$(top_srcdir)/doc/altusmetrum.pdf
 ALTOS_DOC=$(top_srcdir)/doc/altos.pdf
index 6d4876720980e523d624910fb163dec83a09ebd8..ad155a2c4ff387aeed0a5bceea335d229cfab34f 100644 (file)
@@ -137,6 +137,9 @@ Section "Firmware"
        File "../src/easymega-v1.0/easymega-v1.0-${VERSION}.ihx"
        File "../src/easymega-v2.0/easymega-v2.0-${VERSION}.ihx"
        File "../src/easytimer-v1/easytimer-v1-${VERSION}.ihx"
+       File "../src/telelco-v2.0/telelco-v2.0-${VERSION}.ihx"
+       File "../src/telefireeight-v1.0/telefireeight-v1.0-${VERSION}.ihx"
+       File "../src/telefireeight-v2.0/telefireeight-v2.0-${VERSION}.ihx"
 
 SectionEnd
 
index c4a49d683cfa16d65b9d8ab53c720e2436ed1863..1ccde1d6c2e341a2930dc636b603e4f565ff47d7 100644 (file)
@@ -88,6 +88,8 @@ public class AltosGraph extends AltosUIGraph {
        static final private AltosUILineStyle mag_through_color = new AltosUILineStyle();
        static final private AltosUILineStyle mag_total_color = new AltosUILineStyle();
 
+       static final private AltosUILineStyle motor_pressure_color = new AltosUILineStyle();
+
        static AltosUnits dop_units = null;
        static AltosUnits tick_units = null;
 
@@ -100,6 +102,7 @@ public class AltosGraph extends AltosUIGraph {
                AltosUIAxis     pressure_axis, thrust_axis;
                AltosUIAxis     gyro_axis, orient_axis, mag_axis;
                AltosUIAxis     course_axis, dop_axis, tick_axis;
+               AltosUIAxis     motor_pressure_axis;
 
                if (stats != null && stats.serial != AltosLib.MISSING && stats.product != null && stats.flight != AltosLib.MISSING)
                        setName(String.format("%s %d flight %d\n", stats.product, stats.serial, stats.flight));
@@ -122,6 +125,8 @@ public class AltosGraph extends AltosUIGraph {
                course_axis = newAxis("Course", AltosConvert.orient, gps_course_color, 0);
                dop_axis = newAxis("Dilution of Precision", dop_units, gps_pdop_color, 0);
 
+               motor_pressure_axis = newAxis("Motor Pressure", AltosConvert.pressure, motor_pressure_color, 0);
+
                flight_series.register_axis("default",
                                            speed_color,
                                            false,
@@ -352,6 +357,11 @@ public class AltosGraph extends AltosUIGraph {
                                                    voltage_axis);
                }
 
+               flight_series.register_axis(AltosUIFlightSeries.motor_pressure_name,
+                                           motor_pressure_color,
+                                           true,
+                                           motor_pressure_axis);
+
                flight_series.check_axes();
 
                return flight_series.series(cal_data);
index bd3d51cd511f30685b9130a739055089bec81d74..67e846004d9224709aeb0b3f4c4792066b151927 100644 (file)
@@ -18,7 +18,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([altos], 1.9.5)
+AC_INIT([altos], 1.9.6)
 ANDROID_VERSION=27
 AC_CONFIG_SRCDIR([src/kernel/ao.h])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
index 165317e2ff0f351016ecf0dadb5a197d8543fbb7..db742953ab568c9c82b5f26309d9313d2808fa4d 100644 (file)
@@ -17,6 +17,7 @@ FAKETIME=TZ=UTC faketime -f '$(RELEASE_DATE) 00:00:00 i0'
 endif
 
 RELNOTES_INC=\
+       release-notes-1.9.6.inc \
        release-notes-1.9.5.inc \
        release-notes-1.9.4.inc \
        release-notes-1.9.3.inc \
index 66544c1513e90c5c90232f8de754360623f88957..9dd0058e63062aa1116a28525f447e7b4c75dba8 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.6.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.5.adoc[]
 
diff --git a/doc/release-notes-1.9.6.inc b/doc/release-notes-1.9.6.inc
new file mode 100644 (file)
index 0000000..9dbd9aa
--- /dev/null
@@ -0,0 +1,16 @@
+= Release Notes for Version 1.9.6
+include::release-head.adoc[]
+:doctype: article
+
+       Version 1.9.6
+
+       == AltOS
+
+       * Fix EasyTimer bug where it might mis-detect boost (either
+          detect it early or not at all) due to small errors in
+          accelerometer calibration leading to large accumulated error
+          in speed.
+
+       * Adjust self-test of new 9-axis IMU (BMX-160) so that it
+         doesn't think the part has a failure when tested sitting
+         horizontally.
index 917753f46f041dce2675fc6be70e0e4742c7e9e2..2348c4ac8a7a496fbc3a92cfa07df07292b4ad9b 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.6.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.5.adoc[]
 
index 30e8f73b7c319a0bd5266f8fd753a3194cc26eca..03d3ed76a1955c79e2669538ddf254a2c3042da4 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.6.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.5.adoc[]
 
index eb5eb6774fc5e42fa8b14dc1b428e1dd7fd919c4..8c57b3f9d92f4d7a23e4a9fd28977c46d03074aa 100644 (file)
@@ -85,11 +85,12 @@ MINGLIBS=-lsetupapi -lws2_32
 
 fat: all altos.dll altos64.dll
 
-altos.dll: $(WINDOWS_SRC) $(WINDOWS_H)
-       $(MINGCC32) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS)
+#altos.dll: $(WINDOWS_SRC) $(WINDOWS_H)
+#      $(MINGCC32) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS)
 
-altos64.dll: $(WINDOWS_SRC) $(WINDOWS_H)
-       $(MINGCC64) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS)
+#altos64.dll: $(WINDOWS_SRC) $(WINDOWS_H)
+#      $(MINGCC64) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS)
 
 clean-local:
-       -rm -rf libaltosJNI *.class *.java classlibaltos.stamp $(SWIG_FILE) libaltos_wrap.c altos.dll altos64.dll
+       -rm -rf libaltosJNI *.class *.java classlibaltos.stamp $(SWIG_FILE) libaltos_wrap.c
+#      -rm -rf  altos.dll altos64.dll  
diff --git a/libaltos/altos.dll b/libaltos/altos.dll
new file mode 100755 (executable)
index 0000000..ed0e477
Binary files /dev/null and b/libaltos/altos.dll differ
diff --git a/libaltos/altos64.dll b/libaltos/altos64.dll
new file mode 100755 (executable)
index 0000000..e0edc1d
Binary files /dev/null and b/libaltos/altos64.dll differ
index 162c85bab8fa6aa658479017bb920395fb678e8a..b92df70857fb03b1bbf61220cd91608eb307051d 100644 (file)
@@ -132,12 +132,12 @@ altos_ftdi_list_start(void)
 }
 
 static struct {
-       char    *windows;
-       char    *real;
+       unsigned int    vid, pid;
+       char    *name;
 } name_map[] = {
-       { .windows = "AltusMetrum28", .real = "EasyMega" },
-       { .windows = "AltusMetrum2c", .real = "EasyMotor" },
-       { 0, 0 },
+       { .vid = 0xfffe, .pid = 0x0028, .name = "EasyMega" },
+       { .vid = 0xfffe, .pid = 0x002c, .name = "EasyMotor" },
+       { .name = NULL },
 };
 
 PUBLIC int
@@ -240,15 +240,22 @@ altos_list_next(struct altos_list *list, struct altos_device *device)
                        altos_set_last_windows_error();
                        continue;
                }
-               for (i = 0; name_map[i].windows; i++)
-                       if (!strcmp(name_map[i].windows, friendlyname)) {
-                               strcpy(friendlyname, name_map[i].real);
+
+               char *space = friendlyname;
+               while (*space) {
+                       if (*space == ' ') {
+                               *space = '\0';
                                break;
                        }
+                       space++;
+               }
 
-               char *space = strchr(friendlyname, ' ');
-               if  (space)
-                       *space = '\0';
+               for (i = 0; name_map[i].name; i++) {
+                       if (name_map[i].vid == vid && name_map[i].pid == pid) {
+                               strcpy(friendlyname, name_map[i].name);
+                               break;
+                       }
+               }
 
                device->vendor = vid;
                device->product = pid;
index 2d92d4f042631cce5f40471e7e1f0688fcf6f0eb..c93311acd1ddc10fdec992e8abdd0d9a93fa7661 100644 (file)
@@ -83,7 +83,7 @@ check: $(METAINFO)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx *.bin
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx *.bin $(PROGNAME)-*.map
        rm -f ao_product.h
        rm -f *.cab
 
index c7cf78af7d8f7940c985a10c2171630a6c606d77..c95bf9e32bc02776c31b25aa2eec055d79080230 100644 (file)
@@ -105,7 +105,7 @@ struct ao_adxl375_total {
 
 #define MIN_LSB_G      18.4
 #define MAX_LSB_G      22.6
-#define SELF_TEST_MIN_G        6.0
+#define SELF_TEST_MIN_G        5.0
 #define SELF_TEST_MAX_G        6.8
 
 #define MIN_SELF_TEST  ((int32_t) (MIN_LSB_G * SELF_TEST_MIN_G * AO_ADXL375_SELF_TEST_SAMPLES + 0.5))
index a1ed216dc447abfefe8b139a60c64aac9e0c5f54..fe448fd0e27857d06592188d5aa38548ca5b6348 100644 (file)
@@ -93,6 +93,8 @@
 
 #define AO_ADXL375_FIFO_STATUS         0x39
 
+#define ADXL375_ACCEL_FULLSCALE                200
+
 struct ao_adxl375_sample {
        int16_t x;
        int16_t y;
@@ -101,6 +103,8 @@ struct ao_adxl375_sample {
 
 extern struct ao_adxl375_sample        ao_adxl375_current;
 
+#define ao_adxl375_accel_to_sample(accel) ((accel_t) (accel) * (4095.0f / (ADXL375_ACCEL_FULLSCALE * GRAVITY)))
+
 void
 ao_adxl375_init(void);
 
index b8f6df4a264eb863e38914c764b32ccff654fa09..d2a7dbcc293b960895a17a89776dd27c2148088d 100644 (file)
@@ -112,7 +112,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index ab478a4238c61fbd9bd5c496a07311da22a86b97..d999232f6b2c4c105cf4101643f822f9018f950b 100644 (file)
@@ -109,7 +109,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 301a0c1dde8ce0bc014f358a0f78ca3f8164f670..e146f54a46fd954224bc95ae8bb1cbe3c9b98ca8 100644 (file)
@@ -73,7 +73,7 @@ load: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 2f79024416cd52b3dcc79797b18e5e41d67f5cd1..a47fc9bd7ac2a2f99a38208cf31a25b3a373f9c4 100644 (file)
@@ -72,7 +72,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
diff --git a/src/easymotor-v2/.gitignore b/src/easymotor-v2/.gitignore
new file mode 100644 (file)
index 0000000..e5f7d58
--- /dev/null
@@ -0,0 +1,2 @@
+ao_product.h
+*.elf
diff --git a/src/easymotor-v2/Makefile b/src/easymotor-v2/Makefile
new file mode 100644 (file)
index 0000000..33a1b2d
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# AltOS build
+#
+#
+
+include ../stmf0/Makefile.defs
+
+INC = \
+       ao.h \
+       ao_arch.h \
+       ao_arch_funcs.h \
+       ao_pins.h \
+       ao_product.h \
+       ao_adxl375.h \
+       stm32f0.h
+
+#
+# Common AltOS sources
+#
+
+ALTOS_SRC = \
+       ao_interrupt.c \
+       ao_boot_chain.c \
+       ao_romconfig.c \
+       ao_product.c \
+       ao_mutex.c \
+       ao_panic.c \
+       ao_stdio.c \
+       ao_storage.c \
+       ao_report.c \
+       ao_ignite.c \
+       ao_flight.c \
+       ao_kalman.c \
+       ao_sample.c \
+       ao_data.c \
+       ao_convert_volt.c \
+       ao_task.c \
+       ao_log.c \
+       ao_log_motor.c \
+       ao_cmd.c \
+       ao_config.c \
+       ao_dma_stm.c \
+       ao_timer.c \
+       ao_exti_stm.c \
+       ao_spi_stm.c \
+       ao_adc_stm.c \
+       ao_usb_stm.c \
+       ao_m25.c \
+       ao_adxl375.c \
+       ao_beep_stm.c
+
+PRODUCT=EasyMotor-v2
+PRODUCT_DEF=-DEASYMOTOR_V_2
+IDPRODUCT=0x002c
+
+CFLAGS = $(PRODUCT_DEF) $(STMF0_CFLAGS)
+
+PROGNAME=easymotor-v2
+PROG=$(PROGNAME)-$(VERSION).elf
+HEX=$(PROGNAME)-$(VERSION).ihx
+
+SRC=$(ALTOS_SRC) ao_easymotor.c
+OBJ=$(SRC:.c=.o)
+
+all: $(PROG) $(HEX)
+
+$(PROG): Makefile $(OBJ)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+
+$(OBJ): $(INC)
+
+distclean:     clean
+
+clean:
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f ao_product.h
+
+install:
+
+uninstall:
diff --git a/src/easymotor-v2/ao_easymotor.c b/src/easymotor-v2/ao_easymotor.c
new file mode 100644 (file)
index 0000000..9f3aeb2
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright Â© 2020 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_adxl375.h>
+#include <ao_log.h>
+#include <ao_exti.h>
+
+int
+main(void)
+{
+       ao_clock_init();
+       ao_task_init();
+       ao_timer_init();
+
+       ao_dma_init();
+       ao_spi_init();
+       ao_exti_init();
+
+       ao_adc_init();
+       ao_beep_init();
+       ao_cmd_init();
+       ao_usb_init();
+
+       ao_adxl375_init();
+
+       ao_storage_init();
+       ao_flight_init();
+       ao_log_init();
+       ao_report_init();
+       ao_config_init();
+
+       ao_start_scheduler();
+}
diff --git a/src/easymotor-v2/ao_pins.h b/src/easymotor-v2/ao_pins.h
new file mode 100644 (file)
index 0000000..1d970e1
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright Â© 2020 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#define HAS_TASK_QUEUE         1
+#define IS_FLASH_LOADER                0
+
+/* 48MHz clock based on 32MHz reference */
+#define AO_HSE                  32000000
+#define AO_RCC_CFGR_PLLMUL      STM_RCC_CFGR_PLLMUL_3
+#define AO_RCC_CFGR2_PLLDIV     STM_RCC_CFGR2_PREDIV_2
+#define AO_PLLMUL               3
+#define AO_PLLDIV               2
+
+/* HCLK = 48MHz */
+#define AO_AHB_PRESCALER        1
+#define AO_RCC_CFGR_HPRE_DIV    STM_RCC_CFGR_HPRE_DIV_1
+
+/* APB = 40MHz */
+#define AO_APB_PRESCALER        1
+#define AO_RCC_CFGR_PPRE_DIV    STM_RCC_CFGR_PPRE_DIV_1
+
+#define HAS_SERIAL_1           0
+#define USE_SERIAL_1_STDIN     0
+#define SERIAL_1_PB6_PB7       0
+#define SERIAL_1_PA9_PA10      1
+
+#define HAS_SERIAL_2           0
+#define USE_SERIAL_2_STDIN     0
+#define SERIAL_2_PA2_PA3       0
+#define SERIAL_2_PD5_PD6       0
+
+#define HAS_SERIAL_3           0
+#define USE_SERIAL_3_STDIN     0
+#define SERIAL_3_PB10_PB11     1
+#define SERIAL_3_PC10_PC11     0
+#define SERIAL_3_PD8_PD9       0
+
+#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX       (512 * 1024)
+#define AO_CONFIG_MAX_SIZE                     1024
+#define LOG_ERASE_MARK                         0x55
+#define LOG_MAX_ERASE                          128
+#define AO_LOG_FORMAT                          AO_LOG_FORMAT_EASYMOTOR
+
+#define HAS_EEPROM             1
+#define USE_INTERNAL_FLASH     0
+#define USE_EEPROM_CONFIG      0
+#define USE_STORAGE_CONFIG     1
+#define HAS_USB                        1
+#define AO_PA11_PA12_RMP       1
+#define HAS_BEEP               1
+#define HAS_BATTERY_REPORT     1
+#define HAS_PAD_REPORT         1
+#define BEEPER_CHANNEL         3
+#define BEEPER_TIMER           2
+#define BEEPER_PORT            (&stm_gpioa)
+#define BEEPER_PIN             2
+#define BEEPER_AFR              STM_AFR_AF2
+
+#define HAS_RADIO              0
+#define HAS_TELEMETRY          0
+#define HAS_APRS               0
+#define HAS_COMPANION          0
+
+#define LOW_LEVEL_DEBUG                0
+
+#define HAS_GPS                        0
+#define HAS_FLIGHT             1
+#define HAS_LOG                        1
+
+/*
+ * ADC
+ */
+#define HAS_ADC                        1
+
+#define AO_ADC_PIN0_PORT       (&stm_gpioa)    /* pressure */
+#define AO_ADC_PIN0_PIN                0
+#define AO_ADC_PIN0_CH         0
+#define AO_ADC_PIN1_PORT       (&stm_gpioa)    /* v_batt */
+#define AO_ADC_PIN1_PIN                1
+#define AO_ADC_PIN1_CH         1
+
+#define AO_ADC_RCC_AHBENR       ((1 << STM_RCC_AHBENR_IOPAEN))
+
+#define AO_NUM_ADC             2
+
+#define AO_DATA_RING           64
+
+struct ao_adc {
+       int16_t                 motor_pressure;
+       int16_t                 v_batt;
+};
+
+#define AO_ADC_DUMP(p) \
+       printf("tick: %5u motor_pressure: %5d batt: %5d\n", \
+              (p)->tick, \
+              (p)->adc.motor_pressure, \
+              (p)->adc.v_batt);
+
+
+/*
+ * Voltage divider on ADC battery sampler
+ */
+#define AO_BATTERY_DIV_PLUS     100     /* 100k */
+#define AO_BATTERY_DIV_MINUS    27      /* 27k */
+
+/*
+ * Voltage divider on pressure sensor input
+ */
+#define AO_PRESSURE_DIV_PLUS    56      /* 5.6k 0.1% */
+#define AO_PRESSURE_DIV_MINUS   100     /* 10k  0.1% */ 
+
+/*
+ * ADC reference in decivolts
+ */
+#define AO_ADC_REFERENCE_DV    33
+
+/* SPI */
+
+#define HAS_SPI_1              1
+#define SPI_1_PA5_PA6_PA7      1       /* flash */
+#define SPI_1_PB3_PB4_PB5      1       /* adxl375 */
+#define SPI_1_OSPEEDR          STM_OSPEEDR_MEDIUM
+
+/*
+ * SPI Flash memory
+ */
+
+#define M25_MAX_CHIPS          1
+#define AO_M25_SPI_CS_PORT     (&stm_gpioa)
+#define AO_M25_SPI_CS_MASK     (1 << 4)
+#define AO_M25_SPI_BUS         AO_SPI_1_PA5_PA6_PA7
+
+/* ADXL375 */
+
+#define HAS_ADXL375            1
+#define AO_ADXL375_SPI_INDEX   (AO_SPI_1_PB3_PB4_PB5 | AO_SPI_MODE_3)
+#define AO_ADXL375_CS_PORT     (&stm_gpiob)
+#define AO_ADXL375_CS_PIN      6
+
+#define AO_ADXL375_AXIS                x
+#define AO_ADXL375_ACROSS_AXIS y
+#define AO_ADXL375_THROUGH_AXIS        z
+#define AO_ADXL375_INVERT      0
+#define HAS_IMU                        1
+#define USE_ADXL375_IMU                1
+
+/* Motor pressure */
+#define HAS_MOTOR_PRESSURE     1
+#define ao_data_motor_pressure(packet) ((packet)->adc.motor_pressure)
+
+typedef int16_t        motor_pressure_t;
+
+#endif /* _AO_PINS_H_ */
diff --git a/src/easymotor-v2/flash-loader/Makefile b/src/easymotor-v2/flash-loader/Makefile
new file mode 100644 (file)
index 0000000..478c313
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# AltOS flash loader build
+#
+#
+
+TOPDIR=../..
+HARDWARE=easymotor-v2
+include $(TOPDIR)/stmf0/Makefile-flash.defs
diff --git a/src/easymotor-v2/flash-loader/ao_pins.h b/src/easymotor-v2/flash-loader/ao_pins.h
new file mode 100644 (file)
index 0000000..f40ee5b
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright Â© 2020 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#include <ao_flash_stm_pins.h>
+
+/* pin 9 (PA3) on SOC to gnd for boot mode */
+
+#define AO_BOOT_PIN                    1
+#define AO_BOOT_APPLICATION_GPIO       stm_gpioa
+#define AO_BOOT_APPLICATION_PIN                3
+#define AO_BOOT_APPLICATION_VALUE      1
+#define AO_BOOT_APPLICATION_MODE       AO_EXTI_MODE_PULL_UP
+
+/* USB */
+#define HAS_USB                        1
+#define AO_USB_DIRECTIO                0
+#define AO_PA11_PA12_RMP       1
+
+#endif /* _AO_PINS_H_ */
index b0cd15c29e97ec75ae643a937228a01a8b1b786f..758a5b8fa4c29f53b911295741c97959a0ff123b 100644 (file)
@@ -91,7 +91,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 9bc19038d6c6c82e65c4251d8ddf44ca8499cc06..4ae63781fcb0900e39acdfc02ad8f737819d4b03 100644 (file)
@@ -205,8 +205,13 @@ ao_cmd_decimal(void)
 {
        uint32_t result = 0;
        uint8_t r = ao_cmd_lex_error;
+       bool negative = false;
 
        ao_cmd_white();
+       if (ao_cmd_lex_c == '-') {
+               negative = true;
+               ao_cmd_lex();
+       }
        for(;;) {
                if ('0' <= ao_cmd_lex_c && ao_cmd_lex_c <= '9')
                        result = result * 10 + (ao_cmd_lex_c - '0');
@@ -217,6 +222,8 @@ ao_cmd_decimal(void)
        }
        if (r != ao_cmd_success)
                ao_cmd_status = r;
+       if (negative)
+               result = -result;
        return result;
 }
 
index 77cd98e40cdc577bbfd7d998cdfb9f21b1fb5887..f8d8e7f1b66a2b1b950c5ee1e496731de4c41f27 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
+#ifndef AO_FLIGHT_TEST
 #include <ao.h>
 #include <ao_data.h>
+#endif
 
 volatile struct ao_data        ao_data_ring[AO_DATA_RING];
 volatile uint8_t               ao_data_head;
index b43a1cd498dd636a65c0c59c55bcf7af83090bbb..dcd8fc31b8e9a33ee9debadf826bc9a6e6ed3303 100644 (file)
@@ -346,6 +346,13 @@ typedef int16_t    accel_t;
 #endif
 #define ao_data_accel_invert(accel)            (-(accel))
 
+#if USE_ADXL375_IMU
+#define ao_data_along(packet)                  ((packet)->adxl375.AO_ADXL375_AXIS)
+#define ao_data_across(packet)                 ((packet)->adxl375.AO_ADXL375_ACROSS_AXIS)
+#define ao_data_through(packet)                        ((packet)->adxl375.z)
+#define ao_data_accel_to_sample(accel)         ao_adxl375_accel_to_sample(accel)
+#endif
+
 #endif /* HAS_ADXL375 */
 
 #if !HAS_ACCEL && HAS_MPU6000
index 2142546c9b0737b186cca6f6dce65fa51c8e30ec..3c1067cb44e9e079675d863a2eb38368e096e733 100644 (file)
@@ -102,6 +102,10 @@ uint8_t                    ao_flight_force_idle;
 
 #define abs(a) ((a) < 0 ? -(a) : (a))
 
+#if !HAS_BARO
+// #define DEBUG_ACCEL_ONLY    1
+#endif
+
 void
 ao_flight(void)
 {
@@ -127,8 +131,8 @@ ao_flight(void)
 #if HAS_ACCEL
                        if (ao_config.accel_plus_g == 0 ||
                            ao_config.accel_minus_g == 0 ||
-                           ao_ground_accel < ao_config.accel_plus_g - ACCEL_NOSE_UP ||
-                           ao_ground_accel > ao_config.accel_minus_g + ACCEL_NOSE_UP
+                           ao_ground_accel < (accel_t) ao_config.accel_plus_g - ACCEL_NOSE_UP ||
+                           ao_ground_accel > (accel_t) ao_config.accel_minus_g + ACCEL_NOSE_UP
 #if HAS_BARO
                            || ao_ground_height < -1000 ||
                            ao_ground_height > 7000
@@ -200,6 +204,15 @@ ao_flight(void)
                        ao_wakeup(&ao_flight_state);
 
                        break;
+
+#if DEBUG_ACCEL_ONLY
+               case ao_flight_invalid:
+               case ao_flight_idle:
+                       printf("+g %d ga %d sa %d accel %ld speed %ld\n",
+                              ao_config.accel_plus_g, ao_ground_accel, ao_sample_accel, ao_accel, ao_speed);
+                       break;
+#endif
+
                case ao_flight_pad:
                        /* pad to boost:
                         *
@@ -216,8 +229,8 @@ ao_flight(void)
                         */
                        if (ao_height > AO_M_TO_HEIGHT(20)
 #if HAS_ACCEL
-                           || (ao_accel > AO_MSS_TO_ACCEL(20) &&
-                               ao_speed > AO_MS_TO_SPEED(5))
+                           || (ao_accel > AO_MSS_TO_ACCEL(20)
+                               && ao_speed > AO_MS_TO_SPEED(5))
 #endif
                                )
                        {
index aaf0595f01ab7d5e345ab5997983386f78bd4c1e..f93f5aba94f1daa17d2830d7ce42969e6617111e 100644 (file)
@@ -275,6 +275,25 @@ ao_kalman_correct_accel(void)
 #endif /* else FORCE_ACCEL */
 #endif /* HAS_ACCEL */
 
+#if !HAS_BARO
+static ao_k_t  ao_k_height_prev;
+static ao_k_t  ao_k_speed_prev;
+
+/*
+ * While in pad mode without a barometric sensor, remove accumulated
+ * speed and height values to reduce the effect of systematic sensor
+ * error
+ */
+void
+ao_kalman_reset_accumulate(void)
+{
+       ao_k_height -= ao_k_height_prev;
+       ao_k_speed -= ao_k_speed_prev;
+       ao_k_height_prev = ao_k_height;
+       ao_k_speed_prev = ao_k_speed;
+}
+#endif
+
 void
 ao_kalman(void)
 {
index 8fe8b701c291a54af52c8e4864e824994d259ced..5c150abcefac88a4fb2dc4444d01d4b8a9c0e190 100644 (file)
@@ -59,6 +59,7 @@ extern enum ao_flight_state ao_log_state;
 #define AO_LOG_FORMAT_TELESTATIC       17      /* 32 byte typed telestatic records */
 #define AO_LOG_FORMAT_MICROPEAK2       18      /* 2-byte baro values with header */
 #define AO_LOG_FORMAT_TELEMEGA_4       19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
+#define AO_LOG_FORMAT_EASYMOTOR                20      /* ? byte typed easymotor records with pressure sensor and adxl375 */
 #define AO_LOG_FORMAT_NONE             127     /* No log at all */
 
 /* Return the flight number from the given log slot, 0 if none, -slot on failure */
@@ -501,6 +502,37 @@ struct ao_log_gps {
        } u;
 };
 
+struct ao_log_motor {
+       char                    type;                   /* 0 */
+       uint8_t                 csum;                   /* 1 */
+       uint16_t                tick;                   /* 2 */
+       union {                                         /* 4 */
+               /* AO_LOG_FLIGHT */
+               struct {
+                       uint16_t        flight;                 /* 4 */
+                       int16_t         ground_accel;           /* 6 */
+                       int16_t         ground_accel_along;     /* 8 */
+                       int16_t         ground_accel_across;    /* 10 */
+                       int16_t         ground_accel_through;   /* 12 */
+                       int16_t         ground_motor_pressure;  /* 14 */
+               } flight;                                       /* 16 */
+               /* AO_LOG_STATE */
+               struct {
+                       uint16_t        state;                  /* 4 */
+                       uint16_t        reason;                 /* 6 */
+               } state;
+               /* AO_LOG_SENSOR */
+               struct {
+                       uint16_t        pressure;               /* 4 */
+                       uint16_t        v_batt;                 /* 6 */
+                       int16_t         accel;                  /* 8 */
+                       int16_t         accel_across;           /* 10 */
+                       int16_t         accel_along;            /* 12 */
+                       int16_t         accel_through;          /* 14 */
+               } sensor;                                       /* 16 */
+       } u;
+};
+
 #if AO_LOG_FORMAT == AO_LOG_FOMAT_TELEMEGA_OLD || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_3 || AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMEGA_2 || AO_LOG_FORMAT == AO_LOG_FORMAT_TELEMEGA_4
 typedef struct ao_log_mega ao_log_type;
 #endif
@@ -517,6 +549,10 @@ typedef struct ao_log_firetwo ao_log_type;
 typedef struct ao_log_mini ao_log_type;
 #endif
 
+#if AO_LOG_FORMAT == AO_LOG_FORMAT_EASYMOTOR
+typedef struct ao_log_motor ao_log_type;
+#endif 
+
 #if AO_LOG_FORMAT == AO_LOG_FORMAT_TELEGPS
 typedef struct ao_log_gps ao_log_type;
 #endif
diff --git a/src/kernel/ao_log_motor.c b/src/kernel/ao_log_motor.c
new file mode 100644 (file)
index 0000000..3fca80f
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright Â© 2020 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include "ao.h"
+#include <ao_log.h>
+#include <ao_data.h>
+#include <ao_flight.h>
+
+#if HAS_FLIGHT
+static uint8_t ao_log_data_pos;
+
+/* a hack to make sure that ao_log_megas fill the eeprom block in even units */
+typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mega))] ;
+
+#ifndef AO_SENSOR_INTERVAL_ASCENT
+#define AO_SENSOR_INTERVAL_ASCENT      1
+#define AO_SENSOR_INTERVAL_DESCENT     10
+#define AO_OTHER_INTERVAL              32
+#endif
+
+void
+ao_log(void)
+{
+       uint16_t        next_sensor;
+
+       ao_storage_setup();
+
+       ao_log_scan();
+
+       while (!ao_log_running)
+               ao_sleep(&ao_log_running);
+
+       ao_log_data.type = AO_LOG_FLIGHT;
+       ao_log_data.tick = ao_sample_tick;
+       ao_log_data.u.flight.ground_accel = ao_ground_accel;
+       ao_log_data.u.flight.ground_accel_along = ao_ground_accel_along;
+       ao_log_data.u.flight.ground_accel_through = ao_ground_accel_through;
+       ao_log_data.u.flight.ground_motor_pressure = ao_ground_motor_pressure;
+       ao_log_data.u.flight.flight = ao_flight_number;
+       ao_log_write(&ao_log_data);
+
+       /* Write the whole contents of the ring to the log
+        * when starting up.
+        */
+       ao_log_data_pos = ao_data_ring_next(ao_data_head);
+       next_sensor = ao_data_ring[ao_log_data_pos].tick;
+       ao_log_state = ao_flight_startup;
+       for (;;) {
+               /* Write samples to EEPROM */
+               while (ao_log_data_pos != ao_data_head) {
+                       ao_log_data.tick = ao_data_ring[ao_log_data_pos].tick;
+                       if ((int16_t) (ao_log_data.tick - next_sensor) >= 0) {
+                               ao_log_data.type = AO_LOG_SENSOR;
+                               ao_log_data.u.sensor.pressure = ao_data_motor_pressure(&ao_data_ring[ao_log_data_pos]);
+                               ao_log_data.u.sensor.v_batt = ao_data_ring[ao_log_data_pos].adc.v_batt;
+                               ao_log_data.u.sensor.accel = ao_data_accel(&ao_data_ring[ao_log_data_pos]);
+                               ao_log_data.u.sensor.accel_across = ao_data_across(&ao_data_ring[ao_log_data_pos]);
+                               ao_log_data.u.sensor.accel_along = ao_data_along(&ao_data_ring[ao_log_data_pos]);
+                               ao_log_data.u.sensor.accel_through = ao_data_through(&ao_data_ring[ao_log_data_pos]);
+                               ao_log_write(&ao_log_data);
+                               if (ao_log_state <= ao_flight_coast)
+                                       next_sensor = ao_log_data.tick + AO_SENSOR_INTERVAL_ASCENT;
+                               else
+                                       next_sensor = ao_log_data.tick + AO_SENSOR_INTERVAL_DESCENT;
+                       }
+                       ao_log_data_pos = ao_data_ring_next(ao_log_data_pos);
+               }
+#if HAS_FLIGHT
+               /* Write state change to EEPROM */
+               if (ao_flight_state != ao_log_state) {
+                       ao_log_state = ao_flight_state;
+                       ao_log_data.type = AO_LOG_STATE;
+                       ao_log_data.tick = ao_time();
+                       ao_log_data.u.state.state = ao_log_state;
+                       ao_log_data.u.state.reason = 0;
+                       ao_log_write(&ao_log_data);
+
+                       if (ao_log_state == ao_flight_landed)
+                               ao_log_stop();
+               }
+#endif
+
+               ao_log_flush();
+
+               /* Wait for a while */
+               ao_delay(AO_MS_TO_TICKS(100));
+
+               /* Stop logging when told to */
+               while (!ao_log_running)
+                       ao_sleep(&ao_log_running);
+       }
+}
+#endif /* HAS_FLIGHT */
+
index 26604d1ad4d784a96318dae4e8115327fe702cbc..831ba874cc3656d312aca76ff2409cbb03e8a7fa 100644 (file)
@@ -285,6 +285,15 @@ ao_report(void)
                        while (c-- && ao_flight_state == ao_flight_pad)
                                pause(AO_MS_TO_TICKS(100));
                }
+#endif
+#if HAS_PAD_REPORT
+               while (ao_flight_state == ao_flight_pad) {
+                       uint8_t c;
+                       ao_report_flight_state();
+                       c = 50;
+                       while (c-- && ao_flight_state == ao_flight_pad)
+                               pause(AO_MS_TO_TICKS(100));
+               }
 #endif
                while (ao_report_state == ao_flight_state)
                        ao_sleep(&ao_flight_state);
index 67f20aff9093b5941a3ccee9ffc5e6e752f96479..2c77c36920ed5755046e158c9e32f4e92e2d9aae 100644 (file)
@@ -44,10 +44,12 @@ alt_t               ao_sample_height;
 #if HAS_ACCEL
 accel_t                ao_sample_accel;
 #endif
-#if HAS_GYRO
+#if HAS_IMU
 accel_t                ao_sample_accel_along;
 accel_t                ao_sample_accel_across;
 accel_t                ao_sample_accel_through;
+#endif
+#if HAS_GYRO
 gyro_t         ao_sample_roll;
 gyro_t         ao_sample_pitch;
 gyro_t         ao_sample_yaw;
@@ -55,6 +57,9 @@ angle_t               ao_sample_orient;
 angle_t                ao_sample_orients[AO_NUM_ORIENT];
 uint8_t                ao_sample_orient_pos;
 #endif
+#ifdef HAS_MOTOR_PRESSURE
+motor_pressure_t       ao_sample_motor_pressure;
+#endif
 
 uint8_t                ao_sample_data;
 
@@ -73,15 +78,22 @@ accel_t             ao_accel_2g;            /* factory accel calibration */
 int32_t                ao_accel_scale;         /* sensor to m/s² conversion */
 #endif
 
-#if HAS_GYRO
+#if HAS_IMU
 accel_t                ao_ground_accel_along;
 accel_t                ao_ground_accel_across;
 accel_t                ao_ground_accel_through;
+#endif
+
+#if HAS_GYRO
 int32_t                ao_ground_pitch;
 int32_t                ao_ground_yaw;
 int32_t                ao_ground_roll;
 #endif
 
+#if HAS_MOTOR_PRESSURE
+motor_pressure_t       ao_ground_motor_pressure;
+#endif
+
 static uint8_t ao_preflight;           /* in preflight mode */
 
 static uint16_t        nsamples;
@@ -91,15 +103,20 @@ int32_t ao_sample_pres_sum;
 #if HAS_ACCEL
 int32_t ao_sample_accel_sum;
 #endif
-#if HAS_GYRO
+#if HAS_IMU
 int32_t ao_sample_accel_along_sum;
 int32_t ao_sample_accel_across_sum;
 int32_t        ao_sample_accel_through_sum;
+#endif
+#if HAS_GYRO
 int32_t ao_sample_pitch_sum;
 int32_t ao_sample_yaw_sum;
 int32_t        ao_sample_roll_sum;
 static struct ao_quaternion ao_rotation;
 #endif
+#if HAS_MOTOR_PRESSURE
+int32_t ao_sample_motor_pressure_sum;
+#endif
 
 #if HAS_FLIGHT_DEBUG
 extern uint8_t ao_orient_test;
@@ -114,13 +131,18 @@ ao_sample_preflight_add(void)
 #if HAS_BARO
        ao_sample_pres_sum += ao_sample_pres;
 #endif
-#if HAS_GYRO
+#if HAS_IMU
        ao_sample_accel_along_sum += ao_sample_accel_along;
        ao_sample_accel_across_sum += ao_sample_accel_across;
        ao_sample_accel_through_sum += ao_sample_accel_through;
+#endif
+#if HAS_GYRO
        ao_sample_pitch_sum += ao_sample_pitch;
        ao_sample_yaw_sum += ao_sample_yaw;
        ao_sample_roll_sum += ao_sample_roll;
+#endif
+#if HAS_MOTOR_PRESSURE
+       ao_sample_motor_pressure_sum += ao_sample_motor_pressure;
 #endif
        ++nsamples;
 }
@@ -184,16 +206,22 @@ ao_sample_preflight_set(void)
        ao_ground_height = pres_to_altitude(ao_ground_pres);
        ao_sample_pres_sum = 0;
 #endif
-#if HAS_GYRO
+#if HAS_IMU
        ao_ground_accel_along = ao_sample_accel_along_sum >> 9;
        ao_ground_accel_across = ao_sample_accel_across_sum >> 9;
        ao_ground_accel_through = ao_sample_accel_through_sum >> 9;
-       ao_ground_pitch = ao_sample_pitch_sum;
-       ao_ground_yaw = ao_sample_yaw_sum;
-       ao_ground_roll = ao_sample_roll_sum;
        ao_sample_accel_along_sum = 0;
        ao_sample_accel_across_sum = 0;
        ao_sample_accel_through_sum = 0;
+#endif
+#if HAS_MOTOR_PRESSURE
+       ao_ground_motor_pressure = ao_sample_motor_pressure_sum >> 9;
+       ao_sample_motor_pressure_sum = 0;
+#endif
+#if HAS_GYRO
+       ao_ground_pitch = ao_sample_pitch_sum;
+       ao_ground_yaw = ao_sample_yaw_sum;
+       ao_ground_roll = ao_sample_roll_sum;
        ao_sample_pitch_sum = 0;
        ao_sample_yaw_sum = 0;
        ao_sample_roll_sum = 0;
@@ -229,7 +257,7 @@ ao_sample_preflight_set(void)
                       (ao_ground_accel_across - ao_config.accel_zero_across),
                       (ao_ground_accel_through - ao_config.accel_zero_through),
                       (ao_ground_accel_along - ao_config.accel_zero_along));
-#endif 
+#endif
 
        ao_sample_compute_orient();
        ao_sample_set_all_orients();
@@ -310,6 +338,10 @@ ao_sample_preflight_update(void)
                ++nsamples;
        else
                ao_sample_preflight_set();
+#if !HAS_BARO
+       if ((nsamples & 0x3f) == 0)
+               ao_kalman_reset_accumulate();
+#endif
 }
 
 #if 0
@@ -353,14 +385,19 @@ ao_sample(void)
 #if HAS_ACCEL
                ao_sample_accel = ao_data_accel(ao_data);
 #endif
-#if HAS_GYRO
+#if HAS_IMU
                ao_sample_accel_along = ao_data_along(ao_data);
                ao_sample_accel_across = ao_data_across(ao_data);
                ao_sample_accel_through = ao_data_through(ao_data);
+#endif
+#if HAS_GYRO
                ao_sample_pitch = ao_data_pitch(ao_data);
                ao_sample_yaw = ao_data_yaw(ao_data);
                ao_sample_roll = ao_data_roll(ao_data);
 #endif
+#if HAS_MOTOR_PRESSURE
+               ao_sample_motor_pressure = ao_data_motor_pressure(ao_data);
+#endif
 
                if (ao_preflight)
                        ao_sample_preflight();
@@ -393,13 +430,15 @@ ao_sample_init(void)
        ao_sample_accel_sum = 0;
        ao_sample_accel = 0;
 #endif
-#if HAS_GYRO
+#if HAS_IMU
        ao_sample_accel_along_sum = 0;
        ao_sample_accel_across_sum = 0;
        ao_sample_accel_through_sum = 0;
        ao_sample_accel_along = 0;
        ao_sample_accel_across = 0;
        ao_sample_accel_through = 0;
+#endif
+#if HAS_GYRO
        ao_sample_pitch_sum = 0;
        ao_sample_yaw_sum = 0;
        ao_sample_roll_sum = 0;
index 4c51a58c3f0a0089f893f3004a239b3e37d7b3cf..8e64095b79a407478d1f5af3082f3e26fedbee81 100644 (file)
@@ -133,16 +133,21 @@ extern accel_t    ao_ground_accel;        /* startup acceleration */
 extern accel_t         ao_accel_2g;            /* factory accel calibration */
 extern int32_t ao_accel_scale;         /* sensor to m/s² conversion */
 #endif
-#if HAS_GYRO
+#if HAS_IMU
 extern accel_t ao_ground_accel_along;
 extern accel_t ao_ground_accel_across;
 extern accel_t ao_ground_accel_through;
-extern int32_t ao_ground_pitch;        /* * 512 */
-extern int32_t ao_ground_yaw;          /* * 512 */
-extern int32_t ao_ground_roll;         /* * 512 */
 extern accel_t ao_sample_accel_along;
 extern accel_t ao_sample_accel_across;
 extern accel_t ao_sample_accel_through;
+#endif
+#if HAS_GYRO
+#ifndef HAS_IMU
+#define HAS_IMU        1
+#endif
+extern int32_t ao_ground_pitch;        /* * 512 */
+extern int32_t ao_ground_yaw;          /* * 512 */
+extern int32_t ao_ground_roll;         /* * 512 */
 extern gyro_t  ao_sample_roll;
 extern gyro_t  ao_sample_pitch;
 extern gyro_t  ao_sample_yaw;
@@ -151,6 +156,10 @@ extern angle_t     ao_sample_orient;
 extern angle_t ao_sample_orients[AO_NUM_ORIENT];
 extern uint8_t ao_sample_orient_pos;
 #endif
+#if HAS_MOTOR_PRESSURE
+extern motor_pressure_t ao_ground_motor_pressure;
+extern motor_pressure_t ao_sample_motor_pressure;
+#endif
 
 void ao_sample_init(void);
 
@@ -194,4 +203,8 @@ extern ao_v_t                       ao_error_a;
 
 void ao_kalman(void);
 
+#if !HAS_BARO
+void ao_kalman_reset_accumulate(void);
+#endif
+
 #endif /* _AO_SAMPLE_H_ */
index 1ae94c1548bef0c9261a25dde823fce1bb18ca6f..3965919515eeddc6d4f78a62eecf82bcb4f33cb7 100644 (file)
@@ -37,8 +37,8 @@ CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
 
 LDFLAGS=-nostartfiles $(CFLAGS) -L$(TOPDIR)/lpc -Taltos-loader.ld
 
-PROGNAME=altos-flash
-PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
+PROGNAME=$(HARDWARE)-altos-flash
+PROG=$(PROGNAME)-$(VERSION).elf
 
 $(PROG): Makefile $(OBJ) altos-loader.ld
        $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
@@ -50,7 +50,7 @@ all: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 5b38f572d2a8337ec8cffa6072c9493f17a9b10a..a164a2057b8070ea987b9b9fb1ff8baeecec1a8f 100644 (file)
@@ -73,7 +73,7 @@ load-slow: $(HEX)
 distclean:     clean
 
 clean:
-       rm -f *.o *.elf *.ihx $(SCRIPT)
+       rm -f *.o *.elf *.ihx $(SCRIPT) *.map
        rm -f ao_product.h
 
 publish: $(PUBLISH_HEX) $(PUBLISH_SCRIPT)
index a662e49b16e61f1b87ab9e8efd535c3fc4227264..28aba58540e8425728733a761372c41fd8707c96 100644 (file)
@@ -75,7 +75,7 @@ $(PROG): Makefile $(OBJ) micropeak.ld
 distclean:     clean
 
 clean:
-       rm -f *.o *.elf *.ihx
+       rm -f *.o *.elf *.ihx *.map
        rm -f ao_product.h
 
 publish: $(PUBLISH_HEX)
index 74769802fc055942bde95199317adc657e143bd8..3ec43e668570e91e1ae485147946f483e7cd8913 100644 (file)
@@ -73,7 +73,7 @@ load-slow: $(HEX)
 distclean:     clean
 
 clean:
-       rm -f *.o *.elf *.ihx $(SCRIPT)
+       rm -f *.o *.elf *.ihx *.map $(SCRIPT)
        rm -f ao_product.h
 
 publish: $(PUBLISH_HEX) $(PUBLISH_SCRIPT)
index 4850ef14f6e7eabc64f844eff25511b0d98dbaf6..8970995bc4c4d3525ad3556eaf02710d102fcb0b 100644 (file)
@@ -73,7 +73,7 @@ load-slow: $(HEX)
 distclean:     clean
 
 clean:
-       rm -f *.o *.elf *.ihx $(SCRIPT)
+       rm -f *.o *.elf *.ihx *.map $(SCRIPT)
        rm -f ao_product.h
 
 publish: $(PUBLISH_HEX) $(PUBLISH_SCRIPT)
index 4a3864318eb342c85d849fd17dd9b991f385f15e..37fad6d1638b5e59d0bfd9c8712c93986ee0c492 100644 (file)
@@ -37,8 +37,8 @@ CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS)
 
 LDFLAGS=-nostartfiles $(CFLAGS) -L$(TOPDIR)/stm -Taltos-loader.ld -n
 
-PROGNAME=altos-flash
-PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
+PROGNAME=$(HARDWARE)-altos-flash
+PROG=$(PROGNAME)-$(VERSION).elf
 
 $(PROG): Makefile $(OBJ) altos-loader.ld
        $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
@@ -50,7 +50,7 @@ all: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index bc5aa1acb3c4eb24dc40ba236bc7da584c2cec84..51702d526ddeccbcc990dc7ca4cf160a78bd9441 100644 (file)
@@ -37,9 +37,9 @@ CFLAGS = $(PRODUCT_DEF) $(STM32F4_CFLAGS)
 
 LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos-loader.ld
 
-PROGNAME=altos-flash
-PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
-BIN=$(HARDWARE)-$(PROGNAME)-$(VERSION).bin
+PROGNAME=$(HARDWARE)-altos-flash
+PROG=$(PROGNAME)-$(VERSION).elf
+BIN=$(PROGNAME)-$(VERSION).bin
 
 MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin
 FLASH_ADDR=0x08000000
@@ -57,7 +57,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf $(HARDWARE)-$(PROGNAME)-*.bin
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.bin $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 08a4b1773e00be742ac16856a883402d7e4f16b3..83aff3c51390810c68ff7e53fd70e1a36ae3cf59 100644 (file)
@@ -37,8 +37,8 @@ CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS)
 
 LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Wl,-Taltos-loader.ld -n
 
-PROGNAME=altos-flash
-PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
+PROGNAME=$(HARDWARE)-altos-flash
+PROG=$(PROGNAME)-$(VERSION).elf
 
 $(PROG): Makefile $(OBJ) altos-loader.ld
        $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
@@ -50,7 +50,7 @@ all: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index bbb04e77c1292669b8210b6297b903321dcf6998..07e1cb3bc96331d4dd5083d20e402b9f6ee7975f 100644 (file)
@@ -37,9 +37,9 @@ CFLAGS = $(PRODUCT_DEF) $(STMF0_CFLAGS)
 
 LDFLAGS=-nostartfiles $(CFLAGS) -L$(TOPDIR)/stmf0 -Taltos-loader.ld
 
-PROGNAME=altos-flash
-PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
-BIN=$(HARDWARE)-$(PROGNAME)-$(VERSION).bin
+PROGNAME=$(HARDWARE)-altos-flash
+PROG=$(PROGNAME)-$(VERSION).elf
+BIN=$(PROGNAME)-$(VERSION).bin
 
 MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin
 FLASH_ADDR=0x08000000
@@ -57,7 +57,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf $(HARDWARE)-$(PROGNAME)-*.bin
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.bin $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index defe259896e67b4eaf0f78ae0be48808dddcbede..d46899d575c409f149fd7e50767debb0422f24d1 100644 (file)
@@ -73,6 +73,18 @@ ao_spi_speed(uint32_t hz)
 
 #define AO_SPI_INDEX(id)       ((id) & AO_SPI_INDEX_MASK)
 #define AO_SPI_CONFIG(id)      ((id) & AO_SPI_CONFIG_MASK)
+#define AO_SPI_PIN_CONFIG(id)  ((id) & (AO_SPI_INDEX_MASK | AO_SPI_CONFIG_MASK))
+
+#define AO_SPI_CPOL_BIT                4
+#define AO_SPI_CPHA_BIT                5
+#define AO_SPI_CPOL(id)                ((uint32_t) (((id) >> AO_SPI_CPOL_BIT) & 1))
+#define AO_SPI_CPHA(id)                ((uint32_t) (((id) >> AO_SPI_CPHA_BIT) & 1))
+
+#define AO_SPI_MAKE_MODE(pol,pha)      (((pol) << AO_SPI_CPOL_BIT) | ((pha) << AO_SPI_CPHA_BIT))
+#define AO_SPI_MODE_0          AO_SPI_MAKE_MODE(0,0)
+#define AO_SPI_MODE_1          AO_SPI_MAKE_MODE(0,1)
+#define AO_SPI_MODE_2          AO_SPI_MAKE_MODE(1,0)
+#define AO_SPI_MODE_3          AO_SPI_MAKE_MODE(1,1)
 
 uint8_t
 ao_spi_try_get(uint8_t spi_index, uint32_t speed, uint8_t task_id);
index d83f06580380014fb0a09583ee276e9b19dc5b49..0ce114cb0aeef99cffbc2297d70685bd5b1120df 100644 (file)
@@ -25,7 +25,7 @@ struct ao_spi_stm_info {
 };
 
 static uint8_t         ao_spi_mutex[STM_NUM_SPI];
-static uint8_t         ao_spi_index[STM_NUM_SPI];
+static uint8_t         ao_spi_pin_config[STM_NUM_SPI];
 
 static const struct ao_spi_stm_info ao_spi_stm_info[STM_NUM_SPI] = {
        {
@@ -358,11 +358,11 @@ ao_spi_duplex(void *out, void *in, uint16_t len, uint8_t spi_index)
 }
 
 static void
-ao_spi_disable_index(uint8_t spi_index)
+ao_spi_disable_pin_config(uint8_t spi_pin_config)
 {
-       /* Disable current config
+       /* disable config
         */
-       switch (spi_index) {
+       switch (spi_pin_config) {
        case AO_SPI_1_PA5_PA6_PA7:
                stm_gpio_set(&stm_gpioa, 5, 1);
                stm_moder_set(&stm_gpioa, 5, STM_MODER_OUTPUT);
@@ -385,9 +385,11 @@ ao_spi_disable_index(uint8_t spi_index)
 }
 
 static void
-ao_spi_enable_index(uint8_t spi_index)
+ao_spi_enable_pin_config(uint8_t spi_pin_config)
 {
-       switch (spi_index) {
+       /* Disable current config
+        */
+       switch (spi_pin_config) {
        case AO_SPI_1_PA5_PA6_PA7:
                stm_afr_set(&stm_gpioa, 5, STM_AFR_AF0);
                stm_afr_set(&stm_gpioa, 6, STM_AFR_AF0);
@@ -409,6 +411,7 @@ ao_spi_enable_index(uint8_t spi_index)
 static void
 ao_spi_config(uint8_t spi_index, uint32_t speed)
 {
+       uint8_t         spi_pin_config = AO_SPI_PIN_CONFIG(spi_index);
        uint8_t         id = AO_SPI_INDEX(spi_index);
        struct stm_spi  *stm_spi = ao_spi_stm_info[id].stm_spi;
 
@@ -424,19 +427,19 @@ ao_spi_config(uint8_t spi_index, uint32_t speed)
                break;
 #endif
        }
-       if (spi_index != ao_spi_index[id]) {
+       if (spi_pin_config != ao_spi_pin_config[id]) {
 
                /* Disable old config
                 */
-               ao_spi_disable_index(ao_spi_index[id]);
+               ao_spi_disable_pin_config(ao_spi_pin_config[id]);
 
                /* Enable new config
                 */
-               ao_spi_enable_index(spi_index);
+               ao_spi_enable_pin_config(spi_pin_config);
 
                /* Remember current config
                 */
-               ao_spi_index[id] = spi_index;
+               ao_spi_pin_config[id] = spi_pin_config;
        }
        stm_spi->cr2 = SPI_CR2;
        stm_spi->cr1 = ((0 << STM_SPI_CR1_BIDIMODE) |                   /* Three wire mode */
@@ -451,8 +454,8 @@ ao_spi_config(uint8_t spi_index, uint32_t speed)
                        (1 << STM_SPI_CR1_SPE) |                        /* Enable SPI unit */
                        (speed << STM_SPI_CR1_BR) |                     /* baud rate to pclk/4 */
                        (1 << STM_SPI_CR1_MSTR) |
-                       (0 << STM_SPI_CR1_CPOL) |                       /* Format 0 */
-                       (0 << STM_SPI_CR1_CPHA));
+                       (AO_SPI_CPOL(spi_index) << STM_SPI_CR1_CPOL) |  /* Format */
+                       (AO_SPI_CPHA(spi_index) << STM_SPI_CR1_CPHA));
 }
 
 uint8_t
@@ -502,7 +505,7 @@ ao_spi_channel_init(uint8_t spi_index)
        uint8_t         id = AO_SPI_INDEX(spi_index);
        struct stm_spi  *stm_spi = ao_spi_stm_info[id].stm_spi;
 
-       ao_spi_disable_index(spi_index);
+       ao_spi_disable_pin_config(AO_SPI_PIN_CONFIG(spi_index));
 
        stm_spi->cr1 = 0;
        stm_spi->cr2 = SPI_CR2_SYNC;
@@ -579,7 +582,7 @@ ao_spi_init(void)
        stm_ospeedr_set(&stm_gpiob, 5, SPI_1_OSPEEDR);
 # endif
        stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SPI1EN);
-       ao_spi_index[0] = AO_SPI_CONFIG_NONE;
+       ao_spi_pin_config[0] = AO_SPI_CONFIG_NONE;
        ao_spi_channel_init(STM_SPI_INDEX(1));
 #endif
 
index 4230d1b98909fe6853eadccecac4f9cef59ffdaa..4a5cae7c935492526156cf4a27129de17330121f 100644 (file)
@@ -112,7 +112,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 49b70aafd48d4fd42526d01fdd02d0b44a10c8c6..97f71114eaf5e7e08ce365de412a79e551c139ba 100644 (file)
@@ -89,7 +89,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index eba83fbceed3444adfd816a99abe2ac02119b6c2..309493af77c578fb5e84296e5428246e9f412641 100644 (file)
@@ -70,7 +70,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index abb97baf3aecf3e23d88db7f59fff72fb3411623..dd4d7ab2d47c498302aa03554148147e340171d9 100644 (file)
@@ -68,7 +68,7 @@ load: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 1ec0dccf903d3549660031df0d16c0ae5b99a1b6..031fffe062460b25b08f5365880f84a98cae6190 100644 (file)
@@ -78,7 +78,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 48a71231b1b57494d8e7ac47f0a5bc41e06f36b5..79ac28da77f6d4e1a8f641d1007e8a54bba7aa45 100644 (file)
@@ -77,7 +77,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME).map
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index afcdcd67e6932e3654cd28a05f47a75b13b2b2dc..0f3e5809cd85cf1dfb6361c1ed2f41d4bf95764e 100644 (file)
@@ -82,7 +82,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index a462d5b5407f3733257592cd1c9452a8ffdf7554..1a23ed3885ef85f2301926be07fd3685041bfd6f 100644 (file)
@@ -77,7 +77,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 73d8c2455bd4554666c7883bed1a995538c878cd..4620eee2fb005878c4a7bb43beb46f1fc0cbc79f 100644 (file)
@@ -75,7 +75,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o ao_serial_lpc.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o ao_serial_lpc.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index aa644298a2f11cca28c35d339e9492b87ce64c3a..384742599b8bcbcbaf6696cabcb227c1354bc314 100644 (file)
@@ -78,7 +78,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o ao_serial_lpc.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o ao_serial_lpc.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 24410e0d375403c771b8b43c321b61404d133494..3d3a60a7664ef91930a24314e3403123f0d6a1cc 100644 (file)
@@ -80,7 +80,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o ao_serial_stm.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o ao_serial_stm.h $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 04f3b8ff9942bfdc98d025994bced25add2026ed..03ab6515bea13b5fbd17c3452dc1667b7afef420 100644 (file)
@@ -95,7 +95,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 2b8af054fc328aa20a0b913d7c10a9c0a29dbbf8..3e01923ae03f38ac80cfca191186275c0a17439d 100644 (file)
@@ -92,7 +92,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 87e5d72dceae096ca527de611c269930cc80ab5b..f6bf50193ab51c155288667d36351ae89cb621d3 100644 (file)
@@ -93,7 +93,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 1ae5981fa7fdb7f85088b69775acf4ad63f7c14f..5b0787206c18fb472606412fed5ed733d5efeaff 100644 (file)
@@ -95,7 +95,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index c0a90d9d5d18504cb835d2ee1d6a5228266e5e04..f7d25074a4acf98a18d50a6ba015d17ed7e167d4 100644 (file)
@@ -86,7 +86,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 3357a92bda4e0dda8818f3589b2ee1375fca8159..d6bfacc5da7254525101139ca6a44ab080631552 100644 (file)
@@ -123,7 +123,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index c88ff42fb056421396e69ed2b74a3cb74362ff1c..0e4e00831c81f24385cdbf22d72bf5aa49e04b5d 100644 (file)
@@ -125,7 +125,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 6c84792efd28f853caced2286df9c5f2417c8bc1..9036ca568f9fb18f31a8a29aaad28889d596e785 100644 (file)
@@ -124,7 +124,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 87a59c6464ba9a5ea4aaab0c118c4e1b39253217..521816774337dd4172db564869f3c55ed7829e91 100644 (file)
@@ -121,7 +121,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 373a497956f8e09a8d04274325ab31f704d36b66..16db22d6a0d27fa24032cc402f576ba6500d7f1f 100644 (file)
@@ -120,7 +120,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 9b66c5180407eb08a921d4a4f06b5d8750222699..4f196fdd78ee21cb79ebdcf57f796f65e8a80072 100644 (file)
@@ -112,7 +112,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 68a540c48c2b31a09b504acf8b566e4d5522a9a2..320b9fbeaaeafbcc020cbf031c4cb842d4f7157b 100644 (file)
@@ -112,7 +112,7 @@ $(OBJ): $(INC)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 1ed25c1842358e20624c58e80a4cadc6407e1378..b294274d5d785cb85b7e8518a7da22c4be473802 100644 (file)
@@ -82,7 +82,7 @@ load: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index e3af02f655b8479f4a6591040febe3dfe833d881..a7cfad72438637105075f70a6b7d9f5440d98e16 100644 (file)
@@ -17,6 +17,7 @@ ao_flight_test_mm
 ao_flight_test_noisy_accel
 ao_flight_test_metrum
 ao_flight_test_mini
+ao_flight_test_motor
 ao_micropeak_test
 ao_aes_test
 ao_lisp_test
index 7bd13db9a461d8095ccd46c2b3b28eab112a7ede..55a3fbeb5abda9c98d7bffc7b7e587bd575a092e 100644 (file)
@@ -11,7 +11,7 @@ PROGS=ao_flight_test ao_flight_test_baro ao_flight_test_accel ao_flight_test_noi
 
 INCS=ao_kalman.h ao_ms5607.h ao_log.h ao_data.h altitude-pa.h altitude.h ao_quaternion.h ao_eeprom_read.h
 TEST_SRC=ao_flight_test.c
-TEST_SRC_ALL=ao_flight_test.c ao_eeprom_read.c ao_eeprom_read_old.c
+TEST_SRC_ALL=ao_flight_test.c ao_eeprom_read.c ao_eeprom_read_old.c ao_data.c
 TEST_LIB=-ljson-c
 
 KALMAN=make-kalman 
@@ -46,6 +46,9 @@ ao_flight_test_metrum: $(TEST_SRC_ALL) ao_host.h ao_flight.c ao_sample.c ao_kalm
 ao_flight_test_mini: $(TEST_SRC_ALL) ao_host.h ao_flight.c ao_sample.c ao_kalman.c ao_pyro.c ao_pyro.h $(INCS)
        cc -DEASYMINI=1 -DHAS_ACCEL=0 $(CFLAGS) -o $@ $(TEST_SRC)  $(TEST_LIB) -lm
 
+ao_flight_test_motor: $(TEST_SRC_ALL) ao_host.h ao_flight.c ao_sample.c ao_kalman.c ao_pyro.c ao_pyro.h $(INCS)
+       cc -DEASYMOTOR_V_2=1 $(CFLAGS) -o $@ $(TEST_SRC) $(TEST_LIB) -lm
+
 ao_gps_test: ao_gps_test.c ao_gps_sirf.c ao_gps_print.c ao_host.h
        cc $(CFLAGS) -o $@ $<
 
index ff480e2db9fd7ff7890ebbc46f309870c51e9c64..d12652b49617126a5d9177877f800c5886f84b4a 100644 (file)
@@ -19,6 +19,7 @@
 #define _GNU_SOURCE
 
 #include <stdint.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -47,7 +48,7 @@
 
 int ao_gps_new;
 
-#if !defined(TELEMEGA) && !defined(TELEMETRUM_V2) && !defined(EASYMINI)
+#if !defined(TELEMEGA) && !defined(TELEMETRUM_V2) && !defined(EASYMINI) && !defined(EASYMOTOR_V_2)
 #define TELEMETRUM_V1 1
 #endif
 
@@ -58,6 +59,7 @@ int ao_gps_new;
 #define HAS_MMA655X            1
 #define HAS_HMC5883            1
 #define HAS_BEEP               1
+#define HAS_BARO               1
 #define AO_CONFIG_MAX_SIZE     1024
 #define AO_MMA655X_INVERT      0
 
@@ -75,6 +77,7 @@ struct ao_adc {
 #define HAS_MMA655X            1
 #define AO_MMA655X_INVERT      0
 #define HAS_BEEP               1
+#define HAS_BARO               1
 #define AO_CONFIG_MAX_SIZE     1024
 
 struct ao_adc {
@@ -116,6 +119,26 @@ struct ao_adc {
 #define HAS_ACCEL 1
 #define HAS_ACCEL_REF 0
 #endif
+#define HAS_BARO               1
+
+#endif
+
+#if EASYMOTOR_V_2
+#define AO_ADC_NUM_SENSE       0
+#define HAS_ADXL375            1
+#define HAS_BEEP               1
+#define AO_CONFIG_MAX_SIZE     1024
+#define USE_ADXL375_IMU                1
+#define AO_ADXL375_INVERT      0
+#define HAS_IMU                        1
+#define AO_ADXL375_AXIS                x
+#define AO_ADXL375_ACROSS_AXIS y
+#define AO_ADXL375_THROUGH_AXIS        z
+
+struct ao_adc {
+       int16_t                 pressure;
+       int16_t                 v_batt;
+};
 
 #endif
 
@@ -369,11 +392,15 @@ int16_t           ao_flight_number;
 
 extern uint16_t        ao_sample_tick;
 
+#if HAS_BARO
 extern alt_t   ao_sample_height;
+#endif
 extern accel_t ao_sample_accel;
 extern int32_t ao_accel_scale;
+#if HAS_BARO
 extern alt_t   ao_ground_height;
 extern alt_t   ao_sample_alt;
+#endif
 
 double ao_sample_qangle;
 
@@ -385,6 +412,7 @@ uint16_t    prev_tick;
 #include "ao_sqrt.c"
 #include "ao_sample.c"
 #include "ao_flight.c"
+#include "ao_data.c"
 #if TELEMEGA
 #define AO_PYRO_NUM    4
 
@@ -514,9 +542,11 @@ ao_insert(void)
                prev_tick = ao_data_static.tick;
                time = (double) (ao_data_static.tick + tick_offset) / 100;
 
+               double height = 0;
+#if HAS_BARO
 #if TELEMEGA || TELEMETRUM_V2 || EASYMINI
                ao_ms5607_convert(&ao_data_static.ms5607_raw, &ao_data_static.ms5607_cooked);
-               double height = ao_pa_to_altitude(ao_data_static.ms5607_cooked.pres) - ao_ground_height;
+               height = ao_pa_to_altitude(ao_data_static.ms5607_cooked.pres) - ao_ground_height;
 
                /* Hack to skip baro spike at accidental drogue charge
                 * firing in 2015-09-26-serial-2093-flight-0012.eeprom
@@ -532,7 +562,8 @@ ao_insert(void)
                        }
                }
 #else
-               double  height = ao_pres_to_altitude(ao_data_static.adc.pres_real) - ao_ground_height;
+               height = ao_pres_to_altitude(ao_data_static.adc.pres_real) - ao_ground_height;
+#endif
 #endif
 
                if (ao_test_max_height < height) {
@@ -752,15 +783,21 @@ ao_sleep(void *wchan)
 #if TELEMETRUM_V1
                                ao_data_static.adc.accel = ao_flight_ground_accel;
 #endif
+#if EASYMOTOR_V_2
+                               ao_data_static.adxl375.AO_ADXL375_AXIS = ao_flight_ground_accel;
+#endif
 
                                ao_insert();
                                return;
                        }
 
                        if (eeprom) {
-#if TELEMEGA
+#if TELEMEGA || EASYMOTOR_V_2
                                struct ao_log_mega      *log_mega;
 #endif
+#if EASYMOTOR_V_2
+                               struct ao_log_motor     *log_motor;
+#endif
 #if TELEMETRUM_V2
                                struct ao_log_metrum    *log_metrum;
 #endif
@@ -928,6 +965,63 @@ ao_sleep(void *wchan)
                                                break;
                                        }
                                        break;
+#endif
+#if EASYMOTOR_V_2
+                               case AO_LOG_FORMAT_TELEMEGA_3:
+                                       log_mega = (struct ao_log_mega *) &eeprom->data[eeprom_offset];
+                                       eeprom_offset += sizeof (*log_mega);
+                                       switch (log_mega->type) {
+                                       case AO_LOG_FLIGHT:
+                                               ao_flight_number = log_mega->u.flight.flight;
+                                               ao_flight_ground_accel = log_mega->u.flight.ground_accel;
+                                               ao_flight_started = 1;
+                                               break;
+                                       case AO_LOG_SENSOR:
+                                               ao_data_static.tick = log_mega->tick;
+                                               ao_data_static.adxl375.AO_ADXL375_AXIS = -log_mega->u.sensor.accel;
+                                               ao_records_read++;
+                                               ao_insert();
+                                               return;
+                                       }
+                                       break;
+                               case AO_LOG_FORMAT_TELEMEGA_4:
+                                       log_mega = (struct ao_log_mega *) &eeprom->data[eeprom_offset];
+                                       eeprom_offset += sizeof (*log_mega);
+                                       switch (log_mega->type) {
+                                       case AO_LOG_FLIGHT:
+                                               ao_flight_number = log_mega->u.flight.flight;
+                                               ao_flight_ground_accel = log_mega->u.flight.ground_accel;
+                                               ao_flight_started = 1;
+                                               break;
+                                       case AO_LOG_SENSOR:
+                                               ao_data_static.tick = log_mega->tick;
+                                               ao_data_static.adxl375.AO_ADXL375_AXIS = log_mega->u.sensor.accel;
+                                               ao_records_read++;
+                                               ao_insert();
+                                               return;
+                                       }
+                                       break;
+                               case AO_LOG_FORMAT_EASYMOTOR:
+                                       log_motor = (struct ao_log_motor *) &eeprom->data[eeprom_offset];
+                                       eeprom_offset += sizeof (*log_motor);
+                                       switch (log_motor->type) {
+                                       case AO_LOG_FLIGHT:
+                                               ao_flight_number = log_motor->u.flight.flight;
+                                               ao_flight_ground_accel = log_motor->u.flight.ground_accel;
+                                               ao_flight_started = 1;
+                                               break;
+                                       case AO_LOG_SENSOR:
+                                               ao_data_static.tick = log_motor->tick;
+                                               ao_data_static.adc.pressure = log_motor->u.sensor.pressure;
+                                               ao_data_static.adc.v_batt = log_motor->u.sensor.v_batt;
+                                               ao_data_static.adxl375.AO_ADXL375_AXIS = log_motor->u.sensor.accel_along;
+                                               ao_data_static.adxl375.AO_ADXL375_ACROSS_AXIS = log_motor->u.sensor.accel_across;
+                                               ao_data_static.adxl375.AO_ADXL375_THROUGH_AXIS = log_motor->u.sensor.accel_through;
+                                               ao_records_read++;
+                                               ao_insert();
+                                               return;
+                                       }
+                                       break;
 #endif
                                default:
                                        printf ("invalid log format %d\n", log_format);