Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
authorBdale Garbee <bdale@gag.com>
Fri, 4 Nov 2022 08:41:43 +0000 (02:41 -0600)
committerBdale Garbee <bdale@gag.com>
Fri, 4 Nov 2022 08:41:43 +0000 (02:41 -0600)
13 files changed:
altoslib/AltosConfigData.java
altoslib/AltosConfigValues.java
altosui/AltosConfigFCUI.java
ao-bringup/test-easymini-v3.0 [new file with mode: 0755]
ao-bringup/test-easymotor [deleted file]
ao-bringup/test-easymotor-v3 [new file with mode: 0755]
ao-bringup/turnon_easymini
ao-bringup/turnon_easymini_v1.0 [new file with mode: 0755]
ao-bringup/turnon_easymotor
src/kernel/ao_config.c
src/kernel/ao_config.h
src/kernel/ao_data.h
src/kernel/ao_report.c

index da6e7bfc6d8199b228e0b8918219c3fafb6038b2..5b9ee03120689d829d7f789a40218c143837daa8 100644 (file)
@@ -86,6 +86,8 @@ public class AltosConfigData {
        /* HAS_RADIO_10MW */
        public int              radio_10mw;
 
+       public int              report_feet;
+
        /* Storage info replies */
        public int      storage_size;
        public int      storage_erase_unit;
@@ -320,6 +322,8 @@ public class AltosConfigData {
 
                radio_10mw = AltosLib.MISSING;
 
+               report_feet = AltosLib.MISSING;
+
                tracker_motion = AltosLib.MISSING;
                tracker_interval = AltosLib.MISSING;
 
@@ -513,6 +517,8 @@ public class AltosConfigData {
                /* HAS_RADIO_10MW */
                try { radio_10mw = get_int(line, "Radio 10mw limit:"); } catch (Exception e) {}
 
+               try { report_feet = get_int(line, "Report in feet:"); } catch (Exception e) {}
+
                /* HAS_TRACKER */
                try {
                        int[] values = get_values(line, "Tracker setting:");
@@ -747,6 +753,9 @@ public class AltosConfigData {
                if (radio_10mw != AltosLib.MISSING)
                        radio_10mw = source.radio_10mw();
 
+               if (report_feet != AltosLib.MISSING)
+                       report_feet = source.report_feet();
+
                /* HAS_TRACKER */
                if (tracker_motion != AltosLib.MISSING)
                        tracker_motion = source.tracker_motion();
@@ -803,6 +812,7 @@ public class AltosConfigData {
                dest.set_aprs_offset(aprs_offset);
                dest.set_beep(beep);
                dest.set_radio_10mw(radio_10mw);
+               dest.set_report_feet(report_feet);
                dest.set_tracker_motion(tracker_motion);
                dest.set_tracker_interval(tracker_interval);
        }
@@ -926,6 +936,10 @@ public class AltosConfigData {
                if (radio_10mw != AltosLib.MISSING)
                        link.printf("c p %d\n", radio_10mw);
 
+               /* HAS_RADIO_10MW */
+               if (report_feet != AltosLib.MISSING)
+                       link.printf("c u %d\n", report_feet);
+
                /* HAS_TRACKER */
                if (tracker_motion != AltosLib.MISSING && tracker_interval != AltosLib.MISSING)
                        link.printf("c t %d %d\n", tracker_motion, tracker_interval);
index 65b5f0018de5136fbc48b003c5ff52dd0ded9cf3..8fb302779d188892d541c211ddaca607754fa685 100644 (file)
@@ -123,4 +123,8 @@ public interface AltosConfigValues {
        public abstract int radio_10mw() throws AltosConfigDataException;
 
        public abstract void set_radio_10mw(int radio_10mw);
+
+       public abstract int report_feet() throws AltosConfigDataException;
+
+       public abstract void set_report_feet(int radio_10mw);
 }
index 75b294d9b2c01d5acdd440d80a64350420580045..88f8b0808a92a59c68aab2cf982d43bac124949d 100644 (file)
@@ -43,6 +43,7 @@ public class AltosConfigFCUI
        JLabel                  radio_frequency_label;
        JLabel                  radio_enable_label;
        JLabel                  radio_10mw_label;
+       JLabel                  report_feet_label;
        JLabel                  rate_label;
        JLabel                  aprs_interval_label;
        JLabel                  aprs_ssid_label;
@@ -71,6 +72,7 @@ public class AltosConfigFCUI
        JLabel                  radio_calibration_value;
        JRadioButton            radio_enable_value;
        JRadioButton            radio_10mw_value;
+       JComboBox<String>       report_feet_value;
        AltosUIRateList         rate_value;
        JComboBox<String>       aprs_interval_value;
        JComboBox<Integer>      aprs_ssid_value;
@@ -183,6 +185,11 @@ public class AltosConfigFCUI
                "10"
        };
 
+       static String[]         report_feet_values = {
+               "Meters",
+               "Feet",
+       };
+
        /* A window listener to catch closing events and tell the config code */
        class ConfigListener extends WindowAdapter {
                AltosConfigFCUI ui;
@@ -358,6 +365,13 @@ public class AltosConfigFCUI
                        radio_10mw_value.setToolTipText("Older firmware could not limit radio power");
        }
 
+       void set_report_feet_tool_tip() {
+               if (report_feet_value.isVisible())
+                       report_feet_value.setToolTipText("Units used after landing to beep max height");
+               else
+                       report_feet_value.setToolTipText("Older firmware always beeps max height in meters");
+       }
+
        /* Build the UI using a grid bag */
        public AltosConfigFCUI(JFrame in_owner, boolean remote) {
                super (in_owner, title, false);
@@ -616,6 +630,32 @@ public class AltosConfigFCUI
                set_radio_10mw_tool_tip();
                row++;
 
+               /* Report feet */
+               c = new GridBagConstraints();
+               c.gridx = 0; c.gridy = row;
+               c.gridwidth = 4;
+               c.fill = GridBagConstraints.NONE;
+               c.anchor = GridBagConstraints.LINE_START;
+               c.insets = il;
+               c.ipady = 5;
+               report_feet_label = new JLabel("Beep max height in:");
+               pane.add(report_feet_label, c);
+
+               c = new GridBagConstraints();
+               c.gridx = 4; c.gridy = row;
+               c.gridwidth = 4;
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.weightx = 1;
+               c.anchor = GridBagConstraints.LINE_START;
+               c.insets = ir;
+               c.ipady = 5;
+               report_feet_value = new JComboBox<String>(report_feet_values);
+               report_feet_value.setEditable(false);
+               report_feet_value.addItemListener(this);
+               pane.add(report_feet_value, c);
+               set_report_feet_tool_tip();
+               row++;
+
                /* Telemetry Rate */
                c = new GridBagConstraints();
                c.gridx = 0; c.gridy = row;
@@ -1488,6 +1528,31 @@ public class AltosConfigFCUI
                        return AltosLib.MISSING;
        }
 
+       public void set_report_feet(int new_report_feet) {
+               if (new_report_feet != AltosLib.MISSING) {
+                       if (new_report_feet >= report_feet_values.length)
+                               new_report_feet = 0;
+                       if (new_report_feet < 0) {
+                               report_feet_value.setEnabled(false);
+                               new_report_feet = 0;
+                       } else {
+                               report_feet_value.setEnabled(true);
+                       }
+                       report_feet_value.setSelectedIndex(new_report_feet);
+               }
+               report_feet_value.setVisible(new_report_feet != AltosLib.MISSING);
+               report_feet_label.setVisible(new_report_feet != AltosLib.MISSING);
+
+               set_report_feet_tool_tip();
+       }
+
+       public int report_feet() {
+               if (report_feet_value.isVisible())
+                       return report_feet_value.getSelectedIndex();
+               else
+                       return AltosLib.MISSING;
+       }
+
        String[] tracker_motion_values() {
                if (AltosConvert.imperial_units)
                        return tracker_motion_values_ft;
diff --git a/ao-bringup/test-easymini-v3.0 b/ao-bringup/test-easymini-v3.0
new file mode 100755 (executable)
index 0000000..779a800
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+VERSION=3.0
+PRODUCT=EasyMini
+BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
+
+echo "$PRODUCT-v$VERSION Test Program"
+echo "Copyright 2022 by Bdale Garbee.  Released under GPL v3"
+echo
+echo "Expectations:"
+echo -e "\t$PRODUCT v$VERSION powered from USB"
+echo
+
+found=0
+while [ $found -eq 0 ]; do
+    (ao-list; echo END END END END) | while read product serial dev; do
+       case "$product" in
+           "$PRODUCT-v$VERSION")
+
+               found=1
+               echo -e '\e[34m'Testing $product $serial $dev'\e[39m'
+               echo ""
+               
+               sleep 2
+
+               ./test-igniters-nowait "$dev" drogue main
+               echo ""
+
+               echo "Testing baro sensor"
+               ../ao-tools/ao-test-baro/ao-test-baro --tty="$dev"
+
+               if [ $? -ne 0 ]; then
+                   echo -e '\e[31m'"$PRODUCT-$VERSION serial $serial failed"'\e[39m'
+                   exit 1
+               fi
+               echo""
+
+               FLASHSIZE=1048576
+
+               echo "Testing flash"
+               ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE"
+
+               if [ $? -ne 0 ]; then
+                   echo -e '\e[31m'"$PRODUCT-$VERSION serial $serial failed"'\e[39m'
+                   exit 1
+               fi
+               echo ""
+
+               echo -e '\e[32m'"$PRODUCT-v$VERSION" serial "$serial" is ready to ship'\e[39m'
+               exit 0
+               ;;
+           END)
+               exit 2
+               ;;
+       esac
+    done
+    result=$?
+    if [ $result -ne 2 ]; then
+       exit $result
+    fi
+    sleep 0.25
+done
diff --git a/ao-bringup/test-easymotor b/ao-bringup/test-easymotor
deleted file mode 100755 (executable)
index a99ca9d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-VERSION=2
-PRODUCT=EasyMotor
-BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
-
-echo "$PRODUCT-v$VERSION Test Program"
-echo "Copyright 2021 by Bdale Garbee.  Released under GPL v3"
-echo
-echo "Expectations:"
-echo "\t$PRODUCT v$VERSION powered from USB"
-echo
-
-ret=1
-ao-list | while read product serial dev; do
-    case "$product" in
-       "$PRODUCT-v$VERSION")
-
-           echo "Testing $product $serial $dev"
-           echo ""
-
-           FLASHSIZE=8388608
-
-           echo "Testing flash"
-           ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE"
-
-           case $? in
-               0)
-                   ;;
-               *)
-                   echo "failed"
-                   exit 1
-           esac
-           echo""
-
-           echo "$PRODUCT-v$VERSION" serial "$serial" is ready to ship
-           ret=0
-           ;;
-    esac
-done
diff --git a/ao-bringup/test-easymotor-v3 b/ao-bringup/test-easymotor-v3
new file mode 100755 (executable)
index 0000000..8e810b3
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+VERSION=3
+PRODUCT=EasyMotor
+BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
+
+echo "$PRODUCT-v$VERSION Test Program"
+echo "Copyright 2022 by Bdale Garbee.  Released under GPL v3"
+echo
+echo "Expectations:"
+echo "\t$PRODUCT v$VERSION powered from USB"
+echo
+
+ret=1
+ao-list | while read product serial dev; do
+    case "$product" in
+       "$PRODUCT-v$VERSION")
+
+           echo "Testing $product $serial $dev"
+           echo ""
+
+           FLASHSIZE=8388608
+
+           echo "Testing flash"
+           ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE"
+
+           case $? in
+               0)
+                   ;;
+               *)
+                   echo "failed"
+                   exit 1
+           esac
+           echo""
+
+           echo "$PRODUCT-v$VERSION" serial "$serial" is ready to ship
+           ret=0
+           ;;
+    esac
+done
index 2041a448f9d8acc303dbdbeb71cdf0dcf3ad3c06..1960c4d679d314529b58a8bcaf6b7524a46409b0 100755 (executable)
@@ -18,13 +18,13 @@ else
        exit 1
 fi
 
