/* HAS_RADIO_10MW */
public int radio_10mw;
+ public int report_feet;
+
/* Storage info replies */
public int storage_size;
public int storage_erase_unit;
radio_10mw = AltosLib.MISSING;
+ report_feet = AltosLib.MISSING;
+
tracker_motion = AltosLib.MISSING;
tracker_interval = AltosLib.MISSING;
/* 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:");
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();
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);
}
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);
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);
}
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;
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;
"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;
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);
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;
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;
--- /dev/null
+#!/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
+++ /dev/null
-#!/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
--- /dev/null
+#!/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
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"
#
# 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
sleep 1
-./test-easymini-v1.0
+./test-easymini-v3.0
exit $?
--- /dev/null
+#!/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 $?
#!/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
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 $?
#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
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;
}
#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)
{ "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
#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)
#if HAS_RADIO_10MW
uint8_t radio_10mw; /* minor version 25 */
#endif
+ uint8_t report_feet; /* minor version 26 */
};
struct ao_config_1_24 {
#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
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)
}
static void
-ao_report_number(ao_v_t n)
+ao_report_number(int32_t n)
{
uint8_t digits[10];
uint8_t ndigits, i;
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