-VERSION=1.0
+VERSION=3.0
 PRODUCT=EasyMini
 BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
 echo $FILE
 
 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
-echo "Copyright 2010 by Bdale Garbee.  Released under GPL v2"
+echo "Copyright 2022 by Bdale Garbee.  Released under GPL v3"
 echo
 echo "Expectations:"
 echo "\t$PRODUCT v$VERSION powered from USB"
@@ -49,11 +49,8 @@ esac
 #
 # Use released versions of everything
 #
-FLASH_FILE=~/altusmetrumllc/Binaries/loaders/easymini-v1.0-altos-flash-*.elf
-ALTOS_FILE=~/altusmetrumllc/Binaries/easymini-v1.0-*.elf
-
-#FLASH_FILE=../src/$BASE-v$VERSION/flash-loader/$BASE-v$VERSION-altos-flash-*.elf
-#ALTOS_FILE=../src/$BASE-v$VERSION/*.ihx
+FLASH_FILE=~/altusmetrumllc/Binaries/loaders/easymini-v3.0-altos-flash-*.elf
+ALTOS_FILE=~/altusmetrumllc/Binaries/easymini-v3.0-*.elf
 
 echo $FLASH_LPC $FLASH_FILE
 
@@ -67,6 +64,6 @@ $USBLOAD --serial=$SERIAL $ALTOS_FILE || exit 1
 
 sleep 1
 
-./test-easymini-v1.0
+./test-easymini-v3.0
 
 exit $?
diff --git a/ao-bringup/turnon_easymini_v1.0 b/ao-bringup/turnon_easymini_v1.0
new file mode 100755 (executable)
index 0000000..2041a44
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+if [ -x ../ao-tools/ao-flash/ao-flash-lpc ]; then
+       FLASH_LPC=../ao-tools/ao-flash/ao-flash-lpc
+elif [ -x /usr/bin/ao-flash-lpc ]; then
+       FLASH_LPC=/usr/bin/ao-flash-lpc
+else
+       echo "Can't find ao-flash-lpc!  Aborting."
+       exit 1
+fi
+
+if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then
+       USBLOAD=../ao-tools/ao-usbload/ao-usbload
+elif [ -x /usr/bin/ao-usbload ]; then
+       USBLOAD=/usr/bin/ao-usbload
+else
+       echo "Can't find ao-usbload!  Aborting."
+       exit 1
+fi
+
+VERSION=1.0
+PRODUCT=EasyMini
+BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
+echo $FILE
+
+echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
+echo "Copyright 2010 by Bdale Garbee.  Released under GPL v2"
+echo
+echo "Expectations:"
+echo "\t$PRODUCT v$VERSION powered from USB"
+echo "\t\twith ST-Link-V2 cabled to debug header"
+echo
+
+case $# in
+    1)
+       SERIAL="$1"
+       echo "$PRODUCT-$VERSION serial number: $SERIAL" 
+       ;;
+    0)
+       echo -n "$PRODUCT-$VERSION serial number: "
+       read SERIAL
+       ;;
+    *)
+       echo "Usage: $0 <serial-number>" 1>&2
+       exit 1;
+       ;;
+esac
+
+#
+# Use released versions of everything
+#
+FLASH_FILE=~/altusmetrumllc/Binaries/loaders/easymini-v1.0-altos-flash-*.elf
+ALTOS_FILE=~/altusmetrumllc/Binaries/easymini-v1.0-*.elf
+
+#FLASH_FILE=../src/$BASE-v$VERSION/flash-loader/$BASE-v$VERSION-altos-flash-*.elf
+#ALTOS_FILE=../src/$BASE-v$VERSION/*.ihx
+
+echo $FLASH_LPC $FLASH_FILE
+
+$FLASH_LPC $FLASH_FILE || exit 1
+
+sleep 1
+
+echo $USBLOAD $ALTOS_FILE
+
+$USBLOAD --serial=$SERIAL $ALTOS_FILE || exit 1
+
+sleep 1
+
+./test-easymini-v1.0
+
+exit $?
index 306e0ad9c4e7d8b0c9676c0d97a4147374c80b1e..815839c8dc1a09bc7630dbf7bde5a1f2bcf931fa 100755 (executable)
@@ -1,29 +1,35 @@
 #!/bin/sh
 
-PRODUCT=EasyMotor
-VERSION=2
-REPO=~/altusmetrumllc/Binaries
-
-if [ -x /usr/bin/dfu-util ]; then
-    DFU_UTIL=/usr/bin/dfu-util
+if [ -x ../ao-tools/ao-flash/ao-flash-lpc ]; then
+       FLASH_LPC=../ao-tools/ao-flash/ao-flash-lpc
+elif [ -x /usr/bin/ao-flash-lpc ]; then
+       FLASH_LPC=/usr/bin/ao-flash-lpc
 else
-    echo "Can't find dfu-util! Aborting."
-    exit 1
+       echo "Can't find ao-flash-lpc!  Aborting."
+       exit 1
 fi
 
-if [ -x /usr/bin/ao-usbload ]; then
+if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then
+       USBLOAD=../ao-tools/ao-usbload/ao-usbload
+elif [ -x /usr/bin/ao-usbload ]; then
        USBLOAD=/usr/bin/ao-usbload
 else
        echo "Can't find ao-usbload!  Aborting."
        exit 1
 fi
 
+VERSION=3
+PRODUCT=EasyMotor
+BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
+echo $FILE
+
 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
-echo "Copyright 2021 by Bdale Garbee.  Released under GPL v3"
+echo "Copyright 2022 by Bdale Garbee.  Released under GPL v3"
 echo
 echo "Expectations:"
-echo "\t$PRODUCT v$VERSION"
-echo "\t\twith USB cable attached"
+echo "\t$PRODUCT v$VERSION powered from USB"
+echo "\t\twith ST-Link-V2 cabled to debug header"
+echo "\t\tand precision 2:1 resistor divider feeding pressure input from 5V out"
 echo
 
 case $# in
@@ -40,36 +46,49 @@ case $# in
        exit 1;
        ;;
 esac
+otootor
+#
+# Use released versions of everything
+#
+FLASH_FILE=~/altusmetrumllc/Binaries/loaders/easymotor-v3-altos-flash-*.elf
+ALTOS_FILE=~/altusmetrumllc/Binaries/easymotor-v3-*.elf
 
+echo $FLASH_LPC $FLASH_FILE
 
-echo $DFU_UTIL
+$FLASH_LPC $FLASH_FILE || exit 1
 
-$DFU_UTIL -v -v -R -a 0 -s 0x08000000:leave -D $REPO/loaders/easymotor-v$VERSION*.bin
+sleep 1
 
-sleep 3
+echo $USBLOAD $ALTOS_FILE
 
-$USBLOAD --serial=$SERIAL $REPO/easymotor-v$VERSION*.elf || exit 1
+$USBLOAD --serial=$SERIAL $ALTOS_FILE || exit 1
 
-sleep 5
+sleep 1
 
-dev=`ao-list | awk '/'"$PRODUCT"'-v'"$VERSION"'/ { print $3; exit(0); }'`
+dev=`ao-list | awk '/EasyMotor-v'"$VERSION"'/ { print $3; exit(0); }'`
 
 case "$dev" in
 /dev/tty*)
-       echo "$PRODUCT found on $dev"
+       echo "EasyMotor found on $dev"
        ;;
 *)
-       echo 'No '"$PRODUCT"'-v'"$VERSION"' found'
+       echo 'No EasyMotor-v'"$VERSION"' found'
        exit 1
        ;;
 esac
 
+echo 'E 0' > $dev
+
 failed=1
-while [ $failed =  1 ]; do
+while [ $failed = 1 ]; do
     ../ao-tools/ao-cal-accel/ao-cal-accel $dev
     failed=$?
 done
 
-./test-easymotor
+echo 'E 1' > $dev
+
+sleep 1
+
+./test-easymotor-v3
 
 exit $?
index b5dd7ddf8f1c32f47de032be6d65d8904b43944e..be3e8c7222d1bc48746700a8f1ac32d0d7ac6daf 100644 (file)
@@ -55,6 +55,7 @@ uint8_t ao_force_freq;
 #define AO_CONFIG_DEFAULT_PAD_ORIENTATION      AO_PAD_ORIENTATION_ANTENNA_UP
 #define AO_CONFIG_DEFAULT_PYRO_TIME    AO_MS_TO_TICKS(50)
 #define AO_CONFIG_DEFAULT_RADIO_10MW   0
+#define AO_CONFIG_DEFAULT_REPORT_FEET  0
 #if HAS_CONFIG_SAVE
 #ifndef USE_INTERNAL_FLASH
 #error Please define USE_INTERNAL_FLASH
@@ -251,6 +252,8 @@ _ao_config_get(void)
                if (minor < 25)
                        ao_config.radio_10mw = AO_CONFIG_DEFAULT_RADIO_10MW;
 #endif
+               if (minor < 26)
+                       ao_config.report_feet = AO_CONFIG_DEFAULT_REPORT_FEET;
                ao_config.minor = AO_CONFIG_MINOR;
                ao_config_dirty = 1;
        }
@@ -880,6 +883,24 @@ ao_config_radio_10mw_set(void)
 
 #endif
 
+static void
+ao_config_report_feet_show(void)
+{
+       printf ("Report in feet: %d\n", ao_config.report_feet);
+}
+
+static void
+ao_config_report_feet_set(void)
+{
+       uint32_t r = ao_cmd_decimal();
+       if (ao_cmd_status != ao_cmd_success)
+               return;
+       _ao_config_edit_start();
+       ao_config.report_feet = !!r;
+       _ao_config_edit_finish();
+}
+
+
 #if HAS_BEEP
 static void
 ao_config_beep_show(void)
@@ -1131,6 +1152,8 @@ const struct ao_config_var ao_config_vars[] = {
        { "p <0 no limit, 1 limit>\0Limit radio power to 10mW",
          ao_config_radio_10mw_set,     ao_config_radio_10mw_show },
 #endif
+       { "u <0 meters, 1 feet>\0Units to report height after landing",
+         ao_config_report_feet_set,    ao_config_report_feet_show },
        { "s\0Show",
          ao_config_show,               0 },
 #if HAS_CONFIG_SAVE
index f43401be6051a812f0c9854a408f832a64b83ed9..bf57d9543a11102f09dc3d29bdfb4bdf5ffe2b7b 100644 (file)
@@ -58,7 +58,7 @@
 #endif
 
 #define AO_CONFIG_MAJOR        1
-#define AO_CONFIG_MINOR        25
+#define AO_CONFIG_MINOR        26
 
 /* All cc1200 devices support limiting TX power to 10mW */
 #if !defined(HAS_RADIO_10MW) && defined(AO_CC1200_SPI)
@@ -134,6 +134,7 @@ struct ao_config {
 #if HAS_RADIO_10MW
        uint8_t         radio_10mw;             /* minor version 25 */
 #endif
+       uint8_t         report_feet;            /* minor version 26 */
 };
 
 struct ao_config_1_24 {
index 0f96cb897bcf521081c89e6007cc56444697ac73..b49d6a558db2b3b2eb0e18d6c950f42f5e4e04b5 100644 (file)
@@ -182,6 +182,10 @@ extern volatile uint8_t            ao_data_count;
 
 #endif /* AO_DATA_RING */
 
+#define AO_ALT_TYPE    int32_t
+
+typedef AO_ALT_TYPE    alt_t;
+
 #if !HAS_BARO && HAS_MS5607
 
 /* Either an MS5607 or an MS5611 hooked to a SPI port
@@ -191,10 +195,6 @@ extern volatile uint8_t            ao_data_count;
 
 typedef int32_t        pres_t;
 
-#define AO_ALT_TYPE    int32_t
-
-typedef AO_ALT_TYPE    alt_t;
-
 #define ao_data_pres_cook(packet)      ao_ms5607_convert(&packet->ms5607_raw, &packet->ms5607_cooked)
 
 #define ao_data_pres(packet)   ((packet)->ms5607_cooked.pres)
index 4624403a10d61e0a255caf38f56fecdc8bcff4af..977cea854ff1f014e0927a25530b34988e2682a8 100644 (file)
@@ -149,7 +149,7 @@ ao_report_digit(uint8_t digit)
 }
 
 static void
-ao_report_number(ao_v_t n)
+ao_report_number(int32_t n)
 {
        uint8_t digits[10];
        uint8_t ndigits, i;
@@ -171,7 +171,14 @@ ao_report_number(ao_v_t n)
 static void
 ao_report_altitude(void)
 {
-       ao_report_number(ao_max_height);
+       alt_t max_h = ao_max_height;
+       if (ao_config.report_feet) {
+               max_h = max_h * 39 / 12;
+               /* report a leading zero to distinguish */
+               if (max_h)
+                       ao_report_digit(0);
+       }
+       ao_report_number(max_h);
 }
 
 #if HAS_BATTERY_REPORT