From f167d348b147e89d269ad35806e39f28cf104afb Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sun, 15 Jun 2014 18:41:25 -0600 Subject: notes updated for TeleGPS and 1.4 release learnings --- Releasing | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Releasing b/Releasing index 1822efbe..5827f21d 100644 --- a/Releasing +++ b/Releasing @@ -73,7 +73,7 @@ These are Bdale's notes on how to do a release. src/telemega-v1.0/flash-loader/*.elf \ src/telemetrum-v2.0/flash-loader/*.elf \ ~/altusmetrumllc/Binaries/loaders/ - (cd ~/altusmetrumllc ; git commit -a) + (cd ~/altusmetrumllc ; git add Binaries ; git commit -a) - copy the relevant release notes file from doc/ to /home/bdale/web/altusmetrum/AltOS/releases/ @@ -81,8 +81,12 @@ These are Bdale's notes on how to do a release. - create /home/bdale/web/altusmetrum/MicroPeak/releases/, and move the MicroPeak installers from AltOS/releases to there - - go edit ~/web/altusmetrum/AltOS/releases/.mdwn and - /home/bdale/web/altusmetrum/MicroPeak/releases/.mdwn, to + - create /home/bdale/web/altusmetrum/TeleGPS/releases/, + and move the MicroPeak installers from AltOS/releases to there + + - go edit ~/web/altusmetrum/AltOS/releases/.mdwn, + /home/bdale/web/altusmetrum/MicroPeak/releases/.mdwn, and + /home/bdale/web/altusmetrum/TeleGPS/releases/.mdwn, to include release date and explicit ref to dir contents so the web pages shows versioned links, commit and push -- cgit v1.2.3 From 31beeb0882d27cbc05e28118611feec4ae43d9da Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 11:02:49 -0700 Subject: doc: Add instructions for flash recovery technique The flash recovery section explained which pins to connect, but lacked explicit instructions on how to make it work. --- doc/altusmetrum.xsl | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/doc/altusmetrum.xsl b/doc/altusmetrum.xsl index 5ccbee9f..fb8fe7e1 100644 --- a/doc/altusmetrum.xsl +++ b/doc/altusmetrum.xsl @@ -4347,6 +4347,50 @@ NAR #88757, TRA #12200 + + Once you've located the right pins: + + + + + Turn the altimeter power off. + + + + + Connect a battery. + + + + + Connect the indicated terminals together with a short + piece of wire. Take care not to accidentally connect + anything else. + + + + + Connect USB + + + + + Turn the board power on. + + + + + The board should now be visible over USB as 'AltosFlash' + and be ready to receive firmware. + + + + + Once the board has been powered up, you can remove the + piece of wire. + + +
-- cgit v1.2.3 From 6579e4cae8fea65780f1c4677f29c1fc17ca41e2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 15:59:09 -0700 Subject: altos/micropeak: Create a script to load firmware. The micropeak-load script flashes micropeak with firmware from whatever directory it is sitting in. A 'publish' target in the source directory copies the script and hex to ~/altusmetrumllc/Binaries Signed-off-by: Keith Packard --- src/micropeak/Makefile | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/micropeak/Makefile b/src/micropeak/Makefile index 6ae3d0be..ac00f635 100644 --- a/src/micropeak/Makefile +++ b/src/micropeak/Makefile @@ -8,8 +8,15 @@ vpath make-altitude-pa ../util include ../avr/Makefile.defs +PROGNAME=micropeak-v0.1 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +SCRIPT=micropeak-load + PUBLISH_DIR=$(HOME)/altusmetrumllc/Binaries -PUBLISH_FILE=$(PUBLISH_DIR)/$(PROG)-$(VERSION).hex +PUBLISH_HEX=$(PUBLISH_DIR)/$(HEX) +PUBLISH_SCRIPT=$(PUBLISH_DIR)/$(SCRIPT) MCU=attiny85 DUDECPUTYPE=t85 @@ -55,8 +62,6 @@ CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O2 -mcall-prologues -DATTIN NICKLE=nickle -PROG=micropeak-v0.1 - SRC=$(ALTOS_SRC) OBJ=$(SRC:.c=.o) @@ -68,7 +73,7 @@ endif # Otherwise, print the full command line. quiet ?= $($1) -all: $(PROG) $(PROG).hex +all: $(PROG) $(HEX) micropeak-load CHECK=sh ../util/check-avr-mem @@ -76,16 +81,16 @@ $(PROG): Makefile $(OBJ) $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) -$(PROG).hex: $(PROG) +$(HEX): $(PROG) avr-size $(PROG) $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ -load: $(PROG).hex - $(LOADCMD) $(LOADARG)$(PROG).hex +load: $(HEX) + $(LOADCMD) $(LOADARG)$(HEX) -load-slow: $(PROG).hex - $(LOADCMD) $(LOADSLOW) $(LOADARG)$(PROG).hex +load-slow: $(HEX) + $(LOADCMD) $(LOADSLOW) $(LOADARG)$(HEX) ao_product.h: ao-make-product.5c ../Version $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ @@ -98,22 +103,30 @@ ao_product.o: ao_product.c ao_product.h distclean: clean clean: - rm -f *.o $(PROG) $(PROG).hex + rm -f *.o $(PROG) $(HEX) $(SCRIPT) rm -f ao_product.h +publish: $(PUBLISH_HEX) $(PUBLISH_SCRIPT) -publish: $(PROG).hex - cp -a $(PROG).hex $(PUBLISH_FILE) +$(PUBLISH_HEX): $(HEX) + cp -a $(HEX) $@ + +$(PUBLISH_SCRIPT): $(SCRIPT) + cp -a $(SCRIPT) $@ load-product: - $(LOADCMD) $(LOADARG)$(PUBLISH_FILE) + ./$(SCRIPT) fast load-product-slow: - $(LOADCMD) $(LOADSLOW) $(LOADARG)$(PUBLISH_FILE) + ./$(SCRIPT) slow ../altitude-pa.h: make-altitude-pa nickle $< > $@ +$(SCRIPT): $(SCRIPT).tmpl Makefile ../Version + sed -e 's/%HEX%/$(HEX)/' -e 's/%LOADCMD%/$(LOADCMD)/' -e 's/%LOADARG%/$(LOADARG)/' -e 's/%LOADSLOW%/$(LOADSLOW)/' $(SCRIPT).tmpl > $@ || (rm $@ && exit 1) + chmod +x $@ + install: uninstall: -- cgit v1.2.3 From e612693e33ef3b0e22db0656792992fa6e961ff2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 21:57:35 -0700 Subject: altosui/telegps: Use menus for frequency list and telemetry formats This will let us move them into the Mac OS X menu bar, as well as making them look a bit nicer. Signed-off-by: Keith Packard --- altoslib/AltosFrequency.java | 2 +- altosui/AltosFlightUI.java | 57 +++++----------- altosuilib/AltosFreqList.java | 124 ++++++++++++++++++++++++++++++----- altosuilib/AltosUITelemetryMenu.java | 88 +++++++++++++++++++++++++ altosuilib/Makefile.am | 3 +- telegps/TeleGPS.java | 17 +++-- 6 files changed, 225 insertions(+), 66 deletions(-) create mode 100644 altosuilib/AltosUITelemetryMenu.java diff --git a/altoslib/AltosFrequency.java b/altoslib/AltosFrequency.java index 7c291ea9..d1ab847b 100644 --- a/altoslib/AltosFrequency.java +++ b/altoslib/AltosFrequency.java @@ -41,4 +41,4 @@ public class AltosFrequency { frequency = f; description = d; } -} \ No newline at end of file +} diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 43deb631..2e192c73 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -170,13 +170,17 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { } Container bag; - AltosFreqList frequencies; - JComboBox telemetries; - JLabel telemetry; + + JMenuBar menu_bar; + AltosFreqList frequencies; + AltosUITelemetryMenu telemetries; + JLabel telemetry; ActionListener show_timer; public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) { + super(); + AltosUIPreferences.set_component(this); displays = new LinkedList(); @@ -193,6 +197,10 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { /* Stick channel selector at top of table for telemetry monitoring */ if (serial >= 0) { + + menu_bar = new JMenuBar(); + setJMenuBar(menu_bar); + // Channel menu frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial)); frequencies.set_product("Monitor"); @@ -208,43 +216,19 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { reader.save_frequency(); } }); - c.gridx = 0; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.insets = new Insets(3, 3, 3, 3); - c.fill = GridBagConstraints.NONE; - c.anchor = GridBagConstraints.WEST; - bag.add (frequencies, c); + menu_bar.add (frequencies); // Telemetry format menu - if (reader.supports_telemetry(Altos.ao_telemetry_standard)) { - telemetries = new JComboBox(); - for (int i = 1; i <= Altos.ao_telemetry_max; i++) - telemetries.addItem(Altos.telemetry_name(i)); - int telemetry = AltosPreferences.telemetry(serial); - if (telemetry <= Altos.ao_telemetry_off || - telemetry > Altos.ao_telemetry_max) - telemetry = Altos.ao_telemetry_standard; - telemetries.setSelectedIndex(telemetry - 1); - telemetries.setMaximumRowCount(Altos.ao_telemetry_max); - telemetries.setPreferredSize(null); - telemetries.revalidate(); + if (reader.supports_telemetry(AltosLib.ao_telemetry_standard)) { + telemetries = new AltosUITelemetryMenu(serial); telemetries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int telemetry = telemetries.getSelectedIndex() + 1; + int telemetry = telemetries.get_selected(); reader.set_telemetry(telemetry); reader.save_telemetry(); } }); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.fill = GridBagConstraints.NONE; - c.anchor = GridBagConstraints.WEST; - bag.add (telemetries, c); - c.insets = new Insets(0, 0, 0, 0); + menu_bar.add(telemetries); } else { String version; @@ -256,14 +240,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { version = "Telemetry: None"; telemetry = new JLabel(version); - c.gridx = 1; - c.gridy = 0; - c.weightx = 0; - c.weighty = 0; - c.fill = GridBagConstraints.NONE; - c.anchor = GridBagConstraints.WEST; - bag.add (telemetry, c); - c.insets = new Insets(0, 0, 0, 0); + menu_bar.add(telemetry); } } diff --git a/altosuilib/AltosFreqList.java b/altosuilib/AltosFreqList.java index e1299aae..b985d472 100644 --- a/altosuilib/AltosFreqList.java +++ b/altosuilib/AltosFreqList.java @@ -17,15 +17,113 @@ package org.altusmetrum.altosuilib_2; +import java.util.*; import javax.swing.*; +import java.awt.event.*; import org.altusmetrum.altoslib_4.*; -public class AltosFreqList extends JComboBox { +class FreqEntry extends JMenuItem { + AltosFrequency frequency; + + public FreqEntry(AltosFrequency frequency) { + super(frequency.toShortString()); + this.frequency = frequency; + } +} + +public class AltosFreqList extends JMenu implements ActionListener { String product; int serial; int calibrate; + AltosFrequency[] frequencies = new AltosFrequency[0]; + + int selected = -1; + + LinkedList action_listeners = new LinkedList(); + + public void addActionListener(ActionListener listener) { + action_listeners.add(listener); + } + + public void removeActionListener(ActionListener listener) { + action_listeners.remove(listener); + } + + public void actionPerformed(ActionEvent ev) { + FreqEntry e = (FreqEntry) ev.getSource(); + set_selected(e.frequency); + ActionEvent event = new ActionEvent(e.frequency, 0, "selected"); + for (ActionListener l : action_listeners) + l.actionPerformed(event); + } + + private void set_selected(AltosFrequency frequency) { + for (int i = 0; i < frequencies.length; i++) { + if (frequencies[i].frequency == frequency.frequency) { + selected = i; + String new_text = String.format("Frequency: %7.3f MHz (%s) ▾", + frequency.frequency, + frequency.description); + setText(new_text); + } + } + } + + private AltosFrequency get_selected() { + if (0 <= selected && selected < frequencies.length) + return frequencies[selected]; + return null; + } + + private void add(AltosFrequency add) { + int insert; + + for (insert = 0; insert < frequencies.length; insert++) { + if (frequencies[insert].frequency == add.frequency) + return; + if (add.frequency < frequencies[insert].frequency) + break; + } + + AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length + 1]; + + for (int before = 0; before < insert; before++) + new_frequencies[before] = frequencies[before]; + new_frequencies[insert] = add; + + for (int after = insert; after < frequencies.length; after++) + new_frequencies[after+1] = frequencies[after]; + + frequencies = new_frequencies; + + FreqEntry e = new FreqEntry(add); + add(e, insert); + e.addActionListener(this); + } + + private void remove(AltosFrequency remove) { + int delete; + for (delete = 0; delete < frequencies.length; delete++) { + if (frequencies[delete].frequency == remove.frequency) + break; + if (remove.frequency < frequencies[delete].frequency) + return; + } + + remove(delete); + + AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length - 1]; + + for (int before = 0; before < delete; before++) + new_frequencies[before] = frequencies[before]; + + for (int after = delete + 1; after < frequencies.length; after++) + new_frequencies[after-1] = frequencies[after]; + frequencies = new_frequencies; + } + public void set_frequency(double new_frequency) { int i; @@ -34,25 +132,21 @@ public class AltosFreqList extends JComboBox { return; } - for (i = 0; i < getItemCount(); i++) { - AltosFrequency f = (AltosFrequency) getItemAt(i); + for (i = 0; i < frequencies.length; i++) { + AltosFrequency f = frequencies[i]; if (f.close(new_frequency)) { - setSelectedIndex(i); + set_selected(f); return; } } - for (i = 0; i < getItemCount(); i++) { - AltosFrequency f = (AltosFrequency) getItemAt(i); - if (new_frequency < f.frequency) - break; - } String description = String.format("%s serial %d", product, serial); AltosFrequency frequency = new AltosFrequency(new_frequency, description); AltosUIPreferences.add_common_frequency(frequency); - insertItemAt(frequency, i); - setMaximumRowCount(getItemCount()); + + add(frequency); + set_selected(frequency); } public void set_product(String new_product) { @@ -64,16 +158,16 @@ public class AltosFreqList extends JComboBox { } public double frequency() { - AltosFrequency f = (AltosFrequency) getSelectedItem(); + AltosFrequency f = get_selected(); if (f != null) return f.frequency; return 434.550; } public AltosFreqList () { - super(AltosUIPreferences.common_frequencies()); - setMaximumRowCount(getItemCount()); - setEditable(false); + super(); + for (AltosFrequency frequency: AltosUIPreferences.common_frequencies()) + add(frequency); product = "Unknown"; serial = 0; } diff --git a/altosuilib/AltosUITelemetryMenu.java b/altosuilib/AltosUITelemetryMenu.java new file mode 100644 index 00000000..fc4a91c5 --- /dev/null +++ b/altosuilib/AltosUITelemetryMenu.java @@ -0,0 +1,88 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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. + */ + +package org.altusmetrum.altosuilib_2; + +import java.util.*; +import javax.swing.*; +import java.awt.event.*; +import org.altusmetrum.altoslib_4.*; + +class TelemetryMenuItem extends JMenuItem { + public int telemetry; + + public TelemetryMenuItem (int telemetry) { + super(AltosLib.telemetry_name(telemetry)); + this.telemetry = telemetry; + } +} + +public class AltosUITelemetryMenu extends JMenu implements ActionListener { + TelemetryMenuItem selected = null; + + public int get_selected() { + if (selected == null) + return AltosLib.ao_telemetry_off; + return selected.telemetry; + } + + public void set_selected(int telemetry) { + for (int i = 0; i < getItemCount(); i++) { + TelemetryMenuItem item = (TelemetryMenuItem) getItem(i); + if (item.telemetry == telemetry) { + selected = item; + String new_text = String.format("Format: %s ▾", AltosLib.telemetry_name(telemetry)); + setText(new_text); + break; + } + } + } + + private LinkedList action_listeners = new LinkedList(); + + public void addActionListener(ActionListener l) { + action_listeners.add(l); + } + + public void removeActionListener(ActionListener l) { + action_listeners.remove(l); + } + + public void actionPerformed(ActionEvent e) { + TelemetryMenuItem item = (TelemetryMenuItem) e.getSource(); + set_selected(item.telemetry); + ActionEvent my_e = new ActionEvent(selected, 0, "selected"); + for (ActionListener l : action_listeners) + l.actionPerformed(my_e); + } + + public AltosUITelemetryMenu(int serial) { + super(); + for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++) { + TelemetryMenuItem item = new TelemetryMenuItem(i); + + item.addActionListener(this); + add(item); + } + + int telemetry = AltosPreferences.telemetry(serial); + if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry) + telemetry = AltosLib.ao_telemetry_standard; + set_selected(telemetry); + } +} + diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index e08fbe74..157cd5e8 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -80,7 +80,8 @@ altosuilib_JAVA = \ AltosUIFlightTab.java \ AltosUIIndicator.java \ AltosUIUnitsIndicator.java \ - AltosUIVoltageIndicator.java + AltosUIVoltageIndicator.java \ + AltosUITelemetryMenu.java JAR=altosuilib_$(ALTOSUILIB_VERSION).jar diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index 6e68dd30..646495b6 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -351,17 +351,18 @@ public class TeleGPS frequencies.set_product("Monitor"); frequencies.set_serial(serial); frequencies.set_frequency(AltosUIPreferences.frequency(serial)); - frequencies.setEnabled(true); + menu_bar.add(frequencies); + menu_bar.repaint(); } void disable_frequency_menu() { - if (frequency_listener != null) { - frequencies.removeActionListener(frequency_listener); - frequencies.setEnabled(false); - frequency_listener = null; - } - + if (frequency_listener == null) + return; + frequencies.removeActionListener(frequency_listener); + menu_bar.remove(frequencies); + menu_bar.repaint(); + frequency_listener = null; } public void set_reader(AltosFlightReader reader, AltosDevice device) { @@ -435,8 +436,6 @@ public class TeleGPS monitor_menu = make_menu("Monitor", monitor_menu_entries); device_menu = make_menu("Device", device_menu_entries); frequencies = new AltosFreqList(); - frequencies.setEnabled(false); - menu_bar.add(frequencies); displays = new LinkedList(); -- cgit v1.2.3 From ed38b1b596062b2232fa78a3181f6eaf5818b651 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 21:58:13 -0700 Subject: altosuilib: Move menu bars into the Mac OS X top bar Setting these properties causes the top menu bar to get placed into the Mac OS X window system menu bar Signed-off-by: Keith Packard --- altosuilib/AltosUIFrame.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java index 6e62c762..2de1fb1c 100644 --- a/altosuilib/AltosUIFrame.java +++ b/altosuilib/AltosUIFrame.java @@ -157,11 +157,28 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi } } + static boolean global_settings_done; + + public String getName() { + return "Altus Metrum"; + } + void init() { AltosUIPreferences.register_ui_listener(this); AltosUIPreferences.register_position_listener(this); position = AltosUIPreferences.position(); addWindowListener(new AltosUIFrameListener()); + + /* Try to make menus live in the menu bar like regular Mac apps */ + if (!global_settings_done) { + try { + global_settings_done = true; + System.setProperty("com.apple.mrj.application.apple.menu.about.name", getName()); + System.setProperty("com.apple.macos.useScreenMenuBar", "true"); + System.setProperty( "apple.laf.useScreenMenuBar", "true" ); // for older versions of Java + } catch (Exception e) { + } + } set_icon(); } -- cgit v1.2.3 From 75766b0e7ee30fb3bfbf90ecb68f7758bac6eeba Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 22:48:25 -0700 Subject: altosui: Fix ground station configure frequency list Fix the API to match the switch to a menu, wrap in a menu bar to make it work. Signed-off-by: Keith Packard --- altosui/AltosConfigTDUI.java | 30 ++++++------------------------ altosuilib/AltosFreqList.java | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index 22b3384d..955c7dab 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -44,6 +44,7 @@ public class AltosConfigTDUI JLabel product_value; JLabel version_value; JLabel serial_value; + JMenuBar radio_frequency_menu_bar; AltosFreqList radio_frequency_value; JLabel radio_calibration_value; @@ -166,9 +167,11 @@ public class AltosConfigTDUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(); + radio_frequency_value = new AltosFreqList(false); radio_frequency_value.addItemListener(this); - pane.add(radio_frequency_value, c); + radio_frequency_menu_bar = new JMenuBar(); + radio_frequency_menu_bar.add(radio_frequency_value); + pane.add(radio_frequency_menu_bar, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); /* Radio Calibration */ @@ -308,28 +311,7 @@ public class AltosConfigTDUI } public void set_radio_frequency(double new_radio_frequency) { - int i; - for (i = 0; i < radio_frequency_value.getItemCount(); i++) { - AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); - - if (f.close(new_radio_frequency)) { - radio_frequency_value.setSelectedIndex(i); - return; - } - } - for (i = 0; i < radio_frequency_value.getItemCount(); i++) { - AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); - - if (new_radio_frequency < f.frequency) - break; - } - String description = String.format("%s serial %s", - product_value.getText(), - serial_value.getText()); - AltosFrequency new_frequency = new AltosFrequency(new_radio_frequency, description); - AltosPreferences.add_common_frequency(new_frequency); - radio_frequency_value.insertItemAt(new_frequency, i); - radio_frequency_value.setSelectedIndex(i); + radio_frequency_value.set_frequency(new_radio_frequency); } public double radio_frequency() { diff --git a/altosuilib/AltosFreqList.java b/altosuilib/AltosFreqList.java index b985d472..a4c3e36a 100644 --- a/altosuilib/AltosFreqList.java +++ b/altosuilib/AltosFreqList.java @@ -59,14 +59,30 @@ public class AltosFreqList extends JMenu implements ActionListener { l.actionPerformed(event); } + boolean label = true; + + public void set_label(boolean label) { + this.label = label; + set_label(); + } + + private void set_label() { + String new_text = ""; + if (0 <= selected && selected < frequencies.length) { + AltosFrequency frequency = frequencies[selected]; + new_text = String.format("%s%7.3f MHz (%s) ▾", + label ? "Frequency: " : "", + frequency.frequency, + frequency.description); + } + setText(new_text); + } + private void set_selected(AltosFrequency frequency) { for (int i = 0; i < frequencies.length; i++) { if (frequencies[i].frequency == frequency.frequency) { selected = i; - String new_text = String.format("Frequency: %7.3f MHz (%s) ▾", - frequency.frequency, - frequency.description); - setText(new_text); + set_label(); } } } @@ -164,16 +180,27 @@ public class AltosFreqList extends JMenu implements ActionListener { return 434.550; } - public AltosFreqList () { + public AltosFreqList(double in_frequency, boolean label) { super(); + this.label = label; + for (AltosFrequency frequency: AltosUIPreferences.common_frequencies()) add(frequency); product = "Unknown"; serial = 0; - } + if (in_frequency != 0) + set_frequency(in_frequency); + } public AltosFreqList(double in_frequency) { - this(); - set_frequency(in_frequency); + this(in_frequency, true); + } + + public AltosFreqList (boolean label) { + this(0, label); + } + + public AltosFreqList () { + this(0, true); } } -- cgit v1.2.3 From c8078d352a7f54a4a97d25af080155d3f875536a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 22:49:34 -0700 Subject: java: Bump java library versions for next release Prepare for future release by bumping java versions now Signed-off-by: Keith Packard --- altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java | 2 +- .../src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TelemetryLogger.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TelemetryReader.java | 2 +- altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java | 2 +- altoslib/AltosAccel.java | 2 +- altoslib/AltosCRCException.java | 2 +- altoslib/AltosCSV.java | 2 +- altoslib/AltosCompanion.java | 2 +- altoslib/AltosConfigData.java | 2 +- altoslib/AltosConfigDataException.java | 2 +- altoslib/AltosConfigValues.java | 2 +- altoslib/AltosConvert.java | 2 +- altoslib/AltosDebug.java | 2 +- altoslib/AltosDistance.java | 2 +- altoslib/AltosEeprom.java | 2 +- altoslib/AltosEepromChunk.java | 2 +- altoslib/AltosEepromDownload.java | 2 +- altoslib/AltosEepromFile.java | 2 +- altoslib/AltosEepromGPS.java | 2 +- altoslib/AltosEepromHeader.java | 2 +- altoslib/AltosEepromIterable.java | 2 +- altoslib/AltosEepromList.java | 2 +- altoslib/AltosEepromLog.java | 2 +- altoslib/AltosEepromMega.java | 2 +- altoslib/AltosEepromMetrum2.java | 2 +- altoslib/AltosEepromMini.java | 2 +- altoslib/AltosEepromMonitor.java | 2 +- altoslib/AltosEepromTM.java | 2 +- altoslib/AltosEepromTm.java | 2 +- altoslib/AltosFile.java | 2 +- altoslib/AltosFlash.java | 2 +- altoslib/AltosFlashListener.java | 2 +- altoslib/AltosFlightReader.java | 2 +- altoslib/AltosFlightStats.java | 2 +- altoslib/AltosFrequency.java | 2 +- altoslib/AltosGPS.java | 2 +- altoslib/AltosGPSSat.java | 2 +- altoslib/AltosGreatCircle.java | 2 +- altoslib/AltosHeight.java | 2 +- altoslib/AltosHexfile.java | 2 +- altoslib/AltosHexsym.java | 2 +- altoslib/AltosIMU.java | 2 +- altoslib/AltosIdle.java | 2 +- altoslib/AltosIdleFetch.java | 2 +- altoslib/AltosIdleMonitor.java | 2 +- altoslib/AltosIdleMonitorListener.java | 2 +- altoslib/AltosIgnite.java | 2 +- altoslib/AltosKML.java | 2 +- altoslib/AltosLatitude.java | 2 +- altoslib/AltosLib.java | 2 +- altoslib/AltosLine.java | 2 +- altoslib/AltosLink.java | 2 +- altoslib/AltosListenerState.java | 2 +- altoslib/AltosLocation.java | 2 +- altoslib/AltosLog.java | 2 +- altoslib/AltosLongitude.java | 2 +- altoslib/AltosMag.java | 2 +- altoslib/AltosMma655x.java | 2 +- altoslib/AltosMs5607.java | 2 +- altoslib/AltosNoSymbol.java | 2 +- altoslib/AltosOrient.java | 2 +- altoslib/AltosParse.java | 2 +- altoslib/AltosPreferences.java | 2 +- altoslib/AltosPreferencesBackend.java | 2 +- altoslib/AltosProgrammer.java | 2 +- altoslib/AltosPyro.java | 2 +- altoslib/AltosReplayReader.java | 2 +- altoslib/AltosRomconfig.java | 2 +- altoslib/AltosSelfFlash.java | 2 +- altoslib/AltosSensorEMini.java | 2 +- altoslib/AltosSensorMM.java | 2 +- altoslib/AltosSensorMega.java | 2 +- altoslib/AltosSensorMetrum.java | 2 +- altoslib/AltosSensorTM.java | 2 +- altoslib/AltosSensorTMini.java | 2 +- altoslib/AltosSpeed.java | 2 +- altoslib/AltosState.java | 2 +- altoslib/AltosStateIterable.java | 2 +- altoslib/AltosStateUpdate.java | 2 +- altoslib/AltosTelemetry.java | 2 +- altoslib/AltosTelemetryConfiguration.java | 2 +- altoslib/AltosTelemetryFile.java | 2 +- altoslib/AltosTelemetryIterable.java | 2 +- altoslib/AltosTelemetryLegacy.java | 2 +- altoslib/AltosTelemetryLocation.java | 2 +- altoslib/AltosTelemetryMap.java | 2 +- altoslib/AltosTelemetryMegaData.java | 2 +- altoslib/AltosTelemetryMegaSensor.java | 2 +- altoslib/AltosTelemetryMetrumData.java | 2 +- altoslib/AltosTelemetryMetrumSensor.java | 2 +- altoslib/AltosTelemetryMini.java | 2 +- altoslib/AltosTelemetryRaw.java | 2 +- altoslib/AltosTelemetryReader.java | 2 +- altoslib/AltosTelemetrySatellite.java | 2 +- altoslib/AltosTelemetrySensor.java | 2 +- altoslib/AltosTelemetryStandard.java | 2 +- altoslib/AltosTemperature.java | 2 +- altoslib/AltosUnits.java | 2 +- altoslib/AltosUnitsListener.java | 2 +- altoslib/AltosVoltage.java | 2 +- altoslib/AltosWriter.java | 2 +- altosui/Altos.java | 4 ++-- altosui/AltosAscent.java | 4 ++-- altosui/AltosCompanionInfo.java | 4 ++-- altosui/AltosConfig.java | 4 ++-- altosui/AltosConfigPyroUI.java | 4 ++-- altosui/AltosConfigTD.java | 4 ++-- altosui/AltosConfigTDUI.java | 4 ++-- altosui/AltosConfigUI.java | 4 ++-- altosui/AltosConfigureUI.java | 2 +- altosui/AltosDescent.java | 4 ++-- altosui/AltosFlightStatus.java | 4 ++-- altosui/AltosFlightStatusTableModel.java | 2 +- altosui/AltosFlightStatusUpdate.java | 2 +- altosui/AltosFlightUI.java | 4 ++-- altosui/AltosGraphUI.java | 4 ++-- altosui/AltosIdleMonitorUI.java | 4 ++-- altosui/AltosIgniteUI.java | 4 ++-- altosui/AltosIgnitor.java | 4 ++-- altosui/AltosLanded.java | 4 ++-- altosui/AltosLaunch.java | 2 +- altosui/AltosLaunchUI.java | 2 +- altosui/AltosPad.java | 4 ++-- altosui/AltosUI.java | 4 ++-- altosui/AltosUIPreferencesBackend.java | 2 +- altosuilib/AltosBTDevice.java | 4 ++-- altosuilib/AltosBTDeviceIterator.java | 4 ++-- altosuilib/AltosBTKnown.java | 4 ++-- altosuilib/AltosBTManage.java | 4 ++-- altosuilib/AltosCSVUI.java | 4 ++-- altosuilib/AltosConfigFreqUI.java | 4 ++-- altosuilib/AltosDataChooser.java | 4 ++-- altosuilib/AltosDevice.java | 2 +- altosuilib/AltosDeviceDialog.java | 2 +- altosuilib/AltosDeviceUIDialog.java | 2 +- altosuilib/AltosDisplayThread.java | 4 ++-- altosuilib/AltosEepromDelete.java | 4 ++-- altosuilib/AltosEepromManage.java | 4 ++-- altosuilib/AltosEepromMonitor.java | 2 +- altosuilib/AltosEepromMonitorUI.java | 4 ++-- altosuilib/AltosEepromSelect.java | 4 ++-- altosuilib/AltosFlashUI.java | 4 ++-- altosuilib/AltosFlightDisplay.java | 4 ++-- altosuilib/AltosFlightInfoTableModel.java | 2 +- altosuilib/AltosFlightStatsTable.java | 4 ++-- altosuilib/AltosFontListener.java | 2 +- altosuilib/AltosFreqList.java | 4 ++-- altosuilib/AltosGraph.java | 4 ++-- altosuilib/AltosGraphDataPoint.java | 4 ++-- altosuilib/AltosGraphDataSet.java | 4 ++-- altosuilib/AltosInfoTable.java | 4 ++-- altosuilib/AltosLed.java | 2 +- altosuilib/AltosLights.java | 2 +- altosuilib/AltosPositionListener.java | 2 +- altosuilib/AltosRomconfigUI.java | 4 ++-- altosuilib/AltosScanUI.java | 4 ++-- altosuilib/AltosSerial.java | 4 ++-- altosuilib/AltosSerialInUseException.java | 2 +- altosuilib/AltosUIAxis.java | 4 ++-- altosuilib/AltosUIConfigure.java | 2 +- altosuilib/AltosUIDataMissing.java | 2 +- altosuilib/AltosUIDataPoint.java | 2 +- altosuilib/AltosUIDataSet.java | 2 +- altosuilib/AltosUIDialog.java | 2 +- altosuilib/AltosUIEnable.java | 4 ++-- altosuilib/AltosUIFlightTab.java | 4 ++-- altosuilib/AltosUIFrame.java | 2 +- altosuilib/AltosUIGraph.java | 4 ++-- altosuilib/AltosUIGrapher.java | 4 ++-- altosuilib/AltosUIIndicator.java | 4 ++-- altosuilib/AltosUILatLon.java | 4 ++-- altosuilib/AltosUILib.java | 4 ++-- altosuilib/AltosUIListener.java | 2 +- altosuilib/AltosUIMap.java | 4 ++-- altosuilib/AltosUIMapCache.java | 2 +- altosuilib/AltosUIMapImage.java | 2 +- altosuilib/AltosUIMapLine.java | 4 ++-- altosuilib/AltosUIMapMark.java | 4 ++-- altosuilib/AltosUIMapPath.java | 4 ++-- altosuilib/AltosUIMapPreload.java | 4 ++-- altosuilib/AltosUIMapRectangle.java | 2 +- altosuilib/AltosUIMapStore.java | 2 +- altosuilib/AltosUIMapStoreListener.java | 2 +- altosuilib/AltosUIMapTile.java | 4 ++-- altosuilib/AltosUIMapTileListener.java | 2 +- altosuilib/AltosUIMapTransform.java | 4 ++-- altosuilib/AltosUIMapView.java | 4 ++-- altosuilib/AltosUIMapZoomListener.java | 2 +- altosuilib/AltosUIMarker.java | 4 ++-- altosuilib/AltosUIPreferences.java | 4 ++-- altosuilib/AltosUIPreferencesBackend.java | 4 ++-- altosuilib/AltosUISeries.java | 4 ++-- altosuilib/AltosUITelemetryMenu.java | 4 ++-- altosuilib/AltosUIUnitsIndicator.java | 4 ++-- altosuilib/AltosUIVersion.java.in | 2 +- altosuilib/AltosUIVoltageIndicator.java | 4 ++-- altosuilib/AltosUSBDevice.java | 2 +- altosuilib/AltosVoice.java | 2 +- altosuilib/GrabNDrag.java | 2 +- configure.ac | 6 +++--- micropeak/MicroData.java | 4 ++-- micropeak/MicroDataPoint.java | 2 +- micropeak/MicroDeviceDialog.java | 2 +- micropeak/MicroDownload.java | 4 ++-- micropeak/MicroExport.java | 4 ++-- micropeak/MicroFile.java | 4 ++-- micropeak/MicroFileChooser.java | 4 ++-- micropeak/MicroFrame.java | 2 +- micropeak/MicroGraph.java | 4 ++-- micropeak/MicroPeak.java | 4 ++-- micropeak/MicroRaw.java | 4 ++-- micropeak/MicroSave.java | 4 ++-- micropeak/MicroSerial.java | 2 +- micropeak/MicroSerialLog.java | 2 +- micropeak/MicroStats.java | 4 ++-- micropeak/MicroStatsTable.java | 4 ++-- micropeak/MicroUSB.java | 2 +- telegps/TeleGPS.java | 4 ++-- telegps/TeleGPSConfig.java | 4 ++-- telegps/TeleGPSConfigUI.java | 4 ++-- telegps/TeleGPSDisplayThread.java | 4 ++-- telegps/TeleGPSGraphUI.java | 4 ++-- telegps/TeleGPSInfo.java | 4 ++-- telegps/TeleGPSPreferences.java | 2 +- telegps/TeleGPSState.java | 4 ++-- telegps/TeleGPSStatus.java | 4 ++-- telegps/TeleGPSStatusUpdate.java | 2 +- 236 files changed, 321 insertions(+), 321 deletions(-) diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java index 1b4d45ed..a599698f 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java @@ -31,7 +31,7 @@ import android.os.Handler; //import android.os.Message; import android.util.Log; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosBluetooth extends AltosLink { diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index f61baf1e..1b49ba95 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -49,7 +49,7 @@ import android.widget.Toast; import android.app.AlertDialog; import android.location.Location; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosDroid extends FragmentActivity { // Debugging diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java index f6e6881d..70d7def8 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java @@ -23,7 +23,7 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Environment; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosDroidPreferences implements AltosPreferencesBackend { public final static String NAME = "org.altusmetrum.AltosDroid"; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java index fac4b8d4..20593bd5 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java @@ -17,7 +17,7 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import android.location.Location; public interface AltosDroidTab { diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java index 5e8515cb..147405f6 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java @@ -21,7 +21,7 @@ package org.altusmetrum.AltosDroid; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosVoice { diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java index e4a815eb..cb9fd5c8 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java @@ -17,7 +17,7 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import android.app.Activity; import android.os.Bundle; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java index cbbe4d44..2171afa4 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java @@ -17,7 +17,7 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import android.app.Activity; import android.os.Bundle; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java index b2e6fd20..47e41d59 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java @@ -17,7 +17,7 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import android.app.Activity; import android.os.Bundle; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java index 38922771..15dc8bf7 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java @@ -19,7 +19,7 @@ package org.altusmetrum.AltosDroid; import java.util.Arrays; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java index 2d88974d..175a41de 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java @@ -17,7 +17,7 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import android.app.Activity; import android.os.Bundle; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryLogger.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryLogger.java index 4215a330..49bcfb88 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryLogger.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryLogger.java @@ -1,6 +1,6 @@ package org.altusmetrum.AltosDroid; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryReader.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryReader.java index 5bc4b90d..3ba5afa9 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryReader.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryReader.java @@ -25,7 +25,7 @@ import java.util.concurrent.*; import android.util.Log; import android.os.Handler; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class TelemetryReader extends Thread { diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java index da5e044f..f06ed213 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java @@ -44,7 +44,7 @@ import android.location.LocationManager; import android.location.LocationListener; import android.location.Criteria; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class TelemetryService extends Service implements LocationListener { diff --git a/altoslib/AltosAccel.java b/altoslib/AltosAccel.java index 3d340e5d..d91da4da 100644 --- a/altoslib/AltosAccel.java +++ b/altoslib/AltosAccel.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosAccel extends AltosUnits { diff --git a/altoslib/AltosCRCException.java b/altoslib/AltosCRCException.java index 253ca435..507c446b 100644 --- a/altoslib/AltosCRCException.java +++ b/altoslib/AltosCRCException.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosCRCException extends Exception { public int rssi; diff --git a/altoslib/AltosCSV.java b/altoslib/AltosCSV.java index 27e1fade..7e3d6d07 100644 --- a/altoslib/AltosCSV.java +++ b/altoslib/AltosCSV.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosCompanion.java b/altoslib/AltosCompanion.java index 09bfe9f3..47deb2a3 100644 --- a/altoslib/AltosCompanion.java +++ b/altoslib/AltosCompanion.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosCompanion { public final static int board_id_telescience = 0x0a; diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index e1043958..d8b0b081 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.*; import java.text.*; diff --git a/altoslib/AltosConfigDataException.java b/altoslib/AltosConfigDataException.java index ae5621cc..a932d3e3 100644 --- a/altoslib/AltosConfigDataException.java +++ b/altoslib/AltosConfigDataException.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosConfigDataException extends Exception { diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index 724ba7dc..dcb4d48f 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosConfigValues { /* set and get all of the dialog values */ diff --git a/altoslib/AltosConvert.java b/altoslib/AltosConvert.java index dc0fbb62..18878c02 100644 --- a/altoslib/AltosConvert.java +++ b/altoslib/AltosConvert.java @@ -18,7 +18,7 @@ /* * Sensor data conversion functions */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosConvert { /* diff --git a/altoslib/AltosDebug.java b/altoslib/AltosDebug.java index b0e52fc1..6784f60a 100644 --- a/altoslib/AltosDebug.java +++ b/altoslib/AltosDebug.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosDistance.java b/altoslib/AltosDistance.java index 76ca20c0..67bb58e9 100644 --- a/altoslib/AltosDistance.java +++ b/altoslib/AltosDistance.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosDistance extends AltosUnits { diff --git a/altoslib/AltosEeprom.java b/altoslib/AltosEeprom.java index 020590eb..532c9f1d 100644 --- a/altoslib/AltosEeprom.java +++ b/altoslib/AltosEeprom.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromChunk.java b/altoslib/AltosEepromChunk.java index 91eebc5a..4d12f564 100644 --- a/altoslib/AltosEepromChunk.java +++ b/altoslib/AltosEepromChunk.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; import java.util.concurrent.*; diff --git a/altoslib/AltosEepromDownload.java b/altoslib/AltosEepromDownload.java index a2dfc438..a448ee64 100644 --- a/altoslib/AltosEepromDownload.java +++ b/altoslib/AltosEepromDownload.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromFile.java b/altoslib/AltosEepromFile.java index b7e446ce..a1579b55 100644 --- a/altoslib/AltosEepromFile.java +++ b/altoslib/AltosEepromFile.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java index 3c1852c0..2514b4fc 100644 --- a/altoslib/AltosEepromGPS.java +++ b/altoslib/AltosEepromGPS.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromHeader.java b/altoslib/AltosEepromHeader.java index 839aa06e..47e9eceb 100644 --- a/altoslib/AltosEepromHeader.java +++ b/altoslib/AltosEepromHeader.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromIterable.java b/altoslib/AltosEepromIterable.java index d6832c1b..dd0afd9f 100644 --- a/altoslib/AltosEepromIterable.java +++ b/altoslib/AltosEepromIterable.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromList.java b/altoslib/AltosEepromList.java index ab853a88..740499d3 100644 --- a/altoslib/AltosEepromList.java +++ b/altoslib/AltosEepromList.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromLog.java b/altoslib/AltosEepromLog.java index 1a430c03..5a11fa54 100644 --- a/altoslib/AltosEepromLog.java +++ b/altoslib/AltosEepromLog.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; import java.util.concurrent.*; diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java index 71719a26..5d5f3fef 100644 --- a/altoslib/AltosEepromMega.java +++ b/altoslib/AltosEepromMega.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromMetrum2.java b/altoslib/AltosEepromMetrum2.java index d137614a..24277118 100644 --- a/altoslib/AltosEepromMetrum2.java +++ b/altoslib/AltosEepromMetrum2.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromMini.java b/altoslib/AltosEepromMini.java index 32985639..f197539e 100644 --- a/altoslib/AltosEepromMini.java +++ b/altoslib/AltosEepromMini.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromMonitor.java b/altoslib/AltosEepromMonitor.java index b97287c3..173a2cd8 100644 --- a/altoslib/AltosEepromMonitor.java +++ b/altoslib/AltosEepromMonitor.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosEepromMonitor { diff --git a/altoslib/AltosEepromTM.java b/altoslib/AltosEepromTM.java index 77fe20c5..6d36cf47 100644 --- a/altoslib/AltosEepromTM.java +++ b/altoslib/AltosEepromTM.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosEepromTm.java b/altoslib/AltosEepromTm.java index 6cbb7253..81b42f21 100644 --- a/altoslib/AltosEepromTm.java +++ b/altoslib/AltosEepromTm.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosFile.java b/altoslib/AltosFile.java index 2a738996..ba639a04 100644 --- a/altoslib/AltosFile.java +++ b/altoslib/AltosFile.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.File; import java.util.*; diff --git a/altoslib/AltosFlash.java b/altoslib/AltosFlash.java index 8e8722c2..bd4fb6d0 100644 --- a/altoslib/AltosFlash.java +++ b/altoslib/AltosFlash.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosFlashListener.java b/altoslib/AltosFlashListener.java index 8bb86bba..7a51c330 100644 --- a/altoslib/AltosFlashListener.java +++ b/altoslib/AltosFlashListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosFlashListener { public void position(String label, int percent); diff --git a/altoslib/AltosFlightReader.java b/altoslib/AltosFlightReader.java index 2fcd556e..ac151396 100644 --- a/altoslib/AltosFlightReader.java +++ b/altoslib/AltosFlightReader.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; import java.io.*; diff --git a/altoslib/AltosFlightStats.java b/altoslib/AltosFlightStats.java index 56feb848..1b88cb9f 100644 --- a/altoslib/AltosFlightStats.java +++ b/altoslib/AltosFlightStats.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosFrequency.java b/altoslib/AltosFrequency.java index d1ab847b..6093df49 100644 --- a/altoslib/AltosFrequency.java +++ b/altoslib/AltosFrequency.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosFrequency { public double frequency; diff --git a/altoslib/AltosGPS.java b/altoslib/AltosGPS.java index 2708d026..aabcfc5b 100644 --- a/altoslib/AltosGPS.java +++ b/altoslib/AltosGPS.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; import java.util.concurrent.*; diff --git a/altoslib/AltosGPSSat.java b/altoslib/AltosGPSSat.java index ef24d497..adbcbe61 100644 --- a/altoslib/AltosGPSSat.java +++ b/altoslib/AltosGPSSat.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosGPSSat { public int svid; diff --git a/altoslib/AltosGreatCircle.java b/altoslib/AltosGreatCircle.java index 4782c34d..716eeef9 100644 --- a/altoslib/AltosGreatCircle.java +++ b/altoslib/AltosGreatCircle.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.lang.Math; diff --git a/altoslib/AltosHeight.java b/altoslib/AltosHeight.java index 84981032..8c67e043 100644 --- a/altoslib/AltosHeight.java +++ b/altoslib/AltosHeight.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosHeight extends AltosUnits { diff --git a/altoslib/AltosHexfile.java b/altoslib/AltosHexfile.java index d5fa8f5f..9ee64bdc 100644 --- a/altoslib/AltosHexfile.java +++ b/altoslib/AltosHexfile.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.LinkedList; diff --git a/altoslib/AltosHexsym.java b/altoslib/AltosHexsym.java index 403b5644..52eb81db 100644 --- a/altoslib/AltosHexsym.java +++ b/altoslib/AltosHexsym.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosHexsym { String name; diff --git a/altoslib/AltosIMU.java b/altoslib/AltosIMU.java index a22b3fed..89d7def4 100644 --- a/altoslib/AltosIMU.java +++ b/altoslib/AltosIMU.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.*; diff --git a/altoslib/AltosIdle.java b/altoslib/AltosIdle.java index 55f6f5c9..0f723d14 100644 --- a/altoslib/AltosIdle.java +++ b/altoslib/AltosIdle.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosIdleFetch.java b/altoslib/AltosIdleFetch.java index 5cd8bf36..1cb43d6d 100644 --- a/altoslib/AltosIdleFetch.java +++ b/altoslib/AltosIdleFetch.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosIdleMonitor.java b/altoslib/AltosIdleMonitor.java index f81abdff..85bcff10 100644 --- a/altoslib/AltosIdleMonitor.java +++ b/altoslib/AltosIdleMonitor.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.concurrent.*; diff --git a/altoslib/AltosIdleMonitorListener.java b/altoslib/AltosIdleMonitorListener.java index 6a9abea2..4382430c 100644 --- a/altoslib/AltosIdleMonitorListener.java +++ b/altoslib/AltosIdleMonitorListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosIdleMonitorListener { public void update(AltosState state, AltosListenerState listener_state); diff --git a/altoslib/AltosIgnite.java b/altoslib/AltosIgnite.java index c21f17ac..b458911e 100644 --- a/altoslib/AltosIgnite.java +++ b/altoslib/AltosIgnite.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.*; import java.io.*; diff --git a/altoslib/AltosKML.java b/altoslib/AltosKML.java index d55da9ef..e31ddfba 100644 --- a/altoslib/AltosKML.java +++ b/altoslib/AltosKML.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosLatitude.java b/altoslib/AltosLatitude.java index 6156d6dc..2b507173 100644 --- a/altoslib/AltosLatitude.java +++ b/altoslib/AltosLatitude.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosLatitude extends AltosLocation { public String pos() { return "N"; } diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index 69c6d604..ec32fffc 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.*; import java.io.*; diff --git a/altoslib/AltosLine.java b/altoslib/AltosLine.java index f9c712a3..f56938c6 100644 --- a/altoslib/AltosLine.java +++ b/altoslib/AltosLine.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosLine { public String line; diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java index 7f434a06..08bca5fc 100644 --- a/altoslib/AltosLink.java +++ b/altoslib/AltosLink.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.concurrent.*; diff --git a/altoslib/AltosListenerState.java b/altoslib/AltosListenerState.java index 5bf761b0..054ff1d0 100644 --- a/altoslib/AltosListenerState.java +++ b/altoslib/AltosListenerState.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosListenerState { public int crc_errors; diff --git a/altoslib/AltosLocation.java b/altoslib/AltosLocation.java index 725a02ba..9bbbb899 100644 --- a/altoslib/AltosLocation.java +++ b/altoslib/AltosLocation.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public abstract class AltosLocation extends AltosUnits { diff --git a/altoslib/AltosLog.java b/altoslib/AltosLog.java index c4e9e425..1cac6b52 100644 --- a/altoslib/AltosLog.java +++ b/altoslib/AltosLog.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.text.*; diff --git a/altoslib/AltosLongitude.java b/altoslib/AltosLongitude.java index 29a5dcd4..dbcd6bf0 100644 --- a/altoslib/AltosLongitude.java +++ b/altoslib/AltosLongitude.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosLongitude extends AltosLocation { public String pos() { return "E"; } diff --git a/altoslib/AltosMag.java b/altoslib/AltosMag.java index 9262de2d..690241f1 100644 --- a/altoslib/AltosMag.java +++ b/altoslib/AltosMag.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.*; diff --git a/altoslib/AltosMma655x.java b/altoslib/AltosMma655x.java index cb2e63d4..ea47cc9b 100644 --- a/altoslib/AltosMma655x.java +++ b/altoslib/AltosMma655x.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.*; diff --git a/altoslib/AltosMs5607.java b/altoslib/AltosMs5607.java index 5aa3a7ec..81e0641c 100644 --- a/altoslib/AltosMs5607.java +++ b/altoslib/AltosMs5607.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.*; diff --git a/altoslib/AltosNoSymbol.java b/altoslib/AltosNoSymbol.java index f5e53b8c..d436c3f1 100644 --- a/altoslib/AltosNoSymbol.java +++ b/altoslib/AltosNoSymbol.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosNoSymbol extends Exception { public AltosNoSymbol(String name) { diff --git a/altoslib/AltosOrient.java b/altoslib/AltosOrient.java index 5fcbe28d..348c6844 100644 --- a/altoslib/AltosOrient.java +++ b/altoslib/AltosOrient.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosOrient extends AltosUnits { diff --git a/altoslib/AltosParse.java b/altoslib/AltosParse.java index 1bff7682..9cb99a0d 100644 --- a/altoslib/AltosParse.java +++ b/altoslib/AltosParse.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index d299f27b..159951e4 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosPreferencesBackend.java b/altoslib/AltosPreferencesBackend.java index 461b5c80..76a99acb 100644 --- a/altoslib/AltosPreferencesBackend.java +++ b/altoslib/AltosPreferencesBackend.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.File; diff --git a/altoslib/AltosProgrammer.java b/altoslib/AltosProgrammer.java index c96f04ca..443082d5 100644 --- a/altoslib/AltosProgrammer.java +++ b/altoslib/AltosProgrammer.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosPyro.java b/altoslib/AltosPyro.java index 9e47bc80..60b8fe52 100644 --- a/altoslib/AltosPyro.java +++ b/altoslib/AltosPyro.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.*; import java.text.*; diff --git a/altoslib/AltosReplayReader.java b/altoslib/AltosReplayReader.java index bf7e0e5b..15093af1 100644 --- a/altoslib/AltosReplayReader.java +++ b/altoslib/AltosReplayReader.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosRomconfig.java b/altoslib/AltosRomconfig.java index 10df11af..d0de5492 100644 --- a/altoslib/AltosRomconfig.java +++ b/altoslib/AltosRomconfig.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosSelfFlash.java b/altoslib/AltosSelfFlash.java index 502c6d65..3ec69213 100644 --- a/altoslib/AltosSelfFlash.java +++ b/altoslib/AltosSelfFlash.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; diff --git a/altoslib/AltosSensorEMini.java b/altoslib/AltosSensorEMini.java index ee0238f9..53a8e998 100644 --- a/altoslib/AltosSensorEMini.java +++ b/altoslib/AltosSensorEMini.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.TimeoutException; diff --git a/altoslib/AltosSensorMM.java b/altoslib/AltosSensorMM.java index e34e71b7..cdc2ac42 100644 --- a/altoslib/AltosSensorMM.java +++ b/altoslib/AltosSensorMM.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.TimeoutException; diff --git a/altoslib/AltosSensorMega.java b/altoslib/AltosSensorMega.java index 02f3a256..3c7213eb 100644 --- a/altoslib/AltosSensorMega.java +++ b/altoslib/AltosSensorMega.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.TimeoutException; diff --git a/altoslib/AltosSensorMetrum.java b/altoslib/AltosSensorMetrum.java index e5421ef5..d977e886 100644 --- a/altoslib/AltosSensorMetrum.java +++ b/altoslib/AltosSensorMetrum.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.TimeoutException; diff --git a/altoslib/AltosSensorTM.java b/altoslib/AltosSensorTM.java index 2d60d8cf..344e7449 100644 --- a/altoslib/AltosSensorTM.java +++ b/altoslib/AltosSensorTM.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.TimeoutException; diff --git a/altoslib/AltosSensorTMini.java b/altoslib/AltosSensorTMini.java index b9eeca0c..edd76da2 100644 --- a/altoslib/AltosSensorTMini.java +++ b/altoslib/AltosSensorTMini.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.util.concurrent.TimeoutException; diff --git a/altoslib/AltosSpeed.java b/altoslib/AltosSpeed.java index 9134f5f4..d2f86214 100644 --- a/altoslib/AltosSpeed.java +++ b/altoslib/AltosSpeed.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosSpeed extends AltosUnits { diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index b05cd358..e0c00602 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -19,7 +19,7 @@ * Track flight state from telemetry or eeprom data stream */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosState implements Cloneable { diff --git a/altoslib/AltosStateIterable.java b/altoslib/AltosStateIterable.java index be812095..f7cd424d 100644 --- a/altoslib/AltosStateIterable.java +++ b/altoslib/AltosStateIterable.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosStateUpdate.java b/altoslib/AltosStateUpdate.java index ac4e963e..70530f75 100644 --- a/altoslib/AltosStateUpdate.java +++ b/altoslib/AltosStateUpdate.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosStateUpdate { public void update_state(AltosState state) throws InterruptedException; diff --git a/altoslib/AltosTelemetry.java b/altoslib/AltosTelemetry.java index 8182ec6b..4d50a059 100644 --- a/altoslib/AltosTelemetry.java +++ b/altoslib/AltosTelemetry.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; diff --git a/altoslib/AltosTelemetryConfiguration.java b/altoslib/AltosTelemetryConfiguration.java index e3884051..f578e6ad 100644 --- a/altoslib/AltosTelemetryConfiguration.java +++ b/altoslib/AltosTelemetryConfiguration.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryConfiguration extends AltosTelemetryStandard { diff --git a/altoslib/AltosTelemetryFile.java b/altoslib/AltosTelemetryFile.java index 3d3fa407..15344b8d 100644 --- a/altoslib/AltosTelemetryFile.java +++ b/altoslib/AltosTelemetryFile.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosTelemetryIterable.java b/altoslib/AltosTelemetryIterable.java index cba97ddc..ac42597d 100644 --- a/altoslib/AltosTelemetryIterable.java +++ b/altoslib/AltosTelemetryIterable.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.io.*; import java.util.*; diff --git a/altoslib/AltosTelemetryLegacy.java b/altoslib/AltosTelemetryLegacy.java index 3367ece7..b7aae3c4 100644 --- a/altoslib/AltosTelemetryLegacy.java +++ b/altoslib/AltosTelemetryLegacy.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java index 8368188f..32ca7608 100644 --- a/altoslib/AltosTelemetryLocation.java +++ b/altoslib/AltosTelemetryLocation.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryLocation extends AltosTelemetryStandard { diff --git a/altoslib/AltosTelemetryMap.java b/altoslib/AltosTelemetryMap.java index 8d0de355..758311eb 100644 --- a/altoslib/AltosTelemetryMap.java +++ b/altoslib/AltosTelemetryMap.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; import java.util.HashMap; diff --git a/altoslib/AltosTelemetryMegaData.java b/altoslib/AltosTelemetryMegaData.java index fac5695f..93610118 100644 --- a/altoslib/AltosTelemetryMegaData.java +++ b/altoslib/AltosTelemetryMegaData.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryMegaData extends AltosTelemetryStandard { int state; diff --git a/altoslib/AltosTelemetryMegaSensor.java b/altoslib/AltosTelemetryMegaSensor.java index 9e73bc4e..1b568c88 100644 --- a/altoslib/AltosTelemetryMegaSensor.java +++ b/altoslib/AltosTelemetryMegaSensor.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryMegaSensor extends AltosTelemetryStandard { int accel; diff --git a/altoslib/AltosTelemetryMetrumData.java b/altoslib/AltosTelemetryMetrumData.java index 96617306..3377d969 100644 --- a/altoslib/AltosTelemetryMetrumData.java +++ b/altoslib/AltosTelemetryMetrumData.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryMetrumData extends AltosTelemetryStandard { diff --git a/altoslib/AltosTelemetryMetrumSensor.java b/altoslib/AltosTelemetryMetrumSensor.java index e7055404..3e0abedc 100644 --- a/altoslib/AltosTelemetryMetrumSensor.java +++ b/altoslib/AltosTelemetryMetrumSensor.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { diff --git a/altoslib/AltosTelemetryMini.java b/altoslib/AltosTelemetryMini.java index fbfaff8e..221bb67c 100644 --- a/altoslib/AltosTelemetryMini.java +++ b/altoslib/AltosTelemetryMini.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryMini extends AltosTelemetryStandard { diff --git a/altoslib/AltosTelemetryRaw.java b/altoslib/AltosTelemetryRaw.java index 0dca62aa..2a535e84 100644 --- a/altoslib/AltosTelemetryRaw.java +++ b/altoslib/AltosTelemetryRaw.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetryRaw extends AltosTelemetryStandard { public AltosTelemetryRaw(int[] bytes) { diff --git a/altoslib/AltosTelemetryReader.java b/altoslib/AltosTelemetryReader.java index 3dff661a..589f57f2 100644 --- a/altoslib/AltosTelemetryReader.java +++ b/altoslib/AltosTelemetryReader.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; import java.text.*; import java.io.*; diff --git a/altoslib/AltosTelemetrySatellite.java b/altoslib/AltosTelemetrySatellite.java index d611e88c..d1cdaf6d 100644 --- a/altoslib/AltosTelemetrySatellite.java +++ b/altoslib/AltosTelemetrySatellite.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetrySatellite extends AltosTelemetryStandard { int channels; diff --git a/altoslib/AltosTelemetrySensor.java b/altoslib/AltosTelemetrySensor.java index ad4d9283..fc3fe858 100644 --- a/altoslib/AltosTelemetrySensor.java +++ b/altoslib/AltosTelemetrySensor.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTelemetrySensor extends AltosTelemetryStandard { diff --git a/altoslib/AltosTelemetryStandard.java b/altoslib/AltosTelemetryStandard.java index 23ae9d21..f4dfd8e9 100644 --- a/altoslib/AltosTelemetryStandard.java +++ b/altoslib/AltosTelemetryStandard.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public abstract class AltosTelemetryStandard extends AltosTelemetry { int[] bytes; diff --git a/altoslib/AltosTemperature.java b/altoslib/AltosTemperature.java index 5fa71b86..e654fada 100644 --- a/altoslib/AltosTemperature.java +++ b/altoslib/AltosTemperature.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosTemperature extends AltosUnits { diff --git a/altoslib/AltosUnits.java b/altoslib/AltosUnits.java index d29cfae7..dbdb7882 100644 --- a/altoslib/AltosUnits.java +++ b/altoslib/AltosUnits.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public abstract class AltosUnits { diff --git a/altoslib/AltosUnitsListener.java b/altoslib/AltosUnitsListener.java index ca6faafd..664aed67 100644 --- a/altoslib/AltosUnitsListener.java +++ b/altoslib/AltosUnitsListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosUnitsListener { public void units_changed(boolean imperial_units); diff --git a/altoslib/AltosVoltage.java b/altoslib/AltosVoltage.java index 351bf115..22bd1aee 100644 --- a/altoslib/AltosVoltage.java +++ b/altoslib/AltosVoltage.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public class AltosVoltage extends AltosUnits { diff --git a/altoslib/AltosWriter.java b/altoslib/AltosWriter.java index c3479a93..9df52250 100644 --- a/altoslib/AltosWriter.java +++ b/altoslib/AltosWriter.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_4; +package org.altusmetrum.altoslib_5; public interface AltosWriter { diff --git a/altosui/Altos.java b/altosui/Altos.java index 28038ad6..74b45f1c 100644 --- a/altosui/Altos.java +++ b/altosui/Altos.java @@ -20,8 +20,8 @@ package altosui; import java.awt.*; import libaltosJNI.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class Altos extends AltosUILib { diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java index 3bc80406..24fc362f 100644 --- a/altosui/AltosAscent.java +++ b/altosui/AltosAscent.java @@ -21,8 +21,8 @@ import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosAscent extends AltosUIFlightTab { JLabel cur, max; diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java index e7b335ac..7ac53dd8 100644 --- a/altosui/AltosCompanionInfo.java +++ b/altosui/AltosCompanionInfo.java @@ -19,8 +19,8 @@ package altosui; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosCompanionInfo extends JTable implements AltosFlightDisplay { private AltosFlightInfoTableModel model; diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java index 6eb7d40c..40f7ebec 100644 --- a/altosui/AltosConfig.java +++ b/altosui/AltosConfig.java @@ -22,8 +22,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.text.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfig implements ActionListener { diff --git a/altosui/AltosConfigPyroUI.java b/altosui/AltosConfigPyroUI.java index f0b4f0f9..dd4fb505 100644 --- a/altosui/AltosConfigPyroUI.java +++ b/altosui/AltosConfigPyroUI.java @@ -21,8 +21,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigPyroUI extends AltosUIDialog diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index bfbd2c77..2976657c 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -21,8 +21,8 @@ import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigTD implements ActionListener { diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index 955c7dab..ca365718 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -21,8 +21,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigTDUI extends AltosUIDialog diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 1b5ff988..4a33b64f 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -21,8 +21,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigUI extends AltosUIDialog diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index e61a4a5b..80d6d341 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -22,7 +22,7 @@ import java.awt.event.*; import java.beans.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class AltosConfigureUI extends AltosUIConfigure diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index 36fc1613..e38b35ed 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -21,8 +21,8 @@ import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosDescent extends AltosUIFlightTab { diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java index 46c0b387..7e7efa64 100644 --- a/altosui/AltosFlightStatus.java +++ b/altosui/AltosFlightStatus.java @@ -19,8 +19,8 @@ package altosui; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosFlightStatus extends JComponent implements AltosFlightDisplay { GridBagLayout layout; diff --git a/altosui/AltosFlightStatusTableModel.java b/altosui/AltosFlightStatusTableModel.java index b33f40a4..336b44aa 100644 --- a/altosui/AltosFlightStatusTableModel.java +++ b/altosui/AltosFlightStatusTableModel.java @@ -27,7 +27,7 @@ import java.util.*; import java.text.*; import java.util.prefs.*; import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosFlightStatusTableModel extends AbstractTableModel { private String[] columnNames = { diff --git a/altosui/AltosFlightStatusUpdate.java b/altosui/AltosFlightStatusUpdate.java index 0daec04e..3ba78c19 100644 --- a/altosui/AltosFlightStatusUpdate.java +++ b/altosui/AltosFlightStatusUpdate.java @@ -18,7 +18,7 @@ package altosui; import java.awt.event.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosFlightStatusUpdate implements ActionListener { diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 2e192c73..5aff1817 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -22,8 +22,8 @@ import java.awt.event.*; import javax.swing.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { AltosVoice voice; diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java index 07fe9317..ddd281a6 100644 --- a/altosui/AltosGraphUI.java +++ b/altosui/AltosGraphUI.java @@ -23,8 +23,8 @@ import java.util.ArrayList; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 042111ec..dd69b6f1 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -24,8 +24,8 @@ import javax.swing.event.*; import java.io.*; import java.util.concurrent.*; import java.util.Arrays; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosIdleMonitorListener, DocumentListener { AltosDevice device; diff --git a/altosui/AltosIgniteUI.java b/altosui/AltosIgniteUI.java index c251bbe2..15a81e57 100644 --- a/altosui/AltosIgniteUI.java +++ b/altosui/AltosIgniteUI.java @@ -24,8 +24,8 @@ import java.io.*; import java.text.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosIgniteUI extends AltosUIDialog diff --git a/altosui/AltosIgnitor.java b/altosui/AltosIgnitor.java index 990a87e6..117def09 100644 --- a/altosui/AltosIgnitor.java +++ b/altosui/AltosIgnitor.java @@ -20,8 +20,8 @@ package altosui; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosIgnitor extends AltosUIFlightTab { diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java index dd5cf9ab..50c1ea31 100644 --- a/altosui/AltosLanded.java +++ b/altosui/AltosLanded.java @@ -21,8 +21,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosLanded extends AltosUIFlightTab implements ActionListener { diff --git a/altosui/AltosLaunch.java b/altosui/AltosLaunch.java index 9ac1e44c..17178616 100644 --- a/altosui/AltosLaunch.java +++ b/altosui/AltosLaunch.java @@ -20,7 +20,7 @@ package altosui; import java.io.*; import java.util.concurrent.*; import java.awt.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class AltosLaunch { AltosDevice device; diff --git a/altosui/AltosLaunchUI.java b/altosui/AltosLaunchUI.java index cc082542..3320e675 100644 --- a/altosui/AltosLaunchUI.java +++ b/altosui/AltosLaunchUI.java @@ -23,7 +23,7 @@ import javax.swing.*; import java.io.*; import java.text.*; import java.util.concurrent.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; class FireButton extends JButton { protected void processMouseEvent(MouseEvent e) { diff --git a/altosui/AltosPad.java b/altosui/AltosPad.java index 6b5fd150..5c33fd16 100644 --- a/altosui/AltosPad.java +++ b/altosui/AltosPad.java @@ -18,8 +18,8 @@ package altosui; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosPad extends AltosUIFlightTab { diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index 6137487c..1eb03805 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.java @@ -22,8 +22,8 @@ import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class AltosUI extends AltosUIFrame { public AltosVoice voice = new AltosVoice(); diff --git a/altosui/AltosUIPreferencesBackend.java b/altosui/AltosUIPreferencesBackend.java index 28047086..b229d7b2 100644 --- a/altosui/AltosUIPreferencesBackend.java +++ b/altosui/AltosUIPreferencesBackend.java @@ -19,7 +19,7 @@ package altosui; import java.io.File; import java.util.prefs.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import javax.swing.filechooser.FileSystemView; public class AltosUIPreferencesBackend implements AltosPreferencesBackend { diff --git a/altosuilib/AltosBTDevice.java b/altosuilib/AltosBTDevice.java index beefa532..2c085021 100644 --- a/altosuilib/AltosBTDevice.java +++ b/altosuilib/AltosBTDevice.java @@ -15,10 +15,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import libaltosJNI.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosBTDevice extends altos_bt_device implements AltosDevice { diff --git a/altosuilib/AltosBTDeviceIterator.java b/altosuilib/AltosBTDeviceIterator.java index cad60ffb..c99b27f9 100644 --- a/altosuilib/AltosBTDeviceIterator.java +++ b/altosuilib/AltosBTDeviceIterator.java @@ -15,11 +15,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.util.*; import libaltosJNI.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosBTDeviceIterator implements Iterator { AltosBTDevice current; diff --git a/altosuilib/AltosBTKnown.java b/altosuilib/AltosBTKnown.java index 02883c75..c526269d 100644 --- a/altosuilib/AltosBTKnown.java +++ b/altosuilib/AltosBTKnown.java @@ -15,10 +15,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.util.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosBTKnown implements Iterable { LinkedList devices = new LinkedList(); diff --git a/altosuilib/AltosBTManage.java b/altosuilib/AltosBTManage.java index 6da0a3eb..b953ca92 100644 --- a/altosuilib/AltosBTManage.java +++ b/altosuilib/AltosBTManage.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -23,7 +23,7 @@ import javax.swing.*; import javax.swing.plaf.basic.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosBTManage extends AltosUIDialog implements ActionListener, Iterable { LinkedBlockingQueue found_devices; diff --git a/altosuilib/AltosCSVUI.java b/altosuilib/AltosCSVUI.java index 0a5e4fa2..6328d37d 100644 --- a/altosuilib/AltosCSVUI.java +++ b/altosuilib/AltosCSVUI.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosCSVUI extends AltosUIDialog diff --git a/altosuilib/AltosConfigFreqUI.java b/altosuilib/AltosConfigFreqUI.java index 6dcd63b8..a0525a00 100644 --- a/altosuilib/AltosConfigFreqUI.java +++ b/altosuilib/AltosConfigFreqUI.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class AltosEditFreqUI extends AltosUIDialog implements ActionListener { Frame frame; diff --git a/altosuilib/AltosDataChooser.java b/altosuilib/AltosDataChooser.java index 59891c4a..1990faf1 100644 --- a/altosuilib/AltosDataChooser.java +++ b/altosuilib/AltosDataChooser.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosDataChooser extends JFileChooser { JFrame frame; diff --git a/altosuilib/AltosDevice.java b/altosuilib/AltosDevice.java index 251ae994..1f5536ff 100644 --- a/altosuilib/AltosDevice.java +++ b/altosuilib/AltosDevice.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import libaltosJNI.*; diff --git a/altosuilib/AltosDeviceDialog.java b/altosuilib/AltosDeviceDialog.java index 0bedea97..0875bea7 100644 --- a/altosuilib/AltosDeviceDialog.java +++ b/altosuilib/AltosDeviceDialog.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; import java.awt.*; diff --git a/altosuilib/AltosDeviceUIDialog.java b/altosuilib/AltosDeviceUIDialog.java index 3013612a..80a76d6d 100644 --- a/altosuilib/AltosDeviceUIDialog.java +++ b/altosuilib/AltosDeviceUIDialog.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; import java.awt.*; diff --git a/altosuilib/AltosDisplayThread.java b/altosuilib/AltosDisplayThread.java index 06bc68a9..6b6e03e7 100644 --- a/altosuilib/AltosDisplayThread.java +++ b/altosuilib/AltosDisplayThread.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import javax.swing.*; import java.io.*; import java.text.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosDisplayThread extends Thread { diff --git a/altosuilib/AltosEepromDelete.java b/altosuilib/AltosEepromDelete.java index 981daddf..39585dad 100644 --- a/altosuilib/AltosEepromDelete.java +++ b/altosuilib/AltosEepromDelete.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosEepromDelete implements Runnable { AltosEepromList flights; diff --git a/altosuilib/AltosEepromManage.java b/altosuilib/AltosEepromManage.java index 2b967339..81dd3d13 100644 --- a/altosuilib/AltosEepromManage.java +++ b/altosuilib/AltosEepromManage.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosEepromManage implements ActionListener { diff --git a/altosuilib/AltosEepromMonitor.java b/altosuilib/AltosEepromMonitor.java index b1e85622..060d0474 100644 --- a/altosuilib/AltosEepromMonitor.java +++ b/altosuilib/AltosEepromMonitor.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; diff --git a/altosuilib/AltosEepromMonitorUI.java b/altosuilib/AltosEepromMonitorUI.java index 02c71cd9..11dd4adb 100644 --- a/altosuilib/AltosEepromMonitorUI.java +++ b/altosuilib/AltosEepromMonitorUI.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMonitor { JFrame owner; diff --git a/altosuilib/AltosEepromSelect.java b/altosuilib/AltosEepromSelect.java index 293d3045..1adfdab5 100644 --- a/altosuilib/AltosEepromSelect.java +++ b/altosuilib/AltosEepromSelect.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class AltosEepromItem implements ActionListener { AltosEepromLog log; diff --git a/altosuilib/AltosFlashUI.java b/altosuilib/AltosFlashUI.java index 3f120617..0ed4e75d 100644 --- a/altosuilib/AltosFlashUI.java +++ b/altosuilib/AltosFlashUI.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -23,7 +23,7 @@ import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosFlashUI extends AltosUIDialog diff --git a/altosuilib/AltosFlightDisplay.java b/altosuilib/AltosFlightDisplay.java index 55b74034..d0f20bb4 100644 --- a/altosuilib/AltosFlightDisplay.java +++ b/altosuilib/AltosFlightDisplay.java @@ -15,9 +15,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public interface AltosFlightDisplay extends AltosUnitsListener, AltosFontListener { void reset(); diff --git a/altosuilib/AltosFlightInfoTableModel.java b/altosuilib/AltosFlightInfoTableModel.java index 3995efb3..0bc4f847 100644 --- a/altosuilib/AltosFlightInfoTableModel.java +++ b/altosuilib/AltosFlightInfoTableModel.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.table.*; diff --git a/altosuilib/AltosFlightStatsTable.java b/altosuilib/AltosFlightStatsTable.java index 703dfb9d..1ec4a03e 100644 --- a/altosuilib/AltosFlightStatsTable.java +++ b/altosuilib/AltosFlightStatsTable.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import javax.swing.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosFlightStatsTable extends JComponent implements AltosFontListener { GridBagLayout layout; diff --git a/altosuilib/AltosFontListener.java b/altosuilib/AltosFontListener.java index a98cc131..a1b2170b 100644 --- a/altosuilib/AltosFontListener.java +++ b/altosuilib/AltosFontListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosFontListener { void font_size_changed(int font_size); diff --git a/altosuilib/AltosFreqList.java b/altosuilib/AltosFreqList.java index a4c3e36a..293ce032 100644 --- a/altosuilib/AltosFreqList.java +++ b/altosuilib/AltosFreqList.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.util.*; import javax.swing.*; import java.awt.event.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class FreqEntry extends JMenuItem { AltosFrequency frequency; diff --git a/altosuilib/AltosGraph.java b/altosuilib/AltosGraph.java index f8c8b27b..292437de 100644 --- a/altosuilib/AltosGraph.java +++ b/altosuilib/AltosGraph.java @@ -15,14 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosGraphDataPoint.java b/altosuilib/AltosGraphDataPoint.java index 3aff1e82..14486abf 100644 --- a/altosuilib/AltosGraphDataPoint.java +++ b/altosuilib/AltosGraphDataPoint.java @@ -15,9 +15,9 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosGraphDataPoint implements AltosUIDataPoint { diff --git a/altosuilib/AltosGraphDataSet.java b/altosuilib/AltosGraphDataSet.java index 36933e9b..0845f20e 100644 --- a/altosuilib/AltosGraphDataSet.java +++ b/altosuilib/AltosGraphDataSet.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.lang.*; import java.io.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class AltosGraphIterator implements Iterator { AltosGraphDataSet dataSet; diff --git a/altosuilib/AltosInfoTable.java b/altosuilib/AltosInfoTable.java index 23ae4ae5..ce986ac5 100644 --- a/altosuilib/AltosInfoTable.java +++ b/altosuilib/AltosInfoTable.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosInfoTable extends JTable implements AltosFlightDisplay, HierarchyListener { private AltosFlightInfoTableModel model; diff --git a/altosuilib/AltosLed.java b/altosuilib/AltosLed.java index 2debb62a..0dd5740c 100644 --- a/altosuilib/AltosLed.java +++ b/altosuilib/AltosLed.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; diff --git a/altosuilib/AltosLights.java b/altosuilib/AltosLights.java index c91b70e9..30934d96 100644 --- a/altosuilib/AltosLights.java +++ b/altosuilib/AltosLights.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import javax.swing.*; diff --git a/altosuilib/AltosPositionListener.java b/altosuilib/AltosPositionListener.java index 34cf1650..dfc3c649 100644 --- a/altosuilib/AltosPositionListener.java +++ b/altosuilib/AltosPositionListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosPositionListener { public void position_changed(int position); diff --git a/altosuilib/AltosRomconfigUI.java b/altosuilib/AltosRomconfigUI.java index 8f002c4a..481ce656 100644 --- a/altosuilib/AltosRomconfigUI.java +++ b/altosuilib/AltosRomconfigUI.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosRomconfigUI extends AltosUIDialog diff --git a/altosuilib/AltosScanUI.java b/altosuilib/AltosScanUI.java index b0cde059..7e1c7a97 100644 --- a/altosuilib/AltosScanUI.java +++ b/altosuilib/AltosScanUI.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.io.*; import java.util.*; import java.text.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class AltosScanResult { String callsign; diff --git a/altosuilib/AltosSerial.java b/altosuilib/AltosSerial.java index 60e15bdb..0eba55fd 100644 --- a/altosuilib/AltosSerial.java +++ b/altosuilib/AltosSerial.java @@ -19,13 +19,13 @@ * Deal with TeleDongle on a serial port */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.*; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import libaltosJNI.*; /* diff --git a/altosuilib/AltosSerialInUseException.java b/altosuilib/AltosSerialInUseException.java index 1e8207d1..cd19b101 100644 --- a/altosuilib/AltosSerialInUseException.java +++ b/altosuilib/AltosSerialInUseException.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public class AltosSerialInUseException extends Exception { public AltosDevice device; diff --git a/altosuilib/AltosUIAxis.java b/altosuilib/AltosUIAxis.java index 74561673..1b5b9205 100644 --- a/altosuilib/AltosUIAxis.java +++ b/altosuilib/AltosUIAxis.java @@ -15,14 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java index 920ed8e2..9d54cfe5 100644 --- a/altosuilib/AltosUIConfigure.java +++ b/altosuilib/AltosUIConfigure.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; diff --git a/altosuilib/AltosUIDataMissing.java b/altosuilib/AltosUIDataMissing.java index 353ff30f..9a810a41 100644 --- a/altosuilib/AltosUIDataMissing.java +++ b/altosuilib/AltosUIDataMissing.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public class AltosUIDataMissing extends Exception { public int id; diff --git a/altosuilib/AltosUIDataPoint.java b/altosuilib/AltosUIDataPoint.java index 3f16500e..f72bbcd5 100644 --- a/altosuilib/AltosUIDataPoint.java +++ b/altosuilib/AltosUIDataPoint.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosUIDataPoint { public abstract double x() throws AltosUIDataMissing; diff --git a/altosuilib/AltosUIDataSet.java b/altosuilib/AltosUIDataSet.java index ee70a3fd..9e048587 100644 --- a/altosuilib/AltosUIDataSet.java +++ b/altosuilib/AltosUIDataSet.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosUIDataSet { public abstract String name(); diff --git a/altosuilib/AltosUIDialog.java b/altosuilib/AltosUIDialog.java index dc737414..9fc5283e 100644 --- a/altosuilib/AltosUIDialog.java +++ b/altosuilib/AltosUIDialog.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; diff --git a/altosuilib/AltosUIEnable.java b/altosuilib/AltosUIEnable.java index da98797a..e227d2b7 100644 --- a/altosuilib/AltosUIEnable.java +++ b/altosuilib/AltosUIEnable.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -23,7 +23,7 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosUIFlightTab.java b/altosuilib/AltosUIFlightTab.java index 039d83e0..74161634 100644 --- a/altosuilib/AltosUIFlightTab.java +++ b/altosuilib/AltosUIFlightTab.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public abstract class AltosUIFlightTab extends JComponent implements AltosFlightDisplay, HierarchyListener { public GridBagLayout layout; diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java index 2de1fb1c..689ea7f3 100644 --- a/altosuilib/AltosUIFrame.java +++ b/altosuilib/AltosUIFrame.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; diff --git a/altosuilib/AltosUIGraph.java b/altosuilib/AltosUIGraph.java index 9cca088d..870c4e93 100644 --- a/altosuilib/AltosUIGraph.java +++ b/altosuilib/AltosUIGraph.java @@ -15,14 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosUIGrapher.java b/altosuilib/AltosUIGrapher.java index 724fac18..39accab4 100644 --- a/altosuilib/AltosUIGrapher.java +++ b/altosuilib/AltosUIGrapher.java @@ -15,14 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosUIIndicator.java b/altosuilib/AltosUIIndicator.java index b1626cba..d17078e7 100644 --- a/altosuilib/AltosUIIndicator.java +++ b/altosuilib/AltosUIIndicator.java @@ -15,11 +15,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public abstract class AltosUIIndicator implements AltosFontListener, AltosUnitsListener { JLabel label; diff --git a/altosuilib/AltosUILatLon.java b/altosuilib/AltosUILatLon.java index 688dd58b..a15bf19f 100644 --- a/altosuilib/AltosUILatLon.java +++ b/altosuilib/AltosUILatLon.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.lang.Math; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUILatLon { public double lat; diff --git a/altosuilib/AltosUILib.java b/altosuilib/AltosUILib.java index b51c5963..0050f12c 100644 --- a/altosuilib/AltosUILib.java +++ b/altosuilib/AltosUILib.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import libaltosJNI.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUILib extends AltosLib { diff --git a/altosuilib/AltosUIListener.java b/altosuilib/AltosUIListener.java index 75a0ad94..a32d310c 100644 --- a/altosuilib/AltosUIListener.java +++ b/altosuilib/AltosUIListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosUIListener { public void ui_changed(String look_and_feel); diff --git a/altosuilib/AltosUIMap.java b/altosuilib/AltosUIMap.java index aaa68f23..c22801f8 100644 --- a/altosuilib/AltosUIMap.java +++ b/altosuilib/AltosUIMap.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.lang.Math; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosUIMapZoomListener { diff --git a/altosuilib/AltosUIMapCache.java b/altosuilib/AltosUIMapCache.java index 55311d8c..3f1512df 100644 --- a/altosuilib/AltosUIMapCache.java +++ b/altosuilib/AltosUIMapCache.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; import javax.imageio.ImageIO; diff --git a/altosuilib/AltosUIMapImage.java b/altosuilib/AltosUIMapImage.java index 3819d079..77cd4299 100644 --- a/altosuilib/AltosUIMapImage.java +++ b/altosuilib/AltosUIMapImage.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import javax.swing.*; import javax.imageio.ImageIO; diff --git a/altosuilib/AltosUIMapLine.java b/altosuilib/AltosUIMapLine.java index e09a2d9f..86d2e6e2 100644 --- a/altosuilib/AltosUIMapLine.java +++ b/altosuilib/AltosUIMapLine.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.lang.Math; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIMapLine { AltosUILatLon start, end; diff --git a/altosuilib/AltosUIMapMark.java b/altosuilib/AltosUIMapMark.java index 8c640e5f..47fc4d5e 100644 --- a/altosuilib/AltosUIMapMark.java +++ b/altosuilib/AltosUIMapMark.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.lang.Math; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIMapMark { diff --git a/altosuilib/AltosUIMapPath.java b/altosuilib/AltosUIMapPath.java index ff17be67..705f4b6a 100644 --- a/altosuilib/AltosUIMapPath.java +++ b/altosuilib/AltosUIMapPath.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.lang.Math; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class PathPoint { AltosUILatLon lat_lon; diff --git a/altosuilib/AltosUIMapPreload.java b/altosuilib/AltosUIMapPreload.java index 56066d70..1c088a49 100644 --- a/altosuilib/AltosUIMapPreload.java +++ b/altosuilib/AltosUIMapPreload.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -26,7 +26,7 @@ import java.text.*; import java.lang.Math; import java.net.URL; import java.net.URLConnection; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class AltosUIMapPos extends Box { AltosUIFrame owner; diff --git a/altosuilib/AltosUIMapRectangle.java b/altosuilib/AltosUIMapRectangle.java index 8a5b16e1..463ef3f2 100644 --- a/altosuilib/AltosUIMapRectangle.java +++ b/altosuilib/AltosUIMapRectangle.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public class AltosUIMapRectangle { AltosUILatLon ul, lr; diff --git a/altosuilib/AltosUIMapStore.java b/altosuilib/AltosUIMapStore.java index 4cecb54f..dd8ace32 100644 --- a/altosuilib/AltosUIMapStore.java +++ b/altosuilib/AltosUIMapStore.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.net.*; diff --git a/altosuilib/AltosUIMapStoreListener.java b/altosuilib/AltosUIMapStoreListener.java index 91aff00c..0bbd2bc9 100644 --- a/altosuilib/AltosUIMapStoreListener.java +++ b/altosuilib/AltosUIMapStoreListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosUIMapStoreListener { abstract void notify_store(AltosUIMapStore store, int status); diff --git a/altosuilib/AltosUIMapTile.java b/altosuilib/AltosUIMapTile.java index 7c823183..8b6a8f0a 100644 --- a/altosuilib/AltosUIMapTile.java +++ b/altosuilib/AltosUIMapTile.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.image.*; @@ -25,7 +25,7 @@ import java.awt.geom.*; import java.io.*; import java.util.*; import java.awt.RenderingHints.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIMapTile { AltosUIMapTileListener listener; diff --git a/altosuilib/AltosUIMapTileListener.java b/altosuilib/AltosUIMapTileListener.java index 4ca13539..f58f55e0 100644 --- a/altosuilib/AltosUIMapTileListener.java +++ b/altosuilib/AltosUIMapTileListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosUIMapTileListener { abstract public void notify_tile(AltosUIMapTile tile, int status); diff --git a/altosuilib/AltosUIMapTransform.java b/altosuilib/AltosUIMapTransform.java index e6f1ffe3..89a3e9f6 100644 --- a/altosuilib/AltosUIMapTransform.java +++ b/altosuilib/AltosUIMapTransform.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -25,7 +25,7 @@ import java.lang.Math; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIMapTransform { diff --git a/altosuilib/AltosUIMapView.java b/altosuilib/AltosUIMapView.java index a14fde65..1abd1731 100644 --- a/altosuilib/AltosUIMapView.java +++ b/altosuilib/AltosUIMapView.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -26,7 +26,7 @@ import java.lang.*; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIMapView extends Component implements MouseMotionListener, MouseListener, MouseWheelListener, ComponentListener, AltosUIMapTileListener, AltosUIMapStoreListener { diff --git a/altosuilib/AltosUIMapZoomListener.java b/altosuilib/AltosUIMapZoomListener.java index 02e8bb51..23498c89 100644 --- a/altosuilib/AltosUIMapZoomListener.java +++ b/altosuilib/AltosUIMapZoomListener.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public interface AltosUIMapZoomListener { abstract public void zoom_changed(int zoom); diff --git a/altosuilib/AltosUIMarker.java b/altosuilib/AltosUIMarker.java index cd6fa589..5e9809ee 100644 --- a/altosuilib/AltosUIMarker.java +++ b/altosuilib/AltosUIMarker.java @@ -15,14 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosUIPreferences.java b/altosuilib/AltosUIPreferences.java index 7a582a7d..509faaff 100644 --- a/altosuilib/AltosUIPreferences.java +++ b/altosuilib/AltosUIPreferences.java @@ -15,13 +15,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.*; import java.awt.Component; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class AltosUIPreferences extends AltosPreferences { diff --git a/altosuilib/AltosUIPreferencesBackend.java b/altosuilib/AltosUIPreferencesBackend.java index da29253d..4048fd83 100644 --- a/altosuilib/AltosUIPreferencesBackend.java +++ b/altosuilib/AltosUIPreferencesBackend.java @@ -15,11 +15,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.File; import java.util.prefs.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import javax.swing.filechooser.FileSystemView; public class AltosUIPreferencesBackend implements AltosPreferencesBackend { diff --git a/altosuilib/AltosUISeries.java b/altosuilib/AltosUISeries.java index b0632d18..809020c4 100644 --- a/altosuilib/AltosUISeries.java +++ b/altosuilib/AltosUISeries.java @@ -15,14 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.io.*; import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/altosuilib/AltosUITelemetryMenu.java b/altosuilib/AltosUITelemetryMenu.java index fc4a91c5..893c3c44 100644 --- a/altosuilib/AltosUITelemetryMenu.java +++ b/altosuilib/AltosUITelemetryMenu.java @@ -15,12 +15,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.util.*; import javax.swing.*; import java.awt.event.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; class TelemetryMenuItem extends JMenuItem { public int telemetry; diff --git a/altosuilib/AltosUIUnitsIndicator.java b/altosuilib/AltosUIUnitsIndicator.java index 2285b6fc..50c30851 100644 --- a/altosuilib/AltosUIUnitsIndicator.java +++ b/altosuilib/AltosUIUnitsIndicator.java @@ -15,11 +15,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public abstract class AltosUIUnitsIndicator extends AltosUIIndicator { diff --git a/altosuilib/AltosUIVersion.java.in b/altosuilib/AltosUIVersion.java.in index 0edb5c04..9fd5757b 100644 --- a/altosuilib/AltosUIVersion.java.in +++ b/altosuilib/AltosUIVersion.java.in @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; public class AltosUIVersion { public final static String version = "@VERSION@"; diff --git a/altosuilib/AltosUIVoltageIndicator.java b/altosuilib/AltosUIVoltageIndicator.java index 3ff17213..8e991856 100644 --- a/altosuilib/AltosUIVoltageIndicator.java +++ b/altosuilib/AltosUIVoltageIndicator.java @@ -15,11 +15,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public abstract class AltosUIVoltageIndicator extends AltosUIUnitsIndicator { diff --git a/altosuilib/AltosUSBDevice.java b/altosuilib/AltosUSBDevice.java index b70b5e83..a8323704 100644 --- a/altosuilib/AltosUSBDevice.java +++ b/altosuilib/AltosUSBDevice.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.util.*; import libaltosJNI.*; diff --git a/altosuilib/AltosVoice.java b/altosuilib/AltosVoice.java index a3995f68..e02730ba 100644 --- a/altosuilib/AltosVoice.java +++ b/altosuilib/AltosVoice.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import com.sun.speech.freetts.Voice; import com.sun.speech.freetts.VoiceManager; diff --git a/altosuilib/GrabNDrag.java b/altosuilib/GrabNDrag.java index 4426f7a3..9bccb808 100644 --- a/altosuilib/GrabNDrag.java +++ b/altosuilib/GrabNDrag.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; diff --git a/configure.ac b/configure.ac index 23dc9d82..467a5286 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.4) +AC_INIT([altos], 1.4.0.1) AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE @@ -29,8 +29,8 @@ AC_SUBST(VERSION_DASH) dnl ========================================================================== dnl Java library versions -ALTOSUILIB_VERSION=2 -ALTOSLIB_VERSION=4 +ALTOSUILIB_VERSION=3 +ALTOSLIB_VERSION=5 AC_SUBST(ALTOSLIB_VERSION) AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package]) diff --git a/micropeak/MicroData.java b/micropeak/MicroData.java index ca211f16..6c9447aa 100644 --- a/micropeak/MicroData.java +++ b/micropeak/MicroData.java @@ -20,8 +20,8 @@ package org.altusmetrum.micropeak; import java.lang.*; import java.io.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; class MicroIterator implements Iterator { int i; diff --git a/micropeak/MicroDataPoint.java b/micropeak/MicroDataPoint.java index 5a5e8c37..849ae536 100644 --- a/micropeak/MicroDataPoint.java +++ b/micropeak/MicroDataPoint.java @@ -17,7 +17,7 @@ package org.altusmetrum.micropeak; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class MicroDataPoint implements AltosUIDataPoint { public double time; diff --git a/micropeak/MicroDeviceDialog.java b/micropeak/MicroDeviceDialog.java index 305421a7..304eac7d 100644 --- a/micropeak/MicroDeviceDialog.java +++ b/micropeak/MicroDeviceDialog.java @@ -21,7 +21,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class MicroDeviceDialog extends AltosDeviceDialog { diff --git a/micropeak/MicroDownload.java b/micropeak/MicroDownload.java index 1c70e1d1..32dd0450 100644 --- a/micropeak/MicroDownload.java +++ b/micropeak/MicroDownload.java @@ -23,8 +23,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroDownload extends AltosUIDialog implements Runnable, ActionListener, MicroSerialLog, WindowListener { MicroPeak owner; diff --git a/micropeak/MicroExport.java b/micropeak/MicroExport.java index 87d5499b..8d62ace6 100644 --- a/micropeak/MicroExport.java +++ b/micropeak/MicroExport.java @@ -23,8 +23,8 @@ import java.util.ArrayList; import java.awt.*; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroExport extends JFileChooser { diff --git a/micropeak/MicroFile.java b/micropeak/MicroFile.java index 019346ae..d6abfcb7 100644 --- a/micropeak/MicroFile.java +++ b/micropeak/MicroFile.java @@ -19,8 +19,8 @@ package org.altusmetrum.micropeak; import java.io.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroFile { diff --git a/micropeak/MicroFileChooser.java b/micropeak/MicroFileChooser.java index 00b6690a..371c22d0 100644 --- a/micropeak/MicroFileChooser.java +++ b/micropeak/MicroFileChooser.java @@ -20,8 +20,8 @@ package org.altusmetrum.micropeak; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroFileChooser extends JFileChooser { JFrame frame; diff --git a/micropeak/MicroFrame.java b/micropeak/MicroFrame.java index 5bfe5bf7..f82d1c5e 100644 --- a/micropeak/MicroFrame.java +++ b/micropeak/MicroFrame.java @@ -21,7 +21,7 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class MicroFrame extends AltosUIFrame { static String[] micro_icon_names = { diff --git a/micropeak/MicroGraph.java b/micropeak/MicroGraph.java index f9968919..811b1e7c 100644 --- a/micropeak/MicroGraph.java +++ b/micropeak/MicroGraph.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; import org.jfree.ui.*; import org.jfree.chart.*; diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index 19e91660..d7d393ba 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -23,8 +23,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroPeak extends MicroFrame implements ActionListener, ItemListener { diff --git a/micropeak/MicroRaw.java b/micropeak/MicroRaw.java index 26d62012..7a225dcb 100644 --- a/micropeak/MicroRaw.java +++ b/micropeak/MicroRaw.java @@ -20,8 +20,8 @@ package org.altusmetrum.micropeak; import java.awt.*; import java.io.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroRaw extends JTextArea { diff --git a/micropeak/MicroSave.java b/micropeak/MicroSave.java index 7c5d6abe..9497fb33 100644 --- a/micropeak/MicroSave.java +++ b/micropeak/MicroSave.java @@ -24,8 +24,8 @@ import javax.swing.filechooser.FileNameExtensionFilter; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroSave extends JFileChooser { diff --git a/micropeak/MicroSerial.java b/micropeak/MicroSerial.java index 37b68636..f5108c22 100644 --- a/micropeak/MicroSerial.java +++ b/micropeak/MicroSerial.java @@ -20,7 +20,7 @@ package org.altusmetrum.micropeak; import java.util.*; import java.io.*; import libaltosJNI.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class MicroSerial extends InputStream { SWIGTYPE_p_altos_file file; diff --git a/micropeak/MicroSerialLog.java b/micropeak/MicroSerialLog.java index 7300f06d..c49b69ab 100644 --- a/micropeak/MicroSerialLog.java +++ b/micropeak/MicroSerialLog.java @@ -20,7 +20,7 @@ package org.altusmetrum.micropeak; import java.util.*; import java.io.*; import libaltosJNI.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public interface MicroSerialLog { diff --git a/micropeak/MicroStats.java b/micropeak/MicroStats.java index 45c9f225..3fc05bd6 100644 --- a/micropeak/MicroStats.java +++ b/micropeak/MicroStats.java @@ -18,8 +18,8 @@ package org.altusmetrum.micropeak; import java.io.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroStats { double coast_height; diff --git a/micropeak/MicroStatsTable.java b/micropeak/MicroStatsTable.java index 3b17e731..d6265fe8 100644 --- a/micropeak/MicroStatsTable.java +++ b/micropeak/MicroStatsTable.java @@ -19,8 +19,8 @@ package org.altusmetrum.micropeak; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroStatsTable extends JComponent implements AltosFontListener { GridBagLayout layout; diff --git a/micropeak/MicroUSB.java b/micropeak/MicroUSB.java index 437fa0bc..24f6722b 100644 --- a/micropeak/MicroUSB.java +++ b/micropeak/MicroUSB.java @@ -19,7 +19,7 @@ package org.altusmetrum.micropeak; import java.util.*; import libaltosJNI.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class MicroUSB extends altos_device implements AltosDevice { diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index 646495b6..f765ee23 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -23,8 +23,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPS extends AltosUIFrame diff --git a/telegps/TeleGPSConfig.java b/telegps/TeleGPSConfig.java index 3505b0bb..e607a5a5 100644 --- a/telegps/TeleGPSConfig.java +++ b/telegps/TeleGPSConfig.java @@ -22,8 +22,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.text.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSConfig implements ActionListener { diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index 5f269fd3..7d28b371 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -21,8 +21,8 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSConfigUI extends AltosUIDialog diff --git a/telegps/TeleGPSDisplayThread.java b/telegps/TeleGPSDisplayThread.java index a3d4ea07..18b8d9fc 100644 --- a/telegps/TeleGPSDisplayThread.java +++ b/telegps/TeleGPSDisplayThread.java @@ -21,8 +21,8 @@ import java.awt.*; import javax.swing.*; import java.io.*; import java.text.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSDisplayThread extends Thread { diff --git a/telegps/TeleGPSGraphUI.java b/telegps/TeleGPSGraphUI.java index 244eb7b9..b59b122c 100644 --- a/telegps/TeleGPSGraphUI.java +++ b/telegps/TeleGPSGraphUI.java @@ -26,8 +26,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; diff --git a/telegps/TeleGPSInfo.java b/telegps/TeleGPSInfo.java index e87fea90..1b4751b9 100644 --- a/telegps/TeleGPSInfo.java +++ b/telegps/TeleGPSInfo.java @@ -21,8 +21,8 @@ import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSInfo extends AltosUIFlightTab { diff --git a/telegps/TeleGPSPreferences.java b/telegps/TeleGPSPreferences.java index 8bd371f4..2738ceea 100644 --- a/telegps/TeleGPSPreferences.java +++ b/telegps/TeleGPSPreferences.java @@ -22,7 +22,7 @@ import java.awt.event.*; import java.beans.*; import javax.swing.*; import javax.swing.event.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSPreferences extends AltosUIConfigure diff --git a/telegps/TeleGPSState.java b/telegps/TeleGPSState.java index a76182ed..27321c73 100644 --- a/telegps/TeleGPSState.java +++ b/telegps/TeleGPSState.java @@ -21,8 +21,8 @@ import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSState extends AltosUIFlightTab { diff --git a/telegps/TeleGPSStatus.java b/telegps/TeleGPSStatus.java index f3951a37..1d4415d6 100644 --- a/telegps/TeleGPSStatus.java +++ b/telegps/TeleGPSStatus.java @@ -19,8 +19,8 @@ package org.altusmetrum.telegps; import java.awt.*; import javax.swing.*; -import org.altusmetrum.altoslib_4.*; -import org.altusmetrum.altosuilib_2.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class TeleGPSStatus extends JComponent implements AltosFlightDisplay { GridBagLayout layout; diff --git a/telegps/TeleGPSStatusUpdate.java b/telegps/TeleGPSStatusUpdate.java index e7684d88..3d2b7f34 100644 --- a/telegps/TeleGPSStatusUpdate.java +++ b/telegps/TeleGPSStatusUpdate.java @@ -18,7 +18,7 @@ package org.altusmetrum.telegps; import java.awt.event.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; public class TeleGPSStatusUpdate implements ActionListener { -- cgit v1.2.3 From b397e4ff45f054acb1347ffa5468950febc431f7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Jun 2014 23:03:49 -0700 Subject: altos/micropeak: Add load script template Signed-off-by: Keith Packard --- src/micropeak/micropeak-load.tmpl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/micropeak/micropeak-load.tmpl diff --git a/src/micropeak/micropeak-load.tmpl b/src/micropeak/micropeak-load.tmpl new file mode 100644 index 00000000..08236a15 --- /dev/null +++ b/src/micropeak/micropeak-load.tmpl @@ -0,0 +1,20 @@ +#!/bin/sh +dir=`dirname $0` + +HEX="$dir"/"%HEX%" +LOADCMD="%LOADCMD%" +LOADARG="%LOADARG%" +LOADSLOW="%LOADSLOW%" +LOADFAST="" + +case "$1" in +fast) + LOADSPEED="$LOADFAST" + ;; +*) + LOADSPEED="$LOADSLOW" + ;; +esac + +echo ${LOADCMD} ${LOADSPEED} ${LOADARG}${HEX} +${LOADCMD} ${LOADSPEED} ${LOADARG}${HEX} -- cgit v1.2.3 From 495e84540943cccb6d1cb965a772021f7dc5f639 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 17 Jun 2014 00:08:03 -0700 Subject: Sign our .inf file with the comodo key. Update signing-driver I've tested this on Windows 7 and it appears to work. No idea if it works on Windows 8 yet. Signed-off-by: Keith Packard --- altusmetrum.cat | Bin 6263 -> 8242 bytes signing-driver | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/altusmetrum.cat b/altusmetrum.cat index 2d7e8b26..eb5dff98 100644 Binary files a/altusmetrum.cat and b/altusmetrum.cat differ diff --git a/signing-driver b/signing-driver index 177c5079..240609c4 100644 --- a/signing-driver +++ b/signing-driver @@ -2,19 +2,25 @@ Notes on getting a signing key for driver signing http://technet.microsoft.com/en-us/library/dd919238%28v=ws.10%29.aspx -# use MMC to add the certificates snap-in for ComputerAccount on Local computer +Start MMC as administrator (start a console as administrator, launch +mmc from there). -Run console as Administrator: +Use MMC to add the certificates snap-in for ComputerAccount on Local computer -makecert -r -n "CN=AltusMetrum" -ss AltusMetrumCertStore -sr LocalMachine +Create a key store for our keys called AltusMetrumCertStore + +Add our key from ~/altusmetrumllc/altusmetrum-key.p12 + +# Our cert is now called "Altus Metrum, LLC" + +Create a new directory with a simple path. Copy altusmetrum.inf to +that directory # contains the altusmetrum.inf file we ship. Make sure # is otherwise empty or inf2cat will get confused inf2cat /driver: /os:7_X86,7_X64,8_X86,8_X64 -signtool sign /s AltusMetrumCertStore /n “AltusMetrum" +signtool sign /s AltusMetrumCertStore /n “Altus Metrum, LLC" /t http://timestamp.verisign.com/scripts/timestamp.dll altusmetrum.cat - -pnputil -i -a altusmetrum.inf -- cgit v1.2.3 From 3f4e765c05ddbae83ca0c0176572cd698f285d08 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 17 Jun 2014 20:46:33 -0700 Subject: Fix java version detection and downloading Move java stuff to a common include file, java.nsh Let any version no older than 1.6 serve by using ${VersionCompare} Use version 6 downloads as those don't require a click-through agreement. Signed-off-by: Keith Packard --- altosui/Instdrv/NSIS/Includes/java.nsh | 50 ++++++++++++++++++++++++++++++++++ altosui/altos-windows.nsi.in | 47 ++------------------------------ micropeak/Makefile.am | 2 +- micropeak/micropeak-windows.nsi.in | 46 ++----------------------------- telegps/telegps-windows.nsi.in | 47 ++------------------------------ 5 files changed, 58 insertions(+), 134 deletions(-) create mode 100644 altosui/Instdrv/NSIS/Includes/java.nsh diff --git a/altosui/Instdrv/NSIS/Includes/java.nsh b/altosui/Instdrv/NSIS/Includes/java.nsh new file mode 100644 index 00000000..ebf1c5b9 --- /dev/null +++ b/altosui/Instdrv/NSIS/Includes/java.nsh @@ -0,0 +1,50 @@ +!include WordFunc.nsh + +; Definitions for Java Detection + +!define JRE_VERSION "1.6" +!define JRE32_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586.exe" +!define JRE64_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52249&/jre-6u27-windows-x64.exe" + +Var JavaDownload +Var JavaBits + +Function GetJRE + ${If} ${RunningX64} + StrCpy $JavaDownload ${JRE64_URL} + StrCpy $JavaBits "64" + ${Else} + StrCpy $JavaDownload ${JRE32_URL} + StrCpy $JavaBits "32" + ${EndIf} + + MessageBox MB_OK "This product uses Java ${JRE_VERSION}, \ + $JavaBits bits, it will now \ + be downloaded and installed" + + StrCpy $2 "$TEMP\Java Runtime Environment.exe" + nsisdl::download /TIMEOUT=30000 $JavaDownload $2 + Pop $R0 ;Get the return value + StrCmp $R0 "success" +3 + MessageBox MB_OK "Download failed: $R0" + Quit + ExecWait $2 + Delete $2 +FunctionEnd + +Function DetectJRE + ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ + "CurrentVersion" + + DetailPrint "Desired Java version ${JRE_VERSION}" + DetailPrint "Actual Java version $2" + + ${VersionCompare} $2 ${JRE_VERSION} $3 + + IntCmp $3 1 done done + + Call GetJRE + +done: + +FunctionEnd diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in index b72772e2..ab5ac453 100644 --- a/altosui/altos-windows.nsi.in +++ b/altosui/altos-windows.nsi.in @@ -1,10 +1,8 @@ !addplugindir Instdrv/NSIS/Plugins +!addincludedir Instdrv/NSIS/Includes !include x64.nsh -; Definitions for Java 1.7 Detection -!define JRE_VERSION "1.7" -!define JRE_ALTERNATE "1.6" -!define JRE32_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83383&/jre-7u51-windows-i586.exe" -!define JRE64_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83385&/jre-7u51-windows-x64.exe" +!include java.nsh + !define PRODUCT_NAME "Altus Metrum Windows Software" Name "Altus Metrum Installer" @@ -35,45 +33,6 @@ Function .onInit ${EndIf} FunctionEnd -Var JavaDownload -Var JavaBits - -Function GetJRE - ${If} ${RunningX64} - StrCpy $JavaDownload ${JRE64_URL} - StrCpy $JavaBits "64" - ${Else} - StrCpy $JavaDownload ${JRE32_URL} - StrCpy $JavaBits "32" - ${EndIf} - - MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, \ - $JavaBits bits, it will now \ - be downloaded and installed" - - StrCpy $2 "$TEMP\Java Runtime Environment.exe" - nsisdl::download /TIMEOUT=30000 $JavaDownload $2 - Pop $R0 ;Get the return value - StrCmp $R0 "success" +3 - MessageBox MB_OK "Download failed: $R0" - Quit - ExecWait $2 - Delete $2 -FunctionEnd - -Function DetectJRE - ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ - "CurrentVersion" - - StrCmp $2 ${JRE_VERSION} done - - StrCmp $2 ${JRE_ALTERNATE} done - - Call GetJRE - - done: -FunctionEnd - ; Pages to present Page license diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index 216874df..39ebc43a 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -272,7 +272,7 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(WINDOWS_DIST): $(WINDOWS_FILES) micropeak-windows.nsi -rm -f $@ - makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi + makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi || (cat micropeak-windows.log && exit 1) Manifest.txt: Makefile echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@ diff --git a/micropeak/micropeak-windows.nsi.in b/micropeak/micropeak-windows.nsi.in index 6dc9d8c1..bb5da1bb 100644 --- a/micropeak/micropeak-windows.nsi.in +++ b/micropeak/micropeak-windows.nsi.in @@ -1,11 +1,7 @@ !addplugindir Instdrv/NSIS/Plugins +!addincludedir ../altosui/Instdrv/NSIS/Includes !include x64.nsh -; Definitions for Java 1.7 Detection -!define JRE_VERSION "1.7" -!define JRE_ALTERNATE "1.6" -!define JRE32_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83383&/jre-7u51-windows-i586.exe" -!define JRE64_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83385&/jre-7u51-windows-x64.exe" -!define PRODUCT_NAME "Altus Metrum Windows Software" +!include java.nsh Name "Altus Metrum MicroPeak Installer" @@ -35,44 +31,6 @@ Function .onInit ${EndIf} FunctionEnd -Var JavaDownload -Var JavaBits - -Function GetJRE - ${If} ${RunningX64} - StrCpy $JavaDownload ${JRE64_URL} - StrCpy $JavaBits "64" - ${Else} - StrCpy $JavaDownload ${JRE32_URL} - StrCpy $JavaBits "32" - ${EndIf} - - MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, \ - $JavaBits bits, it will now \ - be downloaded and installed" - - StrCpy $2 "$TEMP\Java Runtime Environment.exe" - nsisdl::download /TIMEOUT=30000 $JavaDownload $2 - Pop $R0 ;Get the return value - StrCmp $R0 "success" +3 - MessageBox MB_OK "Download failed: $R0" - Quit - ExecWait $2 - Delete $2 -FunctionEnd - -Function DetectJRE - ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ - "CurrentVersion" - StrCmp $2 ${JRE_VERSION} done - - StrCmp $2 ${JRE_ALTERNATE} done - - Call GetJRE - - done: -FunctionEnd - ; Pages to present Page license diff --git a/telegps/telegps-windows.nsi.in b/telegps/telegps-windows.nsi.in index e6798c46..b4145520 100644 --- a/telegps/telegps-windows.nsi.in +++ b/telegps/telegps-windows.nsi.in @@ -1,11 +1,7 @@ !addplugindir ../altosui/Instdrv/NSIS/Plugins +!addincludedir ../altosui/Instdrv/NSIS/Includes !include x64.nsh -; Definitions for Java 1.7 Detection -!define JRE_VERSION "1.7" -!define JRE_ALTERNATE "1.6" -!define JRE32_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83383&/jre-7u51-windows-i586.exe" -!define JRE64_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=83385&/jre-7u51-windows-x64.exe" -!define PRODUCT_NAME "TeleGPS Windows Software" +!include java.nsh Name "TeleGPS Installer" @@ -35,45 +31,6 @@ Function .onInit ${EndIf} FunctionEnd -Var JavaDownload -Var JavaBits - -Function GetJRE - ${If} ${RunningX64} - StrCpy $JavaDownload ${JRE64_URL} - StrCpy $JavaBits "64" - ${Else} - StrCpy $JavaDownload ${JRE32_URL} - StrCpy $JavaBits "32" - ${EndIf} - - MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, \ - $JavaBits bits, it will now \ - be downloaded and installed" - - StrCpy $2 "$TEMP\Java Runtime Environment.exe" - nsisdl::download /TIMEOUT=30000 $JavaDownload $2 - Pop $R0 ;Get the return value - StrCmp $R0 "success" +3 - MessageBox MB_OK "Download failed: $R0" - Quit - ExecWait $2 - Delete $2 -FunctionEnd - -Function DetectJRE - ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ - "CurrentVersion" - - StrCmp $2 ${JRE_VERSION} done - - StrCmp $2 ${JRE_ALTERNATE} done - - Call GetJRE - - done: -FunctionEnd - ; Pages to present Page license -- cgit v1.2.3 From c93c4efefee0dbf6d193466efd6761d9a1849ae9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 02:15:04 -0700 Subject: icon: Construct .exe files to hold windows icons for file associations It appears that creating an executable with an icon resource is the only way to display icons for files. Fortunately, that's not all that hard. Signed-off-by: Keith Packard --- Makefile.am | 1 + icon/.gitignore | 1 + icon/Makefile.am | 19 ++++++++++++++++++- icon/altus-metrum.rc | 1 + icon/micro-peak.rc | 1 + icon/telegps.rc | 1 + icon/windows-stub.c | 2 ++ 7 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 icon/altus-metrum.rc create mode 100644 icon/micro-peak.rc create mode 100644 icon/telegps.rc create mode 100644 icon/windows-stub.c diff --git a/Makefile.am b/Makefile.am index 15d2c82d..2f8a5ee1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,6 +18,7 @@ fat: cd libaltos && $(MAKE) all cd altoslib && $(MAKE) all cd altosuilib && $(MAKE) all + cd icon && $(MAKE) fat cd altosui && $(MAKE) fat cd micropeak && $(MAKE) fat cd telegps && $(MAKE) fat diff --git a/icon/.gitignore b/icon/.gitignore index e89555de..40cf2f3e 100644 --- a/icon/.gitignore +++ b/icon/.gitignore @@ -4,3 +4,4 @@ telegps-*.png *.ico *.icns *.build +*.exe diff --git a/icon/Makefile.am b/icon/Makefile.am index b1c00f4b..61a16914 100644 --- a/icon/Makefile.am +++ b/icon/Makefile.am @@ -34,7 +34,7 @@ res: all-local: $(ICO_FILES) $(ICNS_FILES) clean-local: - $(RM) altus-metrum-*.png telegps-*.png micropeak-*.png *.build *.ico *.icns + $(RM) altus-metrum-*.png telegps-*.png micropeak-*.png *.build *.ico *.icns *.o *.exe $(AM_FILES): altusmetrum.build @@ -71,3 +71,20 @@ TeleGPS.icns: $(MAC_TG_FILES) MicroPeak.icns: $(MAC_MP_FILES) png2icns $@ $(MAC_MP_FILES) + +MINGCC32=i686-w64-mingw32-gcc +MINGWINDRES=i686-w64-mingw32-windres + +SUFFIXES=.rc .exe + +fat: all micro-peak.exe altus-metrum.exe telegps.exe + +altus-metrum.o: altus-metrum.ico +micro-peak.o: micro-peak.ico +telegps.o: telegps.ico + +.rc.o: + $(MINGWINDRES) $*.rc $@ + +.o.exe: + $(MINGCC32) -o $@ windows-stub.c $*.o diff --git a/icon/altus-metrum.rc b/icon/altus-metrum.rc new file mode 100644 index 00000000..bbd03604 --- /dev/null +++ b/icon/altus-metrum.rc @@ -0,0 +1 @@ +101 ICON "altus-metrum.ico" diff --git a/icon/micro-peak.rc b/icon/micro-peak.rc new file mode 100644 index 00000000..4efe777d --- /dev/null +++ b/icon/micro-peak.rc @@ -0,0 +1 @@ +101 ICON "micro-peak.ico" diff --git a/icon/telegps.rc b/icon/telegps.rc new file mode 100644 index 00000000..7f5957f9 --- /dev/null +++ b/icon/telegps.rc @@ -0,0 +1 @@ +101 ICON "telegps.ico" diff --git a/icon/windows-stub.c b/icon/windows-stub.c new file mode 100644 index 00000000..8df3e0aa --- /dev/null +++ b/icon/windows-stub.c @@ -0,0 +1,2 @@ +__stdcall +WinMain(int a, int b, int c, int d) { return 0; } -- cgit v1.2.3 From 5871225a0c442cf5afa41a444ff8bfb8f4002721 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 02:16:51 -0700 Subject: windows installer: Create file associations for Windows. This makes icons appear for the files in the file manager, and lets you double-click on the files to open the appropriate application. Signed-off-by: Keith Packard --- altosui/Makefile.am | 2 +- altosui/altos-windows.nsi.in | 118 ++++++++++++++++++++++++++++-------- micropeak/Makefile.am | 2 +- micropeak/micropeak-windows.nsi.in | 120 +++++++++++++++++++++++++++---------- telegps/Makefile.am | 2 +- telegps/telegps-windows.nsi.in | 118 ++++++++++++++++++++++++++++-------- 6 files changed, 277 insertions(+), 85 deletions(-) diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 98a5e193..45f4467a 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -90,7 +90,7 @@ ICONJAR= -C $(ICONDIR) altus-metrum-16.png \ -C $(ICONDIR) altus-metrum-128.png \ -C $(ICONDIR) altus-metrum-256.png -WINDOWS_ICON=$(ICONDIR)/altus-metrum.ico +WINDOWS_ICON=$(ICONDIR)/altus-metrum.ico $(ICONDIR)/altus-metrum.exe MACOSX_ICON=$(ICONDIR)/AltosUIIcon.icns # Firmware diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in index ab5ac453..da36ad90 100644 --- a/altosui/altos-windows.nsi.in +++ b/altosui/altos-windows.nsi.in @@ -2,16 +2,22 @@ !addincludedir Instdrv/NSIS/Includes !include x64.nsh !include java.nsh +!include refresh-sh.nsh -!define PRODUCT_NAME "Altus Metrum Windows Software" +!define REG_NAME "Altus Metrum" +!define PROG_ID "org.altusmetrum.altosui.1" +!define PROG_ALTOSUI "org.altusmetrum.altosui.1" +!define FAT_NAME "altosui-fat.jar" +!define ICO_ICO "altus-metrum.ico" +!define ICO_EXE "altus-metrum.exe" -Name "Altus Metrum Installer" +Name "${REG_NAME} Installer" ; Default install directory InstallDir "$PROGRAMFILES\AltusMetrum" ; Tell the installer where to re-install a new version -InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir" +InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir" LicenseText "GNU General Public License Version 2" LicenseData "../COPYING" @@ -21,7 +27,7 @@ RequestExecutionLevel admin ShowInstDetails Show -ComponentText "Altus Metrum Software and Driver Installer" +ComponentText "${REG_NAME} Software and Driver Installer" Function .onInit DetailPrint "Checking host operating system" @@ -33,6 +39,16 @@ Function .onInit ${EndIf} FunctionEnd +Function un.onInit + DetailPrint "Checking host operating system" + ${If} ${RunningX64} + DetailPrint "Installer running on 64-bit host" + SetRegView 64 + StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum" + ${DisableX64FSRedirection} + ${EndIf} +FunctionEnd + ; Pages to present Page license @@ -68,12 +84,12 @@ done: SectionEnd -Section "AltosUI Application" +Section "${REG_NAME} Application" Call DetectJRE SetOutPath $INSTDIR - File "altosui-fat.jar" + File "${FAT_NAME}" File "altoslib_@ALTOSLIB_VERSION@.jar" File "altosuilib_@ALTOSUILIB_VERSION@.jar" File "cmudict04.jar" @@ -88,13 +104,13 @@ Section "AltosUI Application" File "*.dll" - File "../icon/*.ico" + File "../icon/${ICO_ICO}" - CreateShortCut "$SMPROGRAMS\AltusMetrum.lnk" "$SYSDIR\javaw.exe" "-jar altosui-fat.jar" "$INSTDIR\altus-metrum.ico" + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}" SectionEnd -Section "AltosUI Desktop Shortcut" - CreateShortCut "$DESKTOP\AltusMetrum.lnk" "$INSTDIR\altosui-fat.jar" "" "$INSTDIR\altus-metrum.ico" +Section "${REG_NAME} Desktop Shortcut" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}" SectionEnd Section "TeleMetrum, TeleDongle and TeleBT Firmware" @@ -126,38 +142,88 @@ Section "Documentation" File "../doc/telemini.pdf" SectionEnd +Section "File Associations" + + SetOutPath $INSTDIR + + File "../icon/${ICO_EXE}" + + ; application elements + + WriteRegStr HKCR "${PROG_ID}" "" "Altus Metrum Data File" + WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "Altus Metrum Data File" + WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}" + WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + ; .eeprom elements + + WriteRegStr HKCR ".eeprom" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File" + WriteRegStr HKCR ".eeprom" "Content Type" "application/altosui" + + WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" "" + WriteRegStr HKCR ".eeprom\${PROG_ID}" "" "${REG_NAME}" + + ; .telem elements + + WriteRegStr HKCR ".telem" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File" + WriteRegStr HKCR ".telem" "Content Type" "application/altosui" + + WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID}" "" + WriteRegStr HKCR ".telem\${PROG_ID}" "" "${REG_NAME}" + + Call RefreshShellIcons +SectionEnd + Section "Uninstaller" ; Deal with the uninstaller + ${DisableX64FSRedirection} SetOutPath $INSTDIR ; Write the install path to the registry - WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR" + WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR" ; Write the uninstall keys for windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"' + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1" - WriteUninstaller "uninstall.exe" + WriteUninstaller "uninstall-${REG_NAME}.exe" SectionEnd Section "Uninstall" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" - DeleteRegKey HKLM "Software\AltusMetrum" - Delete "$INSTDIR\*.*" - RMDir "$INSTDIR" + ${DisableX64FSRedirection} - ; Remove devices - InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial - InstDrv::DeleteOemInfFiles /NOUNLOAD - InstDrv::RemoveAllDevices + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" + DeleteRegKey HKLM "SOFTWARE\${REG_NAME}" + + DetailPrint "Delete uninstall reg entries" + + DeleteRegKey HKCR "${PROG_ID}" + + DeleteRegKey HKCR ".eeprom\${PROG_ID}" + DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" + + DeleteRegKey HKCR ".telem\${PROG_ID}" + DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID}" + + DetailPrint "Delete file association reg entries" + + Delete "$INSTDIR\${FAT_NAME}" + Delete "$INSTDIR\uninstall-${REG_NAME}.exe" + + Delete "$INSTDIR\${ICO_ICO}" + Delete "$INSTDIR\${ICO_EXE}" ; Remove shortcuts, if any - Delete "$SMPROGRAMS\AltusMetrum.lnk" - Delete "$DESKTOP\AltusMetrum.lnk" + Delete "$SMPROGRAMS\${REG_NAME}.lnk" + Delete "$DESKTOP\${REG_NAME}.lnk" + Call un.RefreshShellIcons SectionEnd diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index 39ebc43a..1e09e523 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -71,7 +71,7 @@ ICONJAR= -C $(ICONDIR) micropeak-16.png \ -C $(ICONDIR) micropeak-128.png \ -C $(ICONDIR) micropeak-256.png -WINDOWS_ICON=$(ICONDIR)/micro-peak.ico +WINDOWS_ICON=$(ICONDIR)/micro-peak.ico $(ICONDIR)/micro-peak.exe MACOSX_ICON=$(ICONDIR)/MicroPeak.icns desktopdir = $(datadir)/applications diff --git a/micropeak/micropeak-windows.nsi.in b/micropeak/micropeak-windows.nsi.in index bb5da1bb..d8e47505 100644 --- a/micropeak/micropeak-windows.nsi.in +++ b/micropeak/micropeak-windows.nsi.in @@ -1,15 +1,22 @@ -!addplugindir Instdrv/NSIS/Plugins +!addplugindir ../altosui/Instdrv/NSIS/Plugins !addincludedir ../altosui/Instdrv/NSIS/Includes !include x64.nsh !include java.nsh +!include refresh-sh.nsh -Name "Altus Metrum MicroPeak Installer" +!define REG_NAME "MicroPeak" +!define PROG_ID "org.altusmetrum.micropeak.1" +!define FAT_NAME "micropeak-fat.jar" +!define ICO_ICO "micro-peak.ico" +!define ICO_EXE "micro-peak.exe" + +Name "${REG_NAME} Installer" ; Default install directory InstallDir "$PROGRAMFILES\AltusMetrum" ; Tell the installer where to re-install a new version -InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir" +InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir" LicenseText "GNU General Public License Version 2" LicenseData "../COPYING" @@ -19,7 +26,7 @@ RequestExecutionLevel admin ShowInstDetails Show -ComponentText "Altus Metrum MicroPeak Software Installer" +ComponentText "${REG_NAME} Software and Driver Installer" Function .onInit DetailPrint "Checking host operating system" @@ -31,6 +38,16 @@ Function .onInit ${EndIf} FunctionEnd +Function un.onInit + DetailPrint "Checking host operating system" + ${If} ${RunningX64} + DetailPrint "Installer running on 64-bit host" + SetRegView 64 + StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum" + ${DisableX64FSRedirection} + ${EndIf} +FunctionEnd + ; Pages to present Page license @@ -43,12 +60,21 @@ UninstPage instfiles ; And the stuff to install -Section "MicroPeak Application" +Section "FTDI USB Driver" + SetOutPath $INSTDIR + + File "CDM20824_Setup.exe" + + StrCpy $2 "$INSTDIR\CDM20824_Setup.exe" + ExecWait $2 +SectionEnd + +Section "${REG_NAME} Application" Call DetectJRE SetOutPath $INSTDIR - File "micropeak-fat.jar" + File "${FAT_NAME}" File "altoslib_@ALTOSLIB_VERSION@.jar" File "altosuilib_@ALTOSUILIB_VERSION@.jar" File "jfreechart.jar" @@ -56,22 +82,13 @@ Section "MicroPeak Application" File "*.dll" - File "../icon/*.ico" + File "../icon/${ICO_ICO}" - CreateShortCut "$SMPROGRAMS\MicroPeak.lnk" "$SYSDIR\javaw.exe" "-jar micropeak-fat.jar" "$INSTDIR\micro-peak.ico" + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}" SectionEnd -Section "FTDI USB Driver" - SetOutPath $INSTDIR - - File "CDM20824_Setup.exe" - - StrCpy $2 "$INSTDIR\CDM20824_Setup.exe" - ExecWait $2 -SectionEnd - -Section "MicroPeak Desktop Shortcut" - CreateShortCut "$DESKTOP\MicroPeak.lnk" "$INSTDIR\micropeak-fat.jar" "" "$INSTDIR\micro-peak.ico" +Section "${REG_NAME} Desktop Shortcut" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}" SectionEnd Section "Documentation" @@ -81,33 +98,74 @@ Section "Documentation" File "../doc/micropeak.pdf" SectionEnd +Section "File Associations" + + SetOutPath $INSTDIR + + File "../icon/${ICO_EXE}" + + ; application elements + + WriteRegStr HKCR "${PROG_ID}" "" "MicroPeak Data File" + WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "MicroPeak Data File" + WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}" + WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + ; .mpd elements + + WriteRegStr HKCR ".mpd" "" "${PROG_ID}" + WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File" + WriteRegStr HKCR ".mpd" "Content Type" "application/micropeak" + + WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID}" "" + WriteRegStr HKCR ".mpd\${PROG_ID}" "" "${REG_NAME}" + + Call RefreshShellIcons +SectionEnd + Section "Uninstaller" ; Deal with the uninstaller + ${DisableX64FSRedirection} SetOutPath $INSTDIR ; Write the install path to the registry - WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR" + WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR" ; Write the uninstall keys for windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"' + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1" - WriteUninstaller "uninstall.exe" + WriteUninstaller "uninstall-${REG_NAME}.exe" SectionEnd Section "Uninstall" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" - DeleteRegKey HKLM "Software\AltusMetrum" - Delete "$INSTDIR\*.*" - RMDir "$INSTDIR" + ${DisableX64FSRedirection} + + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" + DeleteRegKey HKLM "SOFTWARE\${REG_NAME}" + + DetailPrint "Delete uninstall reg entries" + + DeleteRegKey HKCR "${PROG_ID}" + + DeleteRegKey HKCR ".mpd\${PROG_ID}" + DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID}" + + Delete "$INSTDIR\${FAT_NAME}" + Delete "$INSTDIR\uninstall-${REG_NAME}.exe" + + Delete "$INSTDIR\${ICO_ICO}" + Delete "$INSTDIR\${ICO_EXE}" ; Remove shortcuts, if any - Delete "$SMPROGRAMS\MicroPeak.lnk" - Delete "$DESKTOP\MicroPeak.lnk" + Delete "$SMPROGRAMS\${REG_NAME}.lnk" + Delete "$DESKTOP\${REG_NAME}.lnk" + Call un.RefreshShellIcons SectionEnd diff --git a/telegps/Makefile.am b/telegps/Makefile.am index 7b550e9e..8868c723 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -73,7 +73,7 @@ ICONJAR= -C $(ICONDIR) telegps-16.png \ -C $(ICONDIR) telegps-128.png \ -C $(ICONDIR) telegps-256.png -WINDOWS_ICON=$(ICONDIR)/telegps.ico +WINDOWS_ICON=$(ICONDIR)/telegps.ico $(ICONDIR)/telegps.exe MACOSX_ICON=$(ICONDIR)/TeleGPS.icns # Firmware diff --git a/telegps/telegps-windows.nsi.in b/telegps/telegps-windows.nsi.in index b4145520..3f9648f9 100644 --- a/telegps/telegps-windows.nsi.in +++ b/telegps/telegps-windows.nsi.in @@ -2,14 +2,22 @@ !addincludedir ../altosui/Instdrv/NSIS/Includes !include x64.nsh !include java.nsh +!include refresh-sh.nsh -Name "TeleGPS Installer" +!define REG_NAME "TeleGPS" +!define PROG_ID "org.altusmetrum.telegps.1" +!define PROG_ALTOSUI "org.altusmetrum.altosui.1" +!define FAT_NAME "telegps-fat.jar" +!define ICO_ICO "telegps.ico" +!define ICO_EXE "telegps.exe" + +Name "${REG_NAME} Installer" ; Default install directory InstallDir "$PROGRAMFILES\AltusMetrum" ; Tell the installer where to re-install a new version -InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir" +InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir" LicenseText "GNU General Public License Version 2" LicenseData "../COPYING" @@ -19,7 +27,7 @@ RequestExecutionLevel admin ShowInstDetails Show -ComponentText "TeleGPS Software Installer" +ComponentText "${REG_NAME} Software and Driver Installer" Function .onInit DetailPrint "Checking host operating system" @@ -31,6 +39,16 @@ Function .onInit ${EndIf} FunctionEnd +Function un.onInit + DetailPrint "Checking host operating system" + ${If} ${RunningX64} + DetailPrint "Installer running on 64-bit host" + SetRegView 64 + StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum" + ${DisableX64FSRedirection} + ${EndIf} +FunctionEnd + ; Pages to present Page license @@ -66,12 +84,12 @@ done: SectionEnd -Section "TeleGPS Application" +Section "${REG_NAME} Application" Call DetectJRE SetOutPath $INSTDIR - File "telegps-fat.jar" + File "${FAT_NAME}" File "altoslib_@ALTOSLIB_VERSION@.jar" File "altosuilib_@ALTOSUILIB_VERSION@.jar" File "cmudict04.jar" @@ -86,13 +104,13 @@ Section "TeleGPS Application" File "*.dll" - File "../icon/*.ico" + File "../icon/${ICO_ICO}" - CreateShortCut "$SMPROGRAMS\TeleGPS.lnk" "$SYSDIR\javaw.exe" "-jar telegps-fat.jar" "$INSTDIR\telegps.ico" + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}" SectionEnd -Section "TeleGPS Desktop Shortcut" - CreateShortCut "$DESKTOP\TeleGPS.lnk" "$INSTDIR\telegps-fat.jar" "" "$INSTDIR\telegps.ico" +Section "${REG_NAME} Desktop Shortcut" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}" SectionEnd Section "TeleGPS, TeleDongle and TeleBT Firmware" @@ -114,38 +132,88 @@ Section "Documentation" File "../doc/telemetry.pdf" SectionEnd +Section "File Associations" + + SetOutPath $INSTDIR + + File "../icon/${ICO_EXE}" + + ; application elements + + WriteRegStr HKCR "${PROG_ID}" "" "Altus Metrum Data File" + WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "Altus Metrum Data File" + WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}" + WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + ; .eeprom elements + + WriteRegStr HKCR ".eeprom" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File" + WriteRegStr HKCR ".eeprom" "Content Type" "application/altosui" + + WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" "" + WriteRegStr HKCR ".eeprom\${PROG_ID}" "" "${REG_NAME}" + + ; .telem elements + + WriteRegStr HKCR ".telem" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File" + WriteRegStr HKCR ".telem" "Content Type" "application/altosui" + + WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID}" "" + WriteRegStr HKCR ".telem\${PROG_ID}" "" "${REG_NAME}" + + Call RefreshShellIcons +SectionEnd + Section "Uninstaller" ; Deal with the uninstaller + ${DisableX64FSRedirection} SetOutPath $INSTDIR ; Write the install path to the registry - WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR" + WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR" ; Write the uninstall keys for windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"' + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1" - WriteUninstaller "uninstall.exe" + WriteUninstaller "uninstall-${REG_NAME}.exe" SectionEnd Section "Uninstall" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" - DeleteRegKey HKLM "Software\AltusMetrum" - Delete "$INSTDIR\*.*" - RMDir "$INSTDIR" + ${DisableX64FSRedirection} - ; Remove devices - InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial - InstDrv::DeleteOemInfFiles /NOUNLOAD - InstDrv::RemoveAllDevices + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" + DeleteRegKey HKLM "SOFTWARE\${REG_NAME}" + + DetailPrint "Delete uninstall reg entries" + + DeleteRegKey HKCR "${PROG_ID}" + + DeleteRegKey HKCR ".eeprom\${PROG_ID}" + DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" + + DeleteRegKey HKCR ".telem\${PROG_ID}" + DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID}" + + DetailPrint "Delete file association reg entries" + + Delete "$INSTDIR\${FAT_NAME}" + Delete "$INSTDIR\uninstall-${REG_NAME}.exe" + + Delete "$INSTDIR\${ICO_ICO}" + Delete "$INSTDIR\${ICO_EXE}" ; Remove shortcuts, if any - Delete "$SMPROGRAMS\TeleGPS.lnk" - Delete "$DESKTOP\TeleGPS.lnk" + Delete "$SMPROGRAMS\${REG_NAME}.lnk" + Delete "$DESKTOP\${REG_NAME}.lnk" + Call un.RefreshShellIcons SectionEnd -- cgit v1.2.3 From fac94c593285eacda57de257fa2be0548341b567 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 14:15:27 -0700 Subject: macosx: Define icons for our file types on OS X Adds definitions to the Info.plist files shipped to specify which icons to show for .telem, .eeprom and .mpd files. Note that the applications don't respond to open apple events, so double clicking on a file only starts the application. Signed-off-by: Keith Packard --- altosui/Info.plist.in | 27 +++++++++++++++++++++++++++ micropeak/Info.plist.in | 15 +++++++++++++++ telegps/Info.plist.in | 27 +++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/altosui/Info.plist.in b/altosui/Info.plist.in index 46dea171..bae6d52c 100644 --- a/altosui/Info.plist.in +++ b/altosui/Info.plist.in @@ -24,6 +24,33 @@ 6.0 CFBundleIconFile AltosUIIcon.icns + CFBundleDocumentTypes + + + CFBundleTypeName + Telemetry + CFBundleTypeIconFile + AltosUIIcon.icns + CFBundleTypeExtensions + + telem + + CFBundleTypeRole + Editor + + + CFBundleTypeName + Eeprom + CFBundleTypeIconFile + AltosUIIcon.icns + CFBundleTypeExtensions + + eeprom + + CFBundleTypeRole + Editor + + Java MainClass diff --git a/micropeak/Info.plist.in b/micropeak/Info.plist.in index 40984c5a..8f751079 100644 --- a/micropeak/Info.plist.in +++ b/micropeak/Info.plist.in @@ -24,6 +24,21 @@ 6.0 CFBundleIconFile MicroPeak.icns + CFBundleDocumentTypes + + + CFBundleTypeName + MicroPeak data file + CFBundleTypeIconFile + MicroPeak.icns + CFBundleTypeExtensions + + mpd + + CFBundleTypeRole + Editor + + Java MainClass diff --git a/telegps/Info.plist.in b/telegps/Info.plist.in index df05bb6e..7dbb77d1 100644 --- a/telegps/Info.plist.in +++ b/telegps/Info.plist.in @@ -24,6 +24,33 @@ 6.0 CFBundleIconFile TeleGPS.icns + CFBundleDocumentTypes + + + CFBundleTypeName + Telemetry + CFBundleTypeIconFile + TeleGPS.icns + CFBundleTypeExtensions + + telem + + CFBundleTypeRole + Editor + + + CFBundleTypeName + Eeprom + CFBundleTypeIconFile + TeleGPS.icns + CFBundleTypeExtensions + + eeprom + + CFBundleTypeRole + Editor + + Java MainClass -- cgit v1.2.3 From e3eab18682e77c5394918448409d383a28ba23ad Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 14:16:36 -0700 Subject: altosui: Ship TeleMetrum v2.0 firmware with AltosUI Signed-off-by: Keith Packard --- altosui/Makefile.am | 3 ++- altosui/altos-windows.nsi.in | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 45f4467a..352fb430 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -100,7 +100,8 @@ FIRMWARE_TD=$(FIRMWARE_TD_0_2) FIRMWARE_TM_1_0=$(top_srcdir)/src/telemetrum-v1.0/telemetrum-v1.0-$(VERSION).ihx FIRMWARE_TM_1_1=$(top_srcdir)/src/telemetrum-v1.1/telemetrum-v1.1-$(VERSION).ihx FIRMWARE_TM_1_2=$(top_srcdir)/src/telemetrum-v1.2/telemetrum-v1.2-$(VERSION).ihx -FIRMWARE_TM=$(FIRMWARE_TM_1_0) $(FIRMWARE_TM_1_1) $(FIRMWARE_TM_1_2) +FIRMWARE_TM_2_0=$(top_srcdir)/src/telemetrum-v2.0/telemetrum-v2.0-$(VERSION).ihx +FIRMWARE_TM=$(FIRMWARE_TM_1_0) $(FIRMWARE_TM_1_1) $(FIRMWARE_TM_1_2) $(FIRMWARE_TM_2_0) FIRMWARE_TELEMINI_1_0=$(top_srcdir)/src/telemini-v1.0/telemini-v1.0-$(VERSION).ihx FIRMWARE_TELEMINI=$(FIRMWARE_TELEMINI_1_0) diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in index da36ad90..c6da097e 100644 --- a/altosui/altos-windows.nsi.in +++ b/altosui/altos-windows.nsi.in @@ -120,6 +120,7 @@ Section "TeleMetrum, TeleDongle and TeleBT Firmware" File "../src/telemetrum-v1.0/telemetrum-v1.0-${VERSION}.ihx" File "../src/telemetrum-v1.1/telemetrum-v1.1-${VERSION}.ihx" File "../src/telemetrum-v1.2/telemetrum-v1.2-${VERSION}.ihx" + File "../src/telemetrum-v2.0/telemetrum-v2.0-${VERSION}.ihx" File "../src/telemini-v1.0/telemini-v1.0-${VERSION}.ihx" File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx" File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx" -- cgit v1.2.3 From d5bdb1c5974788b9569897435808fd01b04b0c4d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 16:14:44 -0700 Subject: altosuilib: Hook up apple messages to callbacks This supports open, quit and preferences. I'm leaving 'about' to the existing stuff until I decide it's worth the effort to create a fancy about dialog. Signed-off-by: Keith Packard --- altosuilib/AltosUIFrame.java | 46 +++++++++- altosuilib/Makefile.am | 3 +- altosuilib/OSXAdapter.java | 206 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+), 2 deletions(-) create mode 100755 altosuilib/OSXAdapter.java diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java index 689ea7f3..5b915e85 100644 --- a/altosuilib/AltosUIFrame.java +++ b/altosuilib/AltosUIFrame.java @@ -163,6 +163,50 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi return "Altus Metrum"; } + public void macosx_quit_handler() { + System.out.printf("Got quit handler\n"); + } + + public void macosx_about_handler() { + System.out.printf("Got about handler\n"); + } + + public void macosx_preferences_handler() { + System.out.printf("Got preferences handler\n"); + } + + public void macosx_file_handler(String path) { + System.out.printf("Got file handler with \"%s\"\n", path); + } + + /* Check that we are on Mac OS X. This is crucial to loading and using the OSXAdapter class. + */ + public static boolean MAC_OS_X = (System.getProperty("os.name").toLowerCase().startsWith("mac os x")); + + private static boolean registered_for_macosx_events; + + /* Generic registration with the Mac OS X application menu + * Checks the platform, then attempts to register with the Apple EAWT + * See OSXAdapter.java to see how this is done without directly referencing any Apple APIs + */ + public synchronized void register_for_macosx_events() { + if (registered_for_macosx_events) + return; + registered_for_macosx_events = true; + if (MAC_OS_X) { + try { + // Generate and register the OSXAdapter, passing it a hash of all the methods we wish to + // use as delegates for various com.apple.eawt.ApplicationListener methods + OSXAdapter.setQuitHandler(this, getClass().getDeclaredMethod("macosx_quit_handler", (Class[])null)); +// OSXAdapter.setAboutHandler(this, getClass().getDeclaredMethod("macosx_about_handler", (Class[])null)); + OSXAdapter.setPreferencesHandler(this, getClass().getDeclaredMethod("macosx_preferences_handler", (Class[])null)); + OSXAdapter.setFileHandler(this, getClass().getDeclaredMethod("macosx_file_handler", new Class[] { String.class })); + } catch (Exception e) { + System.err.println("Error while loading the OSXAdapter:"); + e.printStackTrace(); + } + } + } void init() { AltosUIPreferences.register_ui_listener(this); AltosUIPreferences.register_position_listener(this); @@ -175,7 +219,7 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi global_settings_done = true; System.setProperty("com.apple.mrj.application.apple.menu.about.name", getName()); System.setProperty("com.apple.macos.useScreenMenuBar", "true"); - System.setProperty( "apple.laf.useScreenMenuBar", "true" ); // for older versions of Java + System.setProperty("apple.laf.useScreenMenuBar", "true" ); // for older versions of Java } catch (Exception e) { } } diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index 157cd5e8..bbee6a45 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -81,7 +81,8 @@ altosuilib_JAVA = \ AltosUIIndicator.java \ AltosUIUnitsIndicator.java \ AltosUIVoltageIndicator.java \ - AltosUITelemetryMenu.java + AltosUITelemetryMenu.java \ + OSXAdapter.java JAR=altosuilib_$(ALTOSUILIB_VERSION).jar diff --git a/altosuilib/OSXAdapter.java b/altosuilib/OSXAdapter.java new file mode 100755 index 00000000..23aacd78 --- /dev/null +++ b/altosuilib/OSXAdapter.java @@ -0,0 +1,206 @@ +/* + +File: OSXAdapter.java + +Abstract: Hooks existing preferences/about/quit functionality from an + existing Java app into handlers for the Mac OS X application menu. + Uses a Proxy object to dynamically implement the + com.apple.eawt.ApplicationListener interface and register it with the + com.apple.eawt.Application object. This allows the complete project + to be both built and run on any platform without any stubs or + placeholders. Useful for developers looking to implement Mac OS X + features while supporting multiple platforms with minimal impact. + +Version: 2.0 + +Disclaimer: IMPORTANT: This Apple software is supplied to you by +Apple Inc. ("Apple") in consideration of your agreement to the +following terms, and your use, installation, modification or +redistribution of this Apple software constitutes acceptance of these +terms. If you do not agree with these terms, please do not use, +install, modify or redistribute this Apple software. + +In consideration of your agreement to abide by the following terms, and +subject to these terms, Apple grants you a personal, non-exclusive +license, under Apple's copyrights in this original Apple software (the +"Apple Software"), to use, reproduce, modify and redistribute the Apple +Software, with or without modifications, in source and/or binary forms; +provided that if you redistribute the Apple Software in its entirety and +without modifications, you must retain this notice and the following +text and disclaimers in all such redistributions of the Apple Software. +Neither the name, trademarks, service marks or logos of Apple Inc. +may be used to endorse or promote products derived from the Apple +Software without specific prior written permission from Apple. Except +as expressly stated in this notice, no other rights or licenses, express +or implied, are granted by Apple herein, including but not limited to +any patent rights that may be infringed by your derivative works or by +other works in which the Apple Software may be incorporated. + +The Apple Software is provided by Apple on an "AS IS" basis. APPLE +MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION +THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND +OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + +IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, +MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED +AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), +STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +Copyright © 2003-2007 Apple, Inc., All Rights Reserved + +*/ + +package org.altusmetrum.altosuilib_3; + +import java.lang.reflect.*; +import java.util.HashMap; + + +public class OSXAdapter implements InvocationHandler { + + protected Object targetObject; + protected Method targetMethod; + protected String proxySignature; + + static Object macOSXApplication; + + // Pass this method an Object and Method equipped to perform application shutdown logic + // The method passed should return a boolean stating whether or not the quit should occur + public static void setQuitHandler(Object target, Method quitHandler) { + setHandler(new OSXAdapter("handleQuit", target, quitHandler)); + } + + // Pass this method an Object and Method equipped to display application info + // They will be called when the About menu item is selected from the application menu + public static void setAboutHandler(Object target, Method aboutHandler) { + boolean enableAboutMenu = (target != null && aboutHandler != null); + if (enableAboutMenu) { + setHandler(new OSXAdapter("handleAbout", target, aboutHandler)); + } + // If we're setting a handler, enable the About menu item by calling + // com.apple.eawt.Application reflectively + try { + Method enableAboutMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledAboutMenu", new Class[] { boolean.class }); + enableAboutMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enableAboutMenu) }); + } catch (Exception ex) { + System.err.println("OSXAdapter could not access the About Menu"); + ex.printStackTrace(); + } + } + + // Pass this method an Object and a Method equipped to display application options + // They will be called when the Preferences menu item is selected from the application menu + public static void setPreferencesHandler(Object target, Method prefsHandler) { + boolean enablePrefsMenu = (target != null && prefsHandler != null); + if (enablePrefsMenu) { + setHandler(new OSXAdapter("handlePreferences", target, prefsHandler)); + } + // If we're setting a handler, enable the Preferences menu item by calling + // com.apple.eawt.Application reflectively + try { + Method enablePrefsMethod = macOSXApplication.getClass().getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class }); + enablePrefsMethod.invoke(macOSXApplication, new Object[] { Boolean.valueOf(enablePrefsMenu) }); + } catch (Exception ex) { + System.err.println("OSXAdapter could not access the About Menu"); + ex.printStackTrace(); + } + } + + // Pass this method an Object and a Method equipped to handle document events from the Finder + // Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the + // application bundle's Info.plist + public static void setFileHandler(Object target, Method fileHandler) { + setHandler(new OSXAdapter("handleOpenFile", target, fileHandler) { + // Override OSXAdapter.callTarget to send information on the + // file to be opened + public boolean callTarget(Object appleEvent) { + if (appleEvent != null) { + try { + Method getFilenameMethod = appleEvent.getClass().getDeclaredMethod("getFilename", (Class[])null); + String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null); + this.targetMethod.invoke(this.targetObject, new Object[] { filename }); + } catch (Exception ex) { + + } + } + return true; + } + }); + } + + // setHandler creates a Proxy object from the passed OSXAdapter and adds it as an ApplicationListener + public static void setHandler(OSXAdapter adapter) { + try { + Class applicationClass = Class.forName("com.apple.eawt.Application"); + if (macOSXApplication == null) { + macOSXApplication = applicationClass.getConstructor((Class[])null).newInstance((Object[])null); + } + Class applicationListenerClass = Class.forName("com.apple.eawt.ApplicationListener"); + Method addListenerMethod = applicationClass.getDeclaredMethod("addApplicationListener", new Class[] { applicationListenerClass }); + // Create a proxy object around this handler that can be reflectively added as an Apple ApplicationListener + Object osxAdapterProxy = Proxy.newProxyInstance(OSXAdapter.class.getClassLoader(), new Class[] { applicationListenerClass }, adapter); + addListenerMethod.invoke(macOSXApplication, new Object[] { osxAdapterProxy }); + } catch (ClassNotFoundException cnfe) { + System.err.println("This version of Mac OS X does not support the Apple EAWT. ApplicationEvent handling has been disabled (" + cnfe + ")"); + } catch (Exception ex) { // Likely a NoSuchMethodException or an IllegalAccessException loading/invoking eawt.Application methods + System.err.println("Mac OS X Adapter could not talk to EAWT:"); + ex.printStackTrace(); + } + } + + // Each OSXAdapter has the name of the EAWT method it intends to listen for (handleAbout, for example), + // the Object that will ultimately perform the task, and the Method to be called on that Object + protected OSXAdapter(String proxySignature, Object target, Method handler) { + this.proxySignature = proxySignature; + this.targetObject = target; + this.targetMethod = handler; + } + + // Override this method to perform any operations on the event + // that comes with the various callbacks + // See setFileHandler above for an example + public boolean callTarget(Object appleEvent) throws InvocationTargetException, IllegalAccessException { + Object result = targetMethod.invoke(targetObject, (Object[])null); + if (result == null) { + return true; + } + return Boolean.valueOf(result.toString()).booleanValue(); + } + + // InvocationHandler implementation + // This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked + public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { + if (isCorrectMethod(method, args)) { + boolean handled = callTarget(args[0]); + setApplicationEventHandled(args[0], handled); + } + // All of the ApplicationListener methods are void; return null regardless of what happens + return null; + } + + // Compare the method that was called to the intended method when the OSXAdapter instance was created + // (e.g. handleAbout, handleQuit, handleOpenFile, etc.) + protected boolean isCorrectMethod(Method method, Object[] args) { + return (targetMethod != null && proxySignature.equals(method.getName()) && args.length == 1); + } + + // It is important to mark the ApplicationEvent as handled and cancel the default behavior + // This method checks for a boolean result from the proxy method and sets the event accordingly + protected void setApplicationEventHandled(Object event, boolean handled) { + if (event != null) { + try { + Method setHandledMethod = event.getClass().getDeclaredMethod("setHandled", new Class[] { boolean.class }); + // If the target method returns a boolean, use that as a hint + setHandledMethod.invoke(event, new Object[] { Boolean.valueOf(handled) }); + } catch (Exception ex) { + System.err.println("OSXAdapter was unable to handle an ApplicationEvent: " + event); + ex.printStackTrace(); + } + } + } +} -- cgit v1.2.3 From 7767a045d446ea2bc5fe1ec98d89274155f956c4 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 16:18:05 -0700 Subject: macosx: Respond to apple messages in all apps This connects the callbacks in AltosUIFrame to actually do something useful with them. Signed-off-by: Keith Packard --- altosui/AltosUI.java | 15 +++++++++++++++ micropeak/MicroPeak.java | 15 +++++++++++++++ telegps/TeleGPS.java | 24 +++++++++++++++++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index 1eb03805..0aa5d03c 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.java @@ -99,10 +99,25 @@ public class AltosUI extends AltosUIFrame { return b; } + /* OSXAdapter interfaces */ + public void macosx_file_handler(String path) { + process_graph(new File(path)); + } + + public void macosx_quit_handler() { + System.exit(0); + } + + public void macosx_preferences_handler() { + ConfigureAltosUI(); + } + public AltosUI() { load_library(null); + register_for_macosx_events(); + AltosUIPreferences.set_component(this); pane = getContentPane(); diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index d7d393ba..8bdf4b77 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -190,10 +190,25 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene public void itemStateChanged(ItemEvent e) { } + /* OSXAdapter interfaces */ + public void macosx_file_handler(String path) { + CommandGraph(new File(path)); + } + + public void macosx_quit_handler() { + System.exit(0); + } + + public void macosx_preferences_handler() { + Preferences(); + } + public MicroPeak() { ++number_of_windows; + register_for_macosx_events(); + AltosUIPreferences.set_component(this); container = getContentPane(); diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index f765ee23..e78c2124 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -410,16 +410,38 @@ public class TeleGPS private JMenu make_menu(String label, String[][] items) { JMenu menu = new JMenu(label); - for (int i = 0; i < items.length; i++) + for (int i = 0; i < items.length; i++) { + if (MAC_OS_X) { + if (items[i][1].equals("exit")) + continue; + if (items[i][1].equals("preferences")) + continue; + } add_menu(menu, items[i][0], items[i][1]); + } menu_bar.add(menu); return menu; } + /* OSXAdapter interfaces */ + public void macosx_file_handler(String path) { + process_graph(new File(path)); + } + + public void macosx_quit_handler() { + System.exit(0); + } + + public void macosx_preferences_handler() { + preferences(); + } + public TeleGPS() { AltosUIPreferences.set_component(this); + register_for_macosx_events(); + reader = null; bag = getContentPane(); -- cgit v1.2.3 From 1d773cb8921848c99f12b8cd9840cb0267b66e1f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 18 Jun 2014 20:35:12 -0700 Subject: windows: Missed adding 'refresh-sh.nsh' This script forces windows explorer to reload icons. Signed-off-by: Keith Packard --- altosui/Instdrv/NSIS/Includes/refresh-sh.nsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 altosui/Instdrv/NSIS/Includes/refresh-sh.nsh diff --git a/altosui/Instdrv/NSIS/Includes/refresh-sh.nsh b/altosui/Instdrv/NSIS/Includes/refresh-sh.nsh new file mode 100644 index 00000000..23d8e5e4 --- /dev/null +++ b/altosui/Instdrv/NSIS/Includes/refresh-sh.nsh @@ -0,0 +1,14 @@ +!define SHCNE_ASSOCCHANGED 0x08000000 +!define SHCNF_IDLIST 0 + +Function RefreshShellIcons + ; By jerome tremblay - april 2003 + ${DisableX64FSRedirection} + System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' +FunctionEnd + +Function un.RefreshShellIcons + ; By jerome tremblay - april 2003 + ${DisableX64FSRedirection} + System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' +FunctionEnd -- cgit v1.2.3 From 37856672c57f2fd91184c2391a201bbbdc48545e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 19 Jun 2014 10:25:07 -0700 Subject: linux: .desktop files must begin with organization name The spec requires that .desktop files start with the organization name, so I've renamed all of them to altusmetrum-.desktop Signed-off-by: Keith Packard --- altosui/Makefile.am | 6 +++--- altosui/altos.desktop.in | 10 ---------- altosui/altusmetrum-altosui.desktop.in | 11 +++++++++++ micropeak/Makefile.am | 4 ++-- micropeak/altusmetrum-micropeak.desktop.in | 10 ++++++++++ micropeak/micropeak.desktop.in | 10 ---------- telegps/Makefile.am | 8 ++++---- telegps/altusmetrum-telegps.desktop.in | 10 ++++++++++ telegps/telegps.desktop.in | 10 ---------- 9 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 altosui/altos.desktop.in create mode 100644 altosui/altusmetrum-altosui.desktop.in create mode 100644 micropeak/altusmetrum-micropeak.desktop.in delete mode 100644 micropeak/micropeak.desktop.in create mode 100644 telegps/altusmetrum-telegps.desktop.in delete mode 100644 telegps/telegps.desktop.in diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 352fb430..bc074a95 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -64,7 +64,7 @@ LIBALTOS= \ altos.dll desktopdir = $(datadir)/applications -desktop_file = altos.desktop +desktop_file = altusmetrum-altosui.desktop desktop_SCRIPTS = $(desktop_file) JAR=altosui.jar @@ -141,7 +141,7 @@ FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFR LINUX_LIBS=libaltos32.so libaltos64.so -LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) altos.desktop.in ../icon/altusmetrum.svg +LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/altusmetrum.svg LINUX_EXTRA=altosui-fat MACOSX_INFO_PLIST=Info.plist @@ -161,7 +161,7 @@ clean-local: EXTRA_DIST = $(desktop_file).in $(desktop_file): $(desktop_file).in - sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/altos.desktop.in > $@ + sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/$(desktop_file).in > $@ chmod +x $@ if FATINSTALL diff --git a/altosui/altos.desktop.in b/altosui/altos.desktop.in deleted file mode 100644 index 66114348..00000000 --- a/altosui/altos.desktop.in +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Application -Name=AltOS UI -GenericName=Altus Metrum Ground Station -Comment=View and log downlink data from Altus Metrum products -Icon=%icondir%/altusmetrum.svg -Exec=%bindir%/altosui %f -Terminal=false -MimeType=text/plain; -Categories=Education;Electronics;Science; diff --git a/altosui/altusmetrum-altosui.desktop.in b/altosui/altusmetrum-altosui.desktop.in new file mode 100644 index 00000000..716571ce --- /dev/null +++ b/altosui/altusmetrum-altosui.desktop.in @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=AltOS UI +GenericName=Altus Metrum Ground Station +Comment=View and log downlink data from Altus Metrum products +Icon=%icondir%/altusmetrum.svg +Exec=%bindir%/altosui %f +Terminal=false +MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom +Categories=Education;Electronics;Science; diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index 1e09e523..37d5ca63 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -75,7 +75,7 @@ WINDOWS_ICON=$(ICONDIR)/micro-peak.ico $(ICONDIR)/micro-peak.exe MACOSX_ICON=$(ICONDIR)/MicroPeak.icns desktopdir = $(datadir)/applications -desktop_file = micropeak.desktop +desktop_file = altusmetrum-micropeak.desktop desktop_SCRIPTS = $(desktop_file) all-local: micropeak-test micropeak-jdb $(JAR) @@ -92,7 +92,7 @@ clean-local: EXTRA_DIST = $(desktop_file).in $(desktop_file): $(desktop_file).in - sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/micropeak.desktop.in > $@ + sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/$(desktop_file).in > $@ chmod +x $@ LINUX_DIST=MicroPeak-Linux-$(VERSION).tar.bz2 diff --git a/micropeak/altusmetrum-micropeak.desktop.in b/micropeak/altusmetrum-micropeak.desktop.in new file mode 100644 index 00000000..f7d258ec --- /dev/null +++ b/micropeak/altusmetrum-micropeak.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=MicroPeak +GenericName=MicroPeak Download and Analysis +Comment=View and log data from MicroPeak altimeters +Icon=%icondir%/micropeak.svg +Exec=%bindir%/micropeak %f +Terminal=false +MimeType=application/vnd.altusmetrum.micropeak +Categories=Education;Electronics;Science; diff --git a/micropeak/micropeak.desktop.in b/micropeak/micropeak.desktop.in deleted file mode 100644 index abdf286f..00000000 --- a/micropeak/micropeak.desktop.in +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Application -Name=MicroPeak -GenericName=MicroPeak download and analysis -Comment=View and log data from MicroPeak altimeters -Icon=%icondir%/micropeak.svg -Exec=%bindir%/micropeak %f -Terminal=false -MimeType=text/plain; -Categories=Education;Electronics;Science; diff --git a/telegps/Makefile.am b/telegps/Makefile.am index 8868c723..c4f6a58b 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -89,7 +89,7 @@ FIRMWARE_TG=$(FIRMWARE_TG_1_0) FIRMWARE=$(FIRMWARE_TG) $(FIRMWARE_TD) $(FIRMWARE_TBT) desktopdir = $(datadir)/applications -desktop_file = telegps.desktop +desktop_file = altusmetrum-telegps.desktop desktop_SCRIPTS = $(desktop_file) all-local: telegps-test telegps-jdb $(JAR) @@ -106,7 +106,7 @@ clean-local: EXTRA_DIST = $(desktop_file).in $(desktop_file): $(desktop_file).in - sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/telegps.desktop.in > $@ + sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/$(desktop_file).in > $@ chmod +x $@ LINUX_DIST=TeleGPS-Linux-$(VERSION).tar.bz2 @@ -120,8 +120,8 @@ DOC=$(TELEGPS_DOC) FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) -LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) telegps.desktop.in ../icon/telegps.svg -LINUX_EXTRA=telegps-fat telegps.desktop.in +LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/telegps.svg +LINUX_EXTRA=telegps-fat $(desktop_file).in MACOSX_INFO_PLIST=Info.plist MACOSX_README=ReadMe-Mac.rtf diff --git a/telegps/altusmetrum-telegps.desktop.in b/telegps/altusmetrum-telegps.desktop.in new file mode 100644 index 00000000..76c1eb42 --- /dev/null +++ b/telegps/altusmetrum-telegps.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=TeleGPS +GenericName=TeleGPS monitor, download and analysis +Comment=View and log data from TeleGPS tracking devices +Icon=%icondir%/telegps.svg +Exec=%bindir%/telegps %f +Terminal=false +MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom +Categories=Education;Electronics;Science; diff --git a/telegps/telegps.desktop.in b/telegps/telegps.desktop.in deleted file mode 100644 index 3d249d8a..00000000 --- a/telegps/telegps.desktop.in +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Type=Application -Name=TeleGPS -GenericName=TeleGPS monitor, download and analysis -Comment=View and log data from TeleGPS tracking devices -Icon=%icondir%/telegps.svg -Exec=%bindir%/telegps %f -Terminal=false -MimeType=text/plain; -Categories=Education;Electronics;Science; -- cgit v1.2.3 From 1b0f56ddb2b85b68232c22a7a8b8744cb9ad76f9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 19 Jun 2014 14:33:27 -0700 Subject: Rename icon files to fit XDG specifications. Add file icons. Add mime types Our SVG icons now follow XDG standards by including a vendor prefix. The new file type icons include application-vnd.altusmetrum as a prefix so that they match the mime types declared. Signed-off-by: Keith Packard --- altosui/.gitignore | 2 +- altosui/Info.plist.in | 6 +- altosui/Makefile.am | 52 +-- altosui/altos-windows.nsi.in | 83 +++-- altosui/altusmetrum-altosui.desktop.in | 2 +- icon/.gitignore | 6 +- icon/Makefile.am | 156 +++++--- icon/altus-metrum.rc | 1 - icon/altusmetrum-altosui.svg | 250 +++++++++++++ icon/altusmetrum-micropeak.svg | 219 ++++++++++++ icon/altusmetrum-telegps.svg | 324 +++++++++++++++++ icon/altusmetrum.svg | 250 ------------- icon/application-vnd.altusmetrum.eeprom.svg | 397 +++++++++++++++++++++ icon/application-vnd.altusmetrum.micropeak.svg | 1 + icon/application-vnd.altusmetrum.telemetry.svg | 397 +++++++++++++++++++++ icon/creating-linux-icons | 29 ++ icon/micro-peak.rc | 1 - icon/micropeak.svg | 219 ------------ icon/org-altusmetrum-mimetypes.xml | 16 + icon/telegps.rc | 1 - icon/telegps.svg | 324 ----------------- micropeak/.gitignore | 2 +- micropeak/Info.plist.in | 4 +- micropeak/Makefile.am | 48 +-- .../Contents/Resources/MicroPeak.icns | Bin 133711 -> 0 bytes micropeak/altusmetrum-micropeak.desktop.in | 2 +- micropeak/micropeak-windows.nsi.in | 51 +-- telegps/.gitignore | 2 +- telegps/Info.plist.in | 6 +- telegps/Makefile.am | 51 +-- telegps/altusmetrum-telegps.desktop.in | 2 +- telegps/telegps-windows.nsi.in | 83 +++-- 32 files changed, 1975 insertions(+), 1012 deletions(-) delete mode 100644 icon/altus-metrum.rc create mode 100644 icon/altusmetrum-altosui.svg create mode 100644 icon/altusmetrum-micropeak.svg create mode 100644 icon/altusmetrum-telegps.svg delete mode 100644 icon/altusmetrum.svg create mode 100644 icon/application-vnd.altusmetrum.eeprom.svg create mode 120000 icon/application-vnd.altusmetrum.micropeak.svg create mode 100644 icon/application-vnd.altusmetrum.telemetry.svg create mode 100644 icon/creating-linux-icons delete mode 100644 icon/micro-peak.rc delete mode 100644 icon/micropeak.svg create mode 100644 icon/org-altusmetrum-mimetypes.xml delete mode 100644 icon/telegps.rc delete mode 100644 icon/telegps.svg delete mode 100644 micropeak/MicroPeak.app/Contents/Resources/MicroPeak.icns diff --git a/altosui/.gitignore b/altosui/.gitignore index 10b600e4..b0c8264b 100644 --- a/altosui/.gitignore +++ b/altosui/.gitignore @@ -17,7 +17,7 @@ Altos-Linux-*.tar.bz2 Altos-Linux-*.sh Altos-Mac-*.zip Altos-Windows-*.exe -altos.desktop +altusmetrum-altosui.desktop *.dll *.dylib *.so diff --git a/altosui/Info.plist.in b/altosui/Info.plist.in index bae6d52c..8dc797d6 100644 --- a/altosui/Info.plist.in +++ b/altosui/Info.plist.in @@ -23,14 +23,14 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleIconFile - AltosUIIcon.icns + altusmetrum-altosui.icns CFBundleDocumentTypes CFBundleTypeName Telemetry CFBundleTypeIconFile - AltosUIIcon.icns + application-vnd.altusmetrum.telemetry.icns CFBundleTypeExtensions telem @@ -42,7 +42,7 @@ CFBundleTypeName Eeprom CFBundleTypeIconFile - AltosUIIcon.icns + application-vnd.altusmetrum.eeprom.icns CFBundleTypeExtensions eeprom diff --git a/altosui/Makefile.am b/altosui/Makefile.am index bc074a95..45d75699 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -72,26 +72,37 @@ JAR=altosui.jar FATJAR=altosui-fat.jar # Icons -ICONDIR=$(top_srcdir)/icon +ICONDIR=../icon JAVA_ICONS=\ - $(ICONDIR)/altus-metrum-16.png \ - $(ICONDIR)/altus-metrum-32.png \ - $(ICONDIR)/altus-metrum-48.png \ - $(ICONDIR)/altus-metrum-64.png \ - $(ICONDIR)/altus-metrum-128.png \ - $(ICONDIR)/altus-metrum-256.png + $(ICONDIR)/altusmetrum-altosui-16.png \ + $(ICONDIR)/altusmetrum-altosui-32.png \ + $(ICONDIR)/altusmetrum-altosui-48.png \ + $(ICONDIR)/altusmetrum-altosui-64.png \ + $(ICONDIR)/altusmetrum-altosui-128.png\ + $(ICONDIR)/altusmetrum-altosui-256.png # icon base names for jar -ICONJAR= -C $(ICONDIR) altus-metrum-16.png \ - -C $(ICONDIR) altus-metrum-32.png \ - -C $(ICONDIR) altus-metrum-48.png \ - -C $(ICONDIR) altus-metrum-64.png \ - -C $(ICONDIR) altus-metrum-128.png \ - -C $(ICONDIR) altus-metrum-256.png - -WINDOWS_ICON=$(ICONDIR)/altus-metrum.ico $(ICONDIR)/altus-metrum.exe -MACOSX_ICON=$(ICONDIR)/AltosUIIcon.icns +ICONJAR= \ + -C $(ICONDIR) altusmetrum-altosui-16.png \ + -C $(ICONDIR) altusmetrum-altosui-32.png \ + -C $(ICONDIR) altusmetrum-altosui-48.png \ + -C $(ICONDIR) altusmetrum-altosui-64.png \ + -C $(ICONDIR) altusmetrum-altosui-128.png\ + -C $(ICONDIR) altusmetrum-altosui-256.png + +WINDOWS_ICONS =\ + $(ICONDIR)/altusmetrum-altosui.ico \ + $(ICONDIR)/altusmetrum-altosui.exe + $(ICONDIR)/application-vnd.altusmetrum.eeprom.ico \ + $(ICONDIR)/application-vnd.altusmetrum.eeprom.exe \ + $(ICONDIR)/application-vnd.altusmetrum.telemetry.ico \ + $(ICONDIR)/application-vnd.altusmetrum.telemetry.exe + +MACOSX_ICONS =\ + $(ICONDIR)/altusmetrum-altosui.icns \ + $(ICONDIR)/application-vnd.altusmetrum.eeprom.icns \ + $(ICONDIR)/application-vnd.altusmetrum.telemetry.icns # Firmware FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx @@ -141,14 +152,14 @@ FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFR LINUX_LIBS=libaltos32.so libaltos64.so -LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/altusmetrum.svg +LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in $(ICONDIR)/altusmetrum-altosui.svg LINUX_EXTRA=altosui-fat MACOSX_INFO_PLIST=Info.plist -MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf $(MACOSX_ICON) +MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf $(MACOSX_ICONS) MACOSX_EXTRA=$(FIRMWARE) -WINDOWS_FILES=$(FAT_FILES) $(FIRMWARE) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(WINDOWS_ICON) +WINDOWS_FILES=$(FAT_FILES) $(FIRMWARE) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(WINDOWS_ICONS) all-local: classes/altosui $(JAR) altosui altosui-test altosui-jdb @@ -195,7 +206,6 @@ else fat: $(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) $(WINDOWS_DIST) endif - altosuidir=$(datadir)/java install-altosuiJAVA: altosui.jar @@ -325,7 +335,7 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile cp -a $(DOC) macosx/Doc cp -p Info.plist macosx/AltosUI.app/Contents mkdir -p macosx/AltOS-$(VERSION) macosx/AltosUI.app/Contents/Resources/Java - cp -p $(MACOSX_ICON) macosx/AltosUI.app/Contents/Resources + cp -p $(MACOSX_ICONS) macosx/AltosUI.app/Contents/Resources cp -p $(FATJAR) macosx/AltosUI.app/Contents/Resources/Java/altosui.jar cp -p libaltos.dylib macosx/AltosUI.app/Contents/Resources/Java cp -p $(ALTOSLIB_CLASS) macosx/AltosUI.app/Contents/Resources/Java diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in index c6da097e..07de5b13 100644 --- a/altosui/altos-windows.nsi.in +++ b/altosui/altos-windows.nsi.in @@ -4,12 +4,14 @@ !include java.nsh !include refresh-sh.nsh -!define REG_NAME "Altus Metrum" -!define PROG_ID "org.altusmetrum.altosui.1" -!define PROG_ALTOSUI "org.altusmetrum.altosui.1" -!define FAT_NAME "altosui-fat.jar" -!define ICO_ICO "altus-metrum.ico" -!define ICO_EXE "altus-metrum.exe" +!define REG_NAME "Altus Metrum" +!define PROG_ID_TELEM "altusmetrum.altosui.telem.1" +!define PROG_ID_EEPROM "altusmetrum.altosui.eeprom.1" +!define FAT_NAME "altosui-fat.jar" +!define WIN_APP_ICON "altusmetrum-altosui.ico" +!define WIN_APP_EXE "altusmetrum-altosui.exe" +!define WIN_TELEM_EXE "application-vnd.altusmetrum.telemetry.exe" +!define WIN_EEPROM_EXE "application-vnd.altusmetrum.eeprom.exe" Name "${REG_NAME} Installer" @@ -104,13 +106,13 @@ Section "${REG_NAME} Application" File "*.dll" - File "../icon/${ICO_ICO}" + File "../icon/${WIN_APP_ICON}" - CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}" + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "${REG_NAME} Desktop Shortcut" - CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "TeleMetrum, TeleDongle and TeleBT Firmware" @@ -145,35 +147,51 @@ SectionEnd Section "File Associations" + ${DisableX64FSRedirection} + SetOutPath $INSTDIR - File "../icon/${ICO_EXE}" + File "../icon/${WIN_APP_EXE}" + File "../icon/${WIN_TELEM_EXE}" + File "../icon/${WIN_EEPROM_EXE}" - ; application elements - - WriteRegStr HKCR "${PROG_ID}" "" "Altus Metrum Data File" - WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "Altus Metrum Data File" - WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}" - WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101' - WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + DeleteRegKey HKCR "${PROG_ID_TELEM}" + DeleteRegKey HKCR "${PROG_ID_EEPROM}" + + DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}" + DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" + DeleteRegKey HKCR ".telem\${PROG_ID_EEPROM}" + DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_EEPROM}" ; .eeprom elements - WriteRegStr HKCR ".eeprom" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR "${PROG_ID_EEPROM}" "" "Altus Metrum Log File" + WriteRegStr HKCR "${PROG_ID_EEPROM}" "FriendlyTypeName" "Altus Metrum Log File" + WriteRegStr HKCR "${PROG_ID_EEPROM}\CurVer" "" "${PROG_ID_EEPROM}" + WriteRegStr HKCR "${PROG_ID_EEPROM}\DefaultIcon" "" '"$INSTDIR\${WIN_EEPROM_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + WriteRegStr HKCR ".eeprom" "" "${PROG_ID_EEPROM}" WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File" - WriteRegStr HKCR ".eeprom" "Content Type" "application/altosui" + WriteRegStr HKCR ".eeprom" "Content Type" "application/vnd.altusmetrum.eeprom" - WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" "" - WriteRegStr HKCR ".eeprom\${PROG_ID}" "" "${REG_NAME}" + WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" "" + WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}" "" "${REG_NAME}" ; .telem elements - WriteRegStr HKCR ".telem" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR "${PROG_ID_TELEM}" "" "Altus Metrum Telemetry File" + WriteRegStr HKCR "${PROG_ID_TELEM}" "FriendlyTypeName" "Altus Metrum Telemetry File" + WriteRegStr HKCR "${PROG_ID_TELEM}\CurVer" "" "${PROG_ID_TELEM}" + WriteRegStr HKCR "${PROG_ID_TELEM}\DefaultIcon" "" '"$INSTDIR\${WIN_TELEM_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + WriteRegStr HKCR ".telem" "" "${PROG_ID_TELEM}" WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File" - WriteRegStr HKCR ".telem" "Content Type" "application/altosui" + WriteRegStr HKCR ".telem" "Content Type" "application/vnd.altusmetrum.telemetry" - WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID}" "" - WriteRegStr HKCR ".telem\${PROG_ID}" "" "${REG_NAME}" + WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" "" + WriteRegStr HKCR ".telem\${PROG_ID_TELEM}" "" "${REG_NAME}" Call RefreshShellIcons SectionEnd @@ -206,21 +224,22 @@ Section "Uninstall" DetailPrint "Delete uninstall reg entries" - DeleteRegKey HKCR "${PROG_ID}" + DeleteRegKey HKCR "${PROG_ID_EEPROM}" + DeleteRegKey HKCR "${PROG_ID_TELEM}" - DeleteRegKey HKCR ".eeprom\${PROG_ID}" - DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" + DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}" + DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" - DeleteRegKey HKCR ".telem\${PROG_ID}" - DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID}" + DeleteRegKey HKCR ".telem\${PROG_ID_TELEM}" + DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" DetailPrint "Delete file association reg entries" Delete "$INSTDIR\${FAT_NAME}" Delete "$INSTDIR\uninstall-${REG_NAME}.exe" - Delete "$INSTDIR\${ICO_ICO}" - Delete "$INSTDIR\${ICO_EXE}" + Delete "$INSTDIR\${WIN_APP_ICON}" + Delete "$INSTDIR\${WIN_APP_EXE}" ; Remove shortcuts, if any Delete "$SMPROGRAMS\${REG_NAME}.lnk" diff --git a/altosui/altusmetrum-altosui.desktop.in b/altosui/altusmetrum-altosui.desktop.in index 716571ce..10fd9e9d 100644 --- a/altosui/altusmetrum-altosui.desktop.in +++ b/altosui/altusmetrum-altosui.desktop.in @@ -4,7 +4,7 @@ Version=1.0 Name=AltOS UI GenericName=Altus Metrum Ground Station Comment=View and log downlink data from Altus Metrum products -Icon=%icondir%/altusmetrum.svg +Icon=%icondir%/altusmetrum-altosui.svg Exec=%bindir%/altosui %f Terminal=false MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom diff --git a/icon/.gitignore b/icon/.gitignore index 40cf2f3e..94c7c70c 100644 --- a/icon/.gitignore +++ b/icon/.gitignore @@ -1,6 +1,6 @@ -altus-metrum-*.png -micropeak-*.png -telegps-*.png +application-*.png +altusmetrum-*.png +*.rc *.ico *.icns *.build diff --git a/icon/Makefile.am b/icon/Makefile.am index 61a16914..516c547c 100644 --- a/icon/Makefile.am +++ b/icon/Makefile.am @@ -3,85 +3,137 @@ MAC_RES=16 32 128 256 512 WIN_RES=16 24 32 48 64 72 96 128 180 256 RES=$(shell echo $(JAVA_RES) $(MAC_RES) $(WIN_RES) | awk '{ for (i = 1; i <= NF; i++) printf("%s\n", $$i); }' | sort -n -u) -AM_FILES=$(shell for i in $(RES); do echo altus-metrum-$$i.png; done) -MP_FILES=$(shell for i in $(RES); do echo micropeak-$$i.png; done) -TG_FILES=$(shell for i in $(RES); do echo telegps-$$i.png; done) +# Application icon base names -MAC_TG_FILES=$(shell for i in $(MAC_RES); do echo telegps-$$i.png; done) -MAC_MP_FILES=$(shell for i in $(MAC_RES); do echo micropeak-$$i.png; done) -MAC_AM_FILES=$(shell for i in $(MAC_RES); do echo altus-metrum-$$i.png; done) +AM_NAME = altusmetrum-altosui +MP_NAME = altusmetrum-micropeak +TG_NAME = altusmetrum-telegps -WIN_TG_FILES=$(shell for i in $(WIN_RES); do echo telegps-$$i.png; done) -WIN_MP_FILES=$(shell for i in $(WIN_RES); do echo micropeak-$$i.png; done) -WIN_AM_FILES=$(shell for i in $(WIN_RES); do echo altus-metrum-$$i.png; done) +# File icon base names -ICO_FILES=altus-metrum.ico micro-peak.ico telegps.ico -ICNS_FILES=AltosUIIcon.icns TeleGPS.icns MicroPeak.icns +EEPROM_NAME = application-vnd.altusmetrum.eeprom +TELEM_NAME = application-vnd.altusmetrum.telemetry +MPD_NAME = application-vnd.altusmetrum.micropeak -icondir = $(datadir)/icons/hicolor/scalable/apps +# Application icons -AM_ICON = altusmetrum.svg -MP_ICON = micropeak.svg -TG_ICON = telegps.svg +AM_ICON = $(AM_NAME).svg +MP_ICON = $(MP_NAME).svg +TG_ICON = $(TG_NAME).svg -icon_DATA = $(AM_ICON) $(MP_ICON) $(TG_ICON) +# File icons (note that MicroPeak uses the application icon for files) -EXTRA_DIST = $(icon_DATA) $(AM_FILES) $(MP_FILES) $(TG_FILES) +EEPROM_ICON = $(EEPROM_NAME).svg +TELEM_ICON = $(TELEM_NAME).svg +MPD_ICON = $(MPD_NAME).svg -res: - echo $(RES) +# Files needed for Mac OSX icons -all-local: $(ICO_FILES) $(ICNS_FILES) +MAC_AM_FILES = $(shell for i in $(MAC_RES); do echo $(AM_NAME)-$$i.png; done) +MAC_MP_FILES = $(shell for i in $(MAC_RES); do echo $(MP_NAME)-$$i.png; done) +MAC_TG_FILES = $(shell for i in $(MAC_RES); do echo $(TG_NAME)-$$i.png; done) +MAC_EEPROM_FILES= $(shell for i in $(MAC_RES); do echo $(EEPROM_NAME)-$$i.png; done) +MAC_TELEM_FILES = $(shell for i in $(MAC_RES); do echo $(TELEM_NAME)-$$i.png; done) +MAC_MPD_FILES = $(shell for i in $(MAC_RES); do echo $(MPD_NAME)-$$i.png; done) -clean-local: - $(RM) altus-metrum-*.png telegps-*.png micropeak-*.png *.build *.ico *.icns *.o *.exe +ICNS_FILES = $(AM_NAME).icns $(MP_NAME).icns $(TG_NAME).icns \ + $(EEPROM_NAME).icns $(TELEM_NAME).icns $(MPD_NAME).icns -$(AM_FILES): altusmetrum.build +# Files needed for Windows icons -altusmetrum.build: altusmetrum.svg - for i in $(RES); do rsvg-convert -w $$i -h $$i -o altus-metrum-$$i.png altusmetrum.svg; done && touch $@ +WIN_AM_FILES = $(shell for i in $(WIN_RES); do echo $(AM_NAME)-$$i.png; done) +WIN_MP_FILES = $(shell for i in $(WIN_RES); do echo $(MP_NAME)-$$i.png; done) +WIN_TG_FILES = $(shell for i in $(WIN_RES); do echo $(TG_NAME)-$$i.png; done) +WIN_EEPROM_FILES= $(shell for i in $(WIN_RES); do echo $(EEPROM_NAME)-$$i.png; done) +WIN_TELEM_FILES = $(shell for i in $(WIN_RES); do echo $(TELEM_NAME)-$$i.png; done) +WIN_MPD_FILES = $(shell for i in $(WIN_RES); do echo $(MPD_NAME)-$$i.png; done) -$(TG_FILES): telegps.build +ICO_FILES = $(AM_NAME).ico $(MP_NAME).ico $(TG_NAME).ico \ + $(EEPROM_NAME).ico $(TELEM_NAME).ico $(MPD_NAME).ico -telegps.build: telegps.svg - for i in $(RES); do rsvg-convert -w $$i -h $$i -o telegps-$$i.png telegps.svg; done && touch $@ +EXE_FILES = $(AM_NAME).exe $(MP_NAME).exe $(TG_NAME).exe \ + $(EEPROM_NAME).exe $(TELEM_NAME).exe $(MPD_NAME).exe -$(MP_FILES): micropeak.build +# Files needed for Java internal icons -micropeak.build: micropeak.svg - for i in $(RES); do rsvg-convert -w $$i -h $$i -o micropeak-$$i.png micropeak.svg; done && touch $@ +JAVA_AM_FILES = $(shell for i in $(JAVA_RES); do echo $(AM_NAME)-$$i.png; done) +JAVA_MP_FILES = $(shell for i in $(JAVA_RES); do echo $(MP_NAME)-$$i.png; done) +JAVA_TG_FILES = $(shell for i in $(JAVA_RES); do echo $(TG_NAME)-$$i.png; done) -#clean-local: -# $(RM) -f $(ICO_FILES) +JAVA_FILES = $(JAVA_AM_FILES) $(JAVA_MP_FILES) $(JAVA_TG_FILES) -altus-metrum.ico: $(WIN_AM_FILES) - icotool -c -o $@ $(WIN_AM_FILES) +# PNG files needed by anyone -micro-peak.ico: $(WIN_MP_FILES) - icotool -c -o $@ $(WIN_MP_FILES) +AM_FILES = $(shell for i in $(RES); do echo $(AM_NAME)-$$i.png; done) +MP_FILES = $(shell for i in $(RES); do echo $(MP_NAME)-$$i.png; done) +TG_FILES = $(shell for i in $(RES); do echo $(TG_NAME)-$$i.png; done) +EEPROM_FILES = $(shell for i in $(RES); do echo $(EEPROM_NAME)-$$i.png; done) +TELEM_FILES = $(shell for i in $(RES); do echo $(TELEM_NAME)-$$i.png; done) +IN_MPD_FILES = $(shell for i in $(RES); do echo $(MPD_NAME)-$$i.png; done) -telegps.ico: $(WIN_TG_FILES) - icotool -c -o $@ $(WIN_TG_FILES) +ICON_THEME=$(datadir)/icons/hicolor -AltosUIIcon.icns: $(MAC_AM_FILES) - png2icns $@ $(MAC_AM_FILES) +appicondir = $(ICON_THEME)/scalable/apps +appicon_DATA = $(AM_ICON) $(MP_ICON) $(TG_ICON) -TeleGPS.icns: $(MAC_TG_FILES) - png2icns $@ $(MAC_TG_FILES) +MIME_ICONS = $(EEPROM_ICON) $(TELEM_ICON) $(MPD_ICON) -MicroPeak.icns: $(MAC_MP_FILES) - png2icns $@ $(MAC_MP_FILES) +mimeicondir = $(ICON_THEME)/scalable/mimetypes +mimeicon_DATA = $(MIME_ICONS) -MINGCC32=i686-w64-mingw32-gcc -MINGWINDRES=i686-w64-mingw32-windres +mimedir = $(datadir)/mime/packages +mime_DATA = org-altusmetrum-mimetypes.xml + +EXTRA_DIST = $(appicon_DATA) $(mimeicon_DATA) $(mime_DATA) windows-stub.c + +res: + echo $(RES) + +java-altosui: + @echo $(JAVA_AM_FILES) + +java-micropeak: + @echo $(JAVA_MP_FILES) + +java-telegps: + @echo $(JAVA_TG_FILES) -SUFFIXES=.rc .exe +fat: all $(ICO_FILES) $(ICNS_FILES) $(EXE_FILES) -fat: all micro-peak.exe altus-metrum.exe telegps.exe +all-local: $(JAVA_FILES) -altus-metrum.o: altus-metrum.ico -micro-peak.o: micro-peak.ico -telegps.o: telegps.ico +clean-local: + $(RM) $(AM_NAME)-*.png $(TG_NAME)-*.png $(MP_NAME)-*.png + $(RM) $(EEPROM_NAME)-*.png $(TELEM_NAME)-*.png $(MPD_NAME)-*.png + $(RM) *.build *.ico *.rc *.icns *.o *.exe $(MPD_ICON) + +install-data-hook: + update-mime-database $(datadir)/mime + update-icon-caches $(ICON_THEME) + +$(MPD_ICON): $(MP_ICON) + $(LN_S) $(MP_ICON) $@ + +$(AM_FILES): $(AM_NAME).build +$(MP_FILES): $(MP_NAME).build +$(TG_FILES): $(TG_NAME).build + +SUFFIXES=.svg .build .icns .ico .rc .o .exe + +.svg.build: + for i in $(RES); do rsvg-convert -w $$i -h $$i -o $*-$$i.png $*.svg; done && touch $@ + +.build.icns: + png2icns $@ $(shell for i in $(MAC_RES); do echo $*-$$i.png; done) + +.build.ico: + icotool -c -o $@ $(shell for i in $(WIN_RES); do echo $*-$$i.png; done) + +.ico.rc: + echo '101 ICON "$*.ico"' > $@ + +MINGCC32=i686-w64-mingw32-gcc +MINGWINDRES=i686-w64-mingw32-windres .rc.o: $(MINGWINDRES) $*.rc $@ diff --git a/icon/altus-metrum.rc b/icon/altus-metrum.rc deleted file mode 100644 index bbd03604..00000000 --- a/icon/altus-metrum.rc +++ /dev/null @@ -1 +0,0 @@ -101 ICON "altus-metrum.ico" diff --git a/icon/altusmetrum-altosui.svg b/icon/altusmetrum-altosui.svg new file mode 100644 index 00000000..e8935a65 --- /dev/null +++ b/icon/altusmetrum-altosui.svg @@ -0,0 +1,250 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icon/altusmetrum-micropeak.svg b/icon/altusmetrum-micropeak.svg new file mode 100644 index 00000000..d37130f5 --- /dev/null +++ b/icon/altusmetrum-micropeak.svg @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/icon/altusmetrum-telegps.svg b/icon/altusmetrum-telegps.svg new file mode 100644 index 00000000..1e390f3b --- /dev/null +++ b/icon/altusmetrum-telegps.svg @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/icon/altusmetrum.svg b/icon/altusmetrum.svg deleted file mode 100644 index e8935a65..00000000 --- a/icon/altusmetrum.svg +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/icon/application-vnd.altusmetrum.eeprom.svg b/icon/application-vnd.altusmetrum.eeprom.svg new file mode 100644 index 00000000..7b481cdc --- /dev/null +++ b/icon/application-vnd.altusmetrum.eeprom.svg @@ -0,0 +1,397 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icon/application-vnd.altusmetrum.micropeak.svg b/icon/application-vnd.altusmetrum.micropeak.svg new file mode 120000 index 00000000..6efd3200 --- /dev/null +++ b/icon/application-vnd.altusmetrum.micropeak.svg @@ -0,0 +1 @@ +altusmetrum-micropeak.svg \ No newline at end of file diff --git a/icon/application-vnd.altusmetrum.telemetry.svg b/icon/application-vnd.altusmetrum.telemetry.svg new file mode 100644 index 00000000..4bcc0850 --- /dev/null +++ b/icon/application-vnd.altusmetrum.telemetry.svg @@ -0,0 +1,397 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icon/creating-linux-icons b/icon/creating-linux-icons new file mode 100644 index 00000000..5b034c09 --- /dev/null +++ b/icon/creating-linux-icons @@ -0,0 +1,29 @@ +# To create linux icons and file associations + +1) Create mime type and install + + http://www.freedesktop.org/wiki/Specifications/AddingMIMETutor/ + + # xdg-mime install --mode system org-altusmetrum-mimetypes.xml + # update-mime-database /usr/local/share/mime + + On debian, + +2) Create icons and install + + For mime type application/vnd.altusmetrum.telemetry + icon name application-vnd.altusmetrum.telemetry.svg + + All mime icons go in + + /usr/share/icons/hicolor/scalable/mimetypes + + Update the icon database + + # update-icon-caches /usr/share/icons/hicolor + +3) Create .desktop file and install + + # xdg-desktop-menu install --mode system altusmetrum-altosui.desktop + + # update-desktop-database diff --git a/icon/micro-peak.rc b/icon/micro-peak.rc deleted file mode 100644 index 4efe777d..00000000 --- a/icon/micro-peak.rc +++ /dev/null @@ -1 +0,0 @@ -101 ICON "micro-peak.ico" diff --git a/icon/micropeak.svg b/icon/micropeak.svg deleted file mode 100644 index d37130f5..00000000 --- a/icon/micropeak.svg +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/icon/org-altusmetrum-mimetypes.xml b/icon/org-altusmetrum-mimetypes.xml new file mode 100644 index 00000000..e8103c03 --- /dev/null +++ b/icon/org-altusmetrum-mimetypes.xml @@ -0,0 +1,16 @@ + + + + Altus Metrum Telemetry File + + + + Altus Metrum Eeprom Log File + + + + Altus Metrum MicroPeak Log File + + + diff --git a/icon/telegps.rc b/icon/telegps.rc deleted file mode 100644 index 7f5957f9..00000000 --- a/icon/telegps.rc +++ /dev/null @@ -1 +0,0 @@ -101 ICON "telegps.ico" diff --git a/icon/telegps.svg b/icon/telegps.svg deleted file mode 100644 index 1e390f3b..00000000 --- a/icon/telegps.svg +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/micropeak/.gitignore b/micropeak/.gitignore index f9a61359..81dd0749 100644 --- a/micropeak/.gitignore +++ b/micropeak/.gitignore @@ -11,7 +11,7 @@ micropeak-windows.nsi MicroPeak-Linux-* MicroPeak-Mac-* MicroPeak-Windows-* -micropeak.desktop +altusmetrum-micropeak.desktop *.dll *.dylib *.so diff --git a/micropeak/Info.plist.in b/micropeak/Info.plist.in index 8f751079..b1dc6cea 100644 --- a/micropeak/Info.plist.in +++ b/micropeak/Info.plist.in @@ -23,14 +23,14 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleIconFile - MicroPeak.icns + altusmetrum-micropeak.icns CFBundleDocumentTypes CFBundleTypeName MicroPeak data file CFBundleTypeIconFile - MicroPeak.icns + application-vnd.altusmetrum.micropeak.icns CFBundleTypeExtensions mpd diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index 37d5ca63..6270fd74 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -56,23 +56,31 @@ ALTOSUILIB_CLASS=\ ICONDIR=$(top_srcdir)/icon JAVA_ICONS=\ - $(ICONDIR)/micropeak-16.png \ - $(ICONDIR)/micropeak-32.png \ - $(ICONDIR)/micropeak-48.png \ - $(ICONDIR)/micropeak-64.png \ - $(ICONDIR)/micropeak-128.png \ - $(ICONDIR)/micropeak-256.png + $(ICONDIR)/altusmetrum-micropeak-16.png \ + $(ICONDIR)/altusmetrum-micropeak-32.png \ + $(ICONDIR)/altusmetrum-micropeak-48.png \ + $(ICONDIR)/altusmetrum-micropeak-64.png \ + $(ICONDIR)/altusmetrum-micropeak-128.png\ + $(ICONDIR)/altusmetrum-micropeak-256.png # icon base names for jar -ICONJAR= -C $(ICONDIR) micropeak-16.png \ - -C $(ICONDIR) micropeak-32.png \ - -C $(ICONDIR) micropeak-48.png \ - -C $(ICONDIR) micropeak-64.png \ - -C $(ICONDIR) micropeak-128.png \ - -C $(ICONDIR) micropeak-256.png - -WINDOWS_ICON=$(ICONDIR)/micro-peak.ico $(ICONDIR)/micro-peak.exe -MACOSX_ICON=$(ICONDIR)/MicroPeak.icns +ICONJAR= \ + -C $(ICONDIR) altusmetrum-micropeak-16.png \ + -C $(ICONDIR) altusmetrum-micropeak-32.png \ + -C $(ICONDIR) altusmetrum-micropeak-48.png \ + -C $(ICONDIR) altusmetrum-micropeak-64.png \ + -C $(ICONDIR) altusmetrum-micropeak-128.png\ + -C $(ICONDIR) altusmetrum-micropeak-256.png + +WINDOWS_ICONS =\ + ../icon/altusmetrum-micropeak.ico \ + ../icon/altusmetrum-micropeak.exe + ../icon/application-vnd.altusmetrum.micropeak.ico \ + ../icon/application-vnd.altusmetrum.micropeak.ico + +MACOSX_ICONS =\ + ../icon/altusmetrum-micropeak.icns \ + ../icon/application-vnd.altusmetrum.micropeak.icns desktopdir = $(datadir)/applications desktop_file = altusmetrum-micropeak.desktop @@ -106,14 +114,14 @@ DOC=$(MICROPEAK_DOC) FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) -LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) micropeak.desktop.in ../icon/micropeak.svg -LINUX_EXTRA=micropeak-fat micropeak.desktop.in +LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/altusmetrum-micropeak.svg +LINUX_EXTRA=micropeak-fat $(desktop_file).in MACOSX_DRIVER_URL=http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg MACOSX_DRIVER=FTDIUSBSerialDriver_v2_2_18.dmg MACOSX_INFO_PLIST=Info.plist MACOSX_README=ReadMe-Mac.rtf -MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(MACOSX_DRIVER) $(MACOSX_README) $(DOC) $(MACOSX_ICON) +MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(MACOSX_DRIVER) $(MACOSX_README) $(DOC) $(MACOSX_ICONS) $(MACOSX_DRIVER): wget $(MACOSX_DRIVER_URL) @@ -124,7 +132,7 @@ WINDOWS_DRIVER=CDM20824_Setup.exe $(WINDOWS_DRIVER): wget $(WINDOWS_DRIVER_URL) -WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(DOC) $(WINDOWS_ICON) $(WINDOWS_DRIVER) +WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(DOC) $(WINDOWS_ICONS) $(WINDOWS_DRIVER) if FATINSTALL @@ -261,7 +269,7 @@ $(MACOSX_DIST): $(MACOSX_FILES) cp -p Info.plist macosx/MicroPeak.app/Contents cp -p $(MACOSX_DRIVER) macosx mkdir -p macosx/MicroPeak.app/Contents/Resources/Java - cp -p $(MACOSX_ICON) macosx/MicroPeak.app/Contents/Resources + cp -p $(MACOSX_ICONS) macosx/MicroPeak.app/Contents/Resources cp -p $(FATJAR) macosx/MicroPeak.app/Contents/Resources/Java/micropeak.jar cp -p libaltos.dylib macosx/MicroPeak.app/Contents/Resources/Java cp -p $(ALTOSLIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java diff --git a/micropeak/MicroPeak.app/Contents/Resources/MicroPeak.icns b/micropeak/MicroPeak.app/Contents/Resources/MicroPeak.icns deleted file mode 100644 index 9ba83bf5..00000000 Binary files a/micropeak/MicroPeak.app/Contents/Resources/MicroPeak.icns and /dev/null differ diff --git a/micropeak/altusmetrum-micropeak.desktop.in b/micropeak/altusmetrum-micropeak.desktop.in index f7d258ec..782b4704 100644 --- a/micropeak/altusmetrum-micropeak.desktop.in +++ b/micropeak/altusmetrum-micropeak.desktop.in @@ -3,7 +3,7 @@ Type=Application Name=MicroPeak GenericName=MicroPeak Download and Analysis Comment=View and log data from MicroPeak altimeters -Icon=%icondir%/micropeak.svg +Icon=%icondir%/altusmetrum-micropeak.svg Exec=%bindir%/micropeak %f Terminal=false MimeType=application/vnd.altusmetrum.micropeak diff --git a/micropeak/micropeak-windows.nsi.in b/micropeak/micropeak-windows.nsi.in index d8e47505..848523b0 100644 --- a/micropeak/micropeak-windows.nsi.in +++ b/micropeak/micropeak-windows.nsi.in @@ -4,11 +4,13 @@ !include java.nsh !include refresh-sh.nsh -!define REG_NAME "MicroPeak" -!define PROG_ID "org.altusmetrum.micropeak.1" -!define FAT_NAME "micropeak-fat.jar" -!define ICO_ICO "micro-peak.ico" -!define ICO_EXE "micro-peak.exe" +!define REG_NAME "MicroPeak" +!define PROG_ID "org.altusmetrum.micropeak.1" +!define PROG_ID_MPD "org.altusmetrum.micropeak.mpd.1" +!define FAT_NAME "micropeak-fat.jar" +!define WIN_APP_ICON "altusmetrum-micropeak.ico" +!define WIN_APP_EXE "altusmetrum-micropeak.exe" +!define WIN_MPD_EXE "application-vnd.altusmetrum.micropeak.exe" Name "${REG_NAME} Installer" @@ -82,13 +84,13 @@ Section "${REG_NAME} Application" File "*.dll" - File "../icon/${ICO_ICO}" + File "../icon/${WIN_APP_ICON}" - CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}" + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "${REG_NAME} Desktop Shortcut" - CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "Documentation" @@ -102,24 +104,28 @@ Section "File Associations" SetOutPath $INSTDIR - File "../icon/${ICO_EXE}" + File "../icon/${WIN_APP_EXE}" + File "../icon/${WIN_MPD_EXE}" ; application elements - WriteRegStr HKCR "${PROG_ID}" "" "MicroPeak Data File" - WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "MicroPeak Data File" - WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}" - WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101' - WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + DeleteRegKey HKCR "${PROG_ID}" + DeleteRegKey HKCR "${PROG_ID_MPD}" + + WriteRegStr HKCR "${PROG_ID_MPD}" "" "MicroPeak Data File" + WriteRegStr HKCR "${PROG_ID_MPD}" "FriendlyTypeName" "MicroPeak Data File" + WriteRegStr HKCR "${PROG_ID_MPD}\CurVer" "" "${PROG_ID_MPD}" + WriteRegStr HKCR "${PROG_ID_MPD}\DefaultIcon" "" '"$INSTDIR\${WIN_MPD_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID_MPD}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' ; .mpd elements - WriteRegStr HKCR ".mpd" "" "${PROG_ID}" + WriteRegStr HKCR ".mpd" "" "${PROG_ID_MPD}" WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File" - WriteRegStr HKCR ".mpd" "Content Type" "application/micropeak" + WriteRegStr HKCR ".mpd" "Content Type" "application/vnd.altusmetrum.micropeak" - WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID}" "" - WriteRegStr HKCR ".mpd\${PROG_ID}" "" "${REG_NAME}" + WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" "" + WriteRegStr HKCR ".mpd\${PROG_ID_MPD}" "" "${REG_NAME}" Call RefreshShellIcons SectionEnd @@ -153,15 +159,16 @@ Section "Uninstall" DetailPrint "Delete uninstall reg entries" DeleteRegKey HKCR "${PROG_ID}" + DeleteRegKey HKCR "${PROG_ID_MPD}" - DeleteRegKey HKCR ".mpd\${PROG_ID}" - DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID}" + DeleteRegKey HKCR ".mpd\${PROG_ID_MPD}" + DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" Delete "$INSTDIR\${FAT_NAME}" Delete "$INSTDIR\uninstall-${REG_NAME}.exe" - Delete "$INSTDIR\${ICO_ICO}" - Delete "$INSTDIR\${ICO_EXE}" + Delete "$INSTDIR\${WIN_APP_ICON}" + Delete "$INSTDIR\${WIN_APP_EXE}" ; Remove shortcuts, if any Delete "$SMPROGRAMS\${REG_NAME}.lnk" diff --git a/telegps/.gitignore b/telegps/.gitignore index edb509f2..37e46ad1 100644 --- a/telegps/.gitignore +++ b/telegps/.gitignore @@ -17,7 +17,7 @@ TeleGPS-Linux-*.tar.bz2 TeleGPS-Linux-*.sh TeleGPS-Mac-*.zip TeleGPS-Windows-*.exe -telegps.desktop +altusmetrum-telegps.desktop telegps-windows.log *.dll *.dylib diff --git a/telegps/Info.plist.in b/telegps/Info.plist.in index 7dbb77d1..89870a8c 100644 --- a/telegps/Info.plist.in +++ b/telegps/Info.plist.in @@ -23,14 +23,14 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleIconFile - TeleGPS.icns + altusmetrum-telegps.icns CFBundleDocumentTypes CFBundleTypeName Telemetry CFBundleTypeIconFile - TeleGPS.icns + application-vnd.altusmetrum.telemetry.icns CFBundleTypeExtensions telem @@ -42,7 +42,7 @@ CFBundleTypeName Eeprom CFBundleTypeIconFile - TeleGPS.icns + application-vnd.altusmetrum.eeprom.icns CFBundleTypeExtensions eeprom diff --git a/telegps/Makefile.am b/telegps/Makefile.am index c4f6a58b..a7defb8a 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -58,23 +58,34 @@ ALTOSUILIB_CLASS=\ ICONDIR=$(top_srcdir)/icon JAVA_ICONS=\ - $(ICONDIR)/telegps-16.png \ - $(ICONDIR)/telegps-32.png \ - $(ICONDIR)/telegps-48.png \ - $(ICONDIR)/telegps-64.png \ - $(ICONDIR)/telegps-128.png \ - $(ICONDIR)/telegps-256.png + $(ICONDIR)/altusmetrum-telegps-16.png \ + $(ICONDIR)/altusmetrum-telegps-32.png \ + $(ICONDIR)/altusmetrum-telegps-48.png \ + $(ICONDIR)/altusmetrum-telegps-64.png \ + $(ICONDIR)/altusmetrum-telegps-128.png\ + $(ICONDIR)/altusmetrum-telegps-256.png # icon base names for jar -ICONJAR= -C $(ICONDIR) telegps-16.png \ - -C $(ICONDIR) telegps-32.png \ - -C $(ICONDIR) telegps-48.png \ - -C $(ICONDIR) telegps-64.png \ - -C $(ICONDIR) telegps-128.png \ - -C $(ICONDIR) telegps-256.png - -WINDOWS_ICON=$(ICONDIR)/telegps.ico $(ICONDIR)/telegps.exe -MACOSX_ICON=$(ICONDIR)/TeleGPS.icns +ICONJAR= \ + -C $(ICONDIR) altusmetrum-telegps-16.png \ + -C $(ICONDIR) altusmetrum-telegps-32.png \ + -C $(ICONDIR) altusmetrum-telegps-48.png \ + -C $(ICONDIR) altusmetrum-telegps-64.png \ + -C $(ICONDIR) altusmetrum-telegps-128.png\ + -C $(ICONDIR) altusmetrum-telegps-256.png + +WINDOWS_ICONS =\ + ../icon/altusmetrum-telegps.ico \ + ../icon/altusmetrum-telegps.exe + ../icon/application-vnd.altusmetrum.eeprom.ico \ + ../icon/application-vnd.altusmetrum.eeprom.exe \ + ../icon/application-vnd.altusmetrum.telemetry.ico \ + ../icon/application-vnd.altusmetrum.telemetry.exe + +MACOSX_ICONS =\ + ../icon/altusmetrum-telegps.icns \ + ../icon/application-vnd.altusmetrum.eeprom.icns \ + ../icon/application-vnd.altusmetrum.telemetry.icns # Firmware FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx @@ -120,15 +131,15 @@ DOC=$(TELEGPS_DOC) FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) -LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/telegps.svg +LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/altusmetrum-telegps.svg LINUX_EXTRA=telegps-fat $(desktop_file).in MACOSX_INFO_PLIST=Info.plist MACOSX_README=ReadMe-Mac.rtf -MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(MACOSX_README) $(DOC) $(MACOSX_ICON) +MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(MACOSX_README) $(DOC) $(MACOSX_ICONS) MACOSX_EXTRA=$(FIRMWARE) -WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(DOC) $(WINDOWS_ICON) +WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(DOC) $(WINDOWS_ICONS) if FATINSTALL @@ -194,7 +205,7 @@ $(FATJAR): classtelegps.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CL -C classes org \ -C ../libaltos libaltosJNI -classaltosui.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) +classtelegps.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) libaltos.so: build-libaltos -rm -f "$@" @@ -269,7 +280,7 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile cp -a $(DOC) macosx/Doc cp -p Info.plist macosx/TeleGPS.app/Contents mkdir -p macosx/AltOS-$(VERSION) macosx/TeleGPS.app/Contents/Resources/Java - cp -p $(MACOSX_ICON) macosx/TeleGPS.app/Contents/Resources + cp -p $(MACOSX_ICONS) macosx/TeleGPS.app/Contents/Resources cp -p $(FATJAR) macosx/TeleGPS.app/Contents/Resources/Java/telegps.jar cp -p libaltos.dylib macosx/TeleGPS.app/Contents/Resources/Java cp -p $(ALTOSLIB_CLASS) macosx/TeleGPS.app/Contents/Resources/Java diff --git a/telegps/altusmetrum-telegps.desktop.in b/telegps/altusmetrum-telegps.desktop.in index 76c1eb42..7a1b3536 100644 --- a/telegps/altusmetrum-telegps.desktop.in +++ b/telegps/altusmetrum-telegps.desktop.in @@ -3,7 +3,7 @@ Type=Application Name=TeleGPS GenericName=TeleGPS monitor, download and analysis Comment=View and log data from TeleGPS tracking devices -Icon=%icondir%/telegps.svg +Icon=%icondir%/altusmetrum-telegps.svg Exec=%bindir%/telegps %f Terminal=false MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom diff --git a/telegps/telegps-windows.nsi.in b/telegps/telegps-windows.nsi.in index 3f9648f9..603d4971 100644 --- a/telegps/telegps-windows.nsi.in +++ b/telegps/telegps-windows.nsi.in @@ -4,12 +4,14 @@ !include java.nsh !include refresh-sh.nsh -!define REG_NAME "TeleGPS" -!define PROG_ID "org.altusmetrum.telegps.1" -!define PROG_ALTOSUI "org.altusmetrum.altosui.1" -!define FAT_NAME "telegps-fat.jar" -!define ICO_ICO "telegps.ico" -!define ICO_EXE "telegps.exe" +!define REG_NAME "TeleGPS" +!define PROG_ID_TELEM "altusmetrum.telegps.telem.1" +!define PROG_ID_EEPROM "altusmetrum.telegps.eeprom.1" +!define FAT_NAME "telegps-fat.jar" +!define WIN_APP_ICON "altusmetrum-telegps.ico" +!define WIN_APP_EXE "altusmetrum-telegps.exe" +!define WIN_TELEM_EXE "application-vnd.altusmetrum.telemetry.exe" +!define WIN_EEPROM_EXE "application-vnd.altusmetrum.eeprom.exe" Name "${REG_NAME} Installer" @@ -104,13 +106,13 @@ Section "${REG_NAME} Application" File "*.dll" - File "../icon/${ICO_ICO}" + File "../icon/${WIN_APP_ICON}" - CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}" + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "${REG_NAME} Desktop Shortcut" - CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "TeleGPS, TeleDongle and TeleBT Firmware" @@ -134,35 +136,51 @@ SectionEnd Section "File Associations" + ${DisableX64FSRedirection} + SetOutPath $INSTDIR - File "../icon/${ICO_EXE}" + File "../icon/${WIN_APP_EXE}" + File "../icon/${WIN_TELEM_EXE}" + File "../icon/${WIN_EEPROM_EXE}" - ; application elements - - WriteRegStr HKCR "${PROG_ID}" "" "Altus Metrum Data File" - WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "Altus Metrum Data File" - WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}" - WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101' - WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + DeleteRegKey HKCR "${PROG_ID_TELEM}" + DeleteRegKey HKCR "${PROG_ID_EEPROM}" + + DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}" + DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" + DeleteRegKey HKCR ".telem\${PROG_ID_EEPROM}" + DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_EEPROM}" ; .eeprom elements - WriteRegStr HKCR ".eeprom" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR "${PROG_ID_EEPROM}" "" "Altus Metrum Log File" + WriteRegStr HKCR "${PROG_ID_EEPROM}" "FriendlyTypeName" "Altus Metrum Log File" + WriteRegStr HKCR "${PROG_ID_EEPROM}\CurVer" "" "${PROG_ID_EEPROM}" + WriteRegStr HKCR "${PROG_ID_EEPROM}\DefaultIcon" "" '"$INSTDIR\${WIN_EEPROM_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + WriteRegStr HKCR ".eeprom" "" "${PROG_ID_EEPROM}" WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File" - WriteRegStr HKCR ".eeprom" "Content Type" "application/altosui" + WriteRegStr HKCR ".eeprom" "Content Type" "application/vnd.altusmetrum.eeprom" - WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" "" - WriteRegStr HKCR ".eeprom\${PROG_ID}" "" "${REG_NAME}" + WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" "" + WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}" "" "${REG_NAME}" ; .telem elements - WriteRegStr HKCR ".telem" "" "${PROG_ALTOSUI}" + WriteRegStr HKCR "${PROG_ID_TELEM}" "" "Altus Metrum Telemetry File" + WriteRegStr HKCR "${PROG_ID_TELEM}" "FriendlyTypeName" "Altus Metrum Telemetry File" + WriteRegStr HKCR "${PROG_ID_TELEM}\CurVer" "" "${PROG_ID_TELEM}" + WriteRegStr HKCR "${PROG_ID_TELEM}\DefaultIcon" "" '"$INSTDIR\${WIN_TELEM_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + WriteRegStr HKCR ".telem" "" "${PROG_ID_TELEM}" WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File" - WriteRegStr HKCR ".telem" "Content Type" "application/altosui" + WriteRegStr HKCR ".telem" "Content Type" "application/vnd.altusmetrum.telemetry" - WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID}" "" - WriteRegStr HKCR ".telem\${PROG_ID}" "" "${REG_NAME}" + WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" "" + WriteRegStr HKCR ".telem\${PROG_ID_TELEM}" "" "${REG_NAME}" Call RefreshShellIcons SectionEnd @@ -195,21 +213,22 @@ Section "Uninstall" DetailPrint "Delete uninstall reg entries" - DeleteRegKey HKCR "${PROG_ID}" + DeleteRegKey HKCR "${PROG_ID_EEPROM}" + DeleteRegKey HKCR "${PROG_ID_TELEM}" - DeleteRegKey HKCR ".eeprom\${PROG_ID}" - DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" + DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}" + DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" - DeleteRegKey HKCR ".telem\${PROG_ID}" - DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID}" + DeleteRegKey HKCR ".telem\${PROG_ID_TELEM}" + DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" DetailPrint "Delete file association reg entries" Delete "$INSTDIR\${FAT_NAME}" Delete "$INSTDIR\uninstall-${REG_NAME}.exe" - Delete "$INSTDIR\${ICO_ICO}" - Delete "$INSTDIR\${ICO_EXE}" + Delete "$INSTDIR\${WIN_APP_ICON}" + Delete "$INSTDIR\${WIN_APP_EXE}" ; Remove shortcuts, if any Delete "$SMPROGRAMS\${REG_NAME}.lnk" -- cgit v1.2.3 From 3016ee5f21ec66bf9230b90ab1420b8fad628f8d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Jun 2014 00:40:10 -0700 Subject: altosuilib: Wrap radio frequency menu in JMenuBar when used in config The device config dialogs place the radio frequency menu inside a dialog box; it needs to be inside a MenuBar to work properly, so create one to hold it. Signed-off-by: Keith Packard --- altosui/AltosConfigUI.java | 5 ++++- telegps/TeleGPSConfigUI.java | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 4a33b64f..a4e7aca6 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -419,7 +419,10 @@ public class AltosConfigUI c.ipady = 5; radio_frequency_value = new AltosFreqList(); radio_frequency_value.addItemListener(this); - pane.add(radio_frequency_value, c); + + JMenuBar menu_bar = new JMenuBar(); + menu_bar.add(radio_frequency_value); + pane.add(menu_bar, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index 7d28b371..dfbff12d 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -257,7 +257,11 @@ public class TeleGPSConfigUI c.ipady = 5; radio_frequency_value = new AltosFreqList(); radio_frequency_value.addItemListener(this); - pane.add(radio_frequency_value, c); + + JMenuBar menu_bar = new JMenuBar(); + menu_bar.add(radio_frequency_value); + + pane.add(menu_bar, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; -- cgit v1.2.3 From 602d6a2424a5c16e22febf6b4e6b3816022261c7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Jun 2014 00:41:17 -0700 Subject: altos/aprs: Encode last serial number in SSID. Transmit serial in comment This makes it a lot easier to tell which device is sending information, and to receive data from multiple devices on the same receiver. Signed-off-by: Keith Packard --- src/drivers/ao_aprs.c | 4 ++++ src/test/ao_aprs_test.c | 24 ------------------------ telegps/Makefile.am | 2 -- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/drivers/ao_aprs.c b/src/drivers/ao_aprs.c index 8a1b6a4d..c33016f0 100644 --- a/src/drivers/ao_aprs.c +++ b/src/drivers/ao_aprs.c @@ -261,6 +261,7 @@ static uint8_t TNC_AX25_HEADER[] = { #define TNC_CALLSIGN_OFF 7 #define TNC_CALLSIGN_LEN 6 +#define TNC_SSID_OFF 13 static void tncSetCallsign(void) @@ -275,6 +276,7 @@ tncSetCallsign(void) } for (; i < TNC_CALLSIGN_LEN; i++) TNC_AX25_HEADER[TNC_CALLSIGN_OFF + i] = ' ' << 1; + TNC_AX25_HEADER[TNC_SSID_OFF] = 0x60 | ((ao_serial_number % 10) << 1); #endif } @@ -530,6 +532,7 @@ static int tncComment(uint8_t *buf) #ifdef AO_SENSE_MAIN " M%d.%d" #endif + " %d" , ao_gps_locked(), ao_num_sats(), battery/10, @@ -542,6 +545,7 @@ static int tncComment(uint8_t *buf) , main/10, main%10 #endif + , ao_serial_number ); #else return sprintf((char *) buf, diff --git a/src/test/ao_aprs_test.c b/src/test/ao_aprs_test.c index 86cf527a..573b5cb2 100644 --- a/src/test/ao_aprs_test.c +++ b/src/test/ao_aprs_test.c @@ -97,36 +97,12 @@ audio_gap(int secs) #endif } -#include - -int -ao_aprs_encode_altitude_expensive(int meters) -{ - double feet = meters / 0.3048; - - double encode = log(feet) / log(1.002); - return floor(encode + 0.5); -} - // This is where we go after reset. int main(int argc, char **argv) { int e, x; int a; - for (a = 1; a < 100000; a++) { - e = ao_aprs_encode_altitude(a); - x = ao_aprs_encode_altitude_expensive(a); - - if (e != x) { - double back_feet, back_meters; - back_feet = pow(1.002, e); - back_meters = back_feet * 0.3048; - fprintf (stderr, "APRS altitude encoding failure: altitude %d actual %d expected %d actual meters %f\n", - a, e, x, back_meters); - } - } - audio_gap(1); ao_gps_data.latitude = (45.0 + 28.25 / 60.0) * 10000000; diff --git a/telegps/Makefile.am b/telegps/Makefile.am index a7defb8a..3f53b949 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -205,8 +205,6 @@ $(FATJAR): classtelegps.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_CL -C classes org \ -C ../libaltos libaltosJNI -classtelegps.stamp: $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) - libaltos.so: build-libaltos -rm -f "$@" $(LN_S) ../libaltos/.libs/"$@" . -- cgit v1.2.3 From ca1c62ca3ea016a1a5baa4520e484c102280c3e3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 21 Jun 2014 18:27:42 -0700 Subject: altosui: Add Ignitor tab to Monitor Idle mode Oops; missed adding this when I included it in the Monitor Flight window. Signed-off-by: Keith Packard --- altosui/AltosIdleMonitorUI.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index dd69b6f1..63d86291 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -33,9 +33,11 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl AltosPad pad; AltosInfoTable flightInfo; AltosFlightStatus flightStatus; + AltosIgnitor ignitor; AltosIdleMonitor thread; int serial; boolean remote; + boolean has_ignitor; void stop_display() { if (thread != null) { @@ -70,10 +72,22 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl public void show(AltosState state, AltosListenerState listener_state) { status_update.saved_state = state; + if (ignitor.should_show(state)) { + if (!has_ignitor) { + pane.add("Ignitor", ignitor); + has_ignitor = true; + } + } else { + if (has_ignitor) { + pane.remove(ignitor); + has_ignitor = false; + } + } // try { pad.show(state, listener_state); flightStatus.show(state, listener_state); flightInfo.show(state, listener_state); + ignitor.show(state, listener_state); // } catch (Exception e) { // System.out.print("Show exception " + e); // } @@ -222,6 +236,8 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl flightInfo = new AltosInfoTable(); pane.add("Table", new JScrollPane(flightInfo)); + ignitor = new AltosIgnitor(); + /* Make the tabbed pane use the rest of the window space */ bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH)); -- cgit v1.2.3 From 3f3382126bf1122b1a78abe8458af5ec112a1f95 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Jun 2014 21:05:05 -0700 Subject: altos: Make APRS SSID configurable This uses the low-digit from the serial number by default, but lets the user change it if desired. Signed-off-by: Keith Packard --- src/drivers/ao_aprs.c | 100 ++++++++++++++++++++++++++----------------------- src/kernel/ao_config.c | 34 +++++++++++++++++ src/kernel/ao_config.h | 5 ++- 3 files changed, 91 insertions(+), 48 deletions(-) diff --git a/src/drivers/ao_aprs.c b/src/drivers/ao_aprs.c index c33016f0..a9047149 100644 --- a/src/drivers/ao_aprs.c +++ b/src/drivers/ao_aprs.c @@ -1,11 +1,11 @@ -/** +/** * http://ad7zj.net/kd7lmo/aprsbeacon_code.html * * @mainpage Pico Beacon * * @section overview_sec Overview * - * The Pico Beacon is an APRS based tracking beacon that operates in the UHF 420-450MHz band. The device utilizes a + * The Pico Beacon is an APRS based tracking beacon that operates in the UHF 420-450MHz band. The device utilizes a * Microchip PIC 18F2525 embedded controller, Motorola M12+ GPS engine, and Analog Devices AD9954 DDS. The device is capable * of generating a 1200bps A-FSK and 9600 bps FSK AX.25 compliant APRS (Automatic Position Reporting System) message. @@ -24,7 +24,7 @@ * (4) corrected size of LOG_COORD block when searching for end of log. * * @subsection v303 V3.03 - * 15 Sep 2005, Change include; (1) removed AD9954 setting SDIO as input pin, + * 15 Sep 2005, Change include; (1) removed AD9954 setting SDIO as input pin, * (2) additional comments and Doxygen tags, * (3) integration and test code calculates DDS FTW, * (4) swapped bus and reference analog input ports (hardware change), @@ -38,7 +38,7 @@ * (2) Doxygen documentation clean up and additions, and * (3) added integration and test code to baseline. * - * + * * @subsection v301 V3.01 * 13 Jan 2005, Renamed project and files to Pico Beacon. * @@ -54,28 +54,28 @@ * (8) added flight data recorder, and * (9) added diagnostics terminal mode. * - * + * * @subsection v201 V2.01 - * 30 Jan 2004, Change include; (1) General clean up of in-line documentation, and + * 30 Jan 2004, Change include; (1) General clean up of in-line documentation, and * (2) changed temperature resolution to 0.1 degrees F. * - * + * * @subsection v200 V2.00 * 26 Oct 2002, Change include; (1) Micro Beacon II hardware changes including PIC18F252 processor, - * (2) serial EEPROM, - * (3) GPS power control, - * (4) additional ADC input, and - * (5) LM60 temperature sensor. + * (2) serial EEPROM, + * (3) GPS power control, + * (4) additional ADC input, and + * (5) LM60 temperature sensor. * * * @subsection v101 V1.01 - * 5 Dec 2001, Change include; (1) Changed startup message, and + * 5 Dec 2001, Change include; (1) Changed startup message, and * (2) applied SEPARATE pragma to several methods for memory usage. * * * @subsection v100 V1.00 * 25 Sep 2001, Initial release. Flew ANSR-3 and ANSR-4. - * + * * @@ -102,11 +102,11 @@ * 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 - * + * - * - * + * + * * @section design Design Details * * Provides design details on a variety of the components that make up the Pico Beacon. @@ -118,29 +118,33 @@ * @page power Power Consumption * * Measured DC power consumption. - * - * 3VDC prime power current + * + * 3VDC prime power current * - * 7mA Held in reset + * 7mA Held in reset - * 18mA Processor running, all I/O off + * 18mA Processor running, all I/O off - * 110mA GPS running + * 110mA GPS running - * 120mA GPS running w/antenna + * 120mA GPS running w/antenna - * 250mA DDS running and GPS w/antenna + * 250mA DDS running and GPS w/antenna - * 420mA DDS running, GPS w/antenna, and PA chain on with no RF + * 420mA DDS running, GPS w/antenna, and PA chain on with no RF - * 900mA Transmit + * 900mA Transmit * */ #ifndef AO_APRS_TEST #include + +#if !HAS_APRS +#error HAS_APRS not set +#endif #endif #include @@ -176,11 +180,11 @@ static uint16_t sysCRC16(const uint8_t *buffer, uint8_t length, uint16_t crc) { uint8_t i, bit, value; - for (i = 0; i < length; ++i) + for (i = 0; i < length; ++i) { value = buffer[i]; - for (bit = 0; bit < 8; ++bit) + for (bit = 0; bit < 8; ++bit) { crc ^= (value & 0x01); crc = ( crc & 0x01 ) ? ( crc >> 1 ) ^ 0x8408 : ( crc >> 1 ); @@ -253,7 +257,7 @@ typedef enum /// AX.25 compliant packet header that contains destination, station call sign, and path. /// 0x76 for SSID-11, 0x78 for SSID-12 -static uint8_t TNC_AX25_HEADER[] = { +static uint8_t TNC_AX25_HEADER[] = { 'A' << 1, 'P' << 1, 'A' << 1, 'M' << 1, ' ' << 1, ' ' << 1, 0x60, 'N' << 1, '0' << 1, 'C' << 1, 'A' << 1, 'L' << 1, 'L' << 1, 0x78, 'W' << 1, 'I' << 1, 'D' << 1, 'E' << 1, '2' << 1, ' ' << 1, 0x65, @@ -276,7 +280,9 @@ tncSetCallsign(void) } for (; i < TNC_CALLSIGN_LEN; i++) TNC_AX25_HEADER[TNC_CALLSIGN_OFF + i] = ' ' << 1; - TNC_AX25_HEADER[TNC_SSID_OFF] = 0x60 | ((ao_serial_number % 10) << 1); + + /* Fill in the SSID with the low digit of the serial number */ + TNC_AX25_HEADER[TNC_SSID_OFF] = 0x60 | ((ao_config.aprs_ssid & 0xf) << 1); #endif } @@ -304,7 +310,7 @@ static uint8_t tncBitStuff; /// Buffer to hold the message portion of the AX.25 packet as we prepare it. static uint8_t tncBuffer[TNC_BUFFER_SIZE]; -/** +/** * Initialize the TNC internal variables. */ static void tncInit() @@ -325,7 +331,7 @@ static void tnc1200TimerTick() else timeNCOFreq = 0x3aab; - switch (tncMode) + switch (tncMode) { case TNC_TX_READY: // Generate a test signal alteranting between high and low tones. @@ -341,16 +347,16 @@ static void tnc1200TimerTick() else tncTxBit = 0; } - + // When the flag is done, determine if we need to send more or data. - if (++tncBitCount == 8) + if (++tncBitCount == 8) { tncBitCount = 0; tncShift = 0x7e; // Once we transmit x mS of flags, send the data. // txDelay bytes * 8 bits/byte * 833uS/bit = x mS - if (++tncIndex == TNC_TX_DELAY) + if (++tncIndex == TNC_TX_DELAY) { tncIndex = 0; tncShift = TNC_AX25_HEADER[0]; @@ -363,7 +369,7 @@ static void tnc1200TimerTick() case TNC_TX_HEADER: // Determine if we have sent 5 ones in a row, if we have send a zero. - if (tncBitStuff == 0x1f) + if (tncBitStuff == 0x1f) { if (tncTxBit == 0) tncTxBit = 1; @@ -383,17 +389,17 @@ static void tnc1200TimerTick() tncTxBit = 0; } - // Save the data stream so we can determine if bit stuffing is + // Save the data stream so we can determine if bit stuffing is // required on the next bit time. tncBitStuff = ((tncBitStuff << 1) | (tncShift & 0x01)) & 0x1f; // If all the bits were shifted, get the next byte. - if (++tncBitCount == 8) + if (++tncBitCount == 8) { tncBitCount = 0; // After the header is sent, then send the data. - if (++tncIndex == sizeof(TNC_AX25_HEADER)) + if (++tncIndex == sizeof(TNC_AX25_HEADER)) { tncIndex = 0; tncShift = tncBuffer[0]; @@ -408,7 +414,7 @@ static void tnc1200TimerTick() case TNC_TX_DATA: // Determine if we have sent 5 ones in a row, if we have send a zero. - if (tncBitStuff == 0x1f) + if (tncBitStuff == 0x1f) { if (tncTxBit == 0) tncTxBit = 1; @@ -428,17 +434,17 @@ static void tnc1200TimerTick() tncTxBit = 0; } - // Save the data stream so we can determine if bit stuffing is + // Save the data stream so we can determine if bit stuffing is // required on the next bit time. tncBitStuff = ((tncBitStuff << 1) | (tncShift & 0x01)) & 0x1f; // If all the bits were shifted, get the next byte. - if (++tncBitCount == 8) + if (++tncBitCount == 8) { tncBitCount = 0; // If everything was sent, transmit closing flags. - if (++tncIndex == tncLength) + if (++tncIndex == tncLength) { tncIndex = 0; tncShift = 0x7e; @@ -453,7 +459,7 @@ static void tnc1200TimerTick() case TNC_TX_END: // The variable tncShift contains the lastest data byte. - // NRZI enocde the data stream. + // NRZI enocde the data stream. if ((tncShift & 0x01) == 0x00) { if (tncTxBit == 0) tncTxBit = 1; @@ -462,13 +468,13 @@ static void tnc1200TimerTick() } // If all the bits were shifted, get the next one. - if (++tncBitCount == 8) + if (++tncBitCount == 8) { tncBitCount = 0; tncShift = 0x7e; - + // Transmit two closing flags. - if (++tncIndex == 2) + if (++tncIndex == 2) { tncMode = TNC_TX_READY; @@ -763,7 +769,7 @@ tncFill(uint8_t *buf, int16_t len) return l; } -/** +/** * Prepare an AX.25 data packet. Each time this method is called, it automatically * rotates through 1 of 3 messages. * diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 71445335..58fa7354 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -61,6 +61,7 @@ __xdata uint8_t ao_config_mutex; #define AO_CONFIG_DEFAULT_RADIO_POWER 0x60 #endif #define AO_CONFIG_DEFAULT_RADIO_AMP 0 +#define AO_CONFIG_DEFAULT_APRS_SSID (ao_serial_number % 10) #if HAS_EEPROM static void @@ -191,6 +192,10 @@ _ao_config_get(void) #if AO_PYRO_NUM if (minor < 18) ao_config.pyro_time = AO_CONFIG_DEFAULT_PYRO_TIME; +#endif +#if HAS_APRS + if (minor < 19) + ao_config.aprs_ssid = AO_CONFIG_DEFAULT_APRS_SSID; #endif ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; @@ -283,6 +288,7 @@ ao_config_frequency_set(void) __reentrant ao_radio_recv_abort(); #endif } + #endif #if HAS_FLIGHT @@ -737,6 +743,30 @@ ao_config_pyro_time_set(void) } #endif +#if HAS_APRS +void +ao_config_aprs_ssid_show(void) +{ + printf ("APRS SSID: %d\n", + ao_config.aprs_ssid); +} + +void +ao_config_aprs_ssid_set(void) +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + if (15 < ao_cmd_lex_i) { + ao_cmd_status = ao_cmd_lex_error; + return; + } + _ao_config_edit_start(); + ao_config.aprs_ssid = ao_cmd_lex_i; + _ao_config_edit_finish(); +} +#endif /* HAS_APRS */ + struct ao_config_var { __code char *str; void (*set)(void) __reentrant; @@ -816,6 +846,10 @@ __code struct ao_config_var ao_config_vars[] = { #if HAS_TRACKER { "t \0Tracker configuration", ao_config_tracker_set, ao_config_tracker_show }, +#endif +#if HAS_APRS + { "S \0Set APRS SSID (0-15)", + ao_config_aprs_ssid_set, ao_config_aprs_ssid_show }, #endif { "s\0Show", ao_config_show, 0 }, diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h index 2b5cd352..70f9f33b 100644 --- a/src/kernel/ao_config.h +++ b/src/kernel/ao_config.h @@ -53,7 +53,7 @@ #endif #define AO_CONFIG_MAJOR 1 -#define AO_CONFIG_MINOR 18 +#define AO_CONFIG_MINOR 19 #define AO_AES_LEN 16 @@ -102,6 +102,9 @@ struct ao_config { #if AO_PYRO_NUM uint16_t pyro_time; /* minor version 18 */ #endif +#if HAS_APRS + uint8_t aprs_ssid; /* minor version 19 */ +#endif }; #define AO_IGNITE_MODE_DUAL 0 -- cgit v1.2.3 From 6cc2d671c0e335fbedb0e97699f8f273502c6807 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Jun 2014 21:06:24 -0700 Subject: altosui/telegps: Expose configurable APRS SSID Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 8 +++++++ altoslib/AltosConfigValues.java | 4 ++++ altosui/AltosConfigUI.java | 53 +++++++++++++++++++++++++++++++++++++++++ telegps/TeleGPSConfigUI.java | 53 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+) diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index d8b0b081..3bf8ea43 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -71,6 +71,7 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ public int aprs_interval; + public int aprs_ssid; /* HAS_BEEP */ public int beep; @@ -250,6 +251,7 @@ public class AltosConfigData implements Iterable { pyro_firing_time = -1; aprs_interval = -1; + aprs_ssid = -1; beep = -1; @@ -333,6 +335,7 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ try { aprs_interval = get_int(line, "APRS interval:"); } catch (Exception e) {} + try { aprs_ssid = get_int(line, "APRS SSID:"); } catch (Exception e) {} /* HAS_BEEP */ try { beep = get_int(line, "Beeper setting:"); } catch (Exception e) {} @@ -459,6 +462,8 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ if (aprs_interval >= 0) aprs_interval = source.aprs_interval(); + if (aprs_ssid >= 0) + aprs_ssid = source.aprs_ssid(); /* HAS_BEEP */ if (beep >= 0) @@ -507,6 +512,7 @@ public class AltosConfigData implements Iterable { dest.set_pyros(null); dest.set_pyro_firing_time(pyro_firing_time); dest.set_aprs_interval(aprs_interval); + dest.set_aprs_ssid(aprs_ssid); dest.set_beep(beep); dest.set_tracker_motion(tracker_motion); dest.set_tracker_interval(tracker_interval); @@ -577,6 +583,8 @@ public class AltosConfigData implements Iterable { /* HAS_APRS */ if (aprs_interval >= 0) link.printf("c A %d\n", aprs_interval); + if (aprs_ssid >= 0) + link.printf("c S %d\n", aprs_ssid); /* HAS_BEEP */ if (beep >= 0) diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index dcb4d48f..b0c49e98 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -81,6 +81,10 @@ public interface AltosConfigValues { public abstract void set_aprs_interval(int new_aprs_interval); + public abstract int aprs_ssid() throws AltosConfigDataException; + + public abstract void set_aprs_ssid(int new_aprs_ssid); + public abstract int beep() throws AltosConfigDataException; public abstract void set_beep(int new_beep); diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index a4e7aca6..6e1b47c2 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -41,6 +41,7 @@ public class AltosConfigUI JLabel radio_frequency_label; JLabel radio_enable_label; JLabel aprs_interval_label; + JLabel aprs_ssid_label; JLabel flight_log_max_label; JLabel ignite_mode_label; JLabel pad_orientation_label; @@ -62,6 +63,7 @@ public class AltosConfigUI JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; + JComboBox aprs_ssid_value; JComboBox flight_log_max_value; JComboBox ignite_mode_value; JComboBox pad_orientation_value; @@ -113,6 +115,10 @@ public class AltosConfigUI "10" }; + static Integer[] aprs_ssid_values = { + 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + }; + static String[] beep_values = { "3750", "4000", @@ -201,6 +207,15 @@ public class AltosConfigUI aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); } + void set_aprs_ssid_tool_tip() { + if (aprs_ssid_value.isEnabled()) + aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)"); + else if (aprs_interval_value.isEnabled()) + aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID"); + else + aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); + } + void set_flight_log_max_tool_tip() { if (flight_log_max_value.isEnabled()) flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)"); @@ -504,6 +519,33 @@ public class AltosConfigUI set_aprs_interval_tool_tip(); row++; + /* APRS SSID */ + 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; + aprs_ssid_label = new JLabel("APRS SSID:"); + pane.add(aprs_ssid_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; + aprs_ssid_value = new JComboBox(aprs_ssid_values); + aprs_ssid_value.setEditable(false); + aprs_ssid_value.addItemListener(this); + aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length); + pane.add(aprs_ssid_value, c); + set_aprs_ssid_tool_tip(); + row++; + /* Callsign */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -1180,4 +1222,15 @@ public class AltosConfigUI return 0; return parse_int("aprs interval", s, false); } + + public void set_aprs_ssid(int new_aprs_ssid) { + aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid)); + aprs_ssid_value.setVisible(new_aprs_ssid >= 0); + set_aprs_ssid_tool_tip(); + } + + public int aprs_ssid() throws AltosConfigDataException { + Integer i = (Integer) aprs_ssid_value.getSelectedItem(); + return i; + } } diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index dfbff12d..1fdfd70c 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -38,6 +38,7 @@ public class TeleGPSConfigUI JLabel radio_frequency_label; JLabel radio_enable_label; JLabel aprs_interval_label; + JLabel aprs_ssid_label; JLabel flight_log_max_label; JLabel callsign_label; JLabel tracker_motion_label; @@ -53,6 +54,7 @@ public class TeleGPSConfigUI JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; + JComboBox aprs_ssid_value; JComboBox flight_log_max_value; JTextField callsign_value; JComboBox tracker_motion_value; @@ -72,6 +74,10 @@ public class TeleGPSConfigUI "10" }; + static Integer[] aprs_ssid_values = { + 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + }; + static String[] tracker_motion_values_m = { "2", "5", @@ -148,6 +154,15 @@ public class TeleGPSConfigUI aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); } + void set_aprs_ssid_tool_tip() { + if (aprs_ssid_value.isEnabled()) + aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)"); + else if (aprs_interval_value.isEnabled()) + aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID"); + else + aprs_interval_value.setToolTipText("Hardware doesn't support APRS"); + } + void set_flight_log_max_tool_tip() { if (flight_log_max_value.isEnabled()) flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)"); @@ -341,6 +356,33 @@ public class TeleGPSConfigUI set_aprs_interval_tool_tip(); row++; + /* APRS SSID */ + 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; + aprs_ssid_label = new JLabel("APRS SSID:"); + pane.add(aprs_ssid_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; + aprs_ssid_value = new JComboBox(aprs_ssid_values); + aprs_ssid_value.setEditable(false); + aprs_ssid_value.addItemListener(this); + aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length); + pane.add(aprs_ssid_value, c); + set_aprs_ssid_tool_tip(); + row++; + /* Callsign */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -786,4 +828,15 @@ public class TeleGPSConfigUI return 0; return parse_int("aprs interval", s, false); } + + public void set_aprs_ssid(int new_aprs_ssid) { + aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid)); + aprs_ssid_value.setVisible(new_aprs_ssid >= 0); + set_aprs_ssid_tool_tip(); + } + + public int aprs_ssid() throws AltosConfigDataException { + Integer i = (Integer) aprs_ssid_value.getSelectedItem(); + return i; + } } -- cgit v1.2.3 From fc3364de2b6cdfff53f5c38b3ae52ae5601ff3b7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Jun 2014 21:12:37 -0700 Subject: ao-tools: Add ao-test-baro, ao-test-igniter and ao-test-flash C versions of the test programs used to validate hardware prior to ship Signed-off-by: Keith Packard --- ao-tools/Makefile.am | 3 +- ao-tools/ao-test-baro/.gitignore | 1 + ao-tools/ao-test-baro/Makefile.am | 11 ++ ao-tools/ao-test-baro/ao-test-baro.1 | 56 +++++++ ao-tools/ao-test-baro/ao-test-baro.c | 238 ++++++++++++++++++++++++++++ ao-tools/ao-test-flash/.gitignore | 1 + ao-tools/ao-test-flash/Makefile.am | 11 ++ ao-tools/ao-test-flash/ao-test-flash.1 | 59 +++++++ ao-tools/ao-test-flash/ao-test-flash.c | 245 +++++++++++++++++++++++++++++ ao-tools/ao-test-igniter/.gitignore | 1 + ao-tools/ao-test-igniter/Makefile.am | 11 ++ ao-tools/ao-test-igniter/ao-test-igniter.1 | 59 +++++++ ao-tools/ao-test-igniter/ao-test-igniter.c | 223 ++++++++++++++++++++++++++ configure.ac | 3 + 14 files changed, 921 insertions(+), 1 deletion(-) create mode 100644 ao-tools/ao-test-baro/.gitignore create mode 100644 ao-tools/ao-test-baro/Makefile.am create mode 100644 ao-tools/ao-test-baro/ao-test-baro.1 create mode 100644 ao-tools/ao-test-baro/ao-test-baro.c create mode 100644 ao-tools/ao-test-flash/.gitignore create mode 100644 ao-tools/ao-test-flash/Makefile.am create mode 100644 ao-tools/ao-test-flash/ao-test-flash.1 create mode 100644 ao-tools/ao-test-flash/ao-test-flash.c create mode 100644 ao-tools/ao-test-igniter/.gitignore create mode 100644 ao-tools/ao-test-igniter/Makefile.am create mode 100644 ao-tools/ao-test-igniter/ao-test-igniter.1 create mode 100644 ao-tools/ao-test-igniter/ao-test-igniter.c diff --git a/ao-tools/Makefile.am b/ao-tools/Makefile.am index a42988d6..4526f514 100644 --- a/ao-tools/Makefile.am +++ b/ao-tools/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS=lib ao-rawload ao-dbg ao-bitbang ao-eeprom ao-list \ ao-load ao-telem ao-send-telem ao-sky-flash \ ao-dumpflash ao-edit-telem ao-dump-up ao-elftohex \ - ao-flash ao-usbload + ao-flash ao-usbload ao-test-igniter ao-test-baro \ + ao-test-flash if LIBSTLINK SUBDIRS += ao-stmload endif diff --git a/ao-tools/ao-test-baro/.gitignore b/ao-tools/ao-test-baro/.gitignore new file mode 100644 index 00000000..f5fb64d4 --- /dev/null +++ b/ao-tools/ao-test-baro/.gitignore @@ -0,0 +1 @@ +ao-test-baro diff --git a/ao-tools/ao-test-baro/Makefile.am b/ao-tools/ao-test-baro/Makefile.am new file mode 100644 index 00000000..69e47529 --- /dev/null +++ b/ao-tools/ao-test-baro/Makefile.am @@ -0,0 +1,11 @@ +bin_PROGRAMS=ao-test-baro + +AM_CFLAGS=-I$(top_srcdir)/ao-tools/lib $(LIBUSB_CFLAGS) + +ao_test_baro_DEPENDENCIES = $(top_builddir)/ao-tools/lib/libao-tools.a + +ao_test_baro_LDADD=$(top_builddir)/ao-tools/lib/libao-tools.a $(LIBUSB_LIBS) + +ao_test_baro_SOURCES=ao-test-baro.c + +man_MANS = ao-test-baro.1 diff --git a/ao-tools/ao-test-baro/ao-test-baro.1 b/ao-tools/ao-test-baro/ao-test-baro.1 new file mode 100644 index 00000000..0004dba8 --- /dev/null +++ b/ao-tools/ao-test-baro/ao-test-baro.1 @@ -0,0 +1,56 @@ +.\" +.\" Copyright © 2009 Keith Packard +.\" +.\" 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. +.\" +.\" +.TH AO-LOAD 1 "ao-test-baro" "" +.SH NAME +ao-test-baro \- test AltOS flight computer barometric sensor +.SH SYNOPSIS +.B "ao-test-baro" +[\-T \fItty-device\fP] +[\--tty \fItty-device\fP] +[\-D \fIaltos-device\fP] +[\--device \fIaltos-device\fP] +\fIbaro-name...\fP +.SH DESCRIPTION +.I ao-test-baro +makes sure the altitude is between -50m and 3000m and temperature is +between 20°C and 30°C. +.SH OPTIONS +.TP +\-T tty-device | --tty tty-device +This selects which tty device the debugger uses to communicate with +the target device. +.TP +\-D AltOS-device | --device AltOS-device +Search for a connected device. This requires an argument of one of the +following forms: +.IP +TeleMega:2 +.br +TeleMega +.br +2 +.IP +Leaving out the product name will cause the tool to select a suitable +product, leaving out the serial number will cause the tool to match +one of the available devices. +.SH USAGE +.I ao-test-baro +opens the target device and queries the current barometric data. +.SH AUTHOR +Keith Packard diff --git a/ao-tools/ao-test-baro/ao-test-baro.c b/ao-tools/ao-test-baro/ao-test-baro.c new file mode 100644 index 00000000..e883de4a --- /dev/null +++ b/ao-tools/ao-test-baro/ao-test-baro.c @@ -0,0 +1,238 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ao-elf.h" +#include "ccdbg.h" +#include "cc-usb.h" +#include "cc.h" +#include "ao-verbose.h" + +static const struct option options[] = { + { .name = "tty", .has_arg = 1, .val = 'T' }, + { .name = "device", .has_arg = 1, .val = 'D' }, + { .name = "raw", .has_arg = 0, .val = 'r' }, + { .name = "verbose", .has_arg = 1, .val = 'v' }, + { 0, 0, 0, 0}, +}; + +static void usage(char *program) +{ + fprintf(stderr, "usage: %s [--verbose=] [--device=] [-tty=] main|drogue\n", program); + exit(1); +} + +void +done(struct cc_usb *cc, int code) +{ +/* cc_usb_printf(cc, "a\n"); */ + cc_usb_close(cc); + exit (code); +} + +static int +ends_with(char *whole, char *suffix) +{ + int whole_len = strlen(whole); + int suffix_len = strlen(suffix); + + if (suffix_len > whole_len) + return 0; + return strcmp(whole + whole_len - suffix_len, suffix) == 0; +} + +static int +starts_with(char *whole, char *prefix) +{ + int whole_len = strlen(whole); + int prefix_len = strlen(prefix); + + if (prefix_len > whole_len) + return 0; + return strncmp(whole, prefix, prefix_len) == 0; +} + +static char ** +tok(char *line) { + char **strs = malloc (sizeof (char *)), *str; + int n = 0; + + while ((str = strtok(line, " \t"))) { + line = NULL; + strs = realloc(strs, (n + 2) * sizeof (char *)); + strs[n] = strdup(str); + n++; + } + strs[n] = '\0'; + return strs; +} + +static void +free_strs(char **strs) { + char *str; + int i; + + for (i = 0; (str = strs[i]) != NULL; i++) + free(str); + free(strs); +} + +struct baro { + struct baro *next; + char **strs; +}; + +static struct baro * +baro(struct cc_usb *usb) +{ + struct baro *head = NULL, **tail = &head; + cc_usb_printf(usb, "B\n"); + for (;;) { + char line[512]; + struct baro *b; + + cc_usb_getline(usb, line, sizeof (line)); + b = malloc (sizeof (struct baro)); + b->strs = tok(line); + b->next = NULL; + *tail = b; + tail = &b->next; + if (strstr(line, "Altitude:")) + break; + } + return head; +} + +static void +free_baro(struct baro *b) { + struct baro *n; + + while (b) { + n = b->next; + free_strs(b->strs); + free(b); + b = n; + } +} + +char ** +find_baro(struct baro *b, char *word0) { + int i; + for (;b; b = b->next) + if (b->strs[0] && !strcmp(b->strs[0], word0)) + return b->strs; + return NULL; +} + +int +do_baro(struct cc_usb *usb) { + struct baro *b = baro(usb); + char **temp = find_baro(b, "Temperature:"); + char **alt = find_baro(b, "Altitude:"); + + if (!temp || !alt) { + printf("no response\n"); + free_baro(b); + return 0; + } + + double temperature = strtod(temp[2], NULL) / 100.0; + double altitude = strtod(alt[1], NULL); + + if (altitude < -50 || 3000 < altitude) { + printf ("weird altitude %f\n", altitude); + free_baro(b); + return 0; + } + + if (temperature < 20 || 35 < temperature) { + printf ("weird temperature %f\n", temperature); + free_baro(b); + return 0; + } + + printf ("altitude %f temperature %f\n", altitude, temperature); + + return 1; +} + +int +main (int argc, char **argv) +{ + char *device = NULL; + char *filename; + Elf *e; + unsigned int s; + int i; + int c; + int tries; + struct cc_usb *cc = NULL; + char *tty = NULL; + int success; + int verbose = 0; + int ret = 0; + + while ((c = getopt_long(argc, argv, "rT:D:c:s:v:", options, NULL)) != -1) { + switch (c) { + case 'T': + tty = optarg; + break; + case 'D': + device = optarg; + break; + case 'v': + verbose++; + break; + default: + usage(argv[0]); + break; + } + } + + ao_verbose = verbose; + + if (verbose > 1) + ccdbg_add_debug(CC_DEBUG_BITBANG); + + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "AltosFlash"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "TeleMega"); + if (!tty) + tty = getenv("ALTOS_TTY"); + if (!tty) + tty="/dev/ttyACM0"; + + cc = cc_usb_open(tty); + + if (!cc) + exit(1); + + if (!do_baro(cc)) + ret = 1; + done(cc, ret); +} diff --git a/ao-tools/ao-test-flash/.gitignore b/ao-tools/ao-test-flash/.gitignore new file mode 100644 index 00000000..40ab1ef3 --- /dev/null +++ b/ao-tools/ao-test-flash/.gitignore @@ -0,0 +1 @@ +ao-test-flash diff --git a/ao-tools/ao-test-flash/Makefile.am b/ao-tools/ao-test-flash/Makefile.am new file mode 100644 index 00000000..0323c282 --- /dev/null +++ b/ao-tools/ao-test-flash/Makefile.am @@ -0,0 +1,11 @@ +bin_PROGRAMS=ao-test-flash + +AM_CFLAGS=-I$(top_srcdir)/ao-tools/lib $(LIBUSB_CFLAGS) + +ao_test_flash_DEPENDENCIES = $(top_builddir)/ao-tools/lib/libao-tools.a + +ao_test_flash_LDADD=$(top_builddir)/ao-tools/lib/libao-tools.a $(LIBUSB_LIBS) + +ao_test_flash_SOURCES=ao-test-flash.c + +man_MANS = ao-test-flash.1 diff --git a/ao-tools/ao-test-flash/ao-test-flash.1 b/ao-tools/ao-test-flash/ao-test-flash.1 new file mode 100644 index 00000000..155bd1bf --- /dev/null +++ b/ao-tools/ao-test-flash/ao-test-flash.1 @@ -0,0 +1,59 @@ +.\" +.\" Copyright © 2009 Keith Packard +.\" +.\" 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. +.\" +.\" +.TH AO-LOAD 1 "ao-test-igniter" "" +.SH NAME +ao-test-igniter \- test AltOS flight computer igniters +.SH SYNOPSIS +.B "ao-test-igniter" +[\-T \fItty-device\fP] +[\--tty \fItty-device\fP] +[\-D \fIaltos-device\fP] +[\--device \fIaltos-device\fP] +\fIigniter-name...\fP +.SH DESCRIPTION +.I ao-test-igniter +test the status and then fires the specified igniters on the target device +.SH OPTIONS +.TP +\-T tty-device | --tty tty-device +This selects which tty device the debugger uses to communicate with +the target device. The special name 'BITBANG' directs ao-dbg to use +the cp2103 connection, otherwise this should be a usb serial port +connected to a suitable cc1111 debug node. +.TP +\-D AltOS-device | --device AltOS-device +Search for a connected device. This requires an argument of one of the +following forms: +.IP +TeleMega:2 +.br +TeleMega +.br +2 +.IP +Leaving out the product name will cause the tool to select a suitable +product, leaving out the serial number will cause the tool to match +one of the available devices. +.SH USAGE +.I ao-test-igniter +opens the target device, lists the available igniter and then fires +the specified ones. And error occurrs if any of the specified igniters +is not present or not ready. +.SH AUTHOR +Keith Packard diff --git a/ao-tools/ao-test-flash/ao-test-flash.c b/ao-tools/ao-test-flash/ao-test-flash.c new file mode 100644 index 00000000..cf44ae69 --- /dev/null +++ b/ao-tools/ao-test-flash/ao-test-flash.c @@ -0,0 +1,245 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ao-elf.h" +#include "ccdbg.h" +#include "cc-usb.h" +#include "cc.h" +#include "ao-verbose.h" + +static const struct option options[] = { + { .name = "tty", .has_arg = 1, .val = 'T' }, + { .name = "device", .has_arg = 1, .val = 'D' }, + { .name = "raw", .has_arg = 0, .val = 'r' }, + { .name = "verbose", .has_arg = 1, .val = 'v' }, + { 0, 0, 0, 0}, +}; + +static void usage(char *program) +{ + fprintf(stderr, "usage: %s [--verbose=] [--device=] [-tty=] \n", program); + exit(1); +} + +void +done(struct cc_usb *cc, int code) +{ + cc_usb_close(cc); + exit (code); +} + +static int +ends_with(char *whole, char *suffix) +{ + int whole_len = strlen(whole); + int suffix_len = strlen(suffix); + + if (suffix_len > whole_len) + return 0; + return strcmp(whole + whole_len - suffix_len, suffix) == 0; +} + +static int +starts_with(char *whole, char *prefix) +{ + int whole_len = strlen(whole); + int prefix_len = strlen(prefix); + + if (prefix_len > whole_len) + return 0; + return strncmp(whole, prefix, prefix_len) == 0; +} + +static char ** +tok(char *line) { + char **strs = malloc (sizeof (char *)), *str; + int n = 0; + + while ((str = strtok(line, " \t"))) { + line = NULL; + strs = realloc(strs, (n + 2) * sizeof (char *)); + strs[n] = strdup(str); + n++; + } + strs[n] = '\0'; + return strs; +} + +static void +free_strs(char **strs) { + char *str; + int i; + + for (i = 0; (str = strs[i]) != NULL; i++) + free(str); + free(strs); +} + +struct flash { + struct flash *next; + char line[512]; + char **strs; +}; + +static struct flash * +flash(struct cc_usb *usb) +{ + struct flash *head = NULL, **tail = &head; + cc_usb_printf(usb, "f\nv\n"); + for (;;) { + char line[512]; + struct flash *b; + + cc_usb_getline(usb, line, sizeof (line)); + b = malloc (sizeof (struct flash)); + strcpy(b->line, line); + b->strs = tok(line); + b->next = NULL; + *tail = b; + tail = &b->next; + if (strstr(line, "software-version")) + break; + } + return head; +} + +static void +free_flash(struct flash *b) { + struct flash *n; + + while (b) { + n = b->next; + free_strs(b->strs); + free(b); + b = n; + } +} + +char ** +find_flash(struct flash *b, char *word0) { + int i; + for (;b; b = b->next) { + if (strstr(b->line, word0)) + return b->strs; + } + return NULL; +} + +int +do_flash(struct cc_usb *usb, int expected_size) { + struct flash *b = flash(usb); + char **size = find_flash(b, "Storage size:"); + char **erase = find_flash(b, "Storage erase unit:"); + + if (!size || !erase) { + printf("no response\n"); + free_flash(b); + return 0; + } + + int actual_size = atoi(size[2]); + + if (actual_size != expected_size) { + printf ("weird flash size %d != %d\n", actual_size, expected_size); + free_flash(b); + return 0; + } + + int actual_erase = atoi(erase[3]); + + if (actual_erase != 65536) { + printf ("weird erase size %d\n", actual_erase); + free_flash(b); + return 0; + } + + printf ("flash size %d erase block %d\n", actual_size, actual_erase); + + return 1; +} + +int +main (int argc, char **argv) +{ + char *device = NULL; + char *filename; + Elf *e; + unsigned int s; + int i; + int c; + int tries; + struct cc_usb *cc = NULL; + char *tty = NULL; + int success; + int verbose = 0; + int ret = 0; + int expected_size; + + while ((c = getopt_long(argc, argv, "rT:D:c:s:v:", options, NULL)) != -1) { + switch (c) { + case 'T': + tty = optarg; + break; + case 'D': + device = optarg; + break; + case 'v': + verbose++; + break; + default: + usage(argv[0]); + break; + } + } + + if (!argv[optind]) + usage(argv[0]); + + ao_verbose = verbose; + + if (verbose > 1) + ccdbg_add_debug(CC_DEBUG_BITBANG); + + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "AltosFlash"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "TeleMega"); + if (!tty) + tty = getenv("ALTOS_TTY"); + if (!tty) + tty="/dev/ttyACM0"; + + cc = cc_usb_open(tty); + + if (!cc) + exit(1); + + if (!do_flash(cc, atoi(argv[optind]))) + ret = 1; + done(cc, ret); +} diff --git a/ao-tools/ao-test-igniter/.gitignore b/ao-tools/ao-test-igniter/.gitignore new file mode 100644 index 00000000..deee445f --- /dev/null +++ b/ao-tools/ao-test-igniter/.gitignore @@ -0,0 +1 @@ +ao-test-igniter diff --git a/ao-tools/ao-test-igniter/Makefile.am b/ao-tools/ao-test-igniter/Makefile.am new file mode 100644 index 00000000..e24ed469 --- /dev/null +++ b/ao-tools/ao-test-igniter/Makefile.am @@ -0,0 +1,11 @@ +bin_PROGRAMS=ao-test-igniter + +AM_CFLAGS=-I$(top_srcdir)/ao-tools/lib $(LIBUSB_CFLAGS) + +ao_test_igniter_DEPENDENCIES = $(top_builddir)/ao-tools/lib/libao-tools.a + +ao_test_igniter_LDADD=$(top_builddir)/ao-tools/lib/libao-tools.a $(LIBUSB_LIBS) + +ao_test_igniter_SOURCES=ao-test-igniter.c + +man_MANS = ao-test-igniter.1 diff --git a/ao-tools/ao-test-igniter/ao-test-igniter.1 b/ao-tools/ao-test-igniter/ao-test-igniter.1 new file mode 100644 index 00000000..155bd1bf --- /dev/null +++ b/ao-tools/ao-test-igniter/ao-test-igniter.1 @@ -0,0 +1,59 @@ +.\" +.\" Copyright © 2009 Keith Packard +.\" +.\" 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. +.\" +.\" +.TH AO-LOAD 1 "ao-test-igniter" "" +.SH NAME +ao-test-igniter \- test AltOS flight computer igniters +.SH SYNOPSIS +.B "ao-test-igniter" +[\-T \fItty-device\fP] +[\--tty \fItty-device\fP] +[\-D \fIaltos-device\fP] +[\--device \fIaltos-device\fP] +\fIigniter-name...\fP +.SH DESCRIPTION +.I ao-test-igniter +test the status and then fires the specified igniters on the target device +.SH OPTIONS +.TP +\-T tty-device | --tty tty-device +This selects which tty device the debugger uses to communicate with +the target device. The special name 'BITBANG' directs ao-dbg to use +the cp2103 connection, otherwise this should be a usb serial port +connected to a suitable cc1111 debug node. +.TP +\-D AltOS-device | --device AltOS-device +Search for a connected device. This requires an argument of one of the +following forms: +.IP +TeleMega:2 +.br +TeleMega +.br +2 +.IP +Leaving out the product name will cause the tool to select a suitable +product, leaving out the serial number will cause the tool to match +one of the available devices. +.SH USAGE +.I ao-test-igniter +opens the target device, lists the available igniter and then fires +the specified ones. And error occurrs if any of the specified igniters +is not present or not ready. +.SH AUTHOR +Keith Packard diff --git a/ao-tools/ao-test-igniter/ao-test-igniter.c b/ao-tools/ao-test-igniter/ao-test-igniter.c new file mode 100644 index 00000000..6a699fe8 --- /dev/null +++ b/ao-tools/ao-test-igniter/ao-test-igniter.c @@ -0,0 +1,223 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ao-elf.h" +#include "ccdbg.h" +#include "cc-usb.h" +#include "cc.h" +#include "ao-verbose.h" + +static const struct option options[] = { + { .name = "tty", .has_arg = 1, .val = 'T' }, + { .name = "device", .has_arg = 1, .val = 'D' }, + { .name = "raw", .has_arg = 0, .val = 'r' }, + { .name = "verbose", .has_arg = 1, .val = 'v' }, + { 0, 0, 0, 0}, +}; + +static void usage(char *program) +{ + fprintf(stderr, "usage: %s [--verbose=] [--device=] [-tty=] main|drogue\n", program); + exit(1); +} + +void +done(struct cc_usb *cc, int code) +{ +/* cc_usb_printf(cc, "a\n"); */ + cc_usb_close(cc); + exit (code); +} + +static int +ends_with(char *whole, char *suffix) +{ + int whole_len = strlen(whole); + int suffix_len = strlen(suffix); + + if (suffix_len > whole_len) + return 0; + return strcmp(whole + whole_len - suffix_len, suffix) == 0; +} + +static int +starts_with(char *whole, char *prefix) +{ + int whole_len = strlen(whole); + int prefix_len = strlen(prefix); + + if (prefix_len > whole_len) + return 0; + return strncmp(whole, prefix, prefix_len) == 0; +} + +struct igniter { + struct igniter *next; + char name[512]; + char status[512]; +}; + +static struct igniter * +igniters(struct cc_usb *usb) +{ + struct igniter *head = NULL, **tail = &head; + cc_usb_printf(usb, "t\nv\n"); + for (;;) { + char line[512]; + char name[512]; + char status[512]; + + cc_usb_getline(usb, line, sizeof (line)); + if (strstr(line, "software-version")) + break; + if (sscanf(line, "Igniter: %s Status: %s", &name, &status) == 2) { + struct igniter *i = malloc (sizeof (struct igniter)); + strcpy(i->name, name); + strcpy(i->status, status); + i->next = NULL; + *tail = i; + tail = &i->next; + } + } + return head; +} + +static void +free_igniters(struct igniter *i) { + struct igniter *n; + + while (i) { + n = i->next; + free(i); + i = n; + } +} + +static struct igniter * +find_igniter(struct igniter *i, char *name) +{ + for (; i; i = i->next) + if (strcmp(i->name, name) == 0) + return i; +} + +static int +do_igniter(struct cc_usb *usb, char *name) +{ + struct igniter *all = igniters(usb); + struct igniter *this = find_igniter(all, name); + if (!this) { + struct igniter *i; + printf("no igniter %s found in"); + for (i = all; i; i = i->next) + printf(" %s", i->name); + printf("\n"); + free_igniters(all); + return 0; + } + if (strcmp(this->status, "ready") != 0) { + printf("igniter %s status is %s\n", this->name, this->status); + free_igniters(all); + return 0; + } + cc_usb_printf(usb, "i DoIt %s\n", this->name); + cc_usb_sync(usb); + free_igniters(all); + usleep(200000); + return 1; +} + +int +main (int argc, char **argv) +{ + char *device = NULL; + char *filename; + Elf *e; + unsigned int s; + int i; + int c; + int tries; + struct cc_usb *cc = NULL; + char *tty = NULL; + int success; + int verbose = 0; + int ret = 0; + + while ((c = getopt_long(argc, argv, "rT:D:c:s:v:", options, NULL)) != -1) { + switch (c) { + case 'T': + tty = optarg; + break; + case 'D': + device = optarg; + break; + case 'v': + verbose++; + break; + default: + usage(argv[0]); + break; + } + } + + ao_verbose = verbose; + + if (verbose > 1) + ccdbg_add_debug(CC_DEBUG_BITBANG); + + printf ("device %s\n", device); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "TeleMega-v1.0"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "TeleMetrum-v2.0"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "TeleMini-v2.0"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "EasyMega-v1.0"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "EasyMetrum-v1.0"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "EasyMini-v1.0"); + if (!tty) + tty = getenv("ALTOS_TTY"); + if (!tty) + tty="/dev/ttyACM0"; + + cc = cc_usb_open(tty); + + if (!cc) + exit(1); + + for (i = optind; i < argc; i++) { + char *name = argv[i]; + + if (!do_igniter(cc, name)) + ret++; + } + done(cc, ret); +} diff --git a/configure.ac b/configure.ac index 467a5286..650abcc2 100644 --- a/configure.ac +++ b/configure.ac @@ -534,6 +534,9 @@ ao-tools/ao-dump-up/Makefile ao-tools/ao-elftohex/Makefile ao-tools/ao-usbload/Makefile ao-tools/ao-flash/Makefile +ao-tools/ao-test-igniter/Makefile +ao-tools/ao-test-baro/Makefile +ao-tools/ao-test-flash/Makefile ao-utils/Makefile src/Version ]) -- cgit v1.2.3 From 0a19073649570016db28d5e2a4a225273732adb5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 22 Jun 2014 21:13:54 -0700 Subject: ao-bringup: Use the C tools to test EasyMini I think my USB driver in the kernel is broken; the nickle versions of these tools did very strange things and never worked. Signed-off-by: Keith Packard --- ao-bringup/test-easymini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ao-bringup/test-easymini b/ao-bringup/test-easymini index 29139385..17e00955 100755 --- a/ao-bringup/test-easymini +++ b/ao-bringup/test-easymini @@ -19,7 +19,7 @@ ao-list | while read product serial dev; do echo "Testing $product $serial $dev" echo "Testing igniters. Both should flash" - ./test-igniter "$dev" drogue main + ../ao-tools/ao-test-igniter/ao-test-igniter --tty="$dev" drogue main case $? in 0) @@ -30,7 +30,7 @@ ao-list | while read product serial dev; do esac echo "Testing baro sensor" - ./test-baro "$dev" + ../ao-tools/ao-test-baro/ao-test-baro --tty="$dev" case $? in 0) @@ -43,7 +43,7 @@ ao-list | while read product serial dev; do FLASHSIZE=1048576 echo "Testing flash" - ./test-flash "$dev" "$FLASHSIZE" + ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE" case $? in 0) -- cgit v1.2.3 From 443bbb09468df7c1a10f2c76996c92380d8b8c23 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 15:56:11 -0700 Subject: altos: Add optional debugging to print out pyro firing status This dumps pyro check failures for ao_flight_test so you can see why pyro charges aren't firing. Signed-off-by: Keith Packard --- src/kernel/ao_pyro.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index 85d88d98..0b286466 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -69,6 +69,16 @@ ao_pyro_print_status(void) uint16_t ao_pyro_fired; +#ifndef PYRO_DBG +#define PYRO_DBG 0 +#endif + +#if PYRO_DBG +#define DBG(...) do { printf("\t%d: ", (int) (pyro - ao_config.pyro)); printf(__VA_ARGS__); } while (0) +#else +#define DBG(...) +#endif + /* * Given a pyro structure, figure out * if the current flight state satisfies all @@ -88,63 +98,73 @@ ao_pyro_ready(struct ao_pyro *pyro) case ao_pyro_accel_less: if (ao_accel <= pyro->accel_less) continue; + DBG("accel %d > %d\n", ao_accel, pyro->accel_less); break; case ao_pyro_accel_greater: if (ao_accel >= pyro->accel_greater) continue; + DBG("accel %d < %d\n", ao_accel, pyro->accel_greater); break; - - case ao_pyro_speed_less: if (ao_speed <= pyro->speed_less) continue; + DBG("speed %d > %d\n", ao_speed, pyro->speed_less); break; case ao_pyro_speed_greater: if (ao_speed >= pyro->speed_greater) continue; + DBG("speed %d < %d\n", ao_speed, pyro->speed_greater); break; - case ao_pyro_height_less: if (ao_height <= pyro->height_less) continue; + DBG("height %d > %d\n", ao_height, pyro->height_less); break; case ao_pyro_height_greater: if (ao_height >= pyro->height_greater) continue; + DBG("height %d < %d\n", ao_height, pyro->height_greater); break; #if HAS_GYRO case ao_pyro_orient_less: if (ao_sample_orient <= pyro->orient_less) continue; + DBG("orient %d > %d\n", ao_sample_orient, pyro->orient_less); break; case ao_pyro_orient_greater: if (ao_sample_orient >= pyro->orient_greater) continue; + DBG("orient %d < %d\n", ao_sample_orient, pyro->orient_greater); break; #endif case ao_pyro_time_less: if ((int16_t) (ao_time() - ao_boost_tick) <= pyro->time_less) continue; + DBG("time %d > %d\n", (int16_t)(ao_time() - ao_boost_tick), pyro->time_less); break; case ao_pyro_time_greater: if ((int16_t) (ao_time() - ao_boost_tick) >= pyro->time_greater) continue; + DBG("time %d < %d\n", (int16_t)(ao_time() - ao_boost_tick), pyro->time_greater); break; case ao_pyro_ascending: if (ao_speed > 0) continue; + DBG("not ascending speed %d\n", ao_speed); break; case ao_pyro_descending: if (ao_speed < 0) continue; + DBG("not descending speed %d\n", ao_speed); break; case ao_pyro_after_motor: if (ao_motor_number == pyro->motor) continue; + DBG("motor %d != %d\n", ao_motor_number, pyro->motor); break; case ao_pyro_delay: @@ -154,10 +174,12 @@ ao_pyro_ready(struct ao_pyro *pyro) case ao_pyro_state_less: if (ao_flight_state < pyro->state_less) continue; + DBG("state %d >= %d\n", ao_flight_state, pyro->state_less); break; case ao_pyro_state_greater_or_equal: if (ao_flight_state >= pyro->state_greater_or_equal) continue; + DBG("state %d >= %d\n", ao_flight_state, pyro->state_less); break; default: -- cgit v1.2.3 From 309d91d25099bebda21e165165efa9ce86cb0a47 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 15:57:13 -0700 Subject: altos/ao_flight_test: Get the Tmega version compiling again A few changes broke this recently. Signed-off-by: Keith Packard --- src/test/ao_flight_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 0647fc6c..1ab22e5b 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -50,6 +50,7 @@ int ao_gps_new; #define HAS_MMA655X 1 #define HAS_HMC5883 1 #define HAS_BEEP 1 +#define AO_CONFIG_MAX_SIZE 1024 struct ao_adc { int16_t sense[AO_ADC_NUM_SENSE]; @@ -795,6 +796,7 @@ ao_sleep(void *wchan) pyro->flags |= ao_pyro_values[j].flag; if (ao_pyro_values[j].offset != NO_VALUE && i + 1 < nword) { int16_t val = strtoul(words[++i], NULL, 10); + printf("pyro %d condition %s value %d\n", p, words[i-1], val); *((int16_t *) ((char *) pyro + ao_pyro_values[j].offset)) = val; } } -- cgit v1.2.3 From 97269bb90c1602a1f8c54fc7b6c34383a0370621 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 15:58:35 -0700 Subject: Bump version to 1.4.1.1 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 650abcc2..89994ccb 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.4.0.1) +AC_INIT([altos], 1.4.1.1) AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -- cgit v1.2.3 From ade2cc9abb8ca403a9ae5d1f9c145ab72ce94919 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 18:24:02 -0700 Subject: altosuilib: Make map cache size configurable Systems with sufficient memory can get smoother map scrolling by making the cache larger. Would be nice to do this automatically? Signed-off-by: Keith Packard --- altosuilib/AltosUIConfigure.java | 26 +++++++++++++++++++ altosuilib/AltosUIMapCache.java | 45 +++++++++++++++++++++++++++------ altosuilib/AltosUIMapCacheListener.java | 22 ++++++++++++++++ altosuilib/AltosUIMapView.java | 2 +- altosuilib/AltosUIPreferences.java | 38 ++++++++++++++++++++++++++++ altosuilib/Makefile.am | 1 + 6 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 altosuilib/AltosUIMapCacheListener.java diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java index 9d54cfe5..5ab615e8 100644 --- a/altosuilib/AltosUIConfigure.java +++ b/altosuilib/AltosUIConfigure.java @@ -223,6 +223,31 @@ public class AltosUIConfigure row++; } + static final Integer map_caches[] = { 9, 25, 100 }; + + public void add_map_cache() { + pane.add(new JLabel("Map Cache Size"), constraints(0, 1)); + + final JComboBox map_cache = new JComboBox(map_caches); + + map_cache.setEditable(true); + map_cache.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + int size = (Integer) (map_cache.getSelectedItem()); + + AltosUIPreferences.set_map_cache(size); + } catch (ClassCastException ce) { + map_cache.setSelectedItem(new Integer(AltosUIPreferences.map_cache())); + } + } + }); + + map_cache.setSelectedItem (new Integer(AltosUIPreferences.map_cache())); + pane.add(map_cache, constraints(1, 2, GridBagConstraints.BOTH)); + row++; + } + public void add_bluetooth() { } @@ -255,6 +280,7 @@ public class AltosUIConfigure add_font_size(); add_look_and_feel(); add_position(); + add_map_cache(); add_bluetooth(); add_frequencies(); diff --git a/altosuilib/AltosUIMapCache.java b/altosuilib/AltosUIMapCache.java index 3f1512df..9cc32e24 100644 --- a/altosuilib/AltosUIMapCache.java +++ b/altosuilib/AltosUIMapCache.java @@ -24,33 +24,36 @@ import java.awt.*; import java.io.*; import java.net.*; -public class AltosUIMapCache { +public class AltosUIMapCache implements AltosUIMapCacheListener { static final int success = 0; static final int loading = 1; static final int failed = 2; static final int bad_request = 3; static final int forbidden = 4; - static final int min_cache_size = 9; - static final int max_cache_size = 24; + int min_cache_size; /* configured minimum cache size */ + int cache_size; /* current cache size */ + int requested_cache_size; /* cache size computed by application */ private Object fetch_lock = new Object(); private Object cache_lock = new Object(); - int cache_size = min_cache_size; - AltosUIMapImage[] images = new AltosUIMapImage[cache_size]; long used; public void set_cache_size(int new_size) { + + requested_cache_size = new_size; + if (new_size < min_cache_size) new_size = min_cache_size; - if (new_size > max_cache_size) - new_size = max_cache_size; + if (new_size == cache_size) return; + System.out.printf("cache size now %d\n", new_size); + synchronized(cache_lock) { AltosUIMapImage[] new_images = new AltosUIMapImage[new_size]; @@ -91,8 +94,12 @@ public class AltosUIMapCache { try { image = new AltosUIMapImage(tile, store); image.used = used++; - if (images[oldest] != null) + if (images[oldest] != null) { + System.out.printf("drop %s\n", images[oldest].store.file.toString()); images[oldest].flush(); + } + + System.out.printf("load %s\n", store.file.toString()); images[oldest] = image; @@ -109,6 +116,28 @@ public class AltosUIMapCache { } } + public void map_cache_changed(int map_cache) { + min_cache_size = map_cache; + + set_cache_size(requested_cache_size); + } + + public void dispose() { + AltosUIPreferences.unregister_map_cache_listener(this); + + for (int i = 0; i < cache_size; i++) { + AltosUIMapImage image = images[i]; + + if (image != null) + image.flush(); + } + } + public AltosUIMapCache() { + min_cache_size = AltosUIPreferences.map_cache(); + + set_cache_size(0); + + AltosUIPreferences.register_map_cache_listener(this); } } diff --git a/altosuilib/AltosUIMapCacheListener.java b/altosuilib/AltosUIMapCacheListener.java new file mode 100644 index 00000000..680d123e --- /dev/null +++ b/altosuilib/AltosUIMapCacheListener.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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. + */ + +package org.altusmetrum.altosuilib_3; + +public interface AltosUIMapCacheListener { + public void map_cache_changed(int map_cache); +} diff --git a/altosuilib/AltosUIMapView.java b/altosuilib/AltosUIMapView.java index 1abd1731..34a85f52 100644 --- a/altosuilib/AltosUIMapView.java +++ b/altosuilib/AltosUIMapView.java @@ -370,7 +370,7 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo for (Point point : to_remove) tiles.remove(point); - cache.set_cache_size(((lower_right.y - upper_left.y) / px_size + 1) * ((lower_right.x - upper_left.x) / px_size + 1)); + cache.set_cache_size((getWidth() / px_size + 2) * (getHeight() / px_size + 2)); for (int y = upper_left.y; y <= lower_right.y; y += px_size) { for (int x = upper_left.x; x <= lower_right.x; x += px_size) { Point point = new Point(x, y); diff --git a/altosuilib/AltosUIPreferences.java b/altosuilib/AltosUIPreferences.java index 509faaff..ecab20d4 100644 --- a/altosuilib/AltosUIPreferences.java +++ b/altosuilib/AltosUIPreferences.java @@ -34,6 +34,9 @@ public class AltosUIPreferences extends AltosPreferences { /* Window position preference name */ final static String positionPreference = "POSITION"; + /* Maps cache size preference name */ + final static String mapCachePreference = "MAP-CACHE"; + /* UI Component to pop dialogs up */ static Component component; @@ -52,6 +55,10 @@ public class AltosUIPreferences extends AltosPreferences { public static int position = AltosUILib.position_top_left; + static LinkedList map_cache_listeners; + + public static int map_cache = 9; + public static void init() { AltosPreferences.init(new AltosUIPreferencesBackend()); @@ -68,6 +75,9 @@ public class AltosUIPreferences extends AltosPreferences { position = backend.getInt(positionPreference, AltosUILib.position_top_left); position_listeners = new LinkedList(); + + map_cache = backend.getInt(mapCachePreference, 9); + map_cache_listeners = new LinkedList(); } static { init(); } @@ -215,4 +225,32 @@ public class AltosUIPreferences extends AltosPreferences { return position; } } + + public static void register_map_cache_listener(AltosUIMapCacheListener l) { + synchronized(backend) { + map_cache_listeners.add(l); + } + } + + public static void unregister_map_cache_listener(AltosUIMapCacheListener l) { + synchronized (backend) { + map_cache_listeners.remove(l); + } + } + + public static void set_map_cache(int new_map_cache) { + synchronized(backend) { + map_cache = new_map_cache; + backend.putInt(mapCachePreference, map_cache); + flush_preferences(); + for (AltosUIMapCacheListener l: map_cache_listeners) + l.map_cache_changed(map_cache); + } + } + + public static int map_cache() { + synchronized(backend) { + return map_cache; + } + } } diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index bbee6a45..56b01ec5 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -68,6 +68,7 @@ altosuilib_JAVA = \ AltosUIMapPath.java \ AltosUIMapTile.java \ AltosUIMapCache.java \ + AltosUIMapCacheListener.java \ AltosUIMapImage.java \ AltosUIMapTransform.java \ AltosUIMapRectangle.java \ -- cgit v1.2.3 From dbff6dd42f8b6fb90c8d3f07bde48a6be0bfddf0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 18:25:31 -0700 Subject: altosuilib: Outline map lines and distance value with white This makes the value and line visible on dark backgrounds Signed-off-by: Keith Packard --- altosuilib/AltosUIMapLine.java | 19 ++++++++++++++++--- altosuilib/AltosUIMapView.java | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/altosuilib/AltosUIMapLine.java b/altosuilib/AltosUIMapLine.java index 86d2e6e2..32437d4e 100644 --- a/altosuilib/AltosUIMapLine.java +++ b/altosuilib/AltosUIMapLine.java @@ -31,6 +31,7 @@ public class AltosUIMapLine { AltosUILatLon start, end; private Font font = null; + static public int stroke_width = 6; public void set_font(Font font) { this.font = font; @@ -87,19 +88,24 @@ public class AltosUIMapLine { } public void paint(Graphics2D g, AltosUIMapTransform t) { - g.setColor(Color.BLUE); if (start == null || end == null) return; + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + Line2D.Double line = new Line2D.Double(t.screen(start), t.screen(end)); + g.setColor(Color.WHITE); + g.setStroke(new BasicStroke(stroke_width+4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g.draw(line); + + g.setColor(Color.BLUE); + g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g.draw(line); String message = line_dist(); - g.setFont(font); - g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); Rectangle2D bounds; bounds = font.getStringBounds(message, g.getFontRenderContext()); @@ -111,6 +117,13 @@ public class AltosUIMapLine { } else { x += 2.0f; } + + g.setFont(font); + g.setColor(Color.WHITE); + for (int dy = -2; dy <= 2; dy += 2) + for (int dx = -2; dx <= 2; dx += 2) + g.drawString(message, x + dx, y + dy); + g.setColor(Color.BLUE); g.drawString(message, x, y); } } diff --git a/altosuilib/AltosUIMapView.java b/altosuilib/AltosUIMapView.java index 34a85f52..70b8e2e9 100644 --- a/altosuilib/AltosUIMapView.java +++ b/altosuilib/AltosUIMapView.java @@ -67,7 +67,7 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo AltosUILatLon centre; public void set_font() { - line.set_font(AltosUILib.value_font); + line.set_font(AltosUILib.status_font); for (AltosUIMapTile tile : tiles.values()) tile.set_font(AltosUILib.value_font); repaint(); -- cgit v1.2.3 From 048ce00ea0d1d2744552942559aa1da2431ab954 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 18:26:04 -0700 Subject: icon: Generate altusmetrum.xpm and install it This is for the debian menu, still a required part of a debian package. Signed-off-by: Keith Packard --- icon/Makefile.am | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/icon/Makefile.am b/icon/Makefile.am index 516c547c..bf147ad3 100644 --- a/icon/Makefile.am +++ b/icon/Makefile.am @@ -71,6 +71,10 @@ EEPROM_FILES = $(shell for i in $(RES); do echo $(EEPROM_NAME)-$$i.png; done) TELEM_FILES = $(shell for i in $(RES); do echo $(TELEM_NAME)-$$i.png; done) IN_MPD_FILES = $(shell for i in $(RES); do echo $(MPD_NAME)-$$i.png; done) +# XPM file needed by debian + +AM_XPM = altusmetrum.xpm + ICON_THEME=$(datadir)/icons/hicolor appicondir = $(ICON_THEME)/scalable/apps @@ -84,6 +88,9 @@ mimeicon_DATA = $(MIME_ICONS) mimedir = $(datadir)/mime/packages mime_DATA = org-altusmetrum-mimetypes.xml +pixmapdir = $(datadir)/pixmaps +pixmap_DATA = altusmetrum.xpm + EXTRA_DIST = $(appicon_DATA) $(mimeicon_DATA) $(mime_DATA) windows-stub.c res: @@ -100,12 +107,14 @@ java-telegps: fat: all $(ICO_FILES) $(ICNS_FILES) $(EXE_FILES) -all-local: $(JAVA_FILES) +all-local: $(JAVA_FILES) $(AM_XPM) clean-local: $(RM) $(AM_NAME)-*.png $(TG_NAME)-*.png $(MP_NAME)-*.png + $(RM) altus-metrum-*.png micropeak-*.png telegps-*.png $(RM) $(EEPROM_NAME)-*.png $(TELEM_NAME)-*.png $(MPD_NAME)-*.png $(RM) *.build *.ico *.rc *.icns *.o *.exe $(MPD_ICON) + $(RM) altusmetrum.xpm install-data-hook: update-mime-database $(datadir)/mime @@ -114,6 +123,13 @@ install-data-hook: $(MPD_ICON): $(MP_ICON) $(LN_S) $(MP_ICON) $@ +XPM_SRC=altusmetrum-altosui-32.png + +altusmetrum.xpm: $(XPM_SRC) + pngtopnm -alpha $(XPM_SRC) > mask-$@ && \ + pngtopnm $(XPM_SRC) | \ + ppmtoxpm -alphamask=mask-$@ > $@ && rm mask-$@ + $(AM_FILES): $(AM_NAME).build $(MP_FILES): $(MP_NAME).build $(TG_FILES): $(TG_NAME).build @@ -132,6 +148,7 @@ SUFFIXES=.svg .build .icns .ico .rc .o .exe .ico.rc: echo '101 ICON "$*.ico"' > $@ + MINGCC32=i686-w64-mingw32-gcc MINGWINDRES=i686-w64-mingw32-windres -- cgit v1.2.3 From 5d4f912bcc6784f975c82f7b0ed8dc360e60aae8 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 24 Jun 2014 21:12:59 -0600 Subject: make sure to use Google Maps API key for official builds --- Releasing | 4 ++++ debian/rules | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Releasing b/Releasing index 5827f21d..d7b337e6 100644 --- a/Releasing +++ b/Releasing @@ -2,6 +2,10 @@ These are Bdale's notes on how to do a release. git checkout master + - make sure the Google Maps API key is in the build chroot + mkdir -p /var/cache/pbuilder/base.cow/opt/google + cp ~/altusmetrumllc/google-maps-api-key \ + /var/cache/pbuilder/base.cow/opt/google/maps-api-key - make sure there is a doc/release-notes-.xsl - make sure that doc/altusmetrum.xsl has the right copyright year, and add release to the revision history at the front (release notes diff --git a/debian/rules b/debian/rules index 2b798464..ebcb3b80 100755 --- a/debian/rules +++ b/debian/rules @@ -18,7 +18,8 @@ prebuild: configure: configure-stamp configure-stamp: dh_testdir - PKG_CONFIG_PATH=/opt/stlink/lib/pkgconfig ./autogen.sh --prefix=/usr + PKG_CONFIG_PATH=/opt/stlink/lib/pkgconfig ./autogen.sh \ + --prefix=/usr --with-google-key=/opt/google/maps-api-key touch configure-stamp build: build-arch build-indep -- cgit v1.2.3 From a0ccab8e4235934538a03f8be3b37aa1bbd6b144 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 20:15:38 -0700 Subject: altosuilib: Mark 'Configure AltosUI' window with maps key status This lets us check a build to make sure it has a maps key Signed-off-by: Keith Packard --- altosuilib/AltosUIConfigure.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java index 5ab615e8..5648d1df 100644 --- a/altosuilib/AltosUIConfigure.java +++ b/altosuilib/AltosUIConfigure.java @@ -268,7 +268,9 @@ public class AltosUIConfigure constraints(0, 3)); row++; - pane.add(new JLabel (String.format("AltOS version %s", AltosUIVersion.version)), + pane.add(new JLabel (String.format("AltOS version %s (%smaps key)", + AltosUIVersion.version, + AltosUIVersion.has_google_maps_api_key() ? "" : "no ")), constraints(0, 3)); row++; -- cgit v1.2.3 From d1065424d144b8dab949db7e57140ffdf244bd48 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 24 Jun 2014 21:22:26 -0600 Subject: need the api key in Bdale's root too --- Releasing | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Releasing b/Releasing index d7b337e6..8c1787ee 100644 --- a/Releasing +++ b/Releasing @@ -2,10 +2,13 @@ These are Bdale's notes on how to do a release. git checkout master - - make sure the Google Maps API key is in the build chroot - mkdir -p /var/cache/pbuilder/base.cow/opt/google + - make sure the Google Maps API key is in the build chroot and root + mkdir -p /var/cache/pbuilder/base.cow/opt/google /opt/google cp ~/altusmetrumllc/google-maps-api-key \ /var/cache/pbuilder/base.cow/opt/google/maps-api-key + ln -sf /home/bdale/altusmetrumllc/google-maps-api-key \ + /opt/google/maps-api-key + - make sure there is a doc/release-notes-.xsl - make sure that doc/altusmetrum.xsl has the right copyright year, and add release to the revision history at the front (release notes -- cgit v1.2.3 From b2c5f7d10265794a5778546f2e3eca7d763eab56 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 20:31:50 -0700 Subject: Clean all .desktop files, ignore them too All .desktop files are built from .desktop.in files, so just remove all of them in make clean, and ignore all of them in .gitignore. This makes the rename less painful. Signed-off-by: Keith Packard --- altosui/.gitignore | 2 +- altosui/Makefile.am | 2 +- micropeak/.gitignore | 2 +- micropeak/Makefile.am | 2 +- telegps/.gitignore | 2 +- telegps/Makefile.am | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/altosui/.gitignore b/altosui/.gitignore index b0c8264b..a9b80aa4 100644 --- a/altosui/.gitignore +++ b/altosui/.gitignore @@ -17,7 +17,7 @@ Altos-Linux-*.tar.bz2 Altos-Linux-*.sh Altos-Mac-*.zip Altos-Windows-*.exe -altusmetrum-altosui.desktop +.desktop *.dll *.dylib *.so diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 45d75699..c79e27c0 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -167,7 +167,7 @@ clean-local: -rm -rf classes $(JAR) $(FATJAR) \ $(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) windows $(WINDOWS_DIST) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) \ $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt altos-windows.log altos-windows.nsi \ - altosui altosui-test altosui-jdb macosx linux + altosui altosui-test altosui-jdb macosx linux *.desktop EXTRA_DIST = $(desktop_file).in diff --git a/micropeak/.gitignore b/micropeak/.gitignore index 81dd0749..2cf940a6 100644 --- a/micropeak/.gitignore +++ b/micropeak/.gitignore @@ -11,7 +11,7 @@ micropeak-windows.nsi MicroPeak-Linux-* MicroPeak-Mac-* MicroPeak-Windows-* -altusmetrum-micropeak.desktop +*.desktop *.dll *.dylib *.so diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index 6270fd74..e3b77c8a 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -95,7 +95,7 @@ clean-local: $(ALTOSUILIB_CLASS) \ $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt \ micropeak micropeak-test micropeak-jdb macosx linux windows micropeak-windows.log \ - micropeak-windows.nsi + micropeak-windows.nsi *.desktop EXTRA_DIST = $(desktop_file).in diff --git a/telegps/.gitignore b/telegps/.gitignore index 37e46ad1..1af9e0f1 100644 --- a/telegps/.gitignore +++ b/telegps/.gitignore @@ -17,7 +17,7 @@ TeleGPS-Linux-*.tar.bz2 TeleGPS-Linux-*.sh TeleGPS-Mac-*.zip TeleGPS-Windows-*.exe -altusmetrum-telegps.desktop +*.desktop telegps-windows.log *.dll *.dylib diff --git a/telegps/Makefile.am b/telegps/Makefile.am index 3f53b949..6138b004 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -112,7 +112,7 @@ clean-local: $(ALTOSUILIB_CLASS) \ $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt \ telegps telegps-test telegps-jdb macosx linux windows telegps-windows.log \ - telegps-windows.nsi + telegps-windows.nsi *.desktop EXTRA_DIST = $(desktop_file).in -- cgit v1.2.3 From f95b0e03c75d09e8ff4dbf9083cd3c8a30fdc4e6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Jun 2014 11:51:11 -0700 Subject: Add 1.4.1 release notes Signed-off-by: Keith Packard --- doc/Makefile | 6 +++++- doc/altusmetrum.xsl | 14 ++++++++++++++ doc/release-notes-1.4.1.xsl | 47 +++++++++++++++++++++++++++++++++++++++++++++ doc/telegps.xsl | 24 +++++++++++++++++++++++ 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 doc/release-notes-1.4.1.xsl diff --git a/doc/Makefile b/doc/Makefile index 254e63c4..c39450c7 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -15,7 +15,8 @@ RELNOTES=\ release-notes-1.3.html \ release-notes-1.3.1.html \ release-notes-1.3.2.html \ - release-notes-1.4.html + release-notes-1.4.html \ + release-notes-1.4.1.html PICTURES=\ altosui.png \ @@ -107,6 +108,9 @@ distclean: altusmetrum.html: $(RELNOTES_XSL) $(IMAGES) altusmetrum.pdf: $(RELNOTES_XSL) $(IMAGES) +telegps.html: $(RELNOTES_XSL) $(IMAGES) +telegps.pdf: $(RELNOTES_XSL) $(IMAGES) + $(PDF): $(FOSTYLE) $(TEMPLATES) indent: altusmetrum.xsl diff --git a/doc/altusmetrum.xsl b/doc/altusmetrum.xsl index fb8fe7e1..b4cac48e 100644 --- a/doc/altusmetrum.xsl +++ b/doc/altusmetrum.xsl @@ -40,6 +40,13 @@ + + 1.4.1 + 20 June 2014 + + Minor release fixing some installation bugs. + + 1.4 15 June 2014 @@ -5457,6 +5464,13 @@ NAR #88757, TRA #12200 Release Notes + + Version 1.41 + + Version 1.4 + + +
+ + Version 1.4.1 is a minor release. It fixes install issues on + Windows and provides the missing TeleMetrum V2.0 firmware. There + aren't any changes to the firmware or host applications at + all. All Windows users will want to upgrade to get the signed + driver, but Mac and Linux users who do not need the TeleMetrum + V2.0 firmware image will not need to upgrade. + + + Windows Install Fixes + + + + Provide signed Windows driver files. This should avoid any need to + disable driver signature checking on Windows 7 or 8. + + + + + Fix Java version detection and download. Previously, the + installer would only look for Java 6 or 7 and insist on + downloading its own Java bits if there was something else + installed. Furthermore, the 64-bit Java link provided didn't + work for anyone other than Keith, making it impossible to + install AltOS on any machine with Java SE 8 installed. + + + + + + Other Fixes + + + + Include 1.4 firmware for TeleMetrum V2.0. None of the + installers shipped this file. Now it's included in the AltOS + packages for Linux, Mac and Windows. + + + + +
diff --git a/doc/telegps.xsl b/doc/telegps.xsl index 836c3d9a..bf7eec5a 100644 --- a/doc/telegps.xsl +++ b/doc/telegps.xsl @@ -28,6 +28,13 @@ + + 1.4.1 + 20 June 2014 + + Minor release fixing some installation bugs. + + 1.4 13 June 2014 @@ -1295,6 +1302,23 @@ NAR #88757, TRA #12200
+ + Release Notes + + Version 1.41 + + + + Version 1.4 + + + -- cgit v1.2.3 From 6cb5955ab5aa3b42a507c4a02812cb5569b8562b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 20 Jun 2014 11:56:58 -0700 Subject: Add note about including Google maps API key Signed-off-by: Keith Packard --- doc/release-notes-1.4.1.xsl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/release-notes-1.4.1.xsl b/doc/release-notes-1.4.1.xsl index 14258ea6..e6c82d60 100644 --- a/doc/release-notes-1.4.1.xsl +++ b/doc/release-notes-1.4.1.xsl @@ -42,6 +42,13 @@ packages for Linux, Mac and Windows. + + + Include Google Application Key for map downloading. The 1.4 + release didn't have this key in the released version of the + software, making map downloading fail for most people. + + -- cgit v1.2.3 From 7427f8bac7b3743ce0ab990612bf7168b95e22f9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 20:52:34 -0700 Subject: altosui: Don't show the tracker motion value when switching units The tracker value was left enabled when hidden; the logic for deciding whether to update it with new information used only the enabled state, not the visible state. Set both states when hiding it to keep things more consistent Signed-off-by: Keith Packard --- altosui/AltosConfigUI.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 6e1b47c2..de1b582e 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -925,6 +925,8 @@ public class AltosConfigUI } public void units_changed(boolean imperial_units) { + boolean was_dirty = dirty; + String v = main_deploy_value.getSelectedItem().toString(); main_deploy_label.setText(get_main_deploy_label()); set_main_deploy_values(); @@ -937,6 +939,9 @@ public class AltosConfigUI set_tracker_motion_values(); set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5)); } + + if (!was_dirty) + set_clean(); } public void set_apogee_delay(int new_apogee_delay) { @@ -1151,9 +1156,11 @@ public class AltosConfigUI if (tracker_motion < 0) { tracker_motion_label.setVisible(false); tracker_motion_value.setVisible(false); + tracker_motion_value.setEnabled(false); } else { tracker_motion_label.setVisible(true); tracker_motion_value.setVisible(true); + tracker_motion_value.setEnabled(true); tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); } } @@ -1166,9 +1173,11 @@ public class AltosConfigUI if (tracker_interval< 0) { tracker_interval_label.setVisible(false); tracker_interval_value.setVisible(false); + tracker_interval_value.setEnabled(false); } else { tracker_interval_label.setVisible(true); tracker_interval_value.setVisible(true); + tracker_interval_value.setEnabled(true); tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); } } -- cgit v1.2.3 From 424112349d54bb6360403683f8012b83f49220be Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 24 Jun 2014 20:57:29 -0700 Subject: telegps: Disable tracker config when not available Tracker motion and interval were both left enabled even when the device being configured didn't support them. Disable them like other elements. Signed-off-by: Keith Packard --- telegps/TeleGPSConfigUI.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index 1fdfd70c..ee2fbd2d 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -612,12 +612,16 @@ public class TeleGPSConfigUI } public void units_changed(boolean imperial_units) { + boolean was_dirty = dirty; + if (tracker_motion_value.isEnabled()) { String motion = tracker_motion_value.getSelectedItem().toString(); tracker_motion_label.setText(get_tracker_motion_label()); set_tracker_motion_values(); set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5)); } + if (!was_dirty) + set_clean(); } /* set and get all of the dialog values */ @@ -794,7 +798,12 @@ public class TeleGPSConfigUI } public void set_tracker_motion(int tracker_motion) { - tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); + if (tracker_motion < 0) { + tracker_motion_value.setEnabled(false); + } else { + tracker_motion_value.setEnabled(true); + tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); + } } public int tracker_motion() throws AltosConfigDataException { @@ -802,7 +811,12 @@ public class TeleGPSConfigUI } public void set_tracker_interval(int tracker_interval) { - tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); + if (tracker_interval< 0) { + tracker_interval_value.setEnabled(false); + } else { + tracker_interval_value.setEnabled(true); + tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); + } } public int tracker_interval() throws AltosConfigDataException { -- cgit v1.2.3 From 61ca8493566d5ea0da379970ab94f80a462dd368 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 24 Jun 2014 22:35:43 -0600 Subject: update Releasing file based on learnings from 1.4.1 release --- Releasing | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/Releasing b/Releasing index 8c1787ee..e68a1cb2 100644 --- a/Releasing +++ b/Releasing @@ -1,42 +1,39 @@ These are Bdale's notes on how to do a release. + - make sure build environment is up to date + sudo cowbuilder --update + git checkout master - make sure the Google Maps API key is in the build chroot and root - mkdir -p /var/cache/pbuilder/base.cow/opt/google /opt/google - cp ~/altusmetrumllc/google-maps-api-key \ - /var/cache/pbuilder/base.cow/opt/google/maps-api-key - ln -sf /home/bdale/altusmetrumllc/google-maps-api-key \ - /opt/google/maps-api-key + sudo mkdir -p /var/cache/pbuilder/base.cow/opt/google /opt/google + sudo cp ~/altusmetrumllc/google-maps-api-key \ + /var/cache/pbuilder/base.cow/opt/google/maps-api-key + sudo ln -sf /home/bdale/altusmetrumllc/google-maps-api-key \ + /opt/google/maps-api-key + + - if this is an x.y release, then: + git checkout -b branch- + + - if this is an x.y.z release, then: + git checkout branch- # the x.y parts only + - cherry-pick or merge appropriate content from master + + - update the version in configure.ac - make sure there is a doc/release-notes-.xsl - make sure that doc/altusmetrum.xsl has the right copyright year, and add release to the revision history at the front (release notes will be pulled in automatically) - - - get a Google Maps API key and install it in - ~/altusmetrumllc/google-maps-api-key. If you don't have a - key, the app will still work, but downloading map tiles will - be slow, and you will only be able to download a limited - number per day. - - - update the version in configure.ac - git log > ChangeLog - git commit -a - - make absolutely sure checked-out tree is "clean" - make absolutely sure the pdclib/ submodule is on the master branch, up to date, and "clean" - - if this is an x.y release, then: - git checkout -b branch- - git tag -a - - edit .git/gbp.conf to use branch- as upstream + git log > ChangeLog + git commit -a + git tag -a # full x.y.z version - - if this is an x.y.z release, then: - git checkout branch- # the x.y parts only - git merge master - git tag -a # full x.y.z version + - make sure .git/gbp.conf set to use branch- as upstream git checkout debian git merge branch- @@ -93,9 +90,7 @@ These are Bdale's notes on how to do a release. - go edit ~/web/altusmetrum/AltOS/releases/.mdwn, /home/bdale/web/altusmetrum/MicroPeak/releases/.mdwn, and - /home/bdale/web/altusmetrum/TeleGPS/releases/.mdwn, to - include release date and explicit ref to dir contents so the - web pages shows versioned links, commit and push + /home/bdale/web/altusmetrum/TeleGPS/releases/.mdwn (cd doc ; make publish) -- cgit v1.2.3 From 75db560e2c9fbb2889db507acc93e889bf15bc2a Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 24 Jun 2014 22:43:04 -0600 Subject: Windows sucks, hard .. make sure filenames are legal in .mdwn files --- Releasing | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Releasing b/Releasing index e68a1cb2..c5ecdf34 100644 --- a/Releasing +++ b/Releasing @@ -92,6 +92,8 @@ These are Bdale's notes on how to do a release. /home/bdale/web/altusmetrum/MicroPeak/releases/.mdwn, and /home/bdale/web/altusmetrum/TeleGPS/releases/.mdwn + - make sure the Windows stuff is like 1-4-1, not 1.4.1! + (cd doc ; make publish) this pushes fresh documents to the web site -- cgit v1.2.3 From 505c6a1f8b8d68fe6f74dcb4428c860157fae3de Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 25 Jun 2014 13:37:56 -0600 Subject: note need to push the updated repo with production binaries during release --- Releasing | 1 + 1 file changed, 1 insertion(+) diff --git a/Releasing b/Releasing index c5ecdf34..a1c510fd 100644 --- a/Releasing +++ b/Releasing @@ -78,6 +78,7 @@ These are Bdale's notes on how to do a release. src/telemetrum-v2.0/flash-loader/*.elf \ ~/altusmetrumllc/Binaries/loaders/ (cd ~/altusmetrumllc ; git add Binaries ; git commit -a) + (cd ~/altusmetrumllc ; git push) - copy the relevant release notes file from doc/ to /home/bdale/web/altusmetrum/AltOS/releases/ -- cgit v1.2.3 From 98c3c3f7edd58358939f7dacf5b8f4c336712f5b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:38:53 -0700 Subject: altosui/telegps: Undo the frequency/telemetry menu changes Using menus for these items isn't what we want; we want to show the current value on the screen, which is what a combo box is for. Switch back to those and remove the frequency and telemetry config from the TeleGPS menu bar so that Mac OS X is happy. Signed-off-by: Keith Packard --- altosui/AltosConfigTDUI.java | 33 ++++-- altosui/AltosConfigUI.java | 9 +- altosui/AltosFlightUI.java | 65 +++++++---- altosui/AltosIdleMonitorUI.java | 4 +- altosuilib/AltosFreqList.java | 206 ----------------------------------- altosuilib/AltosUIFreqList.java | 85 +++++++++++++++ altosuilib/AltosUITelemetryList.java | 47 ++++++++ altosuilib/AltosUITelemetryMenu.java | 88 --------------- altosuilib/Makefile.am | 4 +- telegps/TeleGPS.java | 28 +++-- telegps/TeleGPSConfigUI.java | 10 +- 11 files changed, 229 insertions(+), 350 deletions(-) delete mode 100644 altosuilib/AltosFreqList.java create mode 100644 altosuilib/AltosUIFreqList.java create mode 100644 altosuilib/AltosUITelemetryList.java delete mode 100644 altosuilib/AltosUITelemetryMenu.java diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index ca365718..947d78ee 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -44,8 +44,7 @@ public class AltosConfigTDUI JLabel product_value; JLabel version_value; JLabel serial_value; - JMenuBar radio_frequency_menu_bar; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JLabel radio_calibration_value; JButton save; @@ -55,7 +54,6 @@ public class AltosConfigTDUI ActionListener listener; - /* A window listener to catch closing events and tell the config code */ class ConfigListener extends WindowAdapter { AltosConfigTDUI ui; @@ -167,11 +165,9 @@ public class AltosConfigTDUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(false); + radio_frequency_value = new AltosUIFreqList(); radio_frequency_value.addItemListener(this); - radio_frequency_menu_bar = new JMenuBar(); - radio_frequency_menu_bar.add(radio_frequency_value); - pane.add(radio_frequency_menu_bar, c); + pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); /* Radio Calibration */ @@ -311,7 +307,28 @@ public class AltosConfigTDUI } public void set_radio_frequency(double new_radio_frequency) { - radio_frequency_value.set_frequency(new_radio_frequency); + int i; + for (i = 0; i < radio_frequency_value.getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); + + if (f.close(new_radio_frequency)) { + radio_frequency_value.setSelectedIndex(i); + return; + } + } + for (i = 0; i < radio_frequency_value.getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i); + + if (new_radio_frequency < f.frequency) + break; + } + String description = String.format("%s serial %s", + product_value.getText(), + serial_value.getText()); + AltosFrequency new_frequency = new AltosFrequency(new_radio_frequency, description); + AltosPreferences.add_common_frequency(new_frequency); + radio_frequency_value.insertItemAt(new_frequency, i); + radio_frequency_value.setSelectedIndex(i); } public double radio_frequency() { diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index de1b582e..91c37fd5 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -59,7 +59,7 @@ public class AltosConfigUI JComboBox main_deploy_value; JComboBox apogee_delay_value; JComboBox apogee_lockout_value; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; @@ -432,12 +432,9 @@ public class AltosConfigUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(); + radio_frequency_value = new AltosUIFreqList(); radio_frequency_value.addItemListener(this); - - JMenuBar menu_bar = new JMenuBar(); - menu_bar.add(radio_frequency_value); - pane.add(menu_bar, c); + pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 5aff1817..5db0ee92 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -169,18 +169,14 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { exit_on_close = true; } - Container bag; - - JMenuBar menu_bar; - AltosFreqList frequencies; - AltosUITelemetryMenu telemetries; + Container bag; + AltosUIFreqList frequencies; + AltosUITelemetryList telemetries; JLabel telemetry; ActionListener show_timer; public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) { - super(); - AltosUIPreferences.set_component(this); displays = new LinkedList(); @@ -197,12 +193,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { /* Stick channel selector at top of table for telemetry monitoring */ if (serial >= 0) { - - menu_bar = new JMenuBar(); - setJMenuBar(menu_bar); - - // Channel menu - frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial)); + // Frequency menu + frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial)); frequencies.set_product("Monitor"); frequencies.set_serial(serial); frequencies.addActionListener(new ActionListener() { @@ -216,19 +208,43 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { reader.save_frequency(); } }); - menu_bar.add (frequencies); - - // Telemetry format menu - if (reader.supports_telemetry(AltosLib.ao_telemetry_standard)) { - telemetries = new AltosUITelemetryMenu(serial); + c.gridx = 0; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.insets = new Insets(3, 3, 3, 3); + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (frequencies, c); + + // Telemetry format list + if (reader.supports_telemetry(Altos.ao_telemetry_standard)) { + telemetries = new JComboBox(); + for (int i = 1; i <= Altos.ao_telemetry_max; i++) + telemetries.addItem(Altos.telemetry_name(i)); + int telemetry = AltosPreferences.telemetry(serial); + if (telemetry <= Altos.ao_telemetry_off || + telemetry > Altos.ao_telemetry_max) + telemetry = Altos.ao_telemetry_standard; + telemetries.setSelectedIndex(telemetry - 1); + telemetries.setMaximumRowCount(Altos.ao_telemetry_max); + telemetries.setPreferredSize(null); + telemetries.revalidate(); telemetries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int telemetry = telemetries.get_selected(); + int telemetry = telemetries.getSelectedIndex() + 1; reader.set_telemetry(telemetry); reader.save_telemetry(); } }); - menu_bar.add(telemetries); + c.gridx = 1; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (telemetries, c); + c.insets = new Insets(0, 0, 0, 0); } else { String version; @@ -240,7 +256,14 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { version = "Telemetry: None"; telemetry = new JLabel(version); - menu_bar.add(telemetry); + c.gridx = 1; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (telemetry, c); + c.insets = new Insets(0, 0, 0, 0); } } diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 63d86291..67b7a989 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -103,7 +103,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl } Container bag; - AltosFreqList frequencies; + AltosUIFreqList frequencies; JTextField callsign_value; /* DocumentListener interface methods */ @@ -200,7 +200,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl /* Stick frequency selector at top of table for telemetry monitoring */ if (remote && serial >= 0) { // Frequency menu - frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial)); + frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial)); frequencies.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { double frequency = frequencies.frequency(); diff --git a/altosuilib/AltosFreqList.java b/altosuilib/AltosFreqList.java deleted file mode 100644 index 293ce032..00000000 --- a/altosuilib/AltosFreqList.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright © 2011 Keith Packard - * - * 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; version 2 of the License. - * - * 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. - */ - -package org.altusmetrum.altosuilib_3; - -import java.util.*; -import javax.swing.*; -import java.awt.event.*; -import org.altusmetrum.altoslib_5.*; - -class FreqEntry extends JMenuItem { - AltosFrequency frequency; - - public FreqEntry(AltosFrequency frequency) { - super(frequency.toShortString()); - this.frequency = frequency; - } -} - -public class AltosFreqList extends JMenu implements ActionListener { - - String product; - int serial; - int calibrate; - - AltosFrequency[] frequencies = new AltosFrequency[0]; - - int selected = -1; - - LinkedList action_listeners = new LinkedList(); - - public void addActionListener(ActionListener listener) { - action_listeners.add(listener); - } - - public void removeActionListener(ActionListener listener) { - action_listeners.remove(listener); - } - - public void actionPerformed(ActionEvent ev) { - FreqEntry e = (FreqEntry) ev.getSource(); - set_selected(e.frequency); - ActionEvent event = new ActionEvent(e.frequency, 0, "selected"); - for (ActionListener l : action_listeners) - l.actionPerformed(event); - } - - boolean label = true; - - public void set_label(boolean label) { - this.label = label; - set_label(); - } - - private void set_label() { - String new_text = ""; - if (0 <= selected && selected < frequencies.length) { - AltosFrequency frequency = frequencies[selected]; - new_text = String.format("%s%7.3f MHz (%s) ▾", - label ? "Frequency: " : "", - frequency.frequency, - frequency.description); - } - setText(new_text); - } - - private void set_selected(AltosFrequency frequency) { - for (int i = 0; i < frequencies.length; i++) { - if (frequencies[i].frequency == frequency.frequency) { - selected = i; - set_label(); - } - } - } - - private AltosFrequency get_selected() { - if (0 <= selected && selected < frequencies.length) - return frequencies[selected]; - return null; - } - - private void add(AltosFrequency add) { - int insert; - - for (insert = 0; insert < frequencies.length; insert++) { - if (frequencies[insert].frequency == add.frequency) - return; - if (add.frequency < frequencies[insert].frequency) - break; - } - - AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length + 1]; - - for (int before = 0; before < insert; before++) - new_frequencies[before] = frequencies[before]; - new_frequencies[insert] = add; - - for (int after = insert; after < frequencies.length; after++) - new_frequencies[after+1] = frequencies[after]; - - frequencies = new_frequencies; - - FreqEntry e = new FreqEntry(add); - add(e, insert); - e.addActionListener(this); - } - - private void remove(AltosFrequency remove) { - int delete; - for (delete = 0; delete < frequencies.length; delete++) { - if (frequencies[delete].frequency == remove.frequency) - break; - if (remove.frequency < frequencies[delete].frequency) - return; - } - - remove(delete); - - AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length - 1]; - - for (int before = 0; before < delete; before++) - new_frequencies[before] = frequencies[before]; - - for (int after = delete + 1; after < frequencies.length; after++) - new_frequencies[after-1] = frequencies[after]; - frequencies = new_frequencies; - } - - public void set_frequency(double new_frequency) { - int i; - - if (new_frequency < 0) { - setVisible(false); - return; - } - - for (i = 0; i < frequencies.length; i++) { - AltosFrequency f = frequencies[i]; - - if (f.close(new_frequency)) { - set_selected(f); - return; - } - } - - String description = String.format("%s serial %d", product, serial); - AltosFrequency frequency = new AltosFrequency(new_frequency, description); - AltosUIPreferences.add_common_frequency(frequency); - - add(frequency); - set_selected(frequency); - } - - public void set_product(String new_product) { - product = new_product; - } - - public void set_serial(int new_serial) { - serial = new_serial; - } - - public double frequency() { - AltosFrequency f = get_selected(); - if (f != null) - return f.frequency; - return 434.550; - } - - public AltosFreqList(double in_frequency, boolean label) { - super(); - this.label = label; - - for (AltosFrequency frequency: AltosUIPreferences.common_frequencies()) - add(frequency); - product = "Unknown"; - serial = 0; - - if (in_frequency != 0) - set_frequency(in_frequency); - } - public AltosFreqList(double in_frequency) { - this(in_frequency, true); - } - - public AltosFreqList (boolean label) { - this(0, label); - } - - public AltosFreqList () { - this(0, true); - } -} diff --git a/altosuilib/AltosUIFreqList.java b/altosuilib/AltosUIFreqList.java new file mode 100644 index 00000000..f1f83dd5 --- /dev/null +++ b/altosuilib/AltosUIFreqList.java @@ -0,0 +1,85 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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; version 2 of the License. + * + * 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. + */ + +package org.altusmetrum.altosuilib_3; + +import javax.swing.*; +import org.altusmetrum.altoslib_5.*; + +public class AltosUIFreqList extends JComboBox { + + String product; + int serial; + int calibrate; + + public void set_frequency(double new_frequency) { + int i; + + if (new_frequency < 0) { + setVisible(false); + return; + } + + for (i = 0; i < getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) getItemAt(i); + + if (f.close(new_frequency)) { + setSelectedIndex(i); + return; + } + } + for (i = 0; i < getItemCount(); i++) { + AltosFrequency f = (AltosFrequency) getItemAt(i); + + if (new_frequency < f.frequency) + break; + } + String description = String.format("%s serial %d", product, serial); + AltosFrequency frequency = new AltosFrequency(new_frequency, description); + AltosUIPreferences.add_common_frequency(frequency); + insertItemAt(frequency, i); + setMaximumRowCount(getItemCount()); + } + + public void set_product(String new_product) { + product = new_product; + } + + public void set_serial(int new_serial) { + serial = new_serial; + } + + public double frequency() { + AltosFrequency f = (AltosFrequency) getSelectedItem(); + if (f != null) + return f.frequency; + return 434.550; + } + + public AltosUIFreqList () { + super(AltosUIPreferences.common_frequencies()); + setMaximumRowCount(getItemCount()); + setEditable(false); + product = "Unknown"; + serial = 0; + } + + public AltosUIFreqList(double in_frequency) { + this(); + set_frequency(in_frequency); + } +} diff --git a/altosuilib/AltosUITelemetryList.java b/altosuilib/AltosUITelemetryList.java new file mode 100644 index 00000000..facfdcde --- /dev/null +++ b/altosuilib/AltosUITelemetryList.java @@ -0,0 +1,47 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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. + */ + +package org.altusmetrum.altosuilib_3; + +import java.util.*; +import javax.swing.*; +import org.altusmetrum.altoslib_5.*; + + +public class AltosUITelemetryList extends JComboBox { + public int get_selected() { + return getSelectedIndex() + 1; + } + + public void set_selected(int telemetry) { + setSelectedIndex(telemetry-1); + } + + public AltosUITelemetryList(int serial) { + super(); + for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++) + addItem(AltosLib.telemetry_name(i)); + + int telemetry = AltosPreferences.telemetry(serial); + if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry) + telemetry = AltosLib.ao_telemetry_standard; + setMaximumRowCount(AltosLib.ao_telemetry_max); + set_selected(telemetry); + revalidate(); + } +} + diff --git a/altosuilib/AltosUITelemetryMenu.java b/altosuilib/AltosUITelemetryMenu.java deleted file mode 100644 index 893c3c44..00000000 --- a/altosuilib/AltosUITelemetryMenu.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright © 2014 Keith Packard - * - * 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; version 2 of the License. - * - * 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. - */ - -package org.altusmetrum.altosuilib_3; - -import java.util.*; -import javax.swing.*; -import java.awt.event.*; -import org.altusmetrum.altoslib_5.*; - -class TelemetryMenuItem extends JMenuItem { - public int telemetry; - - public TelemetryMenuItem (int telemetry) { - super(AltosLib.telemetry_name(telemetry)); - this.telemetry = telemetry; - } -} - -public class AltosUITelemetryMenu extends JMenu implements ActionListener { - TelemetryMenuItem selected = null; - - public int get_selected() { - if (selected == null) - return AltosLib.ao_telemetry_off; - return selected.telemetry; - } - - public void set_selected(int telemetry) { - for (int i = 0; i < getItemCount(); i++) { - TelemetryMenuItem item = (TelemetryMenuItem) getItem(i); - if (item.telemetry == telemetry) { - selected = item; - String new_text = String.format("Format: %s ▾", AltosLib.telemetry_name(telemetry)); - setText(new_text); - break; - } - } - } - - private LinkedList action_listeners = new LinkedList(); - - public void addActionListener(ActionListener l) { - action_listeners.add(l); - } - - public void removeActionListener(ActionListener l) { - action_listeners.remove(l); - } - - public void actionPerformed(ActionEvent e) { - TelemetryMenuItem item = (TelemetryMenuItem) e.getSource(); - set_selected(item.telemetry); - ActionEvent my_e = new ActionEvent(selected, 0, "selected"); - for (ActionListener l : action_listeners) - l.actionPerformed(my_e); - } - - public AltosUITelemetryMenu(int serial) { - super(); - for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++) { - TelemetryMenuItem item = new TelemetryMenuItem(i); - - item.addActionListener(this); - add(item); - } - - int telemetry = AltosPreferences.telemetry(serial); - if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry) - telemetry = AltosLib.ao_telemetry_standard; - set_selected(telemetry); - } -} - diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index 56b01ec5..40e6dda5 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -36,7 +36,6 @@ altosuilib_JAVA = \ AltosVoice.java \ AltosDisplayThread.java \ AltosDeviceUIDialog.java \ - AltosFreqList.java \ AltosSerial.java \ AltosSerialInUseException.java \ AltosConfigFreqUI.java \ @@ -82,7 +81,8 @@ altosuilib_JAVA = \ AltosUIIndicator.java \ AltosUIUnitsIndicator.java \ AltosUIVoltageIndicator.java \ - AltosUITelemetryMenu.java \ + AltosUIFreqList.java \ + AltosUITelemetryList.java \ OSXAdapter.java JAR=altosuilib_$(ALTOSUILIB_VERSION).jar diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index e78c2124..7e5ff42a 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -58,7 +58,7 @@ public class TeleGPS JMenu file_menu; JMenu monitor_menu; JMenu device_menu; - AltosFreqList frequencies; + AltosUIFreqList frequencies; ActionListener frequency_listener; Container bag; @@ -351,18 +351,17 @@ public class TeleGPS frequencies.set_product("Monitor"); frequencies.set_serial(serial); frequencies.set_frequency(AltosUIPreferences.frequency(serial)); + frequencies.setEnabled(true); - menu_bar.add(frequencies); - menu_bar.repaint(); } void disable_frequency_menu() { - if (frequency_listener == null) - return; - frequencies.removeActionListener(frequency_listener); - menu_bar.remove(frequencies); - menu_bar.repaint(); - frequency_listener = null; + if (frequency_listener != null) { + frequencies.removeActionListener(frequency_listener); + frequencies.setEnabled(false); + frequency_listener = null; + } + } public void set_reader(AltosFlightReader reader, AltosDevice device) { @@ -457,7 +456,16 @@ public class TeleGPS file_menu = make_menu("File", file_menu_entries); monitor_menu = make_menu("Monitor", monitor_menu_entries); device_menu = make_menu("Device", device_menu_entries); - frequencies = new AltosFreqList(); + + frequencies = new AltosUIFreqList(); + frequencies.setEnabled(false); + c.gridx = 0; + c.gridy = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + c.weightx = 0; + c.gridwidth = 1; + bag.add(frequencies, c); displays = new LinkedList(); diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index ee2fbd2d..e5ac6d7e 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -50,7 +50,7 @@ public class TeleGPSConfigUI JLabel product_value; JLabel version_value; JLabel serial_value; - AltosFreqList radio_frequency_value; + AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; JComboBox aprs_interval_value; @@ -270,13 +270,9 @@ public class TeleGPSConfigUI c.anchor = GridBagConstraints.LINE_START; c.insets = ir; c.ipady = 5; - radio_frequency_value = new AltosFreqList(); + radio_frequency_value = new AltosUIFreqList(); radio_frequency_value.addItemListener(this); - - JMenuBar menu_bar = new JMenuBar(); - menu_bar.add(radio_frequency_value); - - pane.add(menu_bar, c); + pane.add(radio_frequency_value, c); radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency"); row++; -- cgit v1.2.3 From d6e64790287d684cb9b70c67fa270825932cc020 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 25 Jun 2014 13:50:54 -0700 Subject: altoslib: Disable telemetry while getting config data We're seeing some log files created without a suitable -via- number included. My hypothesis is that incoming telemetry is getting interleaved with the configuration data containing the serial number. This change simply disables telemetry while retrieving the configuration data to try and keep that from happening. Signed-off-by: Keith Packard --- altoslib/AltosLink.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java index 08bca5fc..ef40c8cb 100644 --- a/altoslib/AltosLink.java +++ b/altoslib/AltosLink.java @@ -385,8 +385,12 @@ public abstract class AltosLink implements Runnable { public AltosConfigData config_data() throws InterruptedException, TimeoutException { synchronized(config_data_lock) { - if (config_data == null) + if (config_data == null) { + printf("m 0\n"); config_data = new AltosConfigData(this); + if (monitor_mode) + set_monitor(true); + } return config_data; } } -- cgit v1.2.3 From 2e99ff2c99f5d4a2fa196507e794c690665ab39e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:20:51 -0700 Subject: altoslib: Preserve receiver_serial across state reset for new transmitter When the transmitter serial or flight number changes, we re-init the state information, but we want to preserve the receiver serial number so that the log file has that in the name Signed-off-by: Keith Packard --- altoslib/AltosState.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index e0c00602..5e7908af 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -1024,15 +1024,21 @@ public class AltosState implements Cloneable { firmware_version = version; } + private void re_init() { + int bt = boost_tick; + int rs = receiver_serial; + init(); + boost_tick = bt; + receiver_serial = rs; + } + public void set_flight(int flight) { /* When the flight changes, reset the state */ - if (flight != AltosLib.MISSING && flight != 0) { + if (flight != AltosLib.MISSING) { if (this.flight != AltosLib.MISSING && this.flight != flight) { - int bt = boost_tick; - init(); - boost_tick = bt; + re_init(); } this.flight = flight; } @@ -1043,9 +1049,7 @@ public class AltosState implements Cloneable { if (serial != AltosLib.MISSING) { if (this.serial != AltosLib.MISSING && this.serial != serial) { - int bt = boost_tick; - init(); - boost_tick = bt; + re_init(); } this.serial = serial; } -- cgit v1.2.3 From cb15cb8db5ef570b57f89d4e58734554542f99ff Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:22:20 -0700 Subject: altosuilib: Remove debug printfs from map cache Just annoying Signed-off-by: Keith Packard --- altosuilib/AltosUIMapCache.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/altosuilib/AltosUIMapCache.java b/altosuilib/AltosUIMapCache.java index 9cc32e24..b9064cf4 100644 --- a/altosuilib/AltosUIMapCache.java +++ b/altosuilib/AltosUIMapCache.java @@ -52,8 +52,6 @@ public class AltosUIMapCache implements AltosUIMapCacheListener { if (new_size == cache_size) return; - System.out.printf("cache size now %d\n", new_size); - synchronized(cache_lock) { AltosUIMapImage[] new_images = new AltosUIMapImage[new_size]; @@ -94,12 +92,8 @@ public class AltosUIMapCache implements AltosUIMapCacheListener { try { image = new AltosUIMapImage(tile, store); image.used = used++; - if (images[oldest] != null) { - System.out.printf("drop %s\n", images[oldest].store.file.toString()); + if (images[oldest] != null) images[oldest].flush(); - } - - System.out.printf("load %s\n", store.file.toString()); images[oldest] = image; -- cgit v1.2.3 From 500353ec83af0da7fce3d67f2707f4725b1f50ba Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:42:43 -0700 Subject: altos: ao_rssi subsystem needs to use AO_LED_TYPE instead of uint8_t Signed-off-by: Keith Packard --- src/kernel/ao.h | 2 +- src/kernel/ao_rssi.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 5ff9b518..b8189e43 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -761,7 +761,7 @@ void ao_rssi_set(int rssi_value); void -ao_rssi_init(uint8_t rssi_led); +ao_rssi_init(AO_LED_TYPE rssi_led); /* * ao_product.c diff --git a/src/kernel/ao_rssi.c b/src/kernel/ao_rssi.c index 244a84fe..f8eeb217 100644 --- a/src/kernel/ao_rssi.c +++ b/src/kernel/ao_rssi.c @@ -17,9 +17,9 @@ #include "ao.h" -static __xdata uint16_t ao_rssi_time; -static __pdata uint16_t ao_rssi_delay; -static __pdata uint8_t ao_rssi_led; +static __xdata uint16_t ao_rssi_time; +static __pdata uint16_t ao_rssi_delay; +static __pdata AO_LED_TYPE ao_rssi_led; void ao_rssi(void) @@ -45,7 +45,7 @@ ao_rssi_set(int rssi_value) __xdata struct ao_task ao_rssi_task; void -ao_rssi_init(uint8_t rssi_led) +ao_rssi_init(AO_LED_TYPE rssi_led) { ao_rssi_led = rssi_led; ao_rssi_delay = 0; -- cgit v1.2.3 From 48508479b0f6f8d6e73db1cae8ee8acdaba022d8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:45:01 -0700 Subject: altos: Stop sticking cc1111 firmware in src directory This just clutters src. Signed-off-by: Keith Packard --- src/product/Makefile.teledongle | 2 +- src/product/Makefile.telelaunch | 2 +- src/product/Makefile.telenano | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/product/Makefile.teledongle b/src/product/Makefile.teledongle index 81151364..b7c28987 100644 --- a/src/product/Makefile.teledongle +++ b/src/product/Makefile.teledongle @@ -83,7 +83,7 @@ quiet ?= $($1) all: $(PROG) $(PROG): $(REL) Makefile - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version diff --git a/src/product/Makefile.telelaunch b/src/product/Makefile.telelaunch index 90fe7833..7311c21e 100644 --- a/src/product/Makefile.telelaunch +++ b/src/product/Makefile.telelaunch @@ -85,7 +85,7 @@ quiet ?= $($1) all: $(PROG) $(PROG): $(REL) Makefile - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version diff --git a/src/product/Makefile.telenano b/src/product/Makefile.telenano index d2fcb6d8..e1e350a6 100644 --- a/src/product/Makefile.telenano +++ b/src/product/Makefile.telenano @@ -85,7 +85,7 @@ quiet ?= $($1) all: $(PROG) $(PROG): $(REL) Makefile - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) .. + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ ao_product.h: ao-make-product.5c ../Version -- cgit v1.2.3 From 657d455a2fad36193e6b3a7037d9ba7f09ae1168 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:46:07 -0700 Subject: altos: Use TeleMetrum v1.9 board for MegaDongle experiments This configures the MegaDongle v0.1 directory to use the pin assignments in TeleMetrum v1.9 boards. Signed-off-by: Keith Packard --- src/kernel/ao.h | 4 ++- src/kernel/ao_monitor.c | 4 ++- src/kernel/ao_rssi.c | 2 +- src/megadongle-v0.1/Makefile | 1 + src/megadongle-v0.1/ao_megadongle.c | 4 +-- src/megadongle-v0.1/ao_pins.h | 49 +++++++++++++++---------------------- 6 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index b8189e43..1df2ea8b 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -757,11 +757,13 @@ extern __xdata uint8_t ao_force_freq; * ao_rssi.c */ +#ifdef AO_LED_TYPE void -ao_rssi_set(int rssi_value); +ao_rssi_set(int16_t rssi_value); void ao_rssi_init(AO_LED_TYPE rssi_led); +#endif /* * ao_product.c diff --git a/src/kernel/ao_monitor.c b/src/kernel/ao_monitor.c index 18f170b4..2d75c41c 100644 --- a/src/kernel/ao_monitor.c +++ b/src/kernel/ao_monitor.c @@ -115,6 +115,8 @@ ao_monitor_put(void) { #if LEGACY_MONITOR __xdata char callsign[AO_MAX_CALLSIGN+1]; +#endif +#if LEGACY_MONITOR || HAS_RSSI int16_t rssi; #endif uint8_t ao_monitor_tail; @@ -240,7 +242,7 @@ ao_monitor_put(void) hex(sum); putchar ('\n'); #if HAS_RSSI - if (recv_raw.packet[ao_monitoring + 1] & PKT_APPEND_STATUS_1_CRC_OK) { + if (recv_raw.packet[ao_monitoring + 1] & AO_RADIO_STATUS_CRC_OK) { rssi = AO_RSSI_FROM_RADIO(recv_raw.packet[ao_monitoring]); ao_rssi_set(rssi); } diff --git a/src/kernel/ao_rssi.c b/src/kernel/ao_rssi.c index f8eeb217..793b190b 100644 --- a/src/kernel/ao_rssi.c +++ b/src/kernel/ao_rssi.c @@ -33,7 +33,7 @@ ao_rssi(void) } void -ao_rssi_set(int rssi_value) +ao_rssi_set(int16_t rssi_value) { if (rssi_value > 0) rssi_value = 0; diff --git a/src/megadongle-v0.1/Makefile b/src/megadongle-v0.1/Makefile index ade8e496..bbe2ea58 100644 --- a/src/megadongle-v0.1/Makefile +++ b/src/megadongle-v0.1/Makefile @@ -53,6 +53,7 @@ ALTOS_SRC = \ ao_rssi.c \ ao_send_packet.c \ ao_packet_master.c \ + ao_eeprom_stm.c \ ao_packet.c PRODUCT=MegaDongle-v0.1 diff --git a/src/megadongle-v0.1/ao_megadongle.c b/src/megadongle-v0.1/ao_megadongle.c index 2792af22..68d6de60 100644 --- a/src/megadongle-v0.1/ao_megadongle.c +++ b/src/megadongle-v0.1/ao_megadongle.c @@ -24,7 +24,7 @@ int main(void) { ao_clock_init(); - + #if HAS_STACK_GUARD ao_mpu_init(); #endif @@ -48,7 +48,7 @@ main(void) ao_send_packet_init(); ao_config_init(); - + ao_start_scheduler(); return 0; } diff --git a/src/megadongle-v0.1/ao_pins.h b/src/megadongle-v0.1/ao_pins.h index d460a490..9edd91f4 100644 --- a/src/megadongle-v0.1/ao_pins.h +++ b/src/megadongle-v0.1/ao_pins.h @@ -15,6 +15,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +/* Using TeleMetrum v1.9 board */ + #ifndef _AO_PINS_H_ #define _AO_PINS_H_ @@ -46,7 +48,7 @@ #define HAS_SERIAL_1 0 #define USE_SERIAL_1_STDIN 0 #define SERIAL_1_PB6_PB7 0 -#define SERIAL_1_PA9_PA10 1 +#define SERIAL_1_PA9_PA10 0 #define HAS_SERIAL_2 0 #define USE_SERIAL_2_STDIN 0 @@ -56,19 +58,18 @@ #define HAS_SERIAL_3 0 #define USE_SERIAL_3_STDIN 0 #define SERIAL_3_PB10_PB11 0 -#define SERIAL_3_PC10_PC11 1 +#define SERIAL_3_PC10_PC11 0 #define SERIAL_3_PD8_PD9 0 -#define ao_gps_getchar ao_serial3_getchar -#define ao_gps_putchar ao_serial3_putchar -#define ao_gps_set_speed ao_serial3_set_speed - -#define HAS_EEPROM 0 -#define USE_INTERNAL_FLASH 0 +#define HAS_EEPROM 1 +#define USE_INTERNAL_FLASH 1 +#define USE_STORAGE_CONFIG 0 +#define USE_EEPROM_CONFIG 1 #define HAS_USB 1 #define HAS_BEEP 0 #define HAS_RADIO 1 #define HAS_TELEMETRY 0 +#define HAS_RSSI 1 #define HAS_SPI_1 0 #define SPI_1_PA5_PA6_PA7 0 /* Barometer */ @@ -76,7 +77,7 @@ #define SPI_1_PE13_PE14_PE15 0 /* Accelerometer */ #define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ +#define SPI_2_PB13_PB14_PB15 1 /* Radio */ #define SPI_2_PD1_PD3_PD4 0 #define SPI_2_OSPEEDR STM_OSPEEDR_10MHz @@ -85,27 +86,17 @@ #define SPI_2_MISO_PIN 14 #define SPI_2_MOSI_PIN 15 -#define HAS_I2C_1 0 -#define I2C_1_PB8_PB9 1 - -#define HAS_I2C_2 0 -#define I2C_2_PB10_PB11 1 - #define PACKET_HAS_SLAVE 0 #define PACKET_HAS_MASTER 1 #define LOW_LEVEL_DEBUG 0 -#define LED_PORT_0_ENABLE STM_RCC_AHBENR_GPIOAEN -#define LED_PORT_1_ENABLE STM_RCC_AHBENR_GPIOBEN -#define LED_PORT_0 (&stm_gpioa) -#define LED_PORT_0_MASK (0xff) +#define LED_PORT_0_ENABLE STM_RCC_AHBENR_GPIOCEN +#define LED_PORT_0 (&stm_gpioc) +#define LED_PORT_0_MASK (0xffff) #define LED_PORT_0_SHIFT 0 -#define LED_PORT_1_MASK (0xff00) -#define LED_PORT_1_SHIFT 0 -#define LED_PORT_1 (&stm_gpiob) -#define LED_PIN_RED 1 -#define LED_PIN_GREEN 12 +#define LED_PIN_RED 14 +#define LED_PIN_GREEN 15 #define AO_LED_RED (1 << LED_PIN_RED) #define AO_LED_GREEN (1 << LED_PIN_GREEN) @@ -134,15 +125,15 @@ #define AO_FEC_DEBUG 0 #define AO_CC1120_SPI_CS_PORT (&stm_gpioa) -#define AO_CC1120_SPI_CS_PIN 0 +#define AO_CC1120_SPI_CS_PIN 2 #define AO_CC1120_SPI_BUS AO_SPI_2_PB13_PB14_PB15 #define AO_CC1120_SPI stm_spi2 -#define AO_CC1120_INT_PORT (&stm_gpioc) -#define AO_CC1120_INT_PIN 13 +#define AO_CC1120_INT_PORT (&stm_gpioa) +#define AO_CC1120_INT_PIN 3 -#define AO_CC1120_MCU_WAKEUP_PORT (&stm_gpioc) -#define AO_CC1120_MCU_WAKEUP_PIN (0) +#define AO_CC1120_MCU_WAKEUP_PORT (&stm_gpioa) +#define AO_CC1120_MCU_WAKEUP_PIN (4) #define AO_CC1120_INT_GPIO 2 #define AO_CC1120_INT_GPIO_IOCFG CC1120_IOCFG2 -- cgit v1.2.3 From f8567a7be7ccd5dcc57ab65e63efe45e62008127 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:26:57 -0700 Subject: altos: Reduce configuration data telemetry to once per 5 seconds This data is constant, so we don't need to send it very often. Once every five seconds should be plenty. Signed-off-by: Keith Packard --- src/kernel/ao_telemetry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index 9f778b09..6fb30069 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -521,7 +521,7 @@ ao_telemetry_set_interval(uint16_t interval) ao_telemetry_companion_cur = cur; #endif - ao_telemetry_config_max = AO_SEC_TO_TICKS(1) / interval; + ao_telemetry_config_max = AO_SEC_TO_TICKS(5) / interval; #if HAS_COMPANION if (ao_telemetry_config_max > cur) cur++; -- cgit v1.2.3 From 0605b5a1cdff5cfd71fc9ef3161a62d74a1124b4 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:42:10 -0700 Subject: altos: Add defines for 2400 and 9600 baud telemetry rates Signed-off-by: Keith Packard --- src/kernel/ao.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 1df2ea8b..6c6abd36 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -521,6 +521,10 @@ struct ao_telemetry_raw_recv { #define AO_TELEMETRY_INTERVAL_RECOVER AO_MS_TO_TICKS(1000) #endif +#define AO_RADIO_RATE_38400 0 +#define AO_RADIO_RATE_9600 1 +#define AO_RADIO_RATE_2400 2 + void ao_telemetry_set_interval(uint16_t interval); @@ -558,6 +562,15 @@ extern __xdata int8_t ao_radio_rssi; #define HAS_RADIO_XMIT HAS_RADIO #endif +#define AO_RADIO_RATE_38400 0 +#define AO_RADIO_RATE_9600 1 +#define AO_RADIO_RATE_2400 2 +#define AO_RADIO_RATE_MAX AO_RADIO_RATE_2400 + +#if defined(HAS_RADIO) && !defined(HAS_RADIO_RATE) +#define HAS_RADIO_RATE HAS_RADIO +#endif + void ao_radio_general_isr(void) ao_arch_interrupt(16); -- cgit v1.2.3 From 214a38eb2b084baec526aa42016eddb954038639 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:44:07 -0700 Subject: altos: Add config support for 2400 and 9600 baud telemetry rates Signed-off-by: Keith Packard --- src/kernel/ao_config.c | 33 +++++++++++++++++++++++++++++++++ src/kernel/ao_config.h | 5 ++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 58fa7354..52c0c4f6 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -62,6 +62,7 @@ __xdata uint8_t ao_config_mutex; #endif #define AO_CONFIG_DEFAULT_RADIO_AMP 0 #define AO_CONFIG_DEFAULT_APRS_SSID (ao_serial_number % 10) +#define AO_CONFIG_DEFAULT_RADIO_RATE AO_RADIO_RATE_38400 #if HAS_EEPROM static void @@ -196,6 +197,10 @@ _ao_config_get(void) #if HAS_APRS if (minor < 19) ao_config.aprs_ssid = AO_CONFIG_DEFAULT_APRS_SSID; +#endif +#if HAS_RADIO_RATE + if (minor < 20) + ao_config.radio_rate = AO_CONFIG_DEFAULT_RADIO_RATE; #endif ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; @@ -483,6 +488,30 @@ ao_config_radio_cal_set(void) __reentrant ao_config_set_radio(); _ao_config_edit_finish(); } + +#endif + +#if HAS_RADIO_RATE +void +ao_config_radio_rate_show(void) __reentrant +{ + printf("Telemetry rate: %d\n", ao_config.radio_rate); +} + +void +ao_config_radio_rate_set(void) __reentrant +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + if (AO_RADIO_RATE_MAX < ao_cmd_lex_i) { + ao_cmd_status = ao_cmd_lex_error; + return; + } + _ao_config_edit_start(); + ao_config.radio_rate = ao_cmd_lex_i; + _ao_config_edit_finish(); +} #endif #if HAS_LOG @@ -802,6 +831,10 @@ __code struct ao_config_var ao_config_vars[] = { ao_config_radio_enable_set, ao_config_radio_enable_show }, { "f \0Radio calib (cal = rf/(xtal/2^16))", ao_config_radio_cal_set, ao_config_radio_cal_show }, +#if HAS_RADIO_RATE + { "T \0Telemetry rate (0=38.4, 1=9.6, 2=2.4)", + ao_config_radio_rate_set, ao_config_radio_rate_show }, +#endif #if HAS_RADIO_POWER { "p \0Radio power setting (0-255)", ao_config_radio_power_set, ao_config_radio_power_show }, diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h index 70f9f33b..a650ffc6 100644 --- a/src/kernel/ao_config.h +++ b/src/kernel/ao_config.h @@ -53,7 +53,7 @@ #endif #define AO_CONFIG_MAJOR 1 -#define AO_CONFIG_MINOR 19 +#define AO_CONFIG_MINOR 20 #define AO_AES_LEN 16 @@ -105,6 +105,9 @@ struct ao_config { #if HAS_APRS uint8_t aprs_ssid; /* minor version 19 */ #endif +#if HAS_RADIO_RATE + uint8_t radio_rate; /* minor version 20 */ +#endif }; #define AO_IGNITE_MODE_DUAL 0 -- cgit v1.2.3 From ea5887027e7a39da2b7d84a142d74950b7a24703 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 5 Jul 2014 00:09:25 -0700 Subject: altos: Call ao_telemetry_reset_interval when telemetry rate changes This lets the radio code adjust the telemetry packet sending pattern when the data rate changes. Signed-off-by: Keith Packard --- src/cc1111/ao_pins.h | 15 +++++++++++++++ src/kernel/ao.h | 5 ++--- src/kernel/ao_config.c | 7 +++++++ src/kernel/ao_telemetry.c | 34 ++++++++++++++++++++++++++++++---- src/telebt-v1.0/ao_pins.h | 1 + src/telefire-v0.1/ao_pins.h | 3 ++- src/telefire-v0.2/ao_pins.h | 3 ++- src/telemini-v2.0/ao_pins.h | 1 + src/teleshield-v0.1/ao_pins.h | 1 + src/teleterra-v0.2/ao_pins.h | 2 +- 10 files changed, 62 insertions(+), 10 deletions(-) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index 2b19f1f6..b40acbbd 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -56,6 +56,7 @@ #define HAS_ACCEL 1 #define HAS_IGNITE 1 #define HAS_MONITOR 0 + #define HAS_TELEMETRY 1 #endif #if defined(TELEMETRUM_V_1_1) @@ -96,6 +97,7 @@ #define HAS_ACCEL 1 #define HAS_IGNITE 1 #define HAS_MONITOR 0 + #define HAS_TELEMETRY 1 #endif #if defined(TELEMETRUM_V_1_2) @@ -136,6 +138,7 @@ #define HAS_ACCEL 1 #define HAS_IGNITE 1 #define HAS_MONITOR 0 + #define HAS_TELEMETRY 1 #endif #if defined(TELEDONGLE_V_0_2) @@ -164,6 +167,7 @@ #define LEGACY_MONITOR 1 #define HAS_RSSI 1 #define HAS_AES 0 + #define HAS_TELEMETRY 0 #endif #if defined(TELEMINI_V_1_0) @@ -193,6 +197,8 @@ #define HAS_ACCEL 0 #define HAS_IGNITE 1 #define HAS_MONITOR 0 + #define HAS_TELEMETRY 1 + #define HAS_RADIO_RATE 0 /* not enough space for this */ #endif #if defined(TELENANO_V_0_1) @@ -220,6 +226,8 @@ #define HAS_ACCEL 0 #define HAS_IGNITE 0 #define HAS_MONITOR 0 + #define HAS_TELEMETRY 1 + #define HAS_RADIO_RATE 0 /* not enough space for this */ #endif #if defined(TELEMETRUM_V_0_1) @@ -252,6 +260,8 @@ #define HAS_ACCEL 1 #define HAS_IGNITE 1 #define HAS_MONITOR 0 + #define HAS_TELEMETRY 1 + #define HAS_RADIO_RATE 0 /* not enough space for this */ #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ((uint32_t) 127 * (uint32_t) 1024) #endif @@ -283,6 +293,7 @@ #define LEGACY_MONITOR 1 #define HAS_RSSI 1 #define HAS_AES 0 + #define HAS_TELEMETRY 0 #endif #if defined(TIDONGLE) @@ -312,6 +323,7 @@ #define LEGACY_MONITOR 1 #define HAS_RSSI 1 #define HAS_AES 0 + #define HAS_TELEMETRY 0 #endif #if defined(TELEBT_V_0_0) @@ -350,6 +362,7 @@ #define LEGACY_MONITOR 1 #define HAS_RSSI 0 #define HAS_AES 0 + #define HAS_TELEMETRY 0 #endif #if defined(TELEBT_V_0_1) @@ -396,6 +409,7 @@ #define LEGACY_MONITOR 1 #define HAS_RSSI 0 #define HAS_AES 0 + #define HAS_TELEMETRY 0 #endif #if defined(TELELAUNCH_V_0_1) @@ -428,6 +442,7 @@ #define HAS_IGNITE 1 #define HAS_MONITOR 0 #define HAS_AES 1 + #define HAS_TELEMETRY 0 #endif #if DBG_ON_P1 diff --git a/src/kernel/ao.h b/src/kernel/ao.h index 6c6abd36..c11aa028 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -521,9 +521,8 @@ struct ao_telemetry_raw_recv { #define AO_TELEMETRY_INTERVAL_RECOVER AO_MS_TO_TICKS(1000) #endif -#define AO_RADIO_RATE_38400 0 -#define AO_RADIO_RATE_9600 1 -#define AO_RADIO_RATE_2400 2 +void +ao_telemetry_reset_interval(void); void ao_telemetry_set_interval(uint16_t interval); diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 52c0c4f6..32a0967c 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -492,6 +492,10 @@ ao_config_radio_cal_set(void) __reentrant #endif #if HAS_RADIO_RATE +#ifndef HAS_TELEMETRY +#error Please define HAS_TELEMETRY +#endif + void ao_config_radio_rate_show(void) __reentrant { @@ -510,6 +514,9 @@ ao_config_radio_rate_set(void) __reentrant } _ao_config_edit_start(); ao_config.radio_rate = ao_cmd_lex_i; +#if HAS_TELEMETRY + ao_telemetry_reset_interval(); +#endif _ao_config_edit_finish(); } #endif diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index 6fb30069..f4fcf400 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -25,6 +25,10 @@ static __pdata uint16_t ao_telemetry_interval; +#if HAS_RADIO_RATE +static __pdata uint16_t ao_telemetry_desired_interval; +#endif + #if HAS_RDF static __pdata uint8_t ao_rdf = 0; static __pdata uint16_t ao_rdf_time; @@ -64,7 +68,7 @@ static void ao_send_sensor(void) { __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; - + telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_SENSOR; @@ -106,12 +110,13 @@ ao_send_sensor(void) #ifdef AO_SEND_MEGA + /* Send mega sensor packet */ static void ao_send_mega_sensor(void) { __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; - + telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_MEGA_SENSOR; @@ -240,7 +245,7 @@ static void ao_send_mini(void) { __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)]; - + telemetry.generic.tick = packet->tick; telemetry.generic.type = AO_TELEMETRY_MINI; @@ -490,12 +495,33 @@ ao_telemetry(void) } } +#if HAS_RADIO_RATE +void +ao_telemetry_reset_interval(void) +{ + ao_telemetry_set_interval(ao_telemetry_desired_interval); +} +#endif + void ao_telemetry_set_interval(uint16_t interval) { int8_t cur = 0; + +#if HAS_RADIO_RATE + /* Limit max telemetry rate based on available radio bandwidth. + */ + static const uint16_t min_interval[] = { + /* [AO_RADIO_RATE_38400] = */ AO_MS_TO_TICKS(100), + /* [AO_RADIO_RATE_9600] = */ AO_MS_TO_TICKS(500), + /* [AO_RADIO_RATE_2400] = */ AO_MS_TO_TICKS(1000) + }; + + ao_telemetry_desired_interval = interval; + if (interval < min_interval[ao_config.radio_rate]) + interval = min_interval[ao_config.radio_rate]; +#endif ao_telemetry_interval = interval; - #if AO_SEND_MEGA if (interval > 1) ao_telemetry_mega_data_max = 1; diff --git a/src/telebt-v1.0/ao_pins.h b/src/telebt-v1.0/ao_pins.h index 9e47f3b8..b5562573 100644 --- a/src/telebt-v1.0/ao_pins.h +++ b/src/telebt-v1.0/ao_pins.h @@ -48,6 +48,7 @@ #define BT_LINK_PIN P1_7 #define HAS_MONITOR 1 #define LEGACY_MONITOR 0 +#define HAS_TELEMETRY 0 #define HAS_ADC 1 #define AO_PAD_ADC_BATT 0 diff --git a/src/telefire-v0.1/ao_pins.h b/src/telefire-v0.1/ao_pins.h index f7a3ff2c..47ae663f 100644 --- a/src/telefire-v0.1/ao_pins.h +++ b/src/telefire-v0.1/ao_pins.h @@ -18,7 +18,8 @@ #ifndef _AO_PINS_H_ #define _AO_PINS_H_ -#define HAS_RADIO 1 +#define HAS_RADIO 1 +#define HAS_TELEMETRY 0 #define HAS_FLIGHT 0 #define HAS_USB 1 diff --git a/src/telefire-v0.2/ao_pins.h b/src/telefire-v0.2/ao_pins.h index 96e6b066..9e6631ce 100644 --- a/src/telefire-v0.2/ao_pins.h +++ b/src/telefire-v0.2/ao_pins.h @@ -18,7 +18,8 @@ #ifndef _AO_PINS_H_ #define _AO_PINS_H_ -#define HAS_RADIO 1 +#define HAS_RADIO 1 +#define HAS_TELEMETRY 0 #define HAS_FLIGHT 0 #define HAS_USB 1 diff --git a/src/telemini-v2.0/ao_pins.h b/src/telemini-v2.0/ao_pins.h index f202ccd1..c9f9de62 100644 --- a/src/telemini-v2.0/ao_pins.h +++ b/src/telemini-v2.0/ao_pins.h @@ -39,6 +39,7 @@ #define USE_INTERNAL_FLASH 0 #define HAS_DBG 0 #define PACKET_HAS_SLAVE 1 +#define HAS_RADIO_RATE 0 /* not enough space for this */ #define AO_LED_RED 2 #define LEDS_AVAILABLE AO_LED_RED diff --git a/src/teleshield-v0.1/ao_pins.h b/src/teleshield-v0.1/ao_pins.h index 30239afc..68bb44ee 100644 --- a/src/teleshield-v0.1/ao_pins.h +++ b/src/teleshield-v0.1/ao_pins.h @@ -62,6 +62,7 @@ #define HAS_RSSI 0 #define HAS_AES 0 #define HAS_RADIO 1 + #define HAS_TELEMETRY 0 #endif #if DBG_ON_P1 diff --git a/src/teleterra-v0.2/ao_pins.h b/src/teleterra-v0.2/ao_pins.h index 1c12c437..60d627ad 100644 --- a/src/teleterra-v0.2/ao_pins.h +++ b/src/teleterra-v0.2/ao_pins.h @@ -71,7 +71,7 @@ #define HAS_P2_ISR 1 #define BATTERY_PIN 5 - + #define HAS_TELEMETRY 0 #endif #if DBG_ON_P1 -- cgit v1.2.3 From c20ddde2f9eb0ad8dbb982e9d0cbe91639160a34 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:30:23 -0700 Subject: altos/cc1111: Adjust receive parameters to improve sensitivity This removes the packet quality test and carrier sense tests when deciding whether to start decoding a packet. This lets more bad packets through, but the CRC check catches those and now we're regularly receiving packets down to -110 or even -112 dBm. Before this change, we'd rarely see packets as low as -105dBm Signed-off-by: Keith Packard --- src/cc1111/ao_pins.h | 3 +++ src/cc1111/ao_radio.c | 51 ++++++++++++++++++++++++++++++--------- src/cc1111/cc1111.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++ src/telebt-v1.0/ao_pins.h | 1 + 4 files changed, 105 insertions(+), 11 deletions(-) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index b40acbbd..2d524188 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -168,6 +168,7 @@ #define HAS_RSSI 1 #define HAS_AES 0 #define HAS_TELEMETRY 0 + #define AO_RADIO_REG_TEST 1 #endif #if defined(TELEMINI_V_1_0) @@ -363,6 +364,7 @@ #define HAS_RSSI 0 #define HAS_AES 0 #define HAS_TELEMETRY 0 + #define AO_RADIO_REG_TEST 1 #endif #if defined(TELEBT_V_0_1) @@ -410,6 +412,7 @@ #define HAS_RSSI 0 #define HAS_AES 0 #define HAS_TELEMETRY 0 + #define AO_RADIO_REG_TEST 1 #endif #if defined(TELELAUNCH_V_0_1) diff --git a/src/cc1111/ao_radio.c b/src/cc1111/ao_radio.c index 190647ce..fbdf7762 100644 --- a/src/cc1111/ao_radio.c +++ b/src/cc1111/ao_radio.c @@ -126,9 +126,9 @@ static __code uint8_t radio_setup[] = { (CHANBW_M << RF_MDMCFG4_CHANBW_M_SHIFT) | (DRATE_E << RF_MDMCFG4_DRATE_E_SHIFT)), RF_MDMCFG3_OFF, (DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), - RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_OFF | + RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_ON | RF_MDMCFG2_MOD_FORMAT_GFSK | - RF_MDMCFG2_SYNC_MODE_15_16_THRES), + RF_MDMCFG2_SYNC_MODE_15_16), RF_MDMCFG1_OFF, (RF_MDMCFG1_FEC_EN | RF_MDMCFG1_NUM_PREAMBLE_4 | (2 << RF_MDMCFG1_CHANSPC_E_SHIFT)), @@ -155,8 +155,8 @@ static __code uint8_t radio_setup[] = { RF_FSCAL1_OFF, 0x00, RF_FSCAL0_OFF, 0x1F, - RF_TEST2_OFF, 0x88, - RF_TEST1_OFF, 0x31, + RF_TEST2_OFF, RF_TEST2_RX_LOW_DATA_RATE_MAGIC, + RF_TEST1_OFF, RF_TEST1_RX_LOW_DATA_RATE_MAGIC, RF_TEST0_OFF, 0x09, /* default sync values */ @@ -187,10 +187,16 @@ static __code uint8_t radio_setup[] = { RF_BSCFG_BS_POST_KI_PRE_KI| RF_BSCFG_BS_POST_KP_PRE_KP| RF_BSCFG_BS_LIMIT_0), - RF_AGCCTRL2_OFF, 0x03, - RF_AGCCTRL1_OFF, 0x40, - RF_AGCCTRL0_OFF, 0x91, - + RF_AGCCTRL2_OFF, (RF_AGCCTRL2_MAX_DVGA_GAIN_ALL| + RF_AGCCTRL2_MAX_LNA_GAIN_0| + RF_AGCCTRL2_MAGN_TARGET_33dB), + RF_AGCCTRL1_OFF, (RF_AGCCTRL1_AGC_LNA_PRIORITY_0 | + RF_AGCCTRL1_CARRIER_SENSE_REL_THR_DISABLE | + RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_0DB), + RF_AGCCTRL0_OFF, (RF_AGCCTRL0_HYST_LEVEL_NONE | + RF_AGCCTRL0_WAIT_TIME_8 | + RF_AGCCTRL0_AGC_FREEZE_NORMAL | + RF_AGCCTRL0_FILTER_LENGTH_8), RF_IOCFG2_OFF, 0x00, RF_IOCFG1_OFF, 0x00, RF_IOCFG0_OFF, 0x00, @@ -212,7 +218,7 @@ static __code uint8_t rdf_setup[] = { (RDF_DEVIATION_M << RF_DEVIATN_DEVIATION_M_SHIFT)), /* packet length is set in-line */ - RF_PKTCTRL1_OFF, ((1 << PKTCTRL1_PQT_SHIFT)| + RF_PKTCTRL1_OFF, ((0 << PKTCTRL1_PQT_SHIFT)| PKTCTRL1_ADR_CHK_NONE), RF_PKTCTRL0_OFF, (RF_PKTCTRL0_PKT_FORMAT_NORMAL| RF_PKTCTRL0_LENGTH_CONFIG_FIXED), @@ -223,9 +229,9 @@ static __code uint8_t fixed_pkt_setup[] = { (CHANBW_M << RF_MDMCFG4_CHANBW_M_SHIFT) | (DRATE_E << RF_MDMCFG4_DRATE_E_SHIFT)), RF_MDMCFG3_OFF, (DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), - RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_OFF | + RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_ON | RF_MDMCFG2_MOD_FORMAT_GFSK | - RF_MDMCFG2_SYNC_MODE_15_16_THRES), + RF_MDMCFG2_SYNC_MODE_15_16), RF_MDMCFG1_OFF, (RF_MDMCFG1_FEC_EN | RF_MDMCFG1_NUM_PREAMBLE_4 | (2 << RF_MDMCFG1_CHANSPC_E_SHIFT)), @@ -551,8 +557,31 @@ ao_radio_test_cmd(void) ao_radio_test(0); } +#if AO_RADIO_REG_TEST +static void +ao_radio_set_reg(void) +{ + uint8_t offset; + ao_cmd_hex(); + offset = ao_cmd_lex_i; + if (ao_cmd_status != ao_cmd_success) + return; + ao_cmd_hex(); + printf("RF[%x] %x", offset, RF[offset]); + if (ao_cmd_status == ao_cmd_success) { + RF[offset] = ao_cmd_lex_i; + printf (" -> %x", RF[offset]); + } + ao_cmd_status = ao_cmd_success; + printf("\n"); +} +#endif + __code struct ao_cmds ao_radio_cmds[] = { { ao_radio_test_cmd, "C <1 start, 0 stop, none both>\0Radio carrier test" }, +#if AO_RADIO_REG_TEST + { ao_radio_set_reg, "V \0Set radio register" }, +#endif { 0, NULL }, }; diff --git a/src/cc1111/cc1111.h b/src/cc1111/cc1111.h index 80d3fb70..ac1e71c9 100644 --- a/src/cc1111/cc1111.h +++ b/src/cc1111/cc1111.h @@ -1165,12 +1165,73 @@ __xdata __at (0xdf16) uint8_t RF_BSCFG; __xdata __at (0xdf17) uint8_t RF_AGCCTRL2; #define RF_AGCCTRL2_OFF 0x17 +#define RF_AGCCTRL2_MAX_DVGA_GAIN_ALL (0 << 6) +#define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_1 (1 << 6) +#define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_2 (2 << 6) +#define RF_AGCCTRL2_MAX_DVGA_GAIN_BUT_3 (3 << 6) +#define RF_AGCCTRL2_MAX_LNA_GAIN_0 (0 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_2_6 (1 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_6_1 (2 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_7_4 (3 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_9_2 (4 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_11_5 (5 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_14_6 (6 << 3) +#define RF_AGCCTRL2_MAX_LNA_GAIN_17_1 (7 << 3) +#define RF_AGCCTRL2_MAGN_TARGET_24dB (0 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_27dB (1 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_30dB (2 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_33dB (3 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_36dB (4 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_38dB (5 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_40dB (6 << 0) +#define RF_AGCCTRL2_MAGN_TARGET_42dB (7 << 0) + __xdata __at (0xdf18) uint8_t RF_AGCCTRL1; #define RF_AGCCTRL1_OFF 0x18 +#define RF_AGCCTRL1_AGC_LNA_PRIORITY_0 (0 << 6) +#define RF_AGCCTRL1_AGC_LNA_PRIORITY_1 (1 << 6) +#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_DISABLE (0 << 4) +#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_6DB (1 << 4) +#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_10DB (2 << 4) +#define RF_AGCCTRL1_CARRIER_SENSE_REL_THR_14DB (3 << 4) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_DISABLE (0x8 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_7DB_BELOW (0x9 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_6DB_BELOW (0xa << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_5DB_BELOW (0xb << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_4DB_BELOW (0xc << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_3DB_BELOW (0xd << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_2DB_BELOW (0xe << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_1DB_BELOW (0xf << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_0DB (0x0 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_1DB_ABOVE (0x1 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_2DB_ABOVE (0x2 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_3DB_ABOVE (0x3 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_4DB_ABOVE (0x4 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_5DB_ABOVE (0x5 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_6DB_ABOVE (0x6 << 0) +#define RF_AGCCTRL1_CARRIER_SENSE_ABS_THR_7DB_ABOVE (0x7 << 0) + __xdata __at (0xdf19) uint8_t RF_AGCCTRL0; #define RF_AGCCTRL0_OFF 0x19 +#define RF_AGCCTRL0_HYST_LEVEL_NONE (0 << 6) +#define RF_AGCCTRL0_HYST_LEVEL_LOW (1 << 6) +#define RF_AGCCTRL0_HYST_LEVEL_MEDIUM (2 << 6) +#define RF_AGCCTRL0_HYST_LEVEL_HIGH (3 << 6) +#define RF_AGCCTRL0_WAIT_TIME_8 (0 << 4) +#define RF_AGCCTRL0_WAIT_TIME_16 (1 << 4) +#define RF_AGCCTRL0_WAIT_TIME_24 (2 << 4) +#define RF_AGCCTRL0_WAIT_TIME_32 (3 << 4) +#define RF_AGCCTRL0_AGC_FREEZE_NORMAL (0 << 2) +#define RF_AGCCTRL0_AGC_FREEZE_SYNC (1 << 2) +#define RF_AGCCTRL0_AGC_FREEZE_MANUAL_ANALOG (2 << 2) +#define RF_AGCCTRL0_AGC_FREEZE_MANUAL_BOTH (3 << 2) +#define RF_AGCCTRL0_FILTER_LENGTH_8 (0 << 0) +#define RF_AGCCTRL0_FILTER_LENGTH_16 (1 << 0) +#define RF_AGCCTRL0_FILTER_LENGTH_32 (2 << 0) +#define RF_AGCCTRL0_FILTER_LENGTH_64 (3 << 0) + __xdata __at (0xdf1a) uint8_t RF_FREND1; #define RF_FREND1_OFF 0x1a diff --git a/src/telebt-v1.0/ao_pins.h b/src/telebt-v1.0/ao_pins.h index b5562573..4181ef35 100644 --- a/src/telebt-v1.0/ao_pins.h +++ b/src/telebt-v1.0/ao_pins.h @@ -49,6 +49,7 @@ #define HAS_MONITOR 1 #define LEGACY_MONITOR 0 #define HAS_TELEMETRY 0 +#define AO_RADIO_REG_TEST 1 #define HAS_ADC 1 #define AO_PAD_ADC_BATT 0 -- cgit v1.2.3 From aba1703a1cff3da001d64bf2d15a591816e3350e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:31:59 -0700 Subject: altos/cc1111: Add 2400 and 9600 baud telemetry rate support Signed-off-by: Keith Packard --- src/cc1111/ao_pins.h | 3 ++ src/cc1111/ao_radio.c | 86 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 80 insertions(+), 9 deletions(-) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index 2d524188..83a3c774 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -57,6 +57,7 @@ #define HAS_IGNITE 1 #define HAS_MONITOR 0 #define HAS_TELEMETRY 1 + #define HAS_RADIO_RATE 0 /* not enough space for this */ #endif #if defined(TELEMETRUM_V_1_1) @@ -98,6 +99,7 @@ #define HAS_IGNITE 1 #define HAS_MONITOR 0 #define HAS_TELEMETRY 1 + #define HAS_RADIO_RATE 0 /* not enough space for this */ #endif #if defined(TELEMETRUM_V_1_2) @@ -139,6 +141,7 @@ #define HAS_IGNITE 1 #define HAS_MONITOR 0 #define HAS_TELEMETRY 1 + #define HAS_RADIO_RATE 0 /* not enough space for this */ #endif #if defined(TELEDONGLE_V_0_2) diff --git a/src/cc1111/ao_radio.c b/src/cc1111/ao_radio.c index fbdf7762..8f519958 100644 --- a/src/cc1111/ao_radio.c +++ b/src/cc1111/ao_radio.c @@ -40,6 +40,42 @@ #define IF_FREQ_CONTROL 6 /* + * http://www.ntia.doc.gov/files/ntia/publications/84-168.pdf + * + * Necessary bandwidth for a FSK modulated signal: + * + * bw = 2.6d + 0.55b 1.5 < m < 5.5 + * bw = 2.1d + 1.9b 5.5 < m < 20 + * + * b is the modulation rate in bps + * d is the peak deviation (from the center) + * + * m = 2d / b + * + * 20.5 kHz deviation 38.4kbps signal: + * + * m = 41 / 38.4, which is < 5.5: + * + * bw = 2.6 * 20.5 + 0.55 * 38.4 = 74.42kHz + * + * M = 1, E = 3, bw = 75kHz + * + * 20.5 kHz deviation, 9.6kbps signal + * + * m = 41 / 9.6, which is < 5.5: + * + * bw = 2.6 * 20.5 + 0.55 * 9.6 = 58.58kHz + * + * M = 2, E = 3, bw = 62.5kHz + * + * 20.5kHz deviation, 2.4kbps signal + * + * m = 41 / 2.4, which is > 5.5: + * + * bw = 2.1 * 20.5 + 1.9 * 2.4 = 47.61kHz + * + * M = 3, E = 3, bw = 53.6kHz + * * For channel bandwidth of 93.75 kHz, the CHANBW_E and CHANBW_M values are * * BW = 24e6 / (8 * (4 + M) * 2 ** E) @@ -47,7 +83,9 @@ * So, M = 0 and E = 3 */ -#define CHANBW_M 0 +#define CHANBW_M_384 1 +#define CHANBW_M_96 2 +#define CHANBW_M_24 3 #define CHANBW_E 3 /* @@ -55,12 +93,23 @@ * * R = (256 + M) * 2** E * 24e6 / 2**28 * - * So M is 163 and E is 10 + * So for 38360kBaud, M is 163 and E is 10 */ -#define DRATE_E 10 #define DRATE_M 163 +#define DRATE_E_384 10 + +/* For 9600 baud, M is 163 and E is 8 + */ + +#define DRATE_E_96 8 + +/* For 2400 baud, M is 163 and E is 6 + */ + +#define DRATE_E_24 6 + /* * For a channel deviation of 20.5kHz, the DEVIATION_E and DEVIATION_M values are: * @@ -122,9 +171,6 @@ static __code uint8_t radio_setup[] = { RF_FSCTRL1_OFF, (IF_FREQ_CONTROL << RF_FSCTRL1_FREQ_IF_SHIFT), RF_FSCTRL0_OFF, (0 << RF_FSCTRL0_FREQOFF_SHIFT), - RF_MDMCFG4_OFF, ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M << RF_MDMCFG4_CHANBW_M_SHIFT) | - (DRATE_E << RF_MDMCFG4_DRATE_E_SHIFT)), RF_MDMCFG3_OFF, (DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_ON | RF_MDMCFG2_MOD_FORMAT_GFSK | @@ -204,7 +250,7 @@ static __code uint8_t radio_setup[] = { static __code uint8_t rdf_setup[] = { RF_MDMCFG4_OFF, ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M << RF_MDMCFG4_CHANBW_M_SHIFT) | + (CHANBW_M_384 << RF_MDMCFG4_CHANBW_M_SHIFT) | (RDF_DRATE_E << RF_MDMCFG4_DRATE_E_SHIFT)), RF_MDMCFG3_OFF, (RDF_DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_OFF | @@ -225,9 +271,11 @@ static __code uint8_t rdf_setup[] = { }; static __code uint8_t fixed_pkt_setup[] = { +#if !HAS_RADIO_RATE RF_MDMCFG4_OFF, ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | - (CHANBW_M << RF_MDMCFG4_CHANBW_M_SHIFT) | - (DRATE_E << RF_MDMCFG4_DRATE_E_SHIFT)), + (CHANBW_M_384 << RF_MDMCFG4_CHANBW_M_SHIFT) | + (DRATE_E_384 << RF_MDMCFG4_DRATE_E_SHIFT)), +#endif RF_MDMCFG3_OFF, (DRATE_M << RF_MDMCFG3_DRATE_M_SHIFT), RF_MDMCFG2_OFF, (RF_MDMCFG2_DEM_DCFILT_ON | RF_MDMCFG2_MOD_FORMAT_GFSK | @@ -249,6 +297,23 @@ static __code uint8_t fixed_pkt_setup[] = { RF_PKTCTRL0_LENGTH_CONFIG_FIXED), }; +#if HAS_RADIO_RATE +static __code uint8_t packet_rate_setup[] = { + /* 38400 */ + ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | + (CHANBW_M_384 << RF_MDMCFG4_CHANBW_M_SHIFT) | + (DRATE_E_384 << RF_MDMCFG4_DRATE_E_SHIFT)), + /* 9600 */ + ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | + (CHANBW_M_96 << RF_MDMCFG4_CHANBW_M_SHIFT) | + (DRATE_E_96 << RF_MDMCFG4_DRATE_E_SHIFT)), + /* 2400 */ + ((CHANBW_E << RF_MDMCFG4_CHANBW_E_SHIFT) | + (CHANBW_M_24 << RF_MDMCFG4_CHANBW_M_SHIFT) | + (DRATE_E_24 << RF_MDMCFG4_DRATE_E_SHIFT)), +}; +#endif + __xdata uint8_t ao_radio_dma; __xdata uint8_t ao_radio_dma_done; __xdata uint8_t ao_radio_done; @@ -314,6 +379,9 @@ ao_radio_get(uint8_t len) RF_FREQ1 = (uint8_t) (ao_config.radio_setting >> 8); RF_FREQ0 = (uint8_t) (ao_config.radio_setting); RF_PKTLEN = len; +#if HAS_RADIO_RATE + RF_MDMCFG4 = packet_rate_setup[ao_config.radio_rate]; +#endif } -- cgit v1.2.3 From 8935e29e5aa9c01cd00b275a35dd7b99c00980c3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:41:20 -0700 Subject: altos: Add 2400 and 9600 baud telemetry support to cc115l driver Signed-off-by: Keith Packard --- src/drivers/ao_cc115l.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/drivers/ao_cc115l.c b/src/drivers/ao_cc115l.c index f250e714..b5103f9b 100644 --- a/src/drivers/ao_cc115l.c +++ b/src/drivers/ao_cc115l.c @@ -269,16 +269,30 @@ ao_radio_idle(void) * (256 + 131) * (2 ** 10) / (2**28) * 26e6 = 38383 * * DATARATE_M = 131 - * DATARATE_E = 10 + * DATARATE_E_384 = 10 + * DATARATE_E_96 = 8 + * DATARATE_E_24 = 6 */ -#define PACKET_DRATE_E 10 -#define PACKET_DRATE_M 131 +#define PACKET_DRATE_M 131 + +#define PACKET_DRATE_E_384 10 +#define PACKET_DRATE_E_96 8 +#define PACKET_DRATE_E_24 6 + +static const uint16_t packet_rate_setup[] = { + [AO_RADIO_RATE_38400] = ((0xf << 4) | + (PACKET_DRATE_E_384 << CC115L_MDMCFG4_DRATE_E)), + + [AO_RADIO_RATE_9600] = ((0xf << 4) | + (PACKET_DRATE_E_96 << CC115L_MDMCFG4_DRATE_E)), + + [AO_RADIO_RATE_2400] = ((0xf << 4) | + (PACKET_DRATE_E_24 << CC115L_MDMCFG4_DRATE_E)), +}; static const uint16_t packet_setup[] = { CC115L_DEVIATN, ((PACKET_DEV_E << CC115L_DEVIATN_DEVIATION_E) | (PACKET_DEV_M << CC115L_DEVIATN_DEVIATION_M)), - CC115L_MDMCFG4, ((0xf << 4) | - (PACKET_DRATE_E << CC115L_MDMCFG4_DRATE_E)), CC115L_MDMCFG3, (PACKET_DRATE_M), CC115L_MDMCFG2, (0x00 | (CC115L_MDMCFG2_MOD_FORMAT_GFSK << CC115L_MDMCFG2_MOD_FORMAT) | @@ -403,9 +417,12 @@ ao_radio_set_mode(uint16_t new_mode) return; changes = new_mode & (~ao_radio_mode); - if (changes & AO_RADIO_MODE_BITS_PACKET_TX) + if (changes & AO_RADIO_MODE_BITS_PACKET_TX) { + ao_radio_reg_write(CC115L_MDMCFG4, packet_rate_setup[ao_config.radio_rate]); + for (i = 0; i < sizeof (packet_setup) / sizeof (packet_setup[0]); i += 2) ao_radio_reg_write(packet_setup[i], packet_setup[i+1]); + } if (changes & AO_RADIO_MODE_BITS_RDF) for (i = 0; i < sizeof (rdf_setup) / sizeof (rdf_setup[0]); i += 2) @@ -494,6 +511,7 @@ static void ao_radio_get(void) { static uint32_t last_radio_setting; + static uint8_t last_radio_rate; ao_mutex_get(&ao_radio_mutex); if (!ao_radio_configured) @@ -504,6 +522,10 @@ ao_radio_get(void) ao_radio_reg_write(CC115L_FREQ0, ao_config.radio_setting); last_radio_setting = ao_config.radio_setting; } + if (ao_config.radio_rate != last_radio_rate) { + ao_radio_mode &= ~AO_RADIO_MODE_BITS_PACKET_TX; + last_radio_rate = ao_config.radio_rate; + } } static void -- cgit v1.2.3 From 91461251f3aa8e1b37a3456f8fb94ab16bc0bec2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:42:30 -0700 Subject: altos: Packet reception tuning for cc1120 driver This adjusts the cc1120 receive parameters to increase sensitivity at the expense of reporting many more invalid packets to the UI. Signed-off-by: Keith Packard --- src/drivers/ao_cc1120.h | 2 +- src/drivers/ao_cc1120_CC1120.h | 56 ++++++++++++++---------------------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/src/drivers/ao_cc1120.h b/src/drivers/ao_cc1120.h index a1d78c01..5d24c49a 100644 --- a/src/drivers/ao_cc1120.h +++ b/src/drivers/ao_cc1120.h @@ -294,7 +294,7 @@ #define CC1120_SETTLING_CFG_FS_AUTOCAL_MASK 3 #define CC1120_SETTLING_CFG_LOCK_TIME 1 #define CC1120_SETTLING_CFG_LOCK_TIME_50_20 0 -#define CC1120_SETTLING_CFG_LOCK_TIME_70_30 1 +#define CC1120_SETTLING_CFG_LOCK_TIME_75_30 1 #define CC1120_SETTLING_CFG_LOCK_TIME_100_40 2 #define CC1120_SETTLING_CFG_LOCK_TIME_150_60 3 #define CC1120_SETTLING_CFG_LOCK_TIME_MASK 3 diff --git a/src/drivers/ao_cc1120_CC1120.h b/src/drivers/ao_cc1120_CC1120.h index 399abc4d..21a31a89 100644 --- a/src/drivers/ao_cc1120_CC1120.h +++ b/src/drivers/ao_cc1120_CC1120.h @@ -31,20 +31,23 @@ CC1120_SYNC0, 0x91, /* Sync Word Configuration [7:0] */ CC1120_SYNC_CFG1, /* Sync Word Detection Configuration */ - (CC1120_SYNC_CFG1_DEM_CFG_PQT_GATING_ENABLED << CC1120_SYNC_CFG1_DEM_CFG) | - (0x07 << CC1120_SYNC_CFG1_SYNC_THR), + (CC1120_SYNC_CFG1_DEM_CFG_PQT_GATING_DISABLED << CC1120_SYNC_CFG1_DEM_CFG) | + (0xc << CC1120_SYNC_CFG1_SYNC_THR), CC1120_SYNC_CFG0, (CC1120_SYNC_CFG0_SYNC_MODE_16_BITS << CC1120_SYNC_CFG0_SYNC_MODE) | - (CC1120_SYNC_CFG0_SYNC_NUM_ERROR_2 << CC1120_SYNC_CFG0_SYNC_NUM_ERROR), - CC1120_DCFILT_CFG, 0x1c, /* Digital DC Removal Configuration */ + (CC1120_SYNC_CFG0_SYNC_NUM_ERROR_DISABLED << CC1120_SYNC_CFG0_SYNC_NUM_ERROR), + CC1120_DCFILT_CFG, 0x15, /* Digital DC Removal Configuration */ CC1120_PREAMBLE_CFG1, /* Preamble Length Configuration */ (CC1120_PREAMBLE_CFG1_NUM_PREAMBLE_4_BYTES << CC1120_PREAMBLE_CFG1_NUM_PREAMBLE) | (CC1120_PREAMBLE_CFG1_PREAMBLE_WORD_AA << CC1120_PREAMBLE_CFG1_PREAMBLE_WORD), CC1120_PREAMBLE_CFG0, - (1 << CC1120_PREAMBLE_CFG0_PQT_EN) | - (0x6 << CC1120_PREAMBLE_CFG0_PQT), - CC1120_FREQ_IF_CFG, 0x40, /* RX Mixer Frequency Configuration */ - CC1120_IQIC, 0x46, /* Digital Image Channel Compensation Configuration */ + (0 << CC1120_PREAMBLE_CFG0_PQT_EN) | + (0xe << CC1120_PREAMBLE_CFG0_PQT), + + /* Adjust PQT lower to accept fewer packets */ + + CC1120_FREQ_IF_CFG, 0x3a, /* RX Mixer Frequency Configuration */ + CC1120_IQIC, 0x00, /* Digital Image Channel Compensation Configuration */ CC1120_CHAN_BW, 0x02, /* Channel Filter Configuration */ CC1120_MDMCFG1, /* General Modem Parameter Configuration */ @@ -53,12 +56,12 @@ (0 << CC1120_MDMCFG1_MANCHESTER_EN) | (0 << CC1120_MDMCFG1_INVERT_DATA_EN) | (0 << CC1120_MDMCFG1_COLLISION_DETECT_EN) | - (CC1120_MDMCFG1_DVGA_GAIN_9 << CC1120_MDMCFG1_DVGA_GAIN) | + (CC1120_MDMCFG1_DVGA_GAIN_0 << CC1120_MDMCFG1_DVGA_GAIN) | (0 << CC1120_MDMCFG1_SINGLE_ADC_EN), - CC1120_MDMCFG0, 0x05, /* General Modem Parameter Configuration */ + CC1120_MDMCFG0, 0x0d, /* General Modem Parameter Configuration */ /* AGC reference = 10 * log10(receive BW) - 4 = 10 * log10(100e3) - 4 = 46 */ - CC1120_AGC_REF, 46, /* AGC Reference Level Configuration */ + CC1120_AGC_REF, 0x36, /* AGC Reference Level Configuration */ /* Carrier sense threshold - 25dB above the noise */ CC1120_AGC_CS_THR, 25, /* Carrier Sense Threshold Configuration */ @@ -93,7 +96,7 @@ CC1120_SETTLING_CFG, /* Frequency Synthesizer Calibration and Settling Configuration */ (CC1120_SETTLING_CFG_FS_AUTOCAL_IDLE_TO_ON << CC1120_SETTLING_CFG_FS_AUTOCAL) | - (CC1120_SETTLING_CFG_LOCK_TIME_50_20 << CC1120_SETTLING_CFG_LOCK_TIME) | + (CC1120_SETTLING_CFG_LOCK_TIME_75_30 << CC1120_SETTLING_CFG_LOCK_TIME) | (CC1120_SETTLING_CFG_FSREG_TIME_60 << CC1120_SETTLING_CFG_FSREG_TIME), CC1120_FS_CFG, /* Frequency Synthesizer Configuration */ @@ -109,7 +112,7 @@ CC1120_PKT_CFG1, 0x45, /* Packet Configuration, Reg 1 */ CC1120_PKT_CFG0, 0x00, /* Packet Configuration, Reg 0 */ #endif - CC1120_RFEND_CFG1, 0x0f, /* RFEND Configuration, Reg 1 */ + CC1120_RFEND_CFG1, 0x0e, /* RFEND Configuration, Reg 1 */ CC1120_RFEND_CFG0, 0x00, /* RFEND Configuration, Reg 0 */ // CC1120_PA_CFG2, 0x3f, /* Power Amplifier Configuration, Reg 2 */ CC1120_PA_CFG2, 0x3f, /* Power Amplifier Configuration, Reg 2 */ @@ -117,8 +120,8 @@ CC1120_PA_CFG0, 0x7b, /* Power Amplifier Configuration, Reg 0 */ CC1120_PKT_LEN, 0xff, /* Packet Length Configuration */ CC1120_IF_MIX_CFG, 0x00, /* IF Mix Configuration */ - CC1120_FREQOFF_CFG, 0x22, /* Frequency Offset Correction Configuration */ - CC1120_TOC_CFG, 0x0b, /* Timing Offset Correction Configuration */ + CC1120_FREQOFF_CFG, 0x20, /* Frequency Offset Correction Configuration */ + CC1120_TOC_CFG, 0x0a, /* Timing Offset Correction Configuration */ CC1120_MARC_SPARE, 0x00, /* MARC Spare */ CC1120_ECG_CFG, 0x00, /* External Clock Frequency Configuration */ CC1120_SOFT_TX_DATA_CFG, 0x00, /* Soft TX Data Configuration */ @@ -167,7 +170,7 @@ CC1120_XOSC4, 0xa0, /* Crystal Oscillator Configuration, Reg 4 */ CC1120_XOSC3, 0x03, /* Crystal Oscillator Configuration, Reg 3 */ CC1120_XOSC2, 0x04, /* Crystal Oscillator Configuration, Reg 2 */ - CC1120_XOSC1, 0x01, /* Crystal Oscillator Configuration, Reg 1 */ + CC1120_XOSC1, 0x03, /* Crystal Oscillator Configuration, Reg 1 */ CC1120_XOSC0, 0x00, /* Crystal Oscillator Configuration, Reg 0 */ CC1120_ANALOG_SPARE, 0x00, /* */ CC1120_PA_CFG3, 0x00, /* Power Amplifier Configuration, Reg 3 */ @@ -196,31 +199,10 @@ CC1120_AGC_GAIN2, 0xd1, /* AGC Gain, Reg 2 */ CC1120_AGC_GAIN1, 0x00, /* AGC Gain, Reg 1 */ CC1120_AGC_GAIN0, 0x3f, /* AGC Gain, Reg 0 */ - CC1120_SOFT_RX_DATA_OUT, 0x00, /* Soft Decision Symbol Data */ - CC1120_SOFT_TX_DATA_IN, 0x00, /* Soft TX Data Input Register */ - CC1120_ASK_SOFT_RX_DATA, 0x30, /* AGC ASK Soft Decision Output */ CC1120_RNDGEN, 0x7f, /* Random Number Value */ - CC1120_MAGN2, 0x00, /* Signal Magnitude after CORDIC [16] */ - CC1120_MAGN1, 0x00, /* Signal Magnitude after CORDIC [15:8] */ - CC1120_MAGN0, 0x00, /* Signal Magnitude after CORDIC [7:0] */ - CC1120_ANG1, 0x00, /* Signal Angular after CORDIC [9:8] */ - CC1120_ANG0, 0x00, /* Signal Angular after CORDIC [7:0] */ - CC1120_CHFILT_I2, 0x08, /* Channel Filter Data Real Part [18:16] */ - CC1120_CHFILT_I1, 0x00, /* Channel Filter Data Real Part [15:8] */ - CC1120_CHFILT_I0, 0x00, /* Channel Filter Data Real Part [7:0] */ - CC1120_CHFILT_Q2, 0x00, /* Channel Filter Data Imaginary Part [18:16] */ - CC1120_CHFILT_Q1, 0x00, /* Channel Filter Data Imaginary Part [15:8] */ - CC1120_CHFILT_Q0, 0x00, /* Channel Filter Data Imaginary Part [7:0] */ - CC1120_GPIO_STATUS, 0x00, /* GPIO Status */ CC1120_FSCAL_CTRL, 0x01, /* */ CC1120_PHASE_ADJUST, 0x00, /* */ - CC1120_PARTNUMBER, 0x00, /* Part Number */ - CC1120_PARTVERSION, 0x00, /* Part Revision */ CC1120_SERIAL_STATUS, 0x00, /* Serial Status */ - CC1120_RX_STATUS, 0x01, /* RX Status */ - CC1120_TX_STATUS, 0x00, /* TX Status */ - CC1120_MARC_STATUS1, 0x00, /* MARC Status, Reg 1 */ - CC1120_MARC_STATUS0, 0x00, /* MARC Status, Reg 0 */ CC1120_PA_IFAMP_TEST, 0x00, /* */ CC1120_FSRF_TEST, 0x00, /* */ CC1120_PRE_TEST, 0x00, /* */ -- cgit v1.2.3 From e0ee2ac6bc68b73e13bf34fac3ffd4a3b79dce98 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:34:48 -0700 Subject: altos: Add telemetry rate support to CC1120 driver This supports the new 2400 and 9600 baud rates Signed-off-by: Keith Packard --- src/drivers/ao_cc1120.c | 121 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 94 insertions(+), 27 deletions(-) diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 31225939..5d51fbcd 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -245,7 +245,7 @@ ao_radio_check_marc_status(void) { ao_radio_mcu_wake = 0; ao_radio_marc_status = ao_radio_get_marc_status(); - + /* Anyt other than 'tx/rx finished' means an error occurred */ if (ao_radio_marc_status & ~(CC1120_MARC_STATUS1_TX_FINISHED|CC1120_MARC_STATUS1_RX_FINISHED)) ao_radio_abort = 1; @@ -297,26 +297,47 @@ ao_radio_idle(void) #define PACKET_DEV_M 80 /* - * For our packet data, set the symbol rate to 38400 Baud + * For our packet data * * (2**20 + DATARATE_M) * 2 ** DATARATE_E * Rdata = -------------------------------------- * fosc * 2 ** 39 * + * Symbol rate 38400 Baud: * * DATARATE_M = 239914 * DATARATE_E = 9 + * CHANBW = 74.42 (round to 100) + * + * Symbol rate 9600 Baud: + * + * DATARATE_M = 239914 + * DATARATE_E = 7 + * CHANBW = 58.58 (round to 62.5) + * + * Symbol rate 2400 Baud: + * + * DATARATE_M = 239914 + * DATARATE_E = 5 + * CHANBW = 47.61 (round to 50) */ -#define PACKET_DRATE_E 9 + #define PACKET_DRATE_M 239914 +#define PACKET_DRATE_E_384 9 +#define PACKET_CHAN_BW_384 0x02 /* 200 / 2 = 100 */ + +#define PACKET_DRATE_E_96 7 +#define PACKET_CHAN_BW_96 0x42 /* 125 / 2 = 62.5 */ + +#define PACKET_DRATE_E_24 5 +#define PACKET_CHAN_BW_24 0x04 /* 200 / 4 = 50 */ + static const uint16_t packet_setup[] = { CC1120_DEVIATION_M, PACKET_DEV_M, CC1120_MODCFG_DEV_E, ((CC1120_MODCFG_DEV_E_MODEM_MODE_NORMAL << CC1120_MODCFG_DEV_E_MODEM_MODE) | (CC1120_MODCFG_DEV_E_MOD_FORMAT_2_GFSK << CC1120_MODCFG_DEV_E_MOD_FORMAT) | (PACKET_DEV_E << CC1120_MODCFG_DEV_E_DEV_E)), - CC1120_DRATE2, ((PACKET_DRATE_E << CC1120_DRATE2_DATARATE_E) | - (((PACKET_DRATE_M >> 16) & CC1120_DRATE2_DATARATE_M_19_16_MASK) << CC1120_DRATE2_DATARATE_M_19_16)), CC1120_DRATE1, ((PACKET_DRATE_M >> 8) & 0xff), CC1120_DRATE0, ((PACKET_DRATE_M >> 0) & 0xff), CC1120_PKT_CFG2, ((CC1120_PKT_CFG2_CCA_MODE_ALWAYS_CLEAR << CC1120_PKT_CFG2_CCA_MODE) | @@ -335,6 +356,27 @@ static const uint16_t packet_setup[] = { AO_CC1120_MARC_GPIO_IOCFG, CC1120_IOCFG_GPIO_CFG_MARC_MCU_WAKEUP, }; +static const uint16_t packet_setup_384[] = { + CC1120_DRATE2, ((PACKET_DRATE_E_384 << CC1120_DRATE2_DATARATE_E) | + (((PACKET_DRATE_M >> 16) & CC1120_DRATE2_DATARATE_M_19_16_MASK) << CC1120_DRATE2_DATARATE_M_19_16)), + CC1120_CHAN_BW, PACKET_CHAN_BW_384, + CC1120_PA_CFG0, 0x7b, +}; + +static const uint16_t packet_setup_96[] = { + CC1120_DRATE2, ((PACKET_DRATE_E_96 << CC1120_DRATE2_DATARATE_E) | + (((PACKET_DRATE_M >> 16) & CC1120_DRATE2_DATARATE_M_19_16_MASK) << CC1120_DRATE2_DATARATE_M_19_16)), + CC1120_CHAN_BW, PACKET_CHAN_BW_96, + CC1120_PA_CFG0, 0x7d, +}; + +static const uint16_t packet_setup_24[] = { + CC1120_DRATE2, ((PACKET_DRATE_E_24 << CC1120_DRATE2_DATARATE_E) | + (((PACKET_DRATE_M >> 16) & CC1120_DRATE2_DATARATE_M_19_16_MASK) << CC1120_DRATE2_DATARATE_M_19_16)), + CC1120_CHAN_BW, PACKET_CHAN_BW_24, + CC1120_PA_CFG0, 0x7e, +}; + static const uint16_t packet_tx_setup[] = { CC1120_PKT_CFG2, ((CC1120_PKT_CFG2_CCA_MODE_ALWAYS_CLEAR << CC1120_PKT_CFG2_CCA_MODE) | (CC1120_PKT_CFG2_PKT_FORMAT_NORMAL << CC1120_PKT_CFG2_PKT_FORMAT)), @@ -397,6 +439,7 @@ static const uint16_t rdf_setup[] = { (0 << CC1120_PKT_CFG0_UART_SWAP_EN)), CC1120_PREAMBLE_CFG1, ((CC1120_PREAMBLE_CFG1_NUM_PREAMBLE_NONE << CC1120_PREAMBLE_CFG1_NUM_PREAMBLE) | (CC1120_PREAMBLE_CFG1_PREAMBLE_WORD_AA << CC1120_PREAMBLE_CFG1_PREAMBLE_WORD)), + CC1120_PA_CFG0, 0x7e, }; /* @@ -443,6 +486,7 @@ static const uint16_t aprs_setup[] = { (0 << CC1120_PKT_CFG1_APPEND_STATUS)), CC1120_PREAMBLE_CFG1, ((CC1120_PREAMBLE_CFG1_NUM_PREAMBLE_NONE << CC1120_PREAMBLE_CFG1_NUM_PREAMBLE) | (CC1120_PREAMBLE_CFG1_PREAMBLE_WORD_AA << CC1120_PREAMBLE_CFG1_PREAMBLE_WORD)), + CC1120_PA_CFG0, 0x7d, }; /* @@ -505,24 +549,49 @@ static uint16_t ao_radio_mode; #define AO_RADIO_MODE_APRS_FINISH (AO_RADIO_MODE_BITS_APRS | AO_RADIO_MODE_BITS_FIXED | AO_RADIO_MODE_BITS_TX_FINISH) #define AO_RADIO_MODE_TEST (AO_RADIO_MODE_BITS_TEST | AO_RADIO_MODE_BITS_INFINITE | AO_RADIO_MODE_BITS_TX_BUF) +static void +_ao_radio_set_regs(const uint16_t *regs, int nreg) +{ + int i; + + for (i = 0; i < nreg; i++) { + ao_radio_reg_write(regs[0], regs[1]); + regs += 2; + } +} + +#define ao_radio_set_regs(setup) _ao_radio_set_regs(setup, (sizeof (setup) / sizeof(setup[0])) >> 1) + static void ao_radio_set_mode(uint16_t new_mode) { uint16_t changes; - unsigned int i; if (new_mode == ao_radio_mode) return; changes = new_mode & (~ao_radio_mode); - if (changes & AO_RADIO_MODE_BITS_PACKET) - for (i = 0; i < sizeof (packet_setup) / sizeof (packet_setup[0]); i += 2) - ao_radio_reg_write(packet_setup[i], packet_setup[i+1]); + + if (changes & AO_RADIO_MODE_BITS_PACKET) { + ao_radio_set_regs(packet_setup); + + switch (ao_config.radio_rate) { + default: + case AO_RADIO_RATE_38400: + ao_radio_set_regs(packet_setup_384); + break; + case AO_RADIO_RATE_9600: + ao_radio_set_regs(packet_setup_96); + break; + case AO_RADIO_RATE_2400: + ao_radio_set_regs(packet_setup_24); + break; + } + } if (changes & AO_RADIO_MODE_BITS_PACKET_TX) - for (i = 0; i < sizeof (packet_tx_setup) / sizeof (packet_tx_setup[0]); i += 2) - ao_radio_reg_write(packet_tx_setup[i], packet_tx_setup[i+1]); - + ao_radio_set_regs(packet_tx_setup); + if (changes & AO_RADIO_MODE_BITS_TX_BUF) ao_radio_reg_write(AO_CC1120_INT_GPIO_IOCFG, CC1120_IOCFG_GPIO_CFG_TXFIFO_THR); @@ -530,20 +599,16 @@ ao_radio_set_mode(uint16_t new_mode) ao_radio_reg_write(AO_CC1120_INT_GPIO_IOCFG, CC1120_IOCFG_GPIO_CFG_RX0TX1_CFG); if (changes & AO_RADIO_MODE_BITS_PACKET_RX) - for (i = 0; i < sizeof (packet_rx_setup) / sizeof (packet_rx_setup[0]); i += 2) - ao_radio_reg_write(packet_rx_setup[i], packet_rx_setup[i+1]); - + ao_radio_set_regs(packet_rx_setup); + if (changes & AO_RADIO_MODE_BITS_RDF) - for (i = 0; i < sizeof (rdf_setup) / sizeof (rdf_setup[0]); i += 2) - ao_radio_reg_write(rdf_setup[i], rdf_setup[i+1]); + ao_radio_set_regs(rdf_setup); if (changes & AO_RADIO_MODE_BITS_APRS) - for (i = 0; i < sizeof (aprs_setup) / sizeof (aprs_setup[0]); i += 2) - ao_radio_reg_write(aprs_setup[i], aprs_setup[i+1]); + ao_radio_set_regs(aprs_setup); if (changes & AO_RADIO_MODE_BITS_TEST) - for (i = 0; i < sizeof (test_setup) / sizeof (test_setup[0]); i += 2) - ao_radio_reg_write(test_setup[i], test_setup[i+1]); + ao_radio_set_regs(test_setup); if (changes & AO_RADIO_MODE_BITS_INFINITE) ao_radio_reg_write(CC1120_PKT_CFG0, AO_PKT_CFG0_INFINITE); @@ -563,12 +628,9 @@ static uint8_t ao_radio_configured = 0; static void ao_radio_setup(void) { - unsigned int i; - ao_radio_strobe(CC1120_SRES); - for (i = 0; i < sizeof (radio_setup) / sizeof (radio_setup[0]); i += 2) - ao_radio_reg_write(radio_setup[i], radio_setup[i+1]); + ao_radio_set_regs(radio_setup); ao_radio_mode = 0; @@ -592,6 +654,7 @@ static void ao_radio_get(uint8_t len) { static uint32_t last_radio_setting; + static uint8_t last_radio_rate; ao_mutex_get(&ao_radio_mutex); @@ -603,6 +666,10 @@ ao_radio_get(uint8_t len) ao_radio_reg_write(CC1120_FREQ0, ao_config.radio_setting); last_radio_setting = ao_config.radio_setting; } + if (ao_config.radio_rate != last_radio_rate) { + ao_radio_mode &= ~AO_RADIO_MODE_BITS_PACKET; + last_radio_rate = ao_config.radio_rate; + } ao_radio_set_len(len); } @@ -696,7 +763,7 @@ ao_radio_test_cmd(void) ao_radio_set_mode(AO_RADIO_MODE_TEST); ao_radio_strobe(CC1120_STX); #if CC1120_TRACE - { int t; + { int t; for (t = 0; t < 10; t++) { printf ("status: %02x\n", ao_radio_status()); ao_delay(AO_MS_TO_TICKS(100)); @@ -793,7 +860,7 @@ ao_radio_send(const void *d, uint8_t size) } else { ao_exti_enable(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN); } - + fifo_space = ao_radio_wait_tx(encode_len != 0); if (ao_radio_abort) { ao_radio_idle(); -- cgit v1.2.3 From 292cb8380b478542555b5f370e8252eafa2f74ac Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 5 Jul 2014 00:04:06 -0700 Subject: altos: Rework packet receive for cc1120 Instead of blocking on PQT, just set up the receiver to start going and when the first bit interrupt comes in, grab the SPI bus if possible and configure it for reception. This improves sensitivity in the radio by a significant amount while making the code conceptually a bit nicer. Signed-off-by: Keith Packard --- src/cc1111/ao_pins.h | 3 + src/drivers/ao_cc1120.c | 160 +++++++++++++++++++++++++++++++----------------- src/kernel/ao.h | 3 + src/kernel/ao_mutex.c | 23 +++++++ src/lpc/ao_arch_funcs.h | 17 ++--- src/stm/ao_arch_funcs.h | 25 ++++++-- src/stm/ao_spi_stm.c | 51 +++++++++++++-- 7 files changed, 208 insertions(+), 74 deletions(-) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index 83a3c774..1bc3d716 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -58,6 +58,7 @@ #define HAS_MONITOR 0 #define HAS_TELEMETRY 1 #define HAS_RADIO_RATE 0 /* not enough space for this */ + #define HAS_MUTEX_TRY 0 #endif #if defined(TELEMETRUM_V_1_1) @@ -100,6 +101,7 @@ #define HAS_MONITOR 0 #define HAS_TELEMETRY 1 #define HAS_RADIO_RATE 0 /* not enough space for this */ + #define HAS_MUTEX_TRY 0 #endif #if defined(TELEMETRUM_V_1_2) @@ -142,6 +144,7 @@ #define HAS_MONITOR 0 #define HAS_TELEMETRY 1 #define HAS_RADIO_RATE 0 /* not enough space for this */ + #define HAS_MUTEX_TRY 0 #endif #if defined(TELEDONGLE_V_0_2) diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 5d51fbcd..1b907940 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -41,8 +41,10 @@ extern const uint32_t ao_radio_cal; #define FOSC 32000000 +#define ao_radio_try_select(task_id) ao_spi_try_get_mask(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN),AO_CC1120_SPI_BUS,AO_SPI_SPEED_4MHz, task_id) #define ao_radio_select() ao_spi_get_mask(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN),AO_CC1120_SPI_BUS,AO_SPI_SPEED_4MHz) #define ao_radio_deselect() ao_spi_put_mask(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN),AO_CC1120_SPI_BUS) +#define ao_radio_spi_send_sync(d,l) ao_spi_send_sync((d), (l), AO_CC1120_SPI_BUS) #define ao_radio_spi_send(d,l) ao_spi_send((d), (l), AO_CC1120_SPI_BUS) #define ao_radio_spi_send_fixed(d,l) ao_spi_send_fixed((d), (l), AO_CC1120_SPI_BUS) #define ao_radio_spi_recv(d,l) ao_spi_recv((d), (l), AO_CC1120_SPI_BUS) @@ -107,7 +109,7 @@ ao_radio_reg_write(uint16_t addr, uint8_t value) } static void -ao_radio_burst_read_start (uint16_t addr) +_ao_radio_burst_read_start (uint16_t addr) { uint8_t data[2]; uint8_t d; @@ -124,8 +126,8 @@ ao_radio_burst_read_start (uint16_t addr) addr); d = 1; } - ao_radio_select(); - ao_radio_spi_send(data, d); + + ao_radio_spi_send_sync(data, d); } static void @@ -209,7 +211,7 @@ ao_radio_tx_fifo_space(void) return CC1120_FIFO_SIZE - ao_radio_reg_read(CC1120_NUM_TXBYTES); } -#if 0 +#if CC1120_DEBUG static uint8_t ao_radio_status(void) { @@ -275,11 +277,13 @@ static void ao_radio_idle(void) { for (;;) { - uint8_t state = ao_radio_strobe(CC1120_SIDLE); - if ((state >> CC1120_STATUS_STATE) == CC1120_STATUS_STATE_IDLE) + uint8_t state = (ao_radio_strobe(CC1120_SIDLE) >> CC1120_STATUS_STATE) & CC1120_STATUS_STATE_MASK; + if (state == CC1120_STATUS_STATE_IDLE) break; - if ((state >> CC1120_STATUS_STATE) == CC1120_STATUS_STATE_TX_FIFO_ERROR) + if (state == CC1120_STATUS_STATE_TX_FIFO_ERROR) ao_radio_strobe(CC1120_SFTX); + if (state == CC1120_STATUS_STATE_RX_FIFO_ERROR) + ao_radio_strobe(CC1120_SFRX); } /* Flush any pending TX bytes */ ao_radio_strobe(CC1120_SFTX); @@ -948,6 +952,11 @@ static uint16_t rx_data_consumed; static uint16_t rx_data_cur; static uint8_t rx_ignore; static uint8_t rx_waiting; +static uint8_t rx_starting; +static uint8_t rx_task_id; +static uint32_t rx_fast_start; +static uint32_t rx_slow_start; +static uint32_t rx_missed; #if AO_PROFILE static uint32_t rx_start_tick, rx_packet_tick, rx_done_tick, rx_last_done_tick; @@ -962,13 +971,34 @@ ao_radio_rx_isr(void) { uint8_t d; + if (rx_task_id) { + if (ao_radio_try_select(rx_task_id)) { + ++rx_fast_start; + rx_task_id = 0; + _ao_radio_burst_read_start(CC1120_SOFT_RX_DATA_OUT); + } else { + if (rx_ignore) + --rx_ignore; + else { + ao_radio_abort = 1; + rx_missed++; + } + return; + } + } + if (rx_starting) { + rx_starting = 0; + ao_wakeup(&ao_radio_wake); + } d = AO_CC1120_SPI.dr; AO_CC1120_SPI.dr = 0; if (rx_ignore == 0) { - if (rx_data_cur >= rx_data_count) - ao_exti_disable(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN); - else + if (rx_data_cur < rx_data_count) rx_data[rx_data_cur++] = d; + if (rx_data_cur >= rx_data_count) { + ao_spi_clr_cs(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN)); + ao_exti_disable(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN); + } if (rx_waiting && rx_data_cur - rx_data_consumed >= AO_FEC_DECODE_BLOCK) { #if AO_PROFILE if (!rx_packet_tick) @@ -987,24 +1017,20 @@ ao_radio_rx_isr(void) static uint16_t ao_radio_rx_wait(void) { - do { - if (ao_radio_mcu_wake) - ao_radio_check_marc_status(); - ao_alarm(AO_MS_TO_TICKS(100)); - ao_arch_block_interrupts(); - rx_waiting = 1; - while (rx_data_cur - rx_data_consumed < AO_FEC_DECODE_BLOCK && - !ao_radio_abort && - !ao_radio_mcu_wake) - { - if (ao_sleep(&ao_radio_wake)) - ao_radio_abort = 1; - } - rx_waiting = 0; - ao_arch_release_interrupts(); - ao_clear_alarm(); - } while (ao_radio_mcu_wake); - if (ao_radio_abort) + ao_alarm(AO_MS_TO_TICKS(100)); + ao_arch_block_interrupts(); + rx_waiting = 1; + while (rx_data_cur - rx_data_consumed < AO_FEC_DECODE_BLOCK && + !ao_radio_abort && + !ao_radio_mcu_wake) + { + if (ao_sleep(&ao_radio_wake)) + ao_radio_abort = 1; + } + rx_waiting = 0; + ao_arch_release_interrupts(); + ao_clear_alarm(); + if (ao_radio_abort || ao_radio_mcu_wake) return 0; rx_data_consumed += AO_FEC_DECODE_BLOCK; #if AO_PROFILE @@ -1044,48 +1070,67 @@ ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) */ ao_radio_abort = 0; - /* configure interrupt pin */ ao_radio_get(len); - ao_radio_set_mode(AO_RADIO_MODE_PACKET_RX); ao_radio_wake = 0; ao_radio_mcu_wake = 0; - AO_CC1120_SPI.cr2 = 0; - - /* clear any RXNE */ - (void) AO_CC1120_SPI.dr; + ao_radio_set_mode(AO_RADIO_MODE_PACKET_RX); - /* Have the radio signal when the preamble quality goes high */ - ao_radio_reg_write(AO_CC1120_INT_GPIO_IOCFG, CC1120_IOCFG_GPIO_CFG_PQT_REACHED); + /* configure interrupt pin */ + ao_radio_reg_write(AO_CC1120_INT_GPIO_IOCFG, CC1120_IOCFG_GPIO_CFG_CLKEN_SOFT); ao_exti_set_mode(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, - AO_EXTI_MODE_RISING|AO_EXTI_PRIORITY_HIGH); - ao_exti_set_callback(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, ao_radio_isr); + AO_EXTI_MODE_FALLING|AO_EXTI_PRIORITY_HIGH); + + ao_exti_set_callback(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, ao_radio_rx_isr); ao_exti_enable(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN); - ao_exti_enable(AO_CC1120_MCU_WAKEUP_PORT, AO_CC1120_MCU_WAKEUP_PIN); + + rx_starting = 1; + rx_task_id = ao_cur_task->task_id; ao_radio_strobe(CC1120_SRX); - /* Wait for the preamble to appear */ - ao_radio_wait_isr(timeout); + if (timeout) + ao_alarm(timeout); + ao_arch_block_interrupts(); + while (rx_starting && !ao_radio_abort) { + if (ao_sleep(&ao_radio_wake)) + ao_radio_abort = 1; + } + uint8_t rx_task_id_save = rx_task_id; + rx_task_id = 0; + rx_starting = 0; + ao_arch_release_interrupts(); + if (timeout) + ao_clear_alarm(); + if (ao_radio_abort) { ret = 0; + rx_task_id = 0; goto abort; } - ao_radio_reg_write(AO_CC1120_INT_GPIO_IOCFG, CC1120_IOCFG_GPIO_CFG_CLKEN_SOFT); - ao_exti_set_mode(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, - AO_EXTI_MODE_FALLING|AO_EXTI_PRIORITY_HIGH); - - ao_exti_set_callback(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN, ao_radio_rx_isr); - ao_exti_enable(AO_CC1120_INT_PORT, AO_CC1120_INT_PIN); - - ao_radio_burst_read_start(CC1120_SOFT_RX_DATA_OUT); + if (rx_task_id_save) { + ++rx_slow_start; + ao_radio_select(); + _ao_radio_burst_read_start(CC1120_SOFT_RX_DATA_OUT); + if (rx_ignore) { + uint8_t ignore = AO_CC1120_SPI.dr; + (void) ignore; + AO_CC1120_SPI.dr = 0; + --rx_ignore; + } + } ret = ao_fec_decode(rx_data, rx_data_count, d, size + 2, ao_radio_rx_wait); ao_radio_burst_read_stop(); + if (ao_radio_mcu_wake) + ao_radio_check_marc_status(); + if (ao_radio_abort) + ret = 0; + abort: /* Convert from 'real' rssi to cc1111-style values */ @@ -1100,7 +1145,7 @@ abort: radio_rssi = AO_RADIO_FROM_RSSI (rssi); } - ao_radio_strobe(CC1120_SIDLE); + ao_radio_idle(); ao_radio_put(); @@ -1139,7 +1184,7 @@ struct ao_cc1120_reg { char *name; }; -const static struct ao_cc1120_reg ao_cc1120_reg[] = { +static const struct ao_cc1120_reg ao_cc1120_reg[] = { { .addr = CC1120_IOCFG3, .name = "IOCFG3" }, { .addr = CC1120_IOCFG2, .name = "IOCFG2" }, { .addr = CC1120_IOCFG1, .name = "IOCFG1" }, @@ -1320,7 +1365,7 @@ const static struct ao_cc1120_reg ao_cc1120_reg[] = { static void ao_radio_show(void) { uint8_t status = ao_radio_status(); - int i; + unsigned int i; ao_radio_get(0xff); status = ao_radio_status(); @@ -1331,6 +1376,10 @@ static void ao_radio_show(void) { for (i = 0; i < AO_NUM_CC1120_REG; i++) printf ("\t%02x %-20.20s\n", ao_radio_reg_read(ao_cc1120_reg[i].addr), ao_cc1120_reg[i].name); + + printf("RX fast start: %u\n", rx_fast_start); + printf("RX slow start: %u\n", rx_slow_start); + printf("RX missed: %u\n", rx_missed); ao_radio_put(); } @@ -1354,12 +1403,12 @@ static void ao_radio_packet(void) { } void -ao_radio_test_recv() +ao_radio_test_recv(void) { uint8_t bytes[34]; uint8_t b; - if (ao_radio_recv(bytes, 34)) { + if (ao_radio_recv(bytes, 34, 0)) { if (bytes[33] & 0x80) printf ("CRC OK"); else @@ -1375,13 +1424,12 @@ ao_radio_test_recv() #include static void -ao_radio_aprs() +ao_radio_aprs(void) { ao_packet_slave_stop(); ao_aprs_send(); } #endif - #endif static const struct ao_cmds ao_radio_cmds[] = { diff --git a/src/kernel/ao.h b/src/kernel/ao.h index c11aa028..a225bc4a 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -132,6 +132,9 @@ ao_clock_init(void); */ #ifndef ao_mutex_get +uint8_t +ao_mutex_try(__xdata uint8_t *ao_mutex, uint8_t task_id) __reentrant; + void ao_mutex_get(__xdata uint8_t *ao_mutex) __reentrant; diff --git a/src/kernel/ao_mutex.c b/src/kernel/ao_mutex.c index 952ff462..a36fe939 100644 --- a/src/kernel/ao_mutex.c +++ b/src/kernel/ao_mutex.c @@ -17,6 +17,29 @@ #include "ao.h" +#ifndef HAS_MUTEX_TRY +#define HAS_MUTEX_TRY 1 +#endif + +#if HAS_MUTEX_TRY + +uint8_t +ao_mutex_try(__xdata uint8_t *mutex, uint8_t task_id) __reentrant +{ + uint8_t ret; + if (*mutex == task_id) + ao_panic(AO_PANIC_MUTEX); + ao_arch_critical( + if (*mutex) + ret = 0; + else { + *mutex = task_id; + ret = 1; + }); + return ret; +} +#endif + void ao_mutex_get(__xdata uint8_t *mutex) __reentrant { diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index 0891903e..21a7a8e5 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -161,16 +161,17 @@ static inline void ao_arch_restore_stack(void) { #endif /* HAS_TASK */ -#define ao_arch_wait_interrupt() do { \ - asm(".global ao_idle_loc\n\twfi\nao_idle_loc:"); \ - ao_arch_release_interrupts(); \ - ao_arch_block_interrupts(); \ +#define ao_arch_wait_interrupt() do { \ + asm("\twfi\n"); \ + ao_arch_release_interrupts(); \ + asm(".global ao_idle_loc\n\nao_idle_loc:"); \ + ao_arch_block_interrupts(); \ } while (0) -#define ao_arch_critical(b) do { \ - ao_arch_block_interrupts(); \ - do { b } while (0); \ - ao_arch_release_interrupts(); \ +#define ao_arch_critical(b) do { \ + uint32_t __mask = ao_arch_irqsave(); \ + do { b } while (0); \ + ao_arch_irqrestore(__mask); \ } while (0) /* diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index b461cd3f..7ad3b4b8 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -64,6 +64,9 @@ #define AO_SPI_INDEX(id) ((id) & AO_SPI_INDEX_MASK) #define AO_SPI_CONFIG(id) ((id) & AO_SPI_CONFIG_MASK) +uint8_t +ao_spi_try_get(uint8_t spi_index, uint32_t speed, uint8_t task_id); + void ao_spi_get(uint8_t spi_index, uint32_t speed); @@ -76,6 +79,9 @@ ao_spi_send(void *block, uint16_t len, uint8_t spi_index); void ao_spi_send_fixed(uint8_t value, uint16_t len, uint8_t spi_index); +void +ao_spi_send_sync(void *block, uint16_t len, uint8_t spi_index); + void ao_spi_recv(void *block, uint16_t len, uint8_t spi_index); @@ -95,6 +101,15 @@ ao_spi_init(void); ao_spi_set_cs(reg,mask); \ } while (0) +static inline uint8_t +ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t speed, uint8_t task_id) +{ + if (!ao_spi_try_get(bus, speed, task_id)) + return 0; + ao_spi_set_cs(reg, mask); + return 1; +} + #define ao_spi_put_mask(reg,mask,bus) do { \ ao_spi_clr_cs(reg,mask); \ ao_spi_put(bus); \ @@ -252,6 +267,8 @@ extern struct ao_stm_usart ao_stm_usart3; #define ARM_PUSH32(stack, val) (*(--(stack)) = (val)) +typedef uint32_t ao_arch_irq_t; + static inline uint32_t ao_arch_irqsave(void) { uint32_t primask; @@ -369,10 +386,10 @@ static inline void ao_arch_start_scheduler(void) { ao_arch_block_interrupts(); \ } while (0) -#define ao_arch_critical(b) do { \ - ao_arch_block_interrupts(); \ - do { b } while (0); \ - ao_arch_release_interrupts(); \ +#define ao_arch_critical(b) do { \ + uint32_t __mask = ao_arch_irqsave(); \ + do { b } while (0); \ + ao_arch_irqrestore(__mask); \ } while (0) #endif /* _AO_ARCH_FUNCS_H_ */ diff --git a/src/stm/ao_spi_stm.c b/src/stm/ao_spi_stm.c index 56329c24..885af544 100644 --- a/src/stm/ao_spi_stm.c +++ b/src/stm/ao_spi_stm.c @@ -153,6 +153,28 @@ ao_spi_send_fixed(uint8_t value, uint16_t len, uint8_t spi_index) ao_dma_done_transfer(miso_dma_index); } +void +ao_spi_send_sync(void *block, uint16_t len, uint8_t spi_index) +{ + uint8_t *b = block; + struct stm_spi *stm_spi = ao_spi_stm_info[AO_SPI_INDEX(spi_index)].stm_spi; + + stm_spi->cr2 = ((0 << STM_SPI_CR2_TXEIE) | + (0 << STM_SPI_CR2_RXNEIE) | + (0 << STM_SPI_CR2_ERRIE) | + (0 << STM_SPI_CR2_SSOE) | + (0 << STM_SPI_CR2_TXDMAEN) | + (0 << STM_SPI_CR2_RXDMAEN)); + + /* Clear RXNE */ + (void) stm_spi->dr; + + while (len--) { + while (!(stm_spi->sr & (1 << STM_SPI_SR_TXE))); + stm_spi->dr = *b++; + } +} + void ao_spi_recv(void *block, uint16_t len, uint8_t spi_index) { @@ -356,13 +378,11 @@ ao_spi_enable_index(uint8_t spi_index) } } -void -ao_spi_get(uint8_t spi_index, uint32_t speed) +static void +ao_spi_config(uint8_t spi_index, uint32_t speed) { uint8_t id = AO_SPI_INDEX(spi_index); struct stm_spi *stm_spi = ao_spi_stm_info[id].stm_spi; - - ao_mutex_get(&ao_spi_mutex[id]); stm_spi->cr1 = ((0 << STM_SPI_CR1_BIDIMODE) | /* Three wire mode */ (0 << STM_SPI_CR1_BIDIOE) | (0 << STM_SPI_CR1_CRCEN) | /* CRC disabled */ @@ -378,7 +398,7 @@ ao_spi_get(uint8_t spi_index, uint32_t speed) (0 << STM_SPI_CR1_CPOL) | /* Format 0 */ (0 << STM_SPI_CR1_CPHA)); if (spi_index != ao_spi_index[id]) { - + /* Disable old config */ ao_spi_disable_index(ao_spi_index[id]); @@ -386,13 +406,32 @@ ao_spi_get(uint8_t spi_index, uint32_t speed) /* Enable new config */ ao_spi_enable_index(spi_index); - + /* Remember current config */ ao_spi_index[id] = spi_index; } } +uint8_t +ao_spi_try_get(uint8_t spi_index, uint32_t speed, uint8_t task_id) +{ + uint8_t id = AO_SPI_INDEX(spi_index); + + if (!ao_mutex_try(&ao_spi_mutex[id], task_id)) + return 0; + ao_spi_config(spi_index, speed); + return 1; +} + +void +ao_spi_get(uint8_t spi_index, uint32_t speed) +{ + uint8_t id = AO_SPI_INDEX(spi_index); + ao_mutex_get(&ao_spi_mutex[id]); + ao_spi_config(spi_index, speed); +} + void ao_spi_put(uint8_t spi_index) { -- cgit v1.2.3 From 55e6558fa7cb23fb1363a86c83fbd6abf67ea324 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jul 2014 22:48:13 -0700 Subject: altoslib: Support multiple telemetry rates Altos now supports 2400 and 9600 baud in addition to the classic 38400 baud rate. Add support to altoslib for these as well Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 9 +++++++ altoslib/AltosConfigValues.java | 4 ++++ altoslib/AltosFlightReader.java | 6 +++++ altoslib/AltosLib.java | 9 +++++++ altoslib/AltosLink.java | 14 ++++++++++- altoslib/AltosPreferences.java | 48 ++++++++++++++++++++++++++++++++++++++ altoslib/AltosTelemetryReader.java | 29 +++++++++++++++++++++++ 7 files changed, 118 insertions(+), 1 deletion(-) diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 3bf8ea43..847436cd 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -46,6 +46,7 @@ public class AltosConfigData implements Iterable { public String callsign; public int radio_enable; public int radio_calibration; + public int telemetry_rate; /* Old HAS_RADIO values */ public int radio_channel; public int radio_setting; @@ -235,6 +236,7 @@ public class AltosConfigData implements Iterable { radio_calibration = -1; radio_channel = -1; radio_setting = -1; + telemetry_rate = -1; accel_cal_plus = -1; accel_cal_minus = -1; @@ -292,6 +294,7 @@ public class AltosConfigData implements Iterable { try { callsign = get_string(line, "Callsign:"); } catch (Exception e) {} try { radio_enable = get_int(line, "Radio enable:"); } catch (Exception e) {} try { radio_calibration = get_int(line, "Radio cal:"); } catch (Exception e) {} + try { telemetry_rate = get_int(line, "Telemetry rate:"); } catch (Exception e) {} /* Old HAS_RADIO values */ try { radio_channel = get_int(line, "Radio channel:"); } catch (Exception e) {} @@ -440,6 +443,8 @@ public class AltosConfigData implements Iterable { callsign = source.callsign(); if (radio_calibration >= 0) radio_calibration = source.radio_calibration(); + if (telemetry_rate >= 0) + telemetry_rate = source.telemetry_rate(); /* HAS_ACCEL */ if (pad_orientation >= 0) @@ -484,6 +489,7 @@ public class AltosConfigData implements Iterable { dest.set_apogee_lockout(apogee_lockout); dest.set_radio_calibration(radio_calibration); dest.set_radio_frequency(frequency()); + dest.set_telemetry_rate(telemetry_rate); boolean max_enabled = true; if (log_space() == 0) @@ -554,6 +560,9 @@ public class AltosConfigData implements Iterable { if (radio_enable >= 0) link.printf("c e %d\n", radio_enable); + if (telemetry_rate >= 0) + link.printf("c T %d\n", telemetry_rate); + /* HAS_ACCEL */ /* UI doesn't support accel cal */ if (pad_orientation >= 0) diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index b0c49e98..987da53b 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -53,6 +53,10 @@ public interface AltosConfigValues { public abstract String callsign(); + public abstract void set_telemetry_rate(int new_telemetry_rate); + + public abstract int telemetry_rate() throws AltosConfigDataException; + public abstract void set_flight_log_max(int new_flight_log_max); public abstract void set_flight_log_max_enabled(boolean enable); diff --git a/altoslib/AltosFlightReader.java b/altoslib/AltosFlightReader.java index ac151396..c0565e88 100644 --- a/altoslib/AltosFlightReader.java +++ b/altoslib/AltosFlightReader.java @@ -38,12 +38,18 @@ public class AltosFlightReader { public void set_telemetry(int telemetry) { } + public void set_telemetry_rate(int telemetry_rate) throws InterruptedException, TimeoutException { } + public void save_telemetry() { } + public void save_telemetry_rate() { } + public void update(AltosState state) throws InterruptedException { } public boolean supports_telemetry(int telemetry) { return false; } + public boolean supports_telemetry_rate(int telemetry_rate) { return false; } + public File backing_file() { return null; } public boolean has_monitor_battery() throws InterruptedException { return false; } diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index ec32fffc..c2ec0e3b 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -161,6 +161,15 @@ public class AltosLib { "Off", "Standard Telemetry", "TeleMetrum v0.9", "TeleMetrum v0.8" }; + public static final int ao_telemetry_rate_38400 = 0; + public static final int ao_telemetry_rate_9600 = 1; + public static final int ao_telemetry_rate_2400 = 2; + public static final int ao_telemetry_rate_max = 2; + + public static final Integer[] ao_telemetry_rate_values = { + 38400, 9600, 2400 + }; + public static final String launch_sites_url = "http://www.altusmetrum.org/AltOS/launch-sites.txt"; public static final int ao_telemetry_standard_len = 32; diff --git a/altoslib/AltosLink.java b/altoslib/AltosLink.java index ef40c8cb..eadab5df 100644 --- a/altoslib/AltosLink.java +++ b/altoslib/AltosLink.java @@ -274,6 +274,8 @@ public abstract class AltosLink implements Runnable { } public void flush_output() { + if (pending_output == null) + return; for (String s : pending_output) System.out.print(s); pending_output.clear(); @@ -305,6 +307,7 @@ public abstract class AltosLink implements Runnable { */ public boolean monitor_mode = false; public int telemetry = AltosLib.ao_telemetry_standard; + public int telemetry_rate = AltosLib.ao_telemetry_rate_38400; public double frequency; public String callsign; AltosConfigData config_data; @@ -356,6 +359,15 @@ public abstract class AltosLink implements Runnable { flush_output(); } + public void set_telemetry_rate(int in_telemetry_rate) { + telemetry_rate = in_telemetry_rate; + if (monitor_mode) + printf("m 0\nc T %d\nm %x\n", telemetry_rate, telemetry_len()); + else + printf("c T %d\n", telemetry_rate); + flush_output(); + } + public void set_monitor(boolean monitor) { monitor_mode = monitor; if (monitor) @@ -383,7 +395,7 @@ public abstract class AltosLink implements Runnable { flush_output(); } - public AltosConfigData config_data() throws InterruptedException, TimeoutException { + public AltosConfigData config_data() throws InterruptedException, TimeoutException { synchronized(config_data_lock) { if (config_data == null) { printf("m 0\n"); diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index 159951e4..72cfeb4b 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -35,6 +35,9 @@ public class AltosPreferences { /* telemetry format preference name */ public final static String telemetryPreferenceFormat = "TELEMETRY-%d"; + /* telemetry rate format preference name */ + public final static String telemetryRatePreferenceFormat = "RATE-%d"; + /* voice preference name */ public final static String voicePreference = "VOICE"; @@ -50,6 +53,9 @@ public class AltosPreferences { /* scanning telemetry preferences name */ public final static String scanningTelemetryPreference = "SCANNING-TELEMETRY"; + /* scanning telemetry rate preferences name */ + public final static String scanningTelemetryRatePreference = "SCANNING-RATE"; + /* Launcher serial preference name */ public final static String launcherSerialPreference = "LAUNCHER-SERIAL"; @@ -74,6 +80,9 @@ public class AltosPreferences { /* Telemetry (map serial to telemetry format) */ public static Hashtable telemetries; + /* Telemetry rate (map serial to telemetry format) */ + public static Hashtable telemetry_rates; + /* Voice preference */ public static boolean voice; @@ -86,6 +95,8 @@ public class AltosPreferences { /* Scanning telemetry */ public static int scanning_telemetry; + public static int scanning_telemetry_rate; + /* List of frequencies */ public final static String common_frequencies_node_name = "COMMON-FREQUENCIES"; public static AltosFrequency[] common_frequencies; @@ -159,12 +170,16 @@ public class AltosPreferences { telemetries = new Hashtable(); + telemetry_rates = new Hashtable(); + voice = backend.getBoolean(voicePreference, true); callsign = backend.getString(callsignPreference,"N0CALL"); scanning_telemetry = backend.getInt(scanningTelemetryPreference,(1 << AltosLib.ao_telemetry_standard)); + scanning_telemetry_rate = backend.getInt(scanningTelemetryRatePreference,(1 << AltosLib.ao_telemetry_rate_38400)); + launcher_serial = backend.getInt(launcherSerialPreference, 0); launcher_channel = backend.getInt(launcherChannelPreference, 0); @@ -266,6 +281,25 @@ public class AltosPreferences { } } + public static void set_telemetry_rate(int serial, int new_telemetry_rate) { + synchronized (backend) { + telemetry_rates.put(serial, new_telemetry_rate); + backend.putInt(String.format(telemetryRatePreferenceFormat, serial), new_telemetry_rate); + flush_preferences(); + } + } + + public static int telemetry_rate(int serial) { + synchronized (backend) { + if (telemetry_rates.containsKey(serial)) + return telemetry_rates.get(serial); + int telemetry_rate = backend.getInt(String.format(telemetryRatePreferenceFormat, serial), + AltosLib.ao_telemetry_rate_38400); + telemetry_rates.put(serial, telemetry_rate); + return telemetry_rate; + } + } + public static void set_scanning_telemetry(int new_scanning_telemetry) { synchronized (backend) { scanning_telemetry = new_scanning_telemetry; @@ -280,6 +314,20 @@ public class AltosPreferences { } } + public static void set_scanning_telemetry_rate(int new_scanning_telemetry_rate) { + synchronized (backend) { + scanning_telemetry_rate = new_scanning_telemetry_rate; + backend.putInt(scanningTelemetryRatePreference, scanning_telemetry_rate); + flush_preferences(); + } + } + + public static int scanning_telemetry_rate() { + synchronized(backend) { + return scanning_telemetry_rate; + } + } + public static void set_voice(boolean new_voice) { synchronized (backend) { voice = new_voice; diff --git a/altoslib/AltosTelemetryReader.java b/altoslib/AltosTelemetryReader.java index 589f57f2..5ed50134 100644 --- a/altoslib/AltosTelemetryReader.java +++ b/altoslib/AltosTelemetryReader.java @@ -26,6 +26,7 @@ public class AltosTelemetryReader extends AltosFlightReader { AltosLog log; double frequency; int telemetry; + int telemetry_rate; AltosState state = null; LinkedBlockingQueue telem; @@ -92,6 +93,23 @@ public class AltosTelemetryReader extends AltosFlightReader { } } + public boolean supports_telemetry_rate(int telemetry_rate) { + try { + /* Version 1.4.1.1 supports all rates, older versions don't */ + if (link.config_data().compare_version("1.4.1.1") >= 0) + return true; + + if (telemetry_rate == AltosLib.ao_telemetry_rate_38400) + return true; + else + return false; + } catch (InterruptedException ie) { + return false; + } catch (TimeoutException te) { + return true; + } + } + public void save_frequency() { AltosPreferences.set_frequency(link.serial, frequency); } @@ -105,6 +123,15 @@ public class AltosTelemetryReader extends AltosFlightReader { AltosPreferences.set_telemetry(link.serial, telemetry); } + public void set_telemetry_rate(int in_telemetry_rate) { + telemetry_rate = in_telemetry_rate; + link.set_telemetry_rate(telemetry_rate); + } + + public void save_telemetry_rate() { + AltosPreferences.set_telemetry_rate(link.serial, telemetry_rate); + } + public void set_monitor(boolean monitor) { link.set_monitor(monitor); } @@ -133,6 +160,8 @@ public class AltosTelemetryReader extends AltosFlightReader { set_frequency(frequency); telemetry = AltosPreferences.telemetry(link.serial); set_telemetry(telemetry); + telemetry_rate = AltosPreferences.telemetry_rate(link.serial); + set_telemetry_rate(telemetry_rate); link.add_monitor(telem); success = true; } finally { -- cgit v1.2.3 From 9557a24b02911a93d74ee29ce359e40266cb4fed Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:57:42 -0700 Subject: altosuilib: Add telemetry rate to Scan UI Let the user scan for multiple data rates as well as telemetry formats and frequencies Signed-off-by: Keith Packard --- altosuilib/AltosScanUI.java | 150 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 120 insertions(+), 30 deletions(-) diff --git a/altosuilib/AltosScanUI.java b/altosuilib/AltosScanUI.java index 7e1c7a97..7b5f2c7e 100644 --- a/altosuilib/AltosScanUI.java +++ b/altosuilib/AltosScanUI.java @@ -33,32 +33,40 @@ class AltosScanResult { int flight; AltosFrequency frequency; int telemetry; + int rate; boolean interrupted = false; public String toString() { - return String.format("%-9.9s serial %-4d flight %-4d (%s %s)", - callsign, serial, flight, frequency.toShortString(), AltosLib.telemetry_name(telemetry)); + return String.format("%-9.9s serial %-4d flight %-4d (%s %s %d)", + callsign, serial, flight, + frequency.toShortString(), + AltosLib.telemetry_name(telemetry), + AltosLib.ao_telemetry_rate_values[rate]); } public String toShortString() { - return String.format("%s %d %d %7.3f %d", - callsign, serial, flight, frequency, telemetry); + return String.format("%s %d %d %7.3f %d %d", + callsign, serial, flight, frequency, telemetry, rate); } public AltosScanResult(String in_callsign, int in_serial, - int in_flight, AltosFrequency in_frequency, int in_telemetry) { + int in_flight, AltosFrequency in_frequency, + int in_telemetry, + int in_rate) { callsign = in_callsign; serial = in_serial; flight = in_flight; frequency = in_frequency; telemetry = in_telemetry; + rate = in_rate; } public boolean equals(AltosScanResult other) { return (serial == other.serial && frequency.frequency == other.frequency.frequency && - telemetry == other.telemetry); + telemetry == other.telemetry && + rate == other.rate); } public boolean up_to_date(AltosScanResult other) { @@ -132,15 +140,20 @@ public class AltosScanUI private JLabel scanning_label; private JLabel frequency_label; private JLabel telemetry_label; + private JLabel rate_label; private JButton cancel_button; private JButton monitor_button; private JCheckBox[] telemetry_boxes; + private JCheckBox[] rate_boxes; javax.swing.Timer timer; AltosScanResults results = new AltosScanResults(); int telemetry; boolean select_telemetry = false; + int rate; + boolean select_rate = false; + final static int timeout = 1200; TelemetryHandler handler; Thread thread; @@ -189,10 +202,11 @@ public class AltosScanUI continue; if (state.flight != AltosLib.MISSING) { final AltosScanResult result = new AltosScanResult(state.callsign, - state.serial, - state.flight, - frequencies[frequency_index], - telemetry); + state.serial, + state.flight, + frequencies[frequency_index], + telemetry, + rate); Runnable r = new Runnable() { public void run() { results.add(result); @@ -217,12 +231,18 @@ public class AltosScanUI frequency_label.setText(String.format("Frequency: %s", frequencies[frequency_index].toString())); if (select_telemetry) telemetry_label.setText(String.format("Telemetry: %s", AltosLib.telemetry_name(telemetry))); + if (select_rate) + rate_label.setText(String.format("Rate: %d baud", AltosLib.ao_telemetry_rate_values[rate])); } void set_telemetry() { reader.set_telemetry(telemetry); } + void set_rate() { + reader.set_telemetry_rate(rate); + } + void set_frequency() throws InterruptedException, TimeoutException { reader.set_frequency(frequencies[frequency_index].frequency); reader.reset(); @@ -230,24 +250,43 @@ public class AltosScanUI void next() throws InterruptedException, TimeoutException { reader.set_monitor(false); + + /* Let any pending input from the last configuration drain out */ Thread.sleep(100); - ++frequency_index; + + if (select_rate) { + boolean wrapped = false; + do { + ++rate; + if (rate > AltosLib.ao_telemetry_rate_max) { + wrapped = true; + rate = 0; + } + } while (!rate_boxes[rate].isSelected()); + set_rate(); + if (!wrapped) { + set_label(); + return; + } + } if (select_telemetry) { - if (frequency_index >= frequencies.length || - !telemetry_boxes[telemetry - AltosLib.ao_telemetry_min].isSelected()) - { - frequency_index = 0; - do { - ++telemetry; - if (telemetry > AltosLib.ao_telemetry_max) - telemetry = AltosLib.ao_telemetry_min; - } while (!telemetry_boxes[telemetry - AltosLib.ao_telemetry_min].isSelected()); - set_telemetry(); + boolean wrapped = false; + do { + ++telemetry; + if (telemetry > AltosLib.ao_telemetry_max) { + wrapped = true; + telemetry = AltosLib.ao_telemetry_min; + } + } while (!telemetry_boxes[telemetry - AltosLib.ao_telemetry_min].isSelected()); + set_telemetry(); + if (!wrapped) { + set_label(); + return; } - } else { - if (frequency_index >= frequencies.length) - frequency_index = 0; } + ++frequency_index; + if (frequency_index >= frequencies.length) + frequency_index = 0; set_frequency(); set_label(); reader.set_monitor(true); @@ -297,6 +336,20 @@ public class AltosScanUI AltosUIPreferences.set_scanning_telemetry(scanning_telemetry); } + if (cmd.equals("rate")) { + int k; + int scanning_rate = 0; + for (k = 0; k <= AltosLib.ao_telemetry_rate_max; k++) { + if (rate_boxes[k].isSelected()) + scanning_rate |= (1 << k); + } + if (scanning_rate == 0) { + scanning_rate = (1 << 0); + rate_boxes[0].setSelected(true); + } + AltosUIPreferences.set_scanning_telemetry_rate(scanning_rate); + } + if (cmd.equals("monitor")) { close(); AltosScanResult r = (AltosScanResult) (list.getSelectedValue()); @@ -304,6 +357,7 @@ public class AltosScanUI if (device != null) { if (reader != null) { reader.set_telemetry(r.telemetry); + reader.set_telemetry_rate(r.rate); reader.set_frequency(r.frequency.frequency); reader.save_frequency(); owner.scan_device_selected(device); @@ -341,6 +395,7 @@ public class AltosScanUI reader = new AltosTelemetryReader(new AltosSerial(device)); set_frequency(); set_telemetry(); + set_rate(); try { Thread.sleep(100); } catch (InterruptedException ie) { @@ -386,11 +441,13 @@ public class AltosScanUI owner = in_owner; select_telemetry = in_select_telemetry; + select_rate = true; frequencies = AltosUIPreferences.common_frequencies(); frequency_index = 0; telemetry = AltosLib.ao_telemetry_standard; + rate = 0; if (!open()) return; @@ -412,18 +469,24 @@ public class AltosScanUI if (select_telemetry) { telemetry_label = new JLabel(""); + telemetry_label.setPreferredSize(new Dimension(100, 16)); telemetry = AltosLib.ao_telemetry_min; } else { telemetry = AltosLib.ao_telemetry_standard; } + if (select_rate) { + rate_label = new JLabel(""); + rate_label.setPreferredSize(new Dimension(100, 16)); + } + set_label(); c.fill = GridBagConstraints.HORIZONTAL; - c.anchor = GridBagConstraints.WEST; + c.anchor = GridBagConstraints.LINE_START; c.insets = i; - c.weightx = 1; - c.weighty = 1; + c.weightx = 0; + c.weighty = 0; c.gridx = 0; c.gridy = 0; @@ -433,10 +496,35 @@ public class AltosScanUI c.gridy = 1; pane.add(frequency_label, c); - int y_offset = 3; + int y_offset_rate = 3; + int y_offset_telem = 3; + + int check_x = 0; + + if (select_rate && select_telemetry) + c.gridwidth = 1; + + if (select_rate) { + c.gridy = 2; + c.gridx = check_x++; + pane.add(rate_label, c); + + int scanning_rate = AltosUIPreferences.scanning_telemetry_rate(); + rate_boxes = new JCheckBox[AltosLib.ao_telemetry_rate_max + 1]; + for (int k = 0; k <= AltosLib.ao_telemetry_rate_max; k++) { + rate_boxes[k] = new JCheckBox(String.format("%d baud", AltosLib.ao_telemetry_rate_values[k])); + c.gridy = y_offset_rate + k; + pane.add(rate_boxes[k], c); + rate_boxes[k].setActionCommand("rate"); + rate_boxes[k].addActionListener(this); + rate_boxes[k].setSelected((scanning_rate & (1 << k)) != 0); + } + y_offset_rate += AltosLib.ao_telemetry_rate_max; + } if (select_telemetry) { c.gridy = 2; + c.gridx = check_x++; pane.add(telemetry_label, c); int scanning_telemetry = AltosUIPreferences.scanning_telemetry(); @@ -444,15 +532,17 @@ public class AltosScanUI for (int k = AltosLib.ao_telemetry_min; k <= AltosLib.ao_telemetry_max; k++) { int j = k - AltosLib.ao_telemetry_min; telemetry_boxes[j] = new JCheckBox(AltosLib.telemetry_name(k)); - c.gridy = 3 + j; + c.gridy = y_offset_telem + j; pane.add(telemetry_boxes[j], c); telemetry_boxes[j].setActionCommand("telemetry"); telemetry_boxes[j].addActionListener(this); telemetry_boxes[j].setSelected((scanning_telemetry & (1 << k)) != 0); } - y_offset += (AltosLib.ao_telemetry_max - AltosLib.ao_telemetry_min + 1); + y_offset_telem += (AltosLib.ao_telemetry_max - AltosLib.ao_telemetry_min + 1); } + int y_offset = Math.max(y_offset_rate, y_offset_telem); + list = new JList(results) { //Subclass JList to workaround bug 4832765, which can cause the //scroll pane to not let the user easily scroll up to the beginning -- cgit v1.2.3 From efb86669b5a74f244e2218f3385db633c36208af Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 4 Jul 2014 23:41:16 -0700 Subject: altosui: Support telemetry data rates Add combo box to flight UI and flight hardware configuration UIs Add telemetry rate to the TD/TBT config dialog Signed-off-by: Keith Packard --- altosui/AltosConfigTD.java | 25 +++++++++++++++- altosui/AltosConfigTDUI.java | 32 ++++++++++++++++++++ altosui/AltosConfigUI.java | 42 ++++++++++++++++++++++++++ altosui/AltosFlightUI.java | 46 ++++++++++++++++++----------- altosuilib/AltosUIRateList.java | 65 +++++++++++++++++++++++++++++++++++++++++ altosuilib/Makefile.am | 1 + 6 files changed, 193 insertions(+), 18 deletions(-) create mode 100644 altosuilib/AltosUIRateList.java diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 2976657c..397ed3db 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -62,6 +62,7 @@ public class AltosConfigTD implements ActionListener { int_ref radio_calibration; int_ref radio_setting; int_ref radio_frequency; + int_ref telemetry_rate; string_ref config_version; string_ref version; string_ref product; @@ -105,6 +106,7 @@ public class AltosConfigTD implements ActionListener { config_ui.set_version(version.get()); config_ui.set_radio_frequency(frequency()); config_ui.set_radio_calibration(radio_calibration.get()); + config_ui.set_telemetry_rate(telemetry_rate.get()); config_ui.set_clean(); if (!made_visible) { made_visible = true; @@ -140,6 +142,7 @@ public class AltosConfigTD implements ActionListener { get_int(line, "Radio cal:", radio_calibration); get_int(line, "Frequency:", radio_frequency); get_int(line, "Radio setting:", radio_setting); + get_int(line, "Telemetry rate:", telemetry_rate); get_string(line,"software-version", version); get_string(line,"product", product); } @@ -151,6 +154,7 @@ public class AltosConfigTD implements ActionListener { radio_setting.set(0); radio_frequency.set(0); radio_calibration.set(1186611); + telemetry_rate.set(Altos.ao_telemetry_rate_38400); config_version.set("0.0"); version.set("unknown"); product.set("unknown"); @@ -178,6 +182,19 @@ public class AltosConfigTD implements ActionListener { } } + synchronized int telemetry_rate() { + System.out.printf("telemetry_rate: %d\n", telemetry_rate.get()); + return telemetry_rate.get(); + } + + synchronized void set_telemetry_rate(int new_telemetry_rate){ + int rate = telemetry_rate.get(); + + System.out.printf("set_telemetry_rate %d\n", new_telemetry_rate); + if (rate >= 0) + telemetry_rate.set(new_telemetry_rate); + } + final static int serial_mode_read = 0; final static int serial_mode_save = 1; final static int serial_mode_reboot = 2; @@ -218,6 +235,7 @@ public class AltosConfigTD implements ActionListener { * available firmware version might place on the actual frequency */ config.set_frequency(AltosPreferences.frequency(serial.get())); + config.set_telemetry_rate(AltosPreferences.telemetry_rate(serial.get())); config.process_line("all finished"); } @@ -226,6 +244,8 @@ public class AltosConfigTD implements ActionListener { if (frequency != 0) AltosPreferences.set_frequency(serial.get(), frequency); + AltosPreferences.set_telemetry_rate(serial.get(), + telemetry_rate()); } public void run () { @@ -279,6 +299,8 @@ public class AltosConfigTD implements ActionListener { void save_data() { double freq = config_ui.radio_frequency(); set_frequency(freq); + int telemetry_rate = config_ui.telemetry_rate(); + set_telemetry_rate(telemetry_rate); run_serial_thread(serial_mode_save); } @@ -311,6 +333,7 @@ public class AltosConfigTD implements ActionListener { radio_setting = new int_ref(0); radio_frequency = new int_ref(0); radio_calibration = new int_ref(1186611); + telemetry_rate = new int_ref(AltosLib.ao_telemetry_rate_38400); config_version = new string_ref("0.0"); version = new string_ref("unknown"); product = new string_ref("unknown"); @@ -340,4 +363,4 @@ public class AltosConfigTD implements ActionListener { } } } -} \ No newline at end of file +} diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index 947d78ee..b677ad23 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -37,6 +37,7 @@ public class AltosConfigTDUI JLabel frequency_label; JLabel radio_calibration_label; JLabel radio_frequency_label; + JLabel rate_label; public boolean dirty; @@ -46,6 +47,7 @@ public class AltosConfigTDUI JLabel serial_value; AltosUIFreqList radio_frequency_value; JLabel radio_calibration_value; + AltosUIRateList rate_value; JButton save; JButton reset; @@ -192,6 +194,28 @@ public class AltosConfigTDUI radio_calibration_value = new JLabel(String.format("%d", 1186611)); pane.add(radio_calibration_value, c); + /* Telemetry Rate */ + c = new GridBagConstraints(); + c.gridx = 0; c.gridy = 7; + c.gridwidth = 4; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.LINE_START; + c.insets = il; + c.ipady = 5; + rate_label = new JLabel("Telemetry Rate:"); + pane.add(rate_label, c); + + c = new GridBagConstraints(); + c.gridx = 4; c.gridy = 7; + c.gridwidth = 4; + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + c.anchor = GridBagConstraints.LINE_START; + c.insets = ir; + c.ipady = 5; + rate_value = new AltosUIRateList(); + pane.add(rate_value, c); + /* Buttons */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = 12; @@ -339,6 +363,14 @@ public class AltosConfigTDUI radio_calibration_value.setText(String.format("%d", calibration)); } + public int telemetry_rate() { + return rate_value.getSelectedIndex(); + } + + public void set_telemetry_rate(int rate) { + rate_value.setSelectedIndex(rate); + } + public void set_clean() { dirty = false; } diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 91c37fd5..e3a1a24f 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -40,6 +40,7 @@ public class AltosConfigUI JLabel radio_calibration_label; JLabel radio_frequency_label; JLabel radio_enable_label; + JLabel rate_label; JLabel aprs_interval_label; JLabel aprs_ssid_label; JLabel flight_log_max_label; @@ -62,6 +63,7 @@ public class AltosConfigUI AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; + AltosUIRateList rate_value; JComboBox aprs_interval_value; JComboBox aprs_ssid_value; JComboBox flight_log_max_value; @@ -200,6 +202,13 @@ public class AltosConfigUI radio_enable_value.setToolTipText("Firmware version does not support disabling radio"); } + void set_rate_tool_tip() { + if (rate_value.isEnabled()) + rate_value.setToolTipText("Select telemetry baud rate"); + else + rate_value.setToolTipText("Firmware version does not support variable telemetry rates"); + } + void set_aprs_interval_tool_tip() { if (aprs_interval_value.isEnabled()) aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports"); @@ -490,6 +499,31 @@ public class AltosConfigUI set_radio_enable_tool_tip(); row++; + /* Telemetry Rate */ + 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; + rate_label = new JLabel("Telemetry baud rate:"); + pane.add(radio_enable_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; + rate_value = new AltosUIRateList(); + rate_value.addItemListener(this); + pane.add(rate_value, c); + set_rate_tool_tip(); + row++; + /* APRS interval */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -1009,6 +1043,14 @@ public class AltosConfigUI return -1; } + public void set_telemetry_rate(int new_rate) { + rate_value.set_rate(new_rate); + } + + public int telemetry_rate() { + return rate_value.rate(); + } + public void set_callsign(String new_callsign) { callsign_value.setVisible(new_callsign != null); callsign_value.setText(new_callsign); diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 5db0ee92..6af345ea 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -171,6 +171,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { Container bag; AltosUIFreqList frequencies; + AltosUIRateList rates; AltosUITelemetryList telemetries; JLabel telemetry; @@ -217,27 +218,40 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { c.anchor = GridBagConstraints.WEST; bag.add (frequencies, c); + // Telemetry rate list + rates = new AltosUIRateList(AltosUIPreferences.telemetry_rate(serial)); + rates.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int rate = rates.rate(); + try { + reader.set_telemetry_rate(rate); + } catch (TimeoutException te) { + } catch (InterruptedException ie) { + } + reader.save_telemetry_rate(); + } + }); + rates.setEnabled(reader.supports_telemetry_rate(AltosLib.ao_telemetry_rate_2400)); + c.gridx = 1; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + c.insets = new Insets(3, 3, 3, 3); + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + bag.add (rates, c); + // Telemetry format list if (reader.supports_telemetry(Altos.ao_telemetry_standard)) { - telemetries = new JComboBox(); - for (int i = 1; i <= Altos.ao_telemetry_max; i++) - telemetries.addItem(Altos.telemetry_name(i)); - int telemetry = AltosPreferences.telemetry(serial); - if (telemetry <= Altos.ao_telemetry_off || - telemetry > Altos.ao_telemetry_max) - telemetry = Altos.ao_telemetry_standard; - telemetries.setSelectedIndex(telemetry - 1); - telemetries.setMaximumRowCount(Altos.ao_telemetry_max); - telemetries.setPreferredSize(null); - telemetries.revalidate(); + telemetries = new AltosUITelemetryList(serial); telemetries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int telemetry = telemetries.getSelectedIndex() + 1; + int telemetry = telemetries.get_selected(); reader.set_telemetry(telemetry); reader.save_telemetry(); } }); - c.gridx = 1; + c.gridx = 2; c.gridy = 0; c.weightx = 0; c.weighty = 0; @@ -256,7 +270,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { version = "Telemetry: None"; telemetry = new JLabel(version); - c.gridx = 1; + c.gridx = 2; c.gridy = 0; c.weightx = 0; c.weighty = 0; @@ -274,9 +288,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { c.gridy = 1; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; - c.gridwidth = 2; + c.gridwidth = 3; bag.add(flightStatus, c); - c.gridwidth = 1; /* The rest of the window uses a tabbed pane to * show one of the alternate data views @@ -315,7 +328,6 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; - c.gridwidth = 2; bag.add(pane, c); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); diff --git a/altosuilib/AltosUIRateList.java b/altosuilib/AltosUIRateList.java new file mode 100644 index 00000000..2e0c65a2 --- /dev/null +++ b/altosuilib/AltosUIRateList.java @@ -0,0 +1,65 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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; version 2 of the License. + * + * 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. + */ + +package org.altusmetrum.altosuilib_3; + +import javax.swing.*; +import org.altusmetrum.altoslib_5.*; + +public class AltosUIRateList extends JComboBox { + + String product; + int serial; + + public void set_rate(int new_rate) { + int i; + + if (new_rate < 0) { + setVisible(false); + return; + } + + setSelectedIndex(new_rate); + } + + public void set_product(String new_product) { + product = new_product; + } + + public void set_serial(int new_serial) { + serial = new_serial; + } + + public int rate() { + return getSelectedIndex(); + } + + public AltosUIRateList () { + super(); + for (int i = 0; i < AltosLib.ao_telemetry_rate_values.length; i++) + addItem(String.format("%d baud", AltosLib.ao_telemetry_rate_values[i])); + setMaximumRowCount(getItemCount()); + setEditable(false); + product = "Unknown"; + serial = 0; + } + + public AltosUIRateList(int in_rate) { + this(); + set_rate(in_rate); + } +} diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am index 40e6dda5..21ccd131 100644 --- a/altosuilib/Makefile.am +++ b/altosuilib/Makefile.am @@ -83,6 +83,7 @@ altosuilib_JAVA = \ AltosUIVoltageIndicator.java \ AltosUIFreqList.java \ AltosUITelemetryList.java \ + AltosUIRateList.java \ OSXAdapter.java JAR=altosuilib_$(ALTOSUILIB_VERSION).jar -- cgit v1.2.3 From f02cc3eec53e9d703837dad55ec2e6625b192588 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 5 Jul 2014 00:16:57 -0700 Subject: telegps: Support variable telemetry rate Add combo box to monitoring window and device configuration. Signed-off-by: Keith Packard --- telegps/TeleGPS.java | 51 +++++++++++++++++++++++++++++++++++++++++++- telegps/TeleGPSConfigUI.java | 42 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index 7e5ff42a..d4b7bacf 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -60,6 +60,8 @@ public class TeleGPS JMenu device_menu; AltosUIFreqList frequencies; ActionListener frequency_listener; + AltosUIRateList rates; + ActionListener rate_listener; Container bag; @@ -184,6 +186,7 @@ public class TeleGPS telegps_status.disable_receive(); disable_frequency_menu(); + disable_rate_menu(); } void connect(AltosDevice device) { @@ -364,6 +367,40 @@ public class TeleGPS } + void enable_rate_menu(int serial, final AltosFlightReader reader) { + + if (rate_listener != null) + disable_rate_menu(); + + rate_listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + int rate = rates.rate(); + try { + System.out.printf("set rate %d\n", rate); + reader.set_telemetry_rate(rate); + } catch (TimeoutException te) { + } catch (InterruptedException ie) { + } + reader.save_telemetry_rate(); + } + }; + + rates.addActionListener(rate_listener); + rates.set_product("Monitor"); + rates.set_serial(serial); + rates.set_rate(AltosUIPreferences.telemetry_rate(serial)); + rates.setEnabled(reader.supports_telemetry_rate(AltosLib.ao_telemetry_rate_2400)); + } + + void disable_rate_menu() { + if (rate_listener != null) { + rates.removeActionListener(rate_listener); + rates.setEnabled(false); + rate_listener = null; + } + + } + public void set_reader(AltosFlightReader reader, AltosDevice device) { status_update = new TeleGPSStatusUpdate(telegps_status); @@ -374,8 +411,10 @@ public class TeleGPS thread = new TeleGPSDisplayThread(this, voice(), this, reader); thread.start(); - if (device != null) + if (device != null) { enable_frequency_menu(device.getSerial(), reader); + enable_rate_menu(device.getSerial(), reader); + } } static int number_of_windows; @@ -467,6 +506,16 @@ public class TeleGPS c.gridwidth = 1; bag.add(frequencies, c); + rates = new AltosUIRateList(); + rates.setEnabled(false); + c.gridx = 1; + c.gridy = 0; + c.fill = GridBagConstraints.NONE; + c.anchor = GridBagConstraints.WEST; + c.weightx = 0; + c.gridwidth = 1; + bag.add(rates, c); + displays = new LinkedList(); int serial = -1; diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index e5ac6d7e..2bd1d2df 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -37,6 +37,7 @@ public class TeleGPSConfigUI JLabel radio_calibration_label; JLabel radio_frequency_label; JLabel radio_enable_label; + JLabel rate_label; JLabel aprs_interval_label; JLabel aprs_ssid_label; JLabel flight_log_max_label; @@ -53,6 +54,7 @@ public class TeleGPSConfigUI AltosUIFreqList radio_frequency_value; JTextField radio_calibration_value; JRadioButton radio_enable_value; + AltosUIRateList rate_value; JComboBox aprs_interval_value; JComboBox aprs_ssid_value; JComboBox flight_log_max_value; @@ -147,6 +149,13 @@ public class TeleGPSConfigUI radio_enable_value.setToolTipText("Firmware version does not support disabling radio"); } + void set_rate_tool_tip() { + if (rate_value.isEnabled()) + rate_value.setToolTipText("Select telemetry baud rate"); + else + rate_value.setToolTipText("Firmware version does not support variable telemetry rates"); + } + void set_aprs_interval_tool_tip() { if (aprs_interval_value.isEnabled()) aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports"); @@ -326,6 +335,31 @@ public class TeleGPSConfigUI set_radio_enable_tool_tip(); row++; + /* Telemetry Rate */ + 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; + rate_label = new JLabel("Telemetry baud rate:"); + pane.add(radio_enable_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; + rate_value = new AltosUIRateList(); + rate_value.addItemListener(this); + pane.add(rate_value, c); + set_rate_tool_tip(); + row++; + /* APRS interval */ c = new GridBagConstraints(); c.gridx = 0; c.gridy = row; @@ -703,6 +737,14 @@ public class TeleGPSConfigUI return -1; } + public void set_telemetry_rate(int new_rate) { + rate_value.set_rate(new_rate); + } + + public int telemetry_rate() { + return rate_value.rate(); + } + public void set_callsign(String new_callsign) { callsign_value.setVisible(new_callsign != null); callsign_value.setText(new_callsign); -- cgit v1.2.3 From d1527a5457210eb914312cf8857bfb88982a8462 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 6 Jul 2014 12:35:13 -0700 Subject: Add support for the "kite" micropeak variant This uses a 100m 'launch detect' altitude and logs data every 19.2s instead of every .192s. Signed-off-by: Keith Packard --- micropeak/MicroData.java | 26 ++++++-- micropeak/MicroPeak.java | 4 +- src/Makefile | 2 +- src/kernel/ao_log_micro.c | 11 ++++ src/kernel/ao_microflight.c | 15 ++++- src/microkite/.gitignore | 2 + src/microkite/Makefile | 134 ++++++++++++++++++++++++++++++++++++++ src/microkite/ao_pins.h | 70 ++++++++++++++++++++ src/microkite/microkite-load.tmpl | 20 ++++++ src/product/ao_micropeak.h | 11 ++++ 10 files changed, 284 insertions(+), 11 deletions(-) create mode 100644 src/microkite/.gitignore create mode 100644 src/microkite/Makefile create mode 100644 src/microkite/ao_pins.h create mode 100644 src/microkite/microkite-load.tmpl diff --git a/micropeak/MicroData.java b/micropeak/MicroData.java index 6c9447aa..c38ada91 100644 --- a/micropeak/MicroData.java +++ b/micropeak/MicroData.java @@ -97,9 +97,15 @@ public class MicroData implements AltosUIDataSet { private double time_step; private double ground_altitude; private ArrayList bytes; + public int log_id; String name; MicroStats stats; - + + public static final int LOG_ID_MICROPEAK = 0; + public static final int LOG_ID_MICROKITE = 1; + + public static final double CLOCK = 0.096; + public class FileEndedException extends Exception { } @@ -172,7 +178,7 @@ public class MicroData implements AltosUIDataSet { if (get_nonwhite(f) == 'M' && get_nonwhite(f) == 'P') return true; } - } + } private int get_32(InputStream f) throws IOException, FileEndedException, NonHexcharException { int v = 0; @@ -345,6 +351,9 @@ public class MicroData implements AltosUIDataSet { ground_pressure = get_32(f); min_pressure = get_32(f); int nsamples = get_16(f); + + log_id = nsamples >> 12; + nsamples &= 0xfff; pressures = new int[nsamples + 1]; ground_altitude = AltosConvert.pressure_to_altitude(ground_pressure); @@ -367,7 +376,7 @@ public class MicroData implements AltosUIDataSet { else cur = down; } - + pressures[i+1] = cur; } @@ -376,7 +385,14 @@ public class MicroData implements AltosUIDataSet { crc_valid = crc == current_crc; - time_step = 0.192; + switch (log_id) { + case LOG_ID_MICROPEAK: + time_step = 2 * CLOCK; + break; + case LOG_ID_MICROKITE: + time_step = 200 * CLOCK; + break; + } stats = new MicroStats(this); } catch (FileEndedException fe) { throw new IOException("File Ended Unexpectedly"); @@ -389,5 +405,5 @@ public class MicroData implements AltosUIDataSet { pressures = new int[1]; pressures[0] = 101000; } - + } diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index 8bdf4b77..1744e803 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -107,7 +107,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene private void DownloadData() { AltosDevice device = MicroDeviceDialog.show(this); - + if (device != null) new MicroDownload(this, device); } @@ -128,7 +128,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene if (save.runDialog()) SetName(data.name); } - + private void Export() { if (data == null) { no_data(); diff --git a/src/Makefile b/src/Makefile index 4e8b3c20..df7a31ee 100644 --- a/src/Makefile +++ b/src/Makefile @@ -39,7 +39,7 @@ ARMM0DIRS=\ easymini-v1.0 easymini-v1.0/flash-loader AVRDIRS=\ - telescience-v0.1 telescience-pwm micropeak nanopeak-v0.1 + telescience-v0.1 telescience-pwm micropeak nanopeak-v0.1 microkite SUBDIRS= diff --git a/src/kernel/ao_log_micro.c b/src/kernel/ao_log_micro.c index d665efb5..aef78def 100644 --- a/src/kernel/ao_log_micro.c +++ b/src/kernel/ao_log_micro.c @@ -22,10 +22,17 @@ static uint16_t ao_log_offset = STARTING_LOG_OFFSET; +#define AO_LOG_ID_SHIFT 12 +#define AO_LOG_ID_MASK ((1 << AO_LOG_ID_SHIFT) - 1) + void ao_log_micro_save(void) { uint16_t n_samples = (ao_log_offset - STARTING_LOG_OFFSET) / sizeof (uint16_t); + +#if AO_LOG_ID + n_samples |= AO_LOG_ID << AO_LOG_ID_SHIFT; +#endif ao_eeprom_write(PA_GROUND_OFFSET, &pa_ground, sizeof (pa_ground)); ao_eeprom_write(PA_MIN_OFFSET, &pa_min, sizeof (pa_min)); ao_eeprom_write(N_SAMPLES_OFFSET, &n_samples, sizeof (n_samples)); @@ -99,8 +106,12 @@ ao_log_micro_dump(void) uint16_t crc = 0xffff; ao_eeprom_read(N_SAMPLES_OFFSET, &n_samples, sizeof (n_samples)); + if (n_samples == 0xffff) n_samples = 0; +#if AO_LOG_ID + n_samples &= AO_LOG_ID_MASK; +#endif nbytes = STARTING_LOG_OFFSET + sizeof (uint16_t) * n_samples; ao_async_start(); ao_async_byte('M'); diff --git a/src/kernel/ao_microflight.c b/src/kernel/ao_microflight.c index f680e400..df624e79 100644 --- a/src/kernel/ao_microflight.c +++ b/src/kernel/ao_microflight.c @@ -43,10 +43,12 @@ void ao_microflight(void) { int16_t sample_count; + int16_t log_count; uint16_t time; uint32_t pa_interval_min, pa_interval_max; int32_t pa_diff; - uint8_t h, i; + uint8_t h; + uint8_t i; uint8_t accel_lock = 0; uint32_t pa_sum = 0; @@ -93,7 +95,10 @@ ao_microflight(void) } /* Log the remaining samples so we get a complete history since leaving the ground */ - for (; i != h; i = SKIP_PA_HIST(i,2)) { +#if LOG_INTERVAL < NUM_PA_HIST + for (; i != h; i = SKIP_PA_HIST(i,2)) +#endif + { pa = pa_hist[i]; ao_log_micro_data(); } @@ -101,6 +106,7 @@ ao_microflight(void) /* Now sit around until the pressure is stable again and record the max */ sample_count = 0; + log_count = 0; pa_min = ao_pa; pa_interval_min = ao_pa; pa_interval_max = ao_pa; @@ -112,8 +118,11 @@ ao_microflight(void) ao_microsample(); if ((sample_count & 3) == 0) ao_led_off(AO_LED_REPORT); - if (sample_count & 1) + if (log_count == LOG_INTERVAL - 1) { ao_log_micro_data(); + log_count = 0; + } else + log_count++; /* If accelerating upwards, don't look for min pressure */ if (ao_pa_accel < ACCEL_LOCK_PA) diff --git a/src/microkite/.gitignore b/src/microkite/.gitignore new file mode 100644 index 00000000..7a5d0a1f --- /dev/null +++ b/src/microkite/.gitignore @@ -0,0 +1,2 @@ +ao_product.h +microkite-* diff --git a/src/microkite/Makefile b/src/microkite/Makefile new file mode 100644 index 00000000..b7523758 --- /dev/null +++ b/src/microkite/Makefile @@ -0,0 +1,134 @@ +# +# Tiny AltOS build +# +# +vpath % ../attiny:../drivers:../kernel:../product:.. +vpath ao-make-product.5c ../util +vpath make-altitude-pa ../util + +include ../avr/Makefile.defs + +PROGNAME=microkite-v0.1 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +SCRIPT=microkite-load + +PUBLISH_DIR=$(HOME)/altusmetrumllc/Binaries +PUBLISH_HEX=$(PUBLISH_DIR)/$(HEX) +PUBLISH_SCRIPT=$(PUBLISH_DIR)/$(SCRIPT) + +MCU=attiny85 +DUDECPUTYPE=t85 +#PROGRAMMER=stk500v2 -P usb +LOADSLOW=-i 32 -B 32 +LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w: + +#LDFLAGS=-L$(LDSCRIPTS) -Tavr25.x + +ALTOS_SRC = \ + ao_micropeak.c \ + ao_spi_attiny.c \ + ao_led.c \ + ao_clock.c \ + ao_ms5607.c \ + ao_exti.c \ + ao_convert_pa.c \ + ao_report_micro.c \ + ao_notask.c \ + ao_eeprom_tiny.c \ + ao_panic.c \ + ao_log_micro.c \ + ao_async.c \ + ao_microflight.c \ + ao_microkalman.c + +INC=\ + ao.h \ + ao_pins.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_exti.h \ + ao_ms5607.h \ + ao_log_micro.h \ + ao_micropeak.h \ + altitude-pa.h + +IDPRODUCT=0 +PRODUCT=MicroKite-v0.1 +PRODUCT_DEF=-DMICROPEAK +CFLAGS = $(PRODUCT_DEF) -I. -I../attiny -I../kernel -I.. -I../drivers -I../product +CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O2 -mcall-prologues -DATTINY + +NICKLE=nickle + +SRC=$(ALTOS_SRC) +OBJ=$(SRC:.c=.o) + +V=0 +# The user has explicitly enabled quiet compilation. +ifeq ($(V),0) +quiet = @printf " $1 $2 $@\n"; $($1) +endif +# Otherwise, print the full command line. +quiet ?= $($1) + +all: $(PROG) $(HEX) microkite-load + +CHECK=sh ../util/check-avr-mem + +$(PROG): Makefile $(OBJ) + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) + $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1) + +$(HEX): $(PROG) + avr-size $(PROG) + $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@ + + +load: $(HEX) + $(LOADCMD) $(LOADARG)$(HEX) + +load-slow: $(HEX) + $(LOADCMD) $(LOADSLOW) $(LOADARG)$(HEX) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +ao_product.o: ao_product.c ao_product.h + +%.o : %.c $(INC) + $(call quiet,CC) -c $(CFLAGS) $< + +distclean: clean + +clean: + rm -f *.o $(PROG) $(HEX) $(SCRIPT) + rm -f ao_product.h + +publish: $(PUBLISH_HEX) $(PUBLISH_SCRIPT) + +$(PUBLISH_HEX): $(HEX) + cp -a $(HEX) $@ + +$(PUBLISH_SCRIPT): $(SCRIPT) + cp -a $(SCRIPT) $@ + +load-product: + ./$(SCRIPT) fast + +load-product-slow: + ./$(SCRIPT) slow + +../altitude-pa.h: make-altitude-pa + nickle $< > $@ + +$(SCRIPT): $(SCRIPT).tmpl Makefile ../Version + sed -e 's/%HEX%/$(HEX)/' -e 's/%LOADCMD%/$(LOADCMD)/' -e 's/%LOADARG%/$(LOADARG)/' -e 's/%LOADSLOW%/$(LOADSLOW)/' $(SCRIPT).tmpl > $@ || (rm $@ && exit 1) + chmod +x $@ + +install: + +uninstall: + +$(OBJ): ao_product.h $(INC) diff --git a/src/microkite/ao_pins.h b/src/microkite/ao_pins.h new file mode 100644 index 00000000..3c56dfb8 --- /dev/null +++ b/src/microkite/ao_pins.h @@ -0,0 +1,70 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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; version 2 of the License. + * + * 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 + +#define AO_LED_ORANGE (1<<4) +#define AO_LED_SERIAL 4 +#define AO_LED_PANIC AO_LED_ORANGE +#define AO_LED_REPORT AO_LED_ORANGE +#define LEDS_AVAILABLE (AO_LED_ORANGE) +#define USE_SERIAL_1_STDIN 0 +#define HAS_USB 0 +#define PACKET_HAS_SLAVE 0 +#define HAS_SERIAL_1 0 +#define HAS_TASK 0 +#define HAS_MS5607 1 +#define HAS_MS5611 0 +#define HAS_EEPROM 0 +#define HAS_BEEP 0 +#define AVR_CLOCK 250000UL + +/* SPI */ +#define SPI_PORT PORTB +#define SPI_PIN PINB +#define SPI_DIR DDRB +#define AO_MS5607_CS_PORT PORTB +#define AO_MS5607_CS_PIN 3 + +/* MS5607 */ +#define AO_MS5607_SPI_INDEX 0 +#define AO_MS5607_MISO_PORT PORTB +#define AO_MS5607_MISO_PIN 0 +#define AO_MS5607_BARO_OVERSAMPLE 4096 +#define AO_MS5607_TEMP_OVERSAMPLE 1024 + +/* I2C */ +#define I2C_PORT PORTB +#define I2C_PIN PINB +#define I2C_DIR DDRB +#define I2C_PIN_SCL PINB2 +#define I2C_PIN_SDA PINB0 + +#define AO_CONST_ATTRIB PROGMEM +typedef int32_t alt_t; +#define FETCH_ALT(o) ((alt_t) pgm_read_dword(&altitude_table[o])) + +#define AO_ALT_VALUE(x) ((x) * (alt_t) 10) + +#define BOOST_DETECT 1200 /* 100m (ish) */ +#define LOG_INTERVAL 200 /* 19.2 seconds */ + +#define AO_LOG_ID AO_LOG_ID_MICROKITE + +#endif /* _AO_PINS_H_ */ diff --git a/src/microkite/microkite-load.tmpl b/src/microkite/microkite-load.tmpl new file mode 100644 index 00000000..08236a15 --- /dev/null +++ b/src/microkite/microkite-load.tmpl @@ -0,0 +1,20 @@ +#!/bin/sh +dir=`dirname $0` + +HEX="$dir"/"%HEX%" +LOADCMD="%LOADCMD%" +LOADARG="%LOADARG%" +LOADSLOW="%LOADSLOW%" +LOADFAST="" + +case "$1" in +fast) + LOADSPEED="$LOADFAST" + ;; +*) + LOADSPEED="$LOADSLOW" + ;; +esac + +echo ${LOADCMD} ${LOADSPEED} ${LOADARG}${HEX} +${LOADCMD} ${LOADSPEED} ${LOADARG}${HEX} diff --git a/src/product/ao_micropeak.h b/src/product/ao_micropeak.h index 0ec407d7..396b9a23 100644 --- a/src/product/ao_micropeak.h +++ b/src/product/ao_micropeak.h @@ -29,6 +29,17 @@ #define BOOST_DETECT 360 /* 30m at sea level, 36m at 2000m */ #endif +#ifndef LOG_INTERVAL +#define LOG_INTERVAL 2 /* 192 ms */ +#endif + +#define AO_LOG_ID_MICROPEAK 0 +#define AO_LOG_ID_MICROKITE 1 + +#ifndef AO_LOG_ID +#define AO_LOG_ID AO_LOG_ID_MICROPEAK +#endif + /* Wait after power on before doing anything to give the user time to assemble the rocket */ #define BOOST_DELAY AO_SEC_TO_TICKS(60) -- cgit v1.2.3 From 78db9e350db104da87e0fe4b72aa41bf6cf45e1d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 6 Jul 2014 20:10:21 -0700 Subject: Bump version to 1.4.9.1 -- on the way to 1.5 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 89994ccb..8cc5adc1 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.4.1.1) +AC_INIT([altos], 1.4.9.1) AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -- cgit v1.2.3 From 95f3a2825377bdb6737446df051c069d58f42d08 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Jul 2014 23:43:31 -0700 Subject: altosui: Hide inactive altimeter configuration entries Instead of disabling them, just hide them so that entries that do not apply to a particular device won't get shown at all. Signed-off-by: Keith Packard --- altosui/AltosConfigTD.java | 2 -- altosui/AltosConfigUI.java | 63 ++++++++++++++++++++++++++++++----------- altosuilib/AltosUIFreqList.java | 1 + altosuilib/AltosUIRateList.java | 6 +--- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 397ed3db..4389e49b 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -183,14 +183,12 @@ public class AltosConfigTD implements ActionListener { } synchronized int telemetry_rate() { - System.out.printf("telemetry_rate: %d\n", telemetry_rate.get()); return telemetry_rate.get(); } synchronized void set_telemetry_rate(int new_telemetry_rate){ int rate = telemetry_rate.get(); - System.out.printf("set_telemetry_rate %d\n", new_telemetry_rate); if (rate >= 0) telemetry_rate.set(new_telemetry_rate); } diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index e3a1a24f..043cb876 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -508,7 +508,7 @@ public class AltosConfigUI c.insets = il; c.ipady = 5; rate_label = new JLabel("Telemetry baud rate:"); - pane.add(radio_enable_label, c); + pane.add(rate_label, c); c = new GridBagConstraints(); c.gridx = 4; c.gridy = row; @@ -929,6 +929,10 @@ public class AltosConfigUI public void set_main_deploy(int new_main_deploy) { main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy)); main_deploy_value.setEnabled(new_main_deploy >= 0); + + main_deploy_value.setVisible(new_main_deploy >= 0); + main_deploy_label.setVisible(new_main_deploy >= 0); + } public int main_deploy() { @@ -976,6 +980,9 @@ public class AltosConfigUI } public void set_apogee_delay(int new_apogee_delay) { + apogee_delay_value.setVisible(new_apogee_delay >= 0); + apogee_delay_label.setVisible(new_apogee_delay >= 0); + apogee_delay_value.setSelectedItem(Integer.toString(new_apogee_delay)); apogee_delay_value.setEnabled(new_apogee_delay >= 0); } @@ -998,6 +1005,9 @@ public class AltosConfigUI public void set_apogee_lockout(int new_apogee_lockout) { apogee_lockout_value.setSelectedItem(Integer.toString(new_apogee_lockout)); apogee_lockout_value.setEnabled(new_apogee_lockout >= 0); + + apogee_lockout_value.setVisible(new_apogee_lockout >= 0); + apogee_lockout_label.setVisible(new_apogee_lockout >= 0); } public int apogee_lockout() throws AltosConfigDataException { @@ -1005,6 +1015,7 @@ public class AltosConfigUI } public void set_radio_frequency(double new_radio_frequency) { + radio_frequency_label.setVisible(new_radio_frequency >= 0); radio_frequency_value.set_frequency(new_radio_frequency); } @@ -1014,6 +1025,8 @@ public class AltosConfigUI public void set_radio_calibration(int new_radio_calibration) { radio_calibration_value.setVisible(new_radio_calibration >= 0); + radio_calibration_label.setVisible(new_radio_calibration >= 0); + if (new_radio_calibration < 0) radio_calibration_value.setText("Disabled"); else @@ -1025,12 +1038,14 @@ public class AltosConfigUI } public void set_radio_enable(int new_radio_enable) { + radio_enable_label.setVisible(new_radio_enable >= 0); + radio_enable_value.setVisible(new_radio_enable >= 0); + if (new_radio_enable >= 0) { radio_enable_value.setSelected(new_radio_enable > 0); radio_enable_value.setEnabled(true); } else { radio_enable_value.setSelected(true); - radio_enable_value.setVisible(radio_frequency() > 0); radio_enable_value.setEnabled(false); } set_radio_enable_tool_tip(); @@ -1044,6 +1059,8 @@ public class AltosConfigUI } public void set_telemetry_rate(int new_rate) { + rate_label.setVisible(new_rate >= 0); + rate_value.set_rate(new_rate); } @@ -1053,6 +1070,8 @@ public class AltosConfigUI public void set_callsign(String new_callsign) { callsign_value.setVisible(new_callsign != null); + callsign_label.setVisible(new_callsign != null); + callsign_value.setText(new_callsign); } @@ -1074,6 +1093,9 @@ public class AltosConfigUI } public void set_flight_log_max(int new_flight_log_max) { + flight_log_max_value.setVisible(new_flight_log_max >= 0); + flight_log_max_label.setVisible(new_flight_log_max >= 0); + flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max)); flight_log_max = new_flight_log_max; set_flight_log_max_tool_tip(); @@ -1100,6 +1122,9 @@ public class AltosConfigUI } public void set_ignite_mode(int new_ignite_mode) { + ignite_mode_value.setVisible(new_ignite_mode >= 0); + ignite_mode_label.setVisible(new_ignite_mode >= 0); + if (new_ignite_mode >= ignite_mode_values.length) new_ignite_mode = 0; if (new_ignite_mode < 0) { @@ -1121,14 +1146,13 @@ public class AltosConfigUI public void set_pad_orientation(int new_pad_orientation) { + pad_orientation_value.setVisible(new_pad_orientation >= 0); + pad_orientation_label.setVisible(new_pad_orientation >= 0); + if (new_pad_orientation >= pad_orientation_values.length) new_pad_orientation = 0; - if (new_pad_orientation < 0) { - pad_orientation_value.setVisible(false); + if (new_pad_orientation < 0) new_pad_orientation = 0; - } else { - pad_orientation_value.setVisible(true); - } pad_orientation_value.setSelectedIndex(new_pad_orientation); set_pad_orientation_tool_tip(); } @@ -1141,6 +1165,9 @@ public class AltosConfigUI } public void set_beep(int new_beep) { + beep_value.setVisible(new_beep >= 0); + beep_label.setVisible(new_beep >= 0); + int new_freq = (int) Math.floor (AltosConvert.beep_value_to_freq(new_beep) + 0.5); for (int i = 0; i < beep_values.length; i++) if (new_beep == AltosConvert.beep_freq_to_value(Integer.parseInt(beep_values[i]))) { @@ -1192,13 +1219,12 @@ public class AltosConfigUI } public void set_tracker_motion(int tracker_motion) { + tracker_motion_label.setVisible(tracker_motion >= 0); + tracker_motion_value.setVisible(tracker_motion >= 0); + if (tracker_motion < 0) { - tracker_motion_label.setVisible(false); - tracker_motion_value.setVisible(false); tracker_motion_value.setEnabled(false); } else { - tracker_motion_label.setVisible(true); - tracker_motion_value.setVisible(true); tracker_motion_value.setEnabled(true); tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); } @@ -1209,13 +1235,12 @@ public class AltosConfigUI } public void set_tracker_interval(int tracker_interval) { + tracker_interval_label.setVisible(tracker_interval >= 0); + tracker_interval_value.setVisible(tracker_interval >= 0); + if (tracker_interval< 0) { - tracker_interval_label.setVisible(false); - tracker_interval_value.setVisible(false); tracker_interval_value.setEnabled(false); } else { - tracker_interval_label.setVisible(true); - tracker_interval_value.setVisible(true); tracker_interval_value.setEnabled(true); tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); } @@ -1252,6 +1277,9 @@ public class AltosConfigUI } public void set_aprs_interval(int new_aprs_interval) { + aprs_interval_value.setVisible(new_aprs_interval >= 0); + aprs_interval_label.setVisible(new_aprs_interval >= 0); + String s; if (new_aprs_interval <= 0) @@ -1259,7 +1287,6 @@ public class AltosConfigUI else s = Integer.toString(new_aprs_interval); aprs_interval_value.setSelectedItem(s); - aprs_interval_value.setVisible(new_aprs_interval >= 0); set_aprs_interval_tool_tip(); } @@ -1272,8 +1299,10 @@ public class AltosConfigUI } public void set_aprs_ssid(int new_aprs_ssid) { - aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid)); aprs_ssid_value.setVisible(new_aprs_ssid >= 0); + aprs_ssid_label.setVisible(new_aprs_ssid >= 0); + + aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid)); set_aprs_ssid_tool_tip(); } diff --git a/altosuilib/AltosUIFreqList.java b/altosuilib/AltosUIFreqList.java index f1f83dd5..84e6dce4 100644 --- a/altosuilib/AltosUIFreqList.java +++ b/altosuilib/AltosUIFreqList.java @@ -53,6 +53,7 @@ public class AltosUIFreqList extends JComboBox { AltosUIPreferences.add_common_frequency(frequency); insertItemAt(frequency, i); setMaximumRowCount(getItemCount()); + setVisible(true); } public void set_product(String new_product) { diff --git a/altosuilib/AltosUIRateList.java b/altosuilib/AltosUIRateList.java index 2e0c65a2..ee35ce6d 100644 --- a/altosuilib/AltosUIRateList.java +++ b/altosuilib/AltosUIRateList.java @@ -28,11 +28,7 @@ public class AltosUIRateList extends JComboBox { public void set_rate(int new_rate) { int i; - if (new_rate < 0) { - setVisible(false); - return; - } - + setVisible(new_rate >= 0); setSelectedIndex(new_rate); } -- cgit v1.2.3 From 1a55cbe1923280f7009c13d5eb5b2ccac89219c2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Jul 2014 23:45:10 -0700 Subject: altos/telemini-v2.0: Add memory decorations to new telemetry variables This lets TeleMini-v2.0 compile. Signed-off-by: Keith Packard --- src/kernel/ao_telemetry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index f4fcf400..d321c8ff 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -1,5 +1,5 @@ /* - * Copyright © 2011 Keith Packard + * Copyright © 2011 Keth Packard * * 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 @@ -26,7 +26,7 @@ static __pdata uint16_t ao_telemetry_interval; #if HAS_RADIO_RATE -static __pdata uint16_t ao_telemetry_desired_interval; +static __xdata uint16_t ao_telemetry_desired_interval; #endif #if HAS_RDF @@ -511,7 +511,7 @@ ao_telemetry_set_interval(uint16_t interval) #if HAS_RADIO_RATE /* Limit max telemetry rate based on available radio bandwidth. */ - static const uint16_t min_interval[] = { + static __xdata const uint16_t min_interval[] = { /* [AO_RADIO_RATE_38400] = */ AO_MS_TO_TICKS(100), /* [AO_RADIO_RATE_9600] = */ AO_MS_TO_TICKS(500), /* [AO_RADIO_RATE_2400] = */ AO_MS_TO_TICKS(1000) -- cgit v1.2.3 From d926ccfbd4596eb3f981d2fcf8f6fc6ccc427db6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Jul 2014 23:46:24 -0700 Subject: altos: Add smaller pa to altitude table for TeleMini TeleMini doesn't have space for the larger table, and the smaller one isn't that much less accurate at lower altitudes. Signed-off-by: Keith Packard --- src/Makefile | 5 +- src/kernel/ao_convert_pa.c | 4 + src/util/make-altitude-pa | 184 ++++++++++++++++++++++++++------------------- 3 files changed, 115 insertions(+), 78 deletions(-) diff --git a/src/Makefile b/src/Makefile index df7a31ee..a7a26b26 100644 --- a/src/Makefile +++ b/src/Makefile @@ -98,7 +98,7 @@ uninstall: all-recursive: all-local -all-local: altitude.h altitude-pa.h ao_kalman.h ao_whiten.h $(PDCLIB) +all-local: altitude.h altitude-pa.h altitude-pa-small.h ao_kalman.h ao_whiten.h $(PDCLIB) altitude.h: make-altitude nickle $< > $@ @@ -106,6 +106,9 @@ altitude.h: make-altitude altitude-pa.h: make-altitude-pa nickle $< > $@ +altitude-pa-small.h: make-altitude-pa + nickle $< --sample 3 > $@ + ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c bash $< kalman > $@ diff --git a/src/kernel/ao_convert_pa.c b/src/kernel/ao_convert_pa.c index fe6e0ef6..20162c1f 100644 --- a/src/kernel/ao_convert_pa.c +++ b/src/kernel/ao_convert_pa.c @@ -24,7 +24,11 @@ #endif static const alt_t altitude_table[] AO_CONST_ATTRIB = { +#if AO_SMALL_ALTITUDE_TABLE +#include "altitude-pa-small.h" +#else #include "altitude-pa.h" +#endif }; #ifndef FETCH_ALT diff --git a/src/util/make-altitude-pa b/src/util/make-altitude-pa index 22831d50..d36f3f41 100644 --- a/src/util/make-altitude-pa +++ b/src/util/make-altitude-pa @@ -185,105 +185,135 @@ line_t best_fit(real[] values, int first, int last) { return (line_t) { m = m, b = b }; } -real min_Pa = 0; -real max_Pa = 120000; +void print_table (int pa_sample_shift, int pa_part_shift) +{ + real min_Pa = 0; + real max_Pa = 120000; -/* Target is an array of < 1000 entries */ -int pa_sample_shift = 2; -int pa_part_shift = 6; -int pa_part_mask = (1 << pa_part_shift) - 1; + int pa_part_mask = (1 << pa_part_shift) - 1; -int num_part = ceil(max_Pa / (2 ** (pa_part_shift + pa_sample_shift))); + int num_part = ceil(max_Pa / (2 ** (pa_part_shift + pa_sample_shift))); -int num_samples = num_part << pa_part_shift; + int num_samples = num_part << pa_part_shift; -real sample_to_Pa(int sample) = sample << pa_sample_shift; + real sample_to_Pa(int sample) = sample << pa_sample_shift; -real sample_to_altitude(int sample) = pressure_to_altitude(sample_to_Pa(sample)); + real sample_to_altitude(int sample) = pressure_to_altitude(sample_to_Pa(sample)); -int part_to_sample(int part) = part << pa_part_shift; + int part_to_sample(int part) = part << pa_part_shift; -int sample_to_part(int sample) = sample >> pa_part_shift; + int sample_to_part(int sample) = sample >> pa_part_shift; -bool is_part(int sample) = (sample & pa_part_mask) == 0; + bool is_part(int sample) = (sample & pa_part_mask) == 0; -real[num_samples] alt = { [n] = sample_to_altitude(n) }; + real[num_samples] alt = { [n] = sample_to_altitude(n) }; -int seg_len = 1 << pa_part_shift; + int seg_len = 1 << pa_part_shift; -line_t [num_part] fit = { - [n] = best_fit(alt, n * seg_len, n * seg_len + seg_len - 1) -}; - -real[num_samples/seg_len + 1] alt_part; -real[dim(alt_part)] alt_error = {0...}; - -alt_part[0] = fit[0].b; -alt_part[dim(fit)] = fit[dim(fit)-1].m * dim(fit) * seg_len + fit[dim(fit)-1].b; + line_t [num_part] fit = { + [n] = best_fit(alt, n * seg_len, n * seg_len + seg_len - 1) + }; -for (int i = 0; i < dim(fit) - 1; i++) { - real here, there; - here = fit[i].m * (i+1) * seg_len + fit[i].b; - there = fit[i+1].m * (i+1) * seg_len + fit[i+1].b; -# printf ("at %d mis-fit %8.2f\n", i, there - here); - alt_part[i+1] = (here + there) / 2; -} + real[num_samples/seg_len + 1] alt_part; + real[dim(alt_part)] alt_error = {0...}; -real round(real x) = floor(x + 0.5); + alt_part[0] = fit[0].b; + alt_part[dim(fit)] = fit[dim(fit)-1].m * dim(fit) * seg_len + fit[dim(fit)-1].b; -real sample_to_fit_altitude(int sample) { - int sub = sample // seg_len; - int off = sample % seg_len; - line_t l = fit[sub]; - real r_v; - real i_v; + for (int i = 0; i < dim(fit) - 1; i++) { + real here, there; + here = fit[i].m * (i+1) * seg_len + fit[i].b; + there = fit[i+1].m * (i+1) * seg_len + fit[i+1].b; +# printf ("at %d mis-fit %8.2f\n", i, there - here); + alt_part[i+1] = (here + there) / 2; + } - r_v = sample * l.m + l.b; - i_v = (round(alt_part[sub]*10) * (seg_len - off) + round(alt_part[sub+1]*10) * off) / seg_len; - return i_v/10; -} + real round(real x) = floor(x + 0.5); -real max_error = 0; -int max_error_sample = 0; -real total_error = 0; + real sample_to_fit_altitude(int sample) { + int sub = sample // seg_len; + int off = sample % seg_len; + line_t l = fit[sub]; + real r_v; + real i_v; -for (int sample = 0; sample < num_samples; sample++) { - real Pa = sample_to_Pa(sample); - real meters = alt[sample]; + r_v = sample * l.m + l.b; + i_v = (round(alt_part[sub]*10) * (seg_len - off) + round(alt_part[sub+1]*10) * off) / seg_len; + return i_v/10; + } - real meters_approx = sample_to_fit_altitude(sample); - real error = abs(meters - meters_approx); + real max_error = 0; + int max_error_sample = 0; + real total_error = 0; + + for (int sample = 0; sample < num_samples; sample++) { + real Pa = sample_to_Pa(sample); + real meters = alt[sample]; + + real meters_approx = sample_to_fit_altitude(sample); + real error = abs(meters - meters_approx); + + int part = sample_to_part(sample); + + if (error > alt_error[part]) + alt_error[part] = error; + + total_error += error; + if (error > max_error) { + max_error = error; + max_error_sample = sample; + } + if (false) { + printf (" %8.1f %8.2f %8.2f %8.2f %s\n", + Pa, + meters, + meters_approx, + meters - meters_approx, + is_part(sample) ? "*" : ""); + } + } - int part = sample_to_part(sample); + printf ("/*max error %f at %7.3f kPa. Average error %f*/\n", + max_error, sample_to_Pa(max_error_sample) / 1000, total_error / num_samples); - if (error > alt_error[part]) - alt_error[part] = error; + printf ("#define NALT %d\n", dim(alt_part)); + printf ("#define ALT_SHIFT %d\n", pa_part_shift + pa_sample_shift); + printf ("#ifndef AO_ALT_VALUE\n#define AO_ALT_VALUE(x) (alt_t) (x)\n#endif\n"); - total_error += error; - if (error > max_error) { - max_error = error; - max_error_sample = sample; - } - if (false) { - printf (" %8.1f %8.2f %8.2f %8.2f %s\n", - Pa, - meters, - meters_approx, - meters - meters_approx, - is_part(sample) ? "*" : ""); + for (int part = 0; part < dim(alt_part); part++) { + real kPa = sample_to_Pa(part_to_sample(part)) / 1000; + printf ("AO_ALT_VALUE(%10.1f), /* %6.2f kPa error %6.2fm */\n", + round (alt_part[part]*10) / 10, kPa, + alt_error[part]); } } -printf ("/*max error %f at %7.3f kPa. Average error %f*/\n", - max_error, sample_to_Pa(max_error_sample) / 1000, total_error / num_samples); - -printf ("#define NALT %d\n", dim(alt_part)); -printf ("#define ALT_SHIFT %d\n", pa_part_shift + pa_sample_shift); -printf ("#ifndef AO_ALT_VALUE\n#define AO_ALT_VALUE(x) (alt_t) (x)\n#endif\n"); - -for (int part = 0; part < dim(alt_part); part++) { - real kPa = sample_to_Pa(part_to_sample(part)) / 1000; - printf ("AO_ALT_VALUE(%10.1f), /* %6.2f kPa error %6.2fm */\n", - round (alt_part[part]*10) / 10, kPa, - alt_error[part]); +autoload ParseArgs; + +void main() +{ + /* Target is an array of < 1000 entries */ + int pa_sample_shift = 2; + int pa_part_shift = 6; + + ParseArgs::argdesc argd = { + .args = { + { .var = { .arg_int = &pa_sample_shift }, + .abbr = 's', + .name = "sample", + .expr_name = "sample_shift", + .desc = "sample shift value" }, + { .var = { .arg_int = &pa_part_shift }, + .abbr = 'p', + .name = "part", + .expr_name = "part_shift", + .desc = "part shift value" }, + } + }; + + ParseArgs::parseargs(&argd, &argv); + + print_table(pa_sample_shift, pa_part_shift); } + +main(); -- cgit v1.2.3 From 1684291ba9a4f3bc2828e7b079ac27efcba6a163 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 8 Jul 2014 23:47:09 -0700 Subject: altos/telemini-v2.0: Enable beep config and radio rate config use the smaller pa to altitude table to make room for the new code Signed-off-by: Keith Packard --- src/telemini-v2.0/Makefile | 3 ++- src/telemini-v2.0/ao_pins.h | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/telemini-v2.0/Makefile b/src/telemini-v2.0/Makefile index ca69dc41..8657e9a9 100644 --- a/src/telemini-v2.0/Makefile +++ b/src/telemini-v2.0/Makefile @@ -25,7 +25,8 @@ INC = \ ao_int64.h \ ao_sample.h \ ao_exti.h \ - ao_task.h + ao_task.h \ + altitude-pa-small.h CORE_SRC = \ ao_cmd.c \ diff --git a/src/telemini-v2.0/ao_pins.h b/src/telemini-v2.0/ao_pins.h index c9f9de62..948310e5 100644 --- a/src/telemini-v2.0/ao_pins.h +++ b/src/telemini-v2.0/ao_pins.h @@ -28,9 +28,11 @@ #define AO_USB_PULLUP_PIN 0 #define AO_USB_PULLUP P1_0 +#define AO_SMALL_ALTITUDE_TABLE 1 + #define USB_FORCE_FLIGHT_IDLE 1 #define HAS_BEEP 1 -#define HAS_BEEP_CONFIG 0 +#define HAS_BEEP_CONFIG 1 #define HAS_BATTERY_REPORT 1 #define HAS_GPS 0 #define HAS_SERIAL_1 0 @@ -39,7 +41,8 @@ #define USE_INTERNAL_FLASH 0 #define HAS_DBG 0 #define PACKET_HAS_SLAVE 1 -#define HAS_RADIO_RATE 0 /* not enough space for this */ +#define HAS_RADIO_RATE 1 +#define HAS_TELEMETRY 1 #define AO_LED_RED 2 #define LEDS_AVAILABLE AO_LED_RED -- cgit v1.2.3 From 6f2a4c610dfacbf500650db0eeeca6623bb49c5c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 00:26:55 -0700 Subject: micropeak/altosui/telegps: Fix icon file names The icon file names are now structured to have an organization name and application name component. This should avoid collisions with other packages when the icon files are installed in a shared directory, as on Linux. Within the Java .jar file, the new names need to be correctly referenced or we won't find them. Signed-off-by: Keith Packard --- altosuilib/AltosUIFrame.java | 12 ++++++------ micropeak/MicroFrame.java | 12 ++++++------ telegps/TeleGPS.java | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java index 5b915e85..2e886932 100644 --- a/altosuilib/AltosUIFrame.java +++ b/altosuilib/AltosUIFrame.java @@ -36,12 +36,12 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi } static String[] altos_icon_names = { - "/altus-metrum-16.png", - "/altus-metrum-32.png", - "/altus-metrum-48.png", - "/altus-metrum-64.png", - "/altus-metrum-128.png", - "/altus-metrum-256.png" + "/altusmetrum-altosui-16.png", + "/altusmetrum-altosui-32.png", + "/altusmetrum-altosui-48.png", + "/altusmetrum-altosui-64.png", + "/altusmetrum-altosui-128.png", + "/altusmetrum-altosui-256.png" }; static public String[] icon_names; diff --git a/micropeak/MicroFrame.java b/micropeak/MicroFrame.java index f82d1c5e..8b3d49b5 100644 --- a/micropeak/MicroFrame.java +++ b/micropeak/MicroFrame.java @@ -25,12 +25,12 @@ import org.altusmetrum.altosuilib_3.*; public class MicroFrame extends AltosUIFrame { static String[] micro_icon_names = { - "/micropeak-16.png", - "/micropeak-32.png", - "/micropeak-48.png", - "/micropeak-64.png", - "/micropeak-128.png", - "/micropeak-256.png" + "/altusmetrum-micropeak-16.png", + "/altusmetrum-micropeak-32.png", + "/altusmetrum-micropeak-48.png", + "/altusmetrum-micropeak-64.png", + "/altusmetrum-micropeak-128.png", + "/altusmetrum-micropeak-256.png" }; static { set_icon_names(micro_icon_names); } diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index d4b7bacf..a4b221e8 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -32,12 +32,12 @@ public class TeleGPS { static String[] telegps_icon_names = { - "/telegps-16.png", - "/telegps-32.png", - "/telegps-48.png", - "/telegps-64.png", - "/telegps-128.png", - "/telegps-256.png" + "/altusmetrum-telegps-16.png", + "/altusmetrum-telegps-32.png", + "/altusmetrum-telegps-48.png", + "/altusmetrum-telegps-64.png", + "/altusmetrum-telegps-128.png", + "/altusmetrum-telegps-256.png" }; static { set_icon_names(telegps_icon_names); } -- cgit v1.2.3 From b8fa4e9a077e8e04b922d0c434c139ad0a57ee66 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 16:15:52 -0700 Subject: altoslib: Clean up GPS DOP support in AltosState Parse out hdop/pdop/vdop from telem and eeprom. Deal with legacy eeprom files that have dop/100 instead of dop/10 values. Clear state DOP values to MISSING at startup Signed-off-by: Keith Packard --- altoslib/AltosEepromGPS.java | 17 +++++++++++++++-- altoslib/AltosEepromMega.java | 17 +++++++++++++++-- altoslib/AltosEepromMetrum2.java | 2 ++ altoslib/AltosGPS.java | 36 +++++++++++++++++++++++++----------- altoslib/AltosLib.java | 25 +++++++++++++++++++++++++ altoslib/AltosState.java | 6 ++++++ altoslib/AltosTelemetryLegacy.java | 2 ++ altoslib/AltosTelemetryLocation.java | 5 +++-- altoslib/AltosWriter.java | 2 -- 9 files changed, 93 insertions(+), 19 deletions(-) diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java index 2514b4fc..46a2173d 100644 --- a/altoslib/AltosEepromGPS.java +++ b/altoslib/AltosEepromGPS.java @@ -118,8 +118,21 @@ public class AltosEepromGPS extends AltosEeprom { gps.ground_speed = ground_speed() * 1.0e-2; gps.course = course() * 2; gps.climb_rate = climb_rate() * 1.0e-2; - gps.hdop = hdop(); - gps.vdop = vdop(); + if (state.compare_version("1.4.9") >= 0) { + gps.pdop = pdop() / 10.0; + gps.hdop = hdop() / 10.0; + gps.vdop = vdop() / 10.0; + } else { + gps.pdop = pdop() / 100.0; + if (gps.pdop < 0.8) + gps.pdop += 2.56; + gps.hdop = hdop() / 100.0; + if (gps.hdop < 0.8) + gps.hdop += 2.56; + gps.vdop = vdop() / 100.0; + if (gps.vdop < 0.8) + gps.vdop += 2.56; + } break; } } diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java index 5d5f3fef..1616de77 100644 --- a/altoslib/AltosEepromMega.java +++ b/altoslib/AltosEepromMega.java @@ -187,8 +187,21 @@ public class AltosEepromMega extends AltosEeprom { gps.ground_speed = ground_speed() * 1.0e-2; gps.course = course() * 2; gps.climb_rate = climb_rate() * 1.0e-2; - gps.hdop = hdop(); - gps.vdop = vdop(); + if (state.compare_version("1.4.9") >= 0) { + gps.pdop = pdop() / 10.0; + gps.hdop = hdop() / 10.0; + gps.vdop = vdop() / 10.0; + } else { + gps.pdop = pdop() / 100.0; + if (gps.pdop < 0.8) + gps.pdop += 2.56; + gps.hdop = hdop() / 100.0; + if (gps.hdop < 0.8) + gps.hdop += 2.56; + gps.vdop = vdop() / 100.0; + if (gps.vdop < 0.8) + gps.vdop += 2.56; + } break; case AltosLib.AO_LOG_GPS_SAT: state.set_tick(tick); diff --git a/altoslib/AltosEepromMetrum2.java b/altoslib/AltosEepromMetrum2.java index 24277118..2f43879e 100644 --- a/altoslib/AltosEepromMetrum2.java +++ b/altoslib/AltosEepromMetrum2.java @@ -59,6 +59,7 @@ public class AltosEepromMetrum2 extends AltosEeprom { public int year() { return data8(4); } public int month() { return data8(5); } public int day() { return data8(6); } + public int pdop() { return data8(7); } /* AO_LOG_GPS_SAT elements */ public int nsat() { return data8(0); } @@ -136,6 +137,7 @@ public class AltosEepromMetrum2 extends AltosEeprom { gps.year = 2000 + year(); gps.month = month(); gps.day = day(); + gps.pdop = pdop() / 10.0; break; case AltosLib.AO_LOG_GPS_SAT: gps = state.make_temp_gps(true); diff --git a/altoslib/AltosGPS.java b/altoslib/AltosGPS.java index aabcfc5b..0154e95d 100644 --- a/altoslib/AltosGPS.java +++ b/altoslib/AltosGPS.java @@ -40,10 +40,11 @@ public class AltosGPS implements Cloneable { public double ground_speed; /* m/s */ public int course; /* degrees */ public double climb_rate; /* m/s */ + public double pdop; /* unitless */ public double hdop; /* unitless */ public double vdop; /* unitless */ - public int h_error; /* m */ - public int v_error; /* m */ + public double h_error; /* m */ + public double v_error; /* m */ public AltosGPSSat[] cc_gps_sat; /* tracking data */ @@ -95,6 +96,7 @@ public class AltosGPS implements Cloneable { AltosLib.MISSING, 1/100.0); course = map.get_int(AltosTelemetryLegacy.AO_TELEM_GPS_COURSE, AltosLib.MISSING); + pdop = map.get_double(AltosTelemetryLegacy.AO_TELEM_GPS_PDOP, MISSING, 1.0); hdop = map.get_double(AltosTelemetryLegacy.AO_TELEM_GPS_HDOP, MISSING, 1.0); vdop = map.get_double(AltosTelemetryLegacy.AO_TELEM_GPS_VDOP, MISSING, 1.0); h_error = map.get_int(AltosTelemetryLegacy.AO_TELEM_GPS_HERROR, MISSING); @@ -268,14 +270,26 @@ public class AltosGPS implements Cloneable { cc_gps_sat[cc_gps_sat.length - 1] = sat; } - public AltosGPS() { + private void init() { lat = AltosLib.MISSING; lon = AltosLib.MISSING; alt = AltosLib.MISSING; + ground_speed = AltosLib.MISSING; + course = AltosLib.MISSING; + climb_rate = AltosLib.MISSING; + pdop = AltosLib.MISSING; + hdop = AltosLib.MISSING; + vdop = AltosLib.MISSING; + h_error = AltosLib.MISSING; + v_error = AltosLib.MISSING; ClearGPSTime(); cc_gps_sat = null; } + public AltosGPS() { + init(); + } + public AltosGPS clone() { AltosGPS g = new AltosGPS(); @@ -295,7 +309,9 @@ public class AltosGPS implements Cloneable { g.ground_speed = ground_speed; /* m/s */ g.course = course; /* degrees */ g.climb_rate = climb_rate; /* m/s */ - g.hdop = hdop; /* unitless? */ + g.pdop = pdop; /* unitless */ + g.hdop = hdop; /* unitless */ + g.vdop = vdop; /* unitless */ g.h_error = h_error; /* m */ g.v_error = v_error; /* m */ @@ -327,9 +343,11 @@ public class AltosGPS implements Cloneable { ground_speed = old.ground_speed; /* m/s */ course = old.course; /* degrees */ climb_rate = old.climb_rate; /* m/s */ + pdop = old.pdop; /* unitless? */ hdop = old.hdop; /* unitless? */ - h_error = old.h_error; /* m */ - v_error = old.v_error; /* m */ + vdop = old.vdop; /* unitless? */ + h_error = old.h_error; /* m */ + v_error = old.v_error; /* m */ if (old.cc_gps_sat != null) { cc_gps_sat = new AltosGPSSat[old.cc_gps_sat.length]; @@ -340,11 +358,7 @@ public class AltosGPS implements Cloneable { } } } else { - lat = AltosLib.MISSING; - lon = AltosLib.MISSING; - alt = AltosLib.MISSING; - ClearGPSTime(); - cc_gps_sat = null; + init(); } } diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index c2ec0e3b..eb188d6b 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -215,6 +215,31 @@ public class AltosLib { telemetry)); } + private static int[] split_version(String version) { + String[] tokens = version.split("\\."); + int[] ret = new int[tokens.length]; + for (int i = 0; i < tokens.length; i++) + ret[i] = Integer.parseInt(tokens[i]); + return ret; + } + + public static int compare_version(String version_a, String version_b) { + int[] a = split_version(version_a); + int[] b = split_version(version_b); + + for (int i = 0; i < Math.min(a.length, b.length); i++) { + if (a[i] < b[i]) + return -1; + if (a[i] > b[i]) + return 1; + } + if (a.length < b.length) + return -1; + if (a.length > b.length) + return 1; + return 0; + } + private static String[] state_to_string = { "startup", "idle", diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index 5e7908af..2fc13b44 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -1024,6 +1024,12 @@ public class AltosState implements Cloneable { firmware_version = version; } + public int compare_version(String other_version) { + if (firmware_version == null) + return AltosLib.MISSING; + return AltosLib.compare_version(firmware_version, other_version); + } + private void re_init() { int bt = boost_tick; int rs = receiver_serial; diff --git a/altoslib/AltosTelemetryLegacy.java b/altoslib/AltosTelemetryLegacy.java index b7aae3c4..72a8bc4a 100644 --- a/altoslib/AltosTelemetryLegacy.java +++ b/altoslib/AltosTelemetryLegacy.java @@ -186,6 +186,7 @@ public class AltosTelemetryLegacy extends AltosTelemetry { * g_v GPS vertical speed (integer, cm/sec) * g_s GPS horizontal speed (integer, cm/sec) * g_c GPS course (integer, 0-359) + * g_pd GPS pdop (integer * 10) * g_hd GPS hdop (integer * 10) * g_vd GPS vdop (integer * 10) * g_he GPS h error (integer) @@ -209,6 +210,7 @@ public class AltosTelemetryLegacy extends AltosTelemetry { final static String AO_TELEM_GPS_VERTICAL_SPEED = "g_v"; final static String AO_TELEM_GPS_HORIZONTAL_SPEED = "g_g"; final static String AO_TELEM_GPS_COURSE = "g_c"; + final static String AO_TELEM_GPS_PDOP = "g_pd"; final static String AO_TELEM_GPS_HDOP = "g_hd"; final static String AO_TELEM_GPS_VDOP = "g_vd"; final static String AO_TELEM_GPS_HERROR = "g_he"; diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java index 32ca7608..9d50e2fa 100644 --- a/altoslib/AltosTelemetryLocation.java +++ b/altoslib/AltosTelemetryLocation.java @@ -80,8 +80,9 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { gps.ground_speed = ground_speed * 1.0e-2; gps.course = course * 2; gps.climb_rate = climb_rate * 1.0e-2; - gps.hdop = hdop; - gps.vdop = vdop; + gps.pdop = pdop / 10.0; + gps.hdop = hdop / 10.0; + gps.vdop = vdop / 10.0; } state.set_temp_gps(); } diff --git a/altoslib/AltosWriter.java b/altoslib/AltosWriter.java index 9df52250..fb208b02 100644 --- a/altoslib/AltosWriter.java +++ b/altoslib/AltosWriter.java @@ -19,8 +19,6 @@ package org.altusmetrum.altoslib_5; public interface AltosWriter { - public void write(AltosState state); - public void write(AltosStateIterable states); public void close(); -- cgit v1.2.3 From 9dafabd77676e08da4067cd405b6f03bf8d8ff85 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 16:17:56 -0700 Subject: altoslib: Ensure CSV output is consistent Scan entire flight to figure out which columns to include before outputing header or data. Limit data output to values which are valid. Signed-off-by: Keith Packard --- altoslib/AltosCSV.java | 139 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 108 insertions(+), 31 deletions(-) diff --git a/altoslib/AltosCSV.java b/altoslib/AltosCSV.java index 7e3d6d07..4a9278d9 100644 --- a/altoslib/AltosCSV.java +++ b/altoslib/AltosCSV.java @@ -29,6 +29,14 @@ public class AltosCSV implements AltosWriter { LinkedList pad_states; AltosState state; + static boolean has_basic; + static boolean has_battery; + static boolean has_flight_state; + static boolean has_advanced; + static boolean has_gps; + static boolean has_gps_sat; + static boolean has_companion; + static final int ALTOS_CSV_VERSION = 5; /* Version 4 format: @@ -55,10 +63,12 @@ public class AltosCSV implements AltosWriter { * accelerometer speed (m/s) * barometer speed (m/s) * temp (°C) - * battery (V) * drogue (V) * main (V) * + * Battery + * battery (V) + * * Advanced sensors (if available) * accel_x (m/s²) * accel_y (m/s²) @@ -87,7 +97,9 @@ public class AltosCSV implements AltosWriter { * from_pad_azimuth (deg true) * from_pad_range (m) * from_pad_elevation (deg from horizon) + * pdop * hdop + * vdop * * GPS Sat data * C/N0 data for all 32 valid SDIDs @@ -107,7 +119,7 @@ public class AltosCSV implements AltosWriter { void write_general(AltosState state) { out.printf("%s, %d, %d, %s, %8.2f, %8.2f, %4d, %3d", ALTOS_CSV_VERSION, state.serial, state.flight, state.callsign, - (double) state.time, (double) state.tick / 100.0, + (double) state.time_since_boost(), (double) state.tick / 100.0, state.rssi, state.status & 0x7f); } @@ -121,11 +133,11 @@ public class AltosCSV implements AltosWriter { } void write_basic_header() { - out.printf("acceleration,pressure,altitude,height,accel_speed,baro_speed,temperature,battery_voltage,drogue_voltage,main_voltage"); + out.printf("acceleration,pressure,altitude,height,accel_speed,baro_speed,temperature,drogue_voltage,main_voltage"); } void write_basic(AltosState state) { - out.printf("%8.2f,%10.2f,%8.2f,%8.2f,%8.2f,%8.2f,%5.1f,%5.2f,%5.2f,%5.2f", + out.printf("%8.2f,%10.2f,%8.2f,%8.2f,%8.2f,%8.2f,%5.1f,%5.2f,%5.2f", state.acceleration(), state.pressure(), state.altitude(), @@ -133,11 +145,18 @@ public class AltosCSV implements AltosWriter { state.speed(), state.speed(), state.temperature, - state.battery_voltage, state.apogee_voltage, state.main_voltage); } + void write_battery_header() { + out.printf("battery_voltage"); + } + + void write_battery(AltosState state) { + out.printf("%5.2f", state.battery_voltage); + } + void write_advanced_header() { out.printf("accel_x,accel_y,accel_z,gyro_x,gyro_y,gyro_z"); } @@ -150,14 +169,14 @@ public class AltosCSV implements AltosWriter { imu = new AltosIMU(); if (mag == null) mag = new AltosMag(); - out.printf("%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d,%6d", + out.printf("%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f", imu.accel_x, imu.accel_y, imu.accel_z, imu.gyro_x, imu.gyro_y, imu.gyro_z, mag.x, mag.y, mag.z); } void write_gps_header() { - out.printf("connected,locked,nsat,latitude,longitude,altitude,year,month,day,hour,minute,second,pad_dist,pad_range,pad_az,pad_el,hdop"); + out.printf("connected,locked,nsat,latitude,longitude,altitude,year,month,day,hour,minute,second,pad_dist,pad_range,pad_az,pad_el,pdop,hdop,vdop"); } void write_gps(AltosState state) { @@ -169,7 +188,7 @@ public class AltosCSV implements AltosWriter { if (from_pad == null) from_pad = new AltosGreatCircle(); - out.printf("%2d,%2d,%3d,%12.7f,%12.7f,%8.1f,%5d,%3d,%3d,%3d,%3d,%3d,%9.0f,%9.0f,%4.0f,%4.0f,%6.1f", + out.printf("%2d,%2d,%3d,%12.7f,%12.7f,%8.1f,%5d,%3d,%3d,%3d,%3d,%3d,%9.0f,%9.0f,%4.0f,%4.0f,%6.1f,%6.1f,%6.1f", gps.connected?1:0, gps.locked?1:0, gps.nsat, @@ -186,7 +205,9 @@ public class AltosCSV implements AltosWriter { state.range, from_pad.bearing, state.elevation, - gps.hdop); + gps.pdop, + gps.hdop, + gps.vdop); } void write_gps_sat_header() { @@ -239,52 +260,83 @@ public class AltosCSV implements AltosWriter { out.printf(",0"); } - void write_header(boolean advanced, boolean gps, boolean companion) { + void write_header() { out.printf("#"); write_general_header(); - out.printf(","); write_flight_header(); - out.printf(","); write_basic_header(); - if (advanced) - out.printf(","); write_advanced_header(); - if (gps) { - out.printf(","); write_gps_header(); - out.printf(","); write_gps_sat_header(); + if (has_flight_state) { + out.printf(","); + write_flight_header(); } - if (companion) { - out.printf(","); write_companion_header(); + if (has_basic) { + out.printf(","); + write_basic_header(); + } + if (has_battery) { + out.printf(","); + write_battery_header(); + } + if (has_advanced) { + out.printf(","); + write_advanced_header(); + } + if (has_gps) { + out.printf(","); + write_gps_header(); + } + if (has_gps_sat) { + out.printf(","); + write_gps_sat_header(); + } + if (has_companion) { + out.printf(","); + write_companion_header(); } out.printf ("\n"); } void write_one(AltosState state) { - write_general(state); out.printf(","); - write_flight(state); out.printf(","); - write_basic(state); out.printf(","); - if (state.imu != null || state.mag != null) + write_general(state); + if (has_flight_state) { + out.printf(","); + write_flight(state); + } + if (has_basic) { + out.printf(","); + write_basic(state); + } + if (has_battery) { + out.printf(","); + write_battery(state); + } + if (has_advanced) { + out.printf(","); write_advanced(state); - if (state.gps != null) { + } + if (has_gps) { + out.printf(","); + write_gps(state); + } + if (has_gps_sat) { out.printf(","); - write_gps(state); out.printf(","); write_gps_sat(state); } - if (state.companion != null) { + if (has_companion) { out.printf(","); write_companion(state); } out.printf ("\n"); } - void flush_pad() { + private void flush_pad() { while (!pad_states.isEmpty()) { write_one (pad_states.remove()); } } - public void write(AltosState state) { + private void write(AltosState state) { if (state.state == AltosLib.ao_flight_startup) return; if (!header_written) { - write_header(state.imu != null || state.mag != null, - state.gps != null, state.companion != null); + write_header(); header_written = true; } if (!seen_boost) { @@ -300,7 +352,7 @@ public class AltosCSV implements AltosWriter { pad_states.add(state); } - public PrintStream out() { + private PrintStream out() { return out; } @@ -314,6 +366,31 @@ public class AltosCSV implements AltosWriter { public void write(AltosStateIterable states) { states.write_comments(out()); + + has_flight_state = false; + has_basic = false; + has_battery = false; + has_advanced = false; + has_gps = false; + has_gps_sat = false; + has_companion = false; + for (AltosState state : states) { + if (state.state != AltosLib.ao_flight_stateless && state.state != AltosLib.ao_flight_invalid && state.state != AltosLib.ao_flight_startup) + has_flight_state = true; + if (state.acceleration() != AltosLib.MISSING || state.pressure() != AltosLib.MISSING) + has_basic = true; + if (state.battery_voltage != AltosLib.MISSING) + has_battery = true; + if (state.imu != null || state.mag != null) + has_advanced = true; + if (state.gps != null) { + has_gps = true; + if (state.gps.cc_gps_sat != null) + has_gps_sat = true; + } + if (state.companion != null) + has_companion = true; + } for (AltosState state : states) write(state); } -- cgit v1.2.3 From 61cbad00b68d9f4f2fed7b76132433e263966952 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 16:19:17 -0700 Subject: altosuilib: Add GPS DOP values to graph Signed-off-by: Keith Packard --- altosuilib/AltosGraph.java | 48 ++++++++++++++++++++++++++++++++++++- altosuilib/AltosGraphDataPoint.java | 23 +++++++++++++++++- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/altosuilib/AltosGraph.java b/altosuilib/AltosGraph.java index 292437de..522eea1e 100644 --- a/altosuilib/AltosGraph.java +++ b/altosuilib/AltosGraph.java @@ -172,6 +172,29 @@ class AltosMagUnits extends AltosUnits { } } +class AltosDopUnits extends AltosUnits { + + public double value(double p, boolean imperial_units) { + return p; + } + + public double inverse(double p, boolean imperial_units) { + return p; + } + + public String show_units(boolean imperial_units) { + return null; + } + + public String say_units(boolean imperial_units) { + return null; + } + + public int show_fraction(int width, boolean imperial_units) { + return 1; + } +} + public class AltosGraph extends AltosUIGraph { static final private Color height_color = new Color(194,31,31); @@ -191,6 +214,9 @@ public class AltosGraph extends AltosUIGraph { static final private Color gps_course_color = new Color (100, 31, 112); static final private Color gps_ground_speed_color = new Color (31, 112, 100); static final private Color gps_climb_rate_color = new Color (31, 31, 112); + static final private Color gps_pdop_color = new Color(50, 194, 0); + static final private Color gps_hdop_color = new Color(50, 0, 194); + static final private Color gps_vdop_color = new Color(194, 0, 50); static final private Color temperature_color = new Color (31, 194, 194); static final private Color dbm_color = new Color(31, 100, 100); static final private Color state_color = new Color(0,0,0); @@ -212,11 +238,12 @@ public class AltosGraph extends AltosUIGraph { static AltosGyroUnits gyro_units = new AltosGyroUnits(); static AltosOrient orient_units = new AltosOrient(); static AltosMagUnits mag_units = new AltosMagUnits(); + static AltosDopUnits dop_units = new AltosDopUnits(); AltosUIAxis height_axis, speed_axis, accel_axis, voltage_axis, temperature_axis, nsat_axis, dbm_axis; AltosUIAxis distance_axis, pressure_axis; AltosUIAxis gyro_axis, orient_axis, mag_axis; - AltosUIAxis course_axis; + AltosUIAxis course_axis, dop_axis; public AltosGraph(AltosUIEnable enable, AltosFlightStats stats, AltosGraphDataSet dataSet) { super(enable); @@ -236,6 +263,7 @@ public class AltosGraph extends AltosUIGraph { orient_axis = newAxis("Tilt Angle", orient_units, orient_color, 0); mag_axis = newAxis("Magnetic Field", mag_units, mag_x_color, 0); course_axis = newAxis("Course", orient_units, gps_course_color, 0); + dop_axis = newAxis("Dilution of Precision", dop_units, gps_pdop_color, 0); addMarker("State", AltosGraphDataPoint.data_state, state_color); @@ -325,6 +353,24 @@ public class AltosGraph extends AltosUIGraph { gps_climb_rate_color, enable_gps, speed_axis); + addSeries("GPS Position DOP", + AltosGraphDataPoint.data_gps_pdop, + dop_units, + gps_pdop_color, + false, + dop_axis); + addSeries("GPS Horizontal DOP", + AltosGraphDataPoint.data_gps_hdop, + dop_units, + gps_hdop_color, + false, + dop_axis); + addSeries("GPS Vertical DOP", + AltosGraphDataPoint.data_gps_vdop, + dop_units, + gps_vdop_color, + false, + dop_axis); } if (stats.has_rssi) addSeries("Received Signal Strength", diff --git a/altosuilib/AltosGraphDataPoint.java b/altosuilib/AltosGraphDataPoint.java index 14486abf..56dadb8b 100644 --- a/altosuilib/AltosGraphDataPoint.java +++ b/altosuilib/AltosGraphDataPoint.java @@ -53,7 +53,10 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { public static final int data_gps_course = 27; public static final int data_gps_ground_speed = 28; public static final int data_gps_climb_rate = 29; - public static final int data_ignitor_0 = 30; + public static final int data_gps_pdop = 30; + public static final int data_gps_hdop = 31; + public static final int data_gps_vdop = 32; + public static final int data_ignitor_0 = 33; public static final int data_ignitor_num = 32; public static final int data_ignitor_max = data_ignitor_0 + data_ignitor_num - 1; public static final int data_ignitor_fired_0 = data_ignitor_0 + data_ignitor_num; @@ -194,6 +197,24 @@ public class AltosGraphDataPoint implements AltosUIDataPoint { else y = AltosLib.MISSING; break; + case data_gps_pdop: + if (state.gps != null) + y = state.gps.pdop; + else + y = AltosLib.MISSING; + break; + case data_gps_hdop: + if (state.gps != null) + y = state.gps.hdop; + else + y = AltosLib.MISSING; + break; + case data_gps_vdop: + if (state.gps != null) + y = state.gps.vdop; + else + y = AltosLib.MISSING; + break; default: if (data_ignitor_0 <= index && index <= data_ignitor_max) { int ignitor = index - data_ignitor_0; -- cgit v1.2.3 From a2f44fa867b17a0f1c1ee9aa9b99ecaa102a361b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 16:19:34 -0700 Subject: altosuilib: Add GPS DOP values to info table Signed-off-by: Keith Packard --- altosuilib/AltosInfoTable.java | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/altosuilib/AltosInfoTable.java b/altosuilib/AltosInfoTable.java index ce986ac5..625fe76f 100644 --- a/altosuilib/AltosInfoTable.java +++ b/altosuilib/AltosInfoTable.java @@ -198,24 +198,28 @@ public class AltosInfoTable extends JTable implements AltosFlightDisplay, Hierar if (state.gps_height != AltosLib.MISSING) info_add_row(1, "GPS height", "%8.1f", state.gps_height); - /* The SkyTraq GPS doesn't report these values */ - /* - if (false) { - info_add_row(1, "GPS ground speed", "%8.1f m/s %3d°", - state.gps.ground_speed, - state.gps.course); - info_add_row(1, "GPS climb rate", "%8.1f m/s", - state.gps.climb_rate); - info_add_row(1, "GPS error", "%6d m(h)%3d m(v)", - state.gps.h_error, state.gps.v_error); - } - */ - - info_add_row(1, "GPS hdop", "%8.1f", state.gps.hdop); + if (state.gps.ground_speed != AltosLib.MISSING && state.gps.course != AltosLib.MISSING) + info_add_row(1, "GPS ground speed", "%6.1f m/s %3d°", + state.gps.ground_speed, + state.gps.course); + if (state.gps.climb_rate != AltosLib.MISSING) + info_add_row(1, "GPS climb rate", "%6.1f m/s", + state.gps.climb_rate); + + if (state.gps.h_error != AltosLib.MISSING && state.gps.v_error != AltosLib.MISSING) + info_add_row(1, "GPS error", "%6d m(h)%3d m(v)", + state.gps.h_error, state.gps.v_error); + if (state.gps.pdop != AltosLib.MISSING && + state.gps.hdop != AltosLib.MISSING && + state.gps.vdop != AltosLib.MISSING) + info_add_row(1, "GPS dop", "%3.1fp/%3.1fh/%3.1fv", + state.gps.pdop, + state.gps.hdop, + state.gps.vdop); if (state.npad > 0) { if (state.from_pad != null) { - info_add_row(1, "Distance from pad", "%6d m", + info_add_row(1, "Ground pad dist", "%6d m", (int) (state.from_pad.distance + 0.5)); info_add_row(1, "Direction from pad", "%6d°", (int) (state.from_pad.bearing + 0.5)); @@ -234,12 +238,12 @@ public class AltosInfoTable extends JTable implements AltosFlightDisplay, Hierar info_add_row(1, "Pad GPS alt", "%6.0f m", state.pad_alt); } if (state.gps.year != AltosLib.MISSING) - info_add_row(1, "GPS date", "%04d-%02d-%02d", + info_add_row(2, "GPS date", "%04d-%02d-%02d", state.gps.year, state.gps.month, state.gps.day); if (state.gps.hour != AltosLib.MISSING) - info_add_row(1, "GPS time", " %02d:%02d:%02d", + info_add_row(2, "GPS time", " %02d:%02d:%02d", state.gps.hour, state.gps.minute, state.gps.second); -- cgit v1.2.3 From 0d044af0c5025a63026d05adcab68f265f179668 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 16:19:52 -0700 Subject: altosuilib: Allow for unitless axes in graphs DOP values have no units. Signed-off-by: Keith Packard --- altosuilib/AltosUIAxis.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/altosuilib/AltosUIAxis.java b/altosuilib/AltosUIAxis.java index 1b5b9205..9e98ddb7 100644 --- a/altosuilib/AltosUIAxis.java +++ b/altosuilib/AltosUIAxis.java @@ -48,7 +48,11 @@ public class AltosUIAxis extends NumberAxis { public final static int axis_default = axis_include_zero; public void set_units() { - setLabel(String.format("%s (%s)", label, units.show_units())); + String u = units.show_units(); + if (u != null) + setLabel(String.format("%s (%s)", label, u)); + else + setLabel(label); } public void set_enable(boolean enable) { -- cgit v1.2.3 From 34d5be68ca23e8beb05db9a480faef63ecc911d0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:07:48 -0700 Subject: altos: Extend GPS altitudes to at least 24 bits everywhere Telemetry gets a special 'mode' flag indicating that 24-bit data is present; log files get new data and log readers are expected to detect that via the firmware version number. Signed-off-by: Keith Packard --- src/cc1111/ao_pins.h | 1 + src/drivers/ao_aprs.c | 2 +- src/drivers/ao_gps_skytraq.c | 3 ++- src/drivers/ao_gps_ublox.c | 2 +- src/kernel/ao_gps_report.c | 8 ++++++-- src/kernel/ao_gps_report_mega.c | 7 ++++--- src/kernel/ao_gps_report_metrum.c | 3 ++- src/kernel/ao_gps_show.c | 8 +++++++- src/kernel/ao_log.h | 23 +++++++++++++++-------- src/kernel/ao_log_gps.c | 3 ++- src/kernel/ao_log_gps.h | 3 --- src/kernel/ao_telemetry.c | 2 +- src/kernel/ao_telemetry.h | 34 ++++++++++++++++++++++++++-------- src/kernel/ao_tracker.c | 13 +++++++------ src/test/ao_aprs_test.c | 7 +++---- src/test/ao_flight_test.c | 7 +++++-- src/test/ao_gps_test.c | 5 ++++- src/test/ao_gps_test_skytraq.c | 4 ++++ src/test/ao_gps_test_ublox.c | 9 ++++++++- 19 files changed, 99 insertions(+), 45 deletions(-) diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index 1bc3d716..4db49215 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -20,6 +20,7 @@ #define HAS_RADIO 1 #define DISABLE_LOG_SPACE 1 +#define HAS_WIDE_GPS 0 #if defined(TELEMETRUM_V_1_0) /* Discontinued and was never built with CC1111 chips needing this */ diff --git a/src/drivers/ao_aprs.c b/src/drivers/ao_aprs.c index a9047149..19beb78f 100644 --- a/src/drivers/ao_aprs.c +++ b/src/drivers/ao_aprs.c @@ -713,7 +713,7 @@ static int tncPositionPacket(void) if (ao_gps_data.flags & AO_GPS_VALID) { latitude = ao_gps_data.latitude; longitude = ao_gps_data.longitude; - altitude = ao_gps_data.altitude; + altitude = AO_TELEMETRY_LOCATION_ALTITUDE(&ao_gps_data); if (altitude < 0) altitude = 0; } diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c index 944a37f9..81178051 100644 --- a/src/drivers/ao_gps_skytraq.c +++ b/src/drivers/ao_gps_skytraq.c @@ -287,7 +287,8 @@ ao_nmea_gga(void) ao_gps_next.hdop = i; ao_gps_skip_field(); - ao_gps_next.altitude = ao_gps_decimal(0xff); + AO_TELEMETRY_LOCATION_SET_ALTITUDE(&ao_gps_next, ao_gps_decimal(0xff)); + ao_gps_skip_field(); /* skip any fractional portion */ ao_nmea_finish(); diff --git a/src/drivers/ao_gps_ublox.c b/src/drivers/ao_gps_ublox.c index 077698a9..48765998 100644 --- a/src/drivers/ao_gps_ublox.c +++ b/src/drivers/ao_gps_ublox.c @@ -728,7 +728,7 @@ ao_gps(void) __reentrant if (nav_timeutc.valid & (1 << NAV_TIMEUTC_VALID_UTC)) ao_gps_data.flags |= AO_GPS_DATE_VALID; - ao_gps_data.altitude = nav_posllh.alt_msl / 1000; + AO_TELEMETRY_LOCATION_SET_ALTITUDE(&ao_gps_data, nav_posllh.alt_msl / 1000); ao_gps_data.latitude = nav_posllh.lat; ao_gps_data.longitude = nav_posllh.lon; diff --git a/src/kernel/ao_gps_report.c b/src/kernel/ao_gps_report.c index 07201ac2..7ef98a97 100644 --- a/src/kernel/ao_gps_report.c +++ b/src/kernel/ao_gps_report.c @@ -52,8 +52,12 @@ ao_gps_report(void) gps_log.u.gps_longitude = gps_data.longitude; ao_log_data(&gps_log); gps_log.type = AO_LOG_GPS_ALT; - gps_log.u.gps_altitude.altitude = gps_data.altitude; - gps_log.u.gps_altitude.unused = 0xffff; + gps_log.u.gps_altitude.altitude_low = gps_data.altitude_low; +#if HAS_WIDE_GPS + gps_log.u.gps_altitude.altitude_high = gps_data.altitude_high; +#else + gps_log.u.gps_altitude.altitude_high = 0xffff; +#endif ao_log_data(&gps_log); if (!date_reported && (gps_data.flags & AO_GPS_DATE_VALID)) { gps_log.type = AO_LOG_GPS_DATE; diff --git a/src/kernel/ao_gps_report_mega.c b/src/kernel/ao_gps_report_mega.c index cb0c0fd9..f3711fb1 100644 --- a/src/kernel/ao_gps_report_mega.c +++ b/src/kernel/ao_gps_report_mega.c @@ -78,7 +78,8 @@ ao_gps_report_mega(void) #if GPS_SPARSE_LOG /* Don't log data if GPS has a fix and hasn't moved for a while */ if ((gps_data.flags & AO_GPS_VALID) && - !ao_gps_sparse_should_log(gps_data.latitude, gps_data.longitude, gps_data.altitude)) + !ao_gps_sparse_should_log(gps_data.latitude, gps_data.longitude, + AO_TELEMETRY_LOCATION_ALTITUDE(&gps_data)) continue; #endif if ((new & AO_GPS_NEW_DATA) && (gps_data.flags & AO_GPS_VALID)) { @@ -87,8 +88,8 @@ ao_gps_report_mega(void) gps_log.type = AO_LOG_GPS_TIME; gps_log.u.gps.latitude = gps_data.latitude; gps_log.u.gps.longitude = gps_data.longitude; - gps_log.u.gps.altitude = gps_data.altitude; - + gps_log.u.gps.altitude_low = gps_data.altitude_low; + gps_log.u.gps.altitude_high = gps_data.altitude_high; gps_log.u.gps.hour = gps_data.hour; gps_log.u.gps.minute = gps_data.minute; gps_log.u.gps.second = gps_data.second; diff --git a/src/kernel/ao_gps_report_metrum.c b/src/kernel/ao_gps_report_metrum.c index 696a833b..31939385 100644 --- a/src/kernel/ao_gps_report_metrum.c +++ b/src/kernel/ao_gps_report_metrum.c @@ -44,7 +44,8 @@ ao_gps_report_metrum(void) gps_log.type = AO_LOG_GPS_POS; gps_log.u.gps.latitude = gps_data.latitude; gps_log.u.gps.longitude = gps_data.longitude; - gps_log.u.gps.altitude = gps_data.altitude; + gps_log.u.gps.altitude_low = gps_data.altitude_low; + gps_log.u.gps.altitude_high = gps_data.altitude_high; ao_log_metrum(&gps_log); gps_log.type = AO_LOG_GPS_TIME; diff --git a/src/kernel/ao_gps_show.c b/src/kernel/ao_gps_show.c index 3a05e35a..e45cd795 100644 --- a/src/kernel/ao_gps_show.c +++ b/src/kernel/ao_gps_show.c @@ -19,6 +19,8 @@ #include #endif +#include + void ao_gps_show(void) __reentrant { @@ -27,7 +29,11 @@ ao_gps_show(void) __reentrant printf ("Date: %02d/%02d/%02d\n", ao_gps_data.year, ao_gps_data.month, ao_gps_data.day); printf ("Time: %02d:%02d:%02d\n", ao_gps_data.hour, ao_gps_data.minute, ao_gps_data.second); printf ("Lat/Lon: %ld %ld\n", (long) ao_gps_data.latitude, (long) ao_gps_data.longitude); - printf ("Alt: %d\n", ao_gps_data.altitude); +#if HAS_WIDE_GPS + printf ("Alt: %ld\n", (long) AO_TELEMETRY_LOCATION_ALTITUDE(&ao_gps_data)); +#else + printf ("Alt: %d\n", AO_TELEMETRY_LOCATION_ALTITUDE(&ao_gps_data)); +#endif printf ("Flags: 0x%x\n", ao_gps_data.flags); printf ("Sats: %d", ao_gps_tracking_data.channels); for (i = 0; i < ao_gps_tracking_data.channels; i++) diff --git a/src/kernel/ao_log.h b/src/kernel/ao_log.h index 33cda3eb..080cfb02 100644 --- a/src/kernel/ao_log.h +++ b/src/kernel/ao_log.h @@ -176,8 +176,8 @@ struct ao_log_record { int32_t gps_latitude; int32_t gps_longitude; struct { - int16_t altitude; - uint16_t unused; + uint16_t altitude_low; + int16_t altitude_high; } gps_altitude; struct { uint16_t svid; @@ -246,7 +246,7 @@ struct ao_log_mega { struct { int32_t latitude; /* 4 */ int32_t longitude; /* 8 */ - int16_t altitude; /* 12 */ + uint16_t altitude_low; /* 12 */ uint8_t hour; /* 14 */ uint8_t minute; /* 15 */ uint8_t second; /* 16 */ @@ -261,7 +261,8 @@ struct ao_log_mega { uint8_t hdop; /* 27 */ uint8_t vdop; /* 28 */ uint8_t mode; /* 29 */ - } gps; /* 30 */ + int16_t altitude_high; /* 30 */ + } gps; /* 32 */ /* AO_LOG_GPS_SAT */ struct { uint16_t channels; /* 4 */ @@ -273,6 +274,11 @@ struct ao_log_mega { } u; }; +#define AO_LOG_MEGA_GPS_ALTITUDE(l) ((int32_t) ((l)->u.gps.altitude_high << 16) | ((l)->u.gps.altitude_low)) +#define AO_LOG_MEGA_SET_GPS_ALTITUDE(l,a) (((l)->u.gps.mode |= AO_GPS_MODE_ALTITUDE_24), \ + ((l)->u.gps.altitude_high = (a) >> 16), \ + (l)->u.gps.altitude_low = (a)) + struct ao_log_metrum { char type; /* 0 */ uint8_t csum; /* 1 */ @@ -306,8 +312,9 @@ struct ao_log_metrum { struct { int32_t latitude; /* 4 */ int32_t longitude; /* 8 */ - int16_t altitude; /* 12 */ - } gps; /* 14 */ + uint16_t altitude_low; /* 12 */ + int16_t altitude_high; /* 14 */ + } gps; /* 16 */ /* AO_LOG_GPS_TIME */ struct { uint8_t hour; /* 4 */ @@ -381,7 +388,7 @@ struct ao_log_gps { struct { int32_t latitude; /* 4 */ int32_t longitude; /* 8 */ - int16_t altitude; /* 12 */ + uint16_t altitude_low; /* 12 */ uint8_t hour; /* 14 */ uint8_t minute; /* 15 */ uint8_t second; /* 16 */ @@ -396,7 +403,7 @@ struct ao_log_gps { uint8_t hdop; /* 27 */ uint8_t vdop; /* 28 */ uint8_t mode; /* 29 */ - uint8_t state; /* 30 */ + int16_t altitude_high; /* 30 */ } gps; /* 31 */ /* AO_LOG_GPS_SAT */ struct { diff --git a/src/kernel/ao_log_gps.c b/src/kernel/ao_log_gps.c index 3b728c25..a5a6358b 100644 --- a/src/kernel/ao_log_gps.c +++ b/src/kernel/ao_log_gps.c @@ -75,7 +75,8 @@ ao_log_gps_data(uint16_t tick, struct ao_telemetry_location *gps_data) log.type = AO_LOG_GPS_TIME; log.u.gps.latitude = gps_data->latitude; log.u.gps.longitude = gps_data->longitude; - log.u.gps.altitude = gps_data->altitude; + log.u.gps.altitude_low = gps_data->altitude_low; + log.u.gps.altitude_high = gps_data->altitude_high; log.u.gps.hour = gps_data->hour; log.u.gps.minute = gps_data->minute; diff --git a/src/kernel/ao_log_gps.h b/src/kernel/ao_log_gps.h index 5851f4d1..a9e8c831 100644 --- a/src/kernel/ao_log_gps.h +++ b/src/kernel/ao_log_gps.h @@ -21,9 +21,6 @@ #ifndef _AO_LOG_GPS_H_ #define _AO_LOG_GPS_H_ -uint8_t -ao_log_gps_should_log(int32_t lat, int32_t lon, int16_t alt); - void ao_log_gps_flight(void); diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c index d321c8ff..56bd715e 100644 --- a/src/kernel/ao_telemetry.c +++ b/src/kernel/ao_telemetry.c @@ -344,7 +344,7 @@ ao_send_location(void) ao_mutex_get(&ao_gps_mutex); ao_xmemcpy(&telemetry.location.flags, &ao_gps_data.flags, - 26); + 27); telemetry.location.tick = ao_gps_tick; ao_mutex_put(&ao_gps_mutex); ao_radio_send(&telemetry, sizeof (telemetry)); diff --git a/src/kernel/ao_telemetry.h b/src/kernel/ao_telemetry.h index be7d0340..83d432cf 100644 --- a/src/kernel/ao_telemetry.h +++ b/src/kernel/ao_telemetry.h @@ -86,12 +86,9 @@ struct ao_telemetry_configuration { #define AO_TELEMETRY_LOCATION 0x05 -#define AO_GPS_MODE_NOT_VALID 'N' -#define AO_GPS_MODE_AUTONOMOUS 'A' -#define AO_GPS_MODE_DIFFERENTIAL 'D' -#define AO_GPS_MODE_ESTIMATED 'E' -#define AO_GPS_MODE_MANUAL 'M' -#define AO_GPS_MODE_SIMULATED 'S' +/* Mode bits */ + +#define AO_GPS_MODE_ALTITUDE_24 (1 << 0) /* reports 24-bits of altitude */ struct ao_telemetry_location { uint16_t serial; /* 0 */ @@ -99,7 +96,7 @@ struct ao_telemetry_location { uint8_t type; /* 4 */ uint8_t flags; /* 5 Number of sats and other flags */ - int16_t altitude; /* 6 GPS reported altitude (m) */ + uint16_t altitude_low; /* 6 GPS reported altitude (m) */ int32_t latitude; /* 8 latitude (degrees * 10⁷) */ int32_t longitude; /* 12 longitude (degrees * 10⁷) */ uint8_t year; /* 16 (- 2000) */ @@ -115,10 +112,31 @@ struct ao_telemetry_location { uint16_t ground_speed; /* 26 cm/s */ int16_t climb_rate; /* 28 cm/s */ uint8_t course; /* 30 degrees / 2 */ - uint8_t unused; /* 31 unused */ + int8_t altitude_high; /* 31 high byte of altitude */ /* 32 */ }; +#if HAS_GPS + +#ifndef HAS_WIDE_GPS +#define HAS_WIDE_GPS 1 +#endif + +#if HAS_WIDE_GPS +typedef int32_t gps_alt_t; +#define AO_TELEMETRY_LOCATION_ALTITUDE(l) (((gps_alt_t) (l)->altitude_high << 16) | ((l)->altitude_low)) +#define AO_TELEMETRY_LOCATION_SET_ALTITUDE(l,a) (((l)->mode |= AO_GPS_MODE_ALTITUDE_24), \ + ((l)->altitude_high = (a) >> 16), \ + ((l)->altitude_low = (a))) +#else +typedef int16_t gps_alt_t; +#define AO_TELEMETRY_LOCATION_ALTITUDE(l) ((gps_alt_t) (l)->altitude_low) +#define AO_TELEMETRY_LOCATION_SET_ALTITUDE(l,a) (((l)->mode = 0, \ + (l)->altitude_low = (a))) +#endif /* HAS_WIDE_GPS */ + +#endif /* HAS_GPS */ + #define AO_TELEMETRY_SATELLITE 0x06 struct ao_telemetry_satellite_info { diff --git a/src/kernel/ao_tracker.c b/src/kernel/ao_tracker.c index 9febc7f0..d9434048 100644 --- a/src/kernel/ao_tracker.c +++ b/src/kernel/ao_tracker.c @@ -36,9 +36,9 @@ ao_usb_connected(void) #endif struct gps_position { - int32_t latitude; - int32_t longitude; - int16_t altitude; + int32_t latitude; + int32_t longitude; + gps_alt_t altitude; }; #define GPS_RING 16 @@ -122,12 +122,13 @@ ao_tracker(void) { uint8_t ring; uint8_t moving = 0; + gps_alt_t altitude = AO_TELEMETRY_LOCATION_ALTITUDE(&gps_data); for (ring = ao_gps_ring_next(gps_head); ring != gps_head; ring = ao_gps_ring_next(ring)) { ground_distance = ao_distance(gps_data.latitude, gps_data.longitude, gps_position[ring].latitude, gps_position[ring].longitude); - height = gps_position[ring].altitude - gps_data.altitude; + height = gps_position[ring].altitude - altitude; if (height < 0) height = -height; @@ -153,7 +154,7 @@ ao_tracker(void) ao_log_gps_data(gps_tick, &gps_data); gps_position[gps_head].latitude = gps_data.latitude; gps_position[gps_head].longitude = gps_data.longitude; - gps_position[gps_head].altitude = gps_data.altitude; + gps_position[gps_head].altitude = altitude; gps_head = ao_gps_ring_next(gps_head); ao_mutex_put(&tracker_mutex); } @@ -203,7 +204,7 @@ ao_tracker_set_telem(void) printf ("log_started: %d\n", log_started); printf ("latitude: %ld\n", (long) gps_data.latitude); printf ("longitude: %ld\n", (long) gps_data.longitude); - printf ("altitude: %d\n", gps_data.altitude); + printf ("altitude: %ld\n", AO_TELEMETRY_LOCATION_ALTITUDE(&gps_data)); printf ("log_running: %d\n", ao_log_running); printf ("log_start_pos: %ld\n", (long) ao_log_start_pos); printf ("log_cur_pos: %ld\n", (long) ao_log_current_pos); diff --git a/src/test/ao_aprs_test.c b/src/test/ao_aprs_test.c index 573b5cb2..ae505dea 100644 --- a/src/test/ao_aprs_test.c +++ b/src/test/ao_aprs_test.c @@ -21,6 +21,8 @@ #include #include +#define HAS_GPS 1 + #include #define AO_GPS_NUM_SAT_MASK (0xf << 0) @@ -100,14 +102,11 @@ audio_gap(int secs) // This is where we go after reset. int main(int argc, char **argv) { - int e, x; - int a; - audio_gap(1); ao_gps_data.latitude = (45.0 + 28.25 / 60.0) * 10000000; ao_gps_data.longitude = (-(122 + 44.2649 / 60.0)) * 10000000; - ao_gps_data.altitude = 84; + AO_TELEMETRY_LOCATION_SET_ALTITUDE(&ao_gps_data, 84); ao_gps_data.flags = (AO_GPS_VALID|AO_GPS_RUNNING); /* Transmit one packet */ diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 1ab22e5b..314998c1 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -175,7 +175,7 @@ ao_gps_angle(void) ao_gps_static.latitude / 1e7, ao_gps_static.longitude / 1e7, &dist, &bearing); - height = ao_gps_static.altitude - ao_gps_prev.altitude; + height = AO_TELEMETRY_LOCATION_ALTITUDE(&ao_gps_static) - AO_TELEMETRY_LOCATION_ALTITUDE(&ao_gps_prev); angle = atan2(dist, height); return angle * 180/M_PI; @@ -756,7 +756,10 @@ ao_sleep(void *wchan) ao_gps_static.tick = tick; ao_gps_static.latitude = int32(bytes, 0); ao_gps_static.longitude = int32(bytes, 4); - ao_gps_static.altitude = int32(bytes, 8); + { + int32_t altitude = int32(bytes, 8); + AO_TELEMETRY_LOCATION_SET_ALTITUDE(&ao_gps_static, altitude); + } ao_gps_static.flags = bytes[13]; if (!ao_gps_count) ao_gps_first = ao_gps_static; diff --git a/src/test/ao_gps_test.c b/src/test/ao_gps_test.c index e799ab0f..543bbcc3 100644 --- a/src/test/ao_gps_test.c +++ b/src/test/ao_gps_test.c @@ -53,6 +53,9 @@ struct ao_gps_orig { uint16_t v_error; /* m */ }; +#define AO_TELEMETRY_LOCATION_ALTITUDE(l) ((l)->altitude) +#define AO_TELEMETRY_LOCATION_SET_ALTITUDE(l,a) ((l)->altitude = (a)) + #define SIRF_SAT_STATE_ACQUIRED (1 << 0) #define SIRF_SAT_STATE_CARRIER_PHASE_VALID (1 << 1) #define SIRF_SAT_BIT_SYNC_COMPLETE (1 << 2) @@ -433,7 +436,7 @@ ao_dump_state(void *wchan) if (wchan != &ao_gps_new) return; - + if (ao_gps_new & AO_GPS_NEW_DATA) { ao_gps_print(&ao_gps_data); putchar('\n'); diff --git a/src/test/ao_gps_test_skytraq.c b/src/test/ao_gps_test_skytraq.c index 1b590d5e..5eb7118d 100644 --- a/src/test/ao_gps_test_skytraq.c +++ b/src/test/ao_gps_test_skytraq.c @@ -16,6 +16,7 @@ */ #define AO_GPS_TEST +#define HAS_GPS 1 #include "ao_host.h" #include #include @@ -53,6 +54,9 @@ struct ao_gps_orig { uint16_t v_error; /* m */ }; +#define AO_TELEMETRY_LOCATION_ALTITUDE(l) ((l)->altitude) +#define AO_TELEMETRY_LOCATION_SET_ALTITUDE(l,a) ((l)->altitude = (a)) + #define SIRF_SAT_STATE_ACQUIRED (1 << 0) #define SIRF_SAT_STATE_CARRIER_PHASE_VALID (1 << 1) #define SIRF_SAT_BIT_SYNC_COMPLETE (1 << 2) diff --git a/src/test/ao_gps_test_ublox.c b/src/test/ao_gps_test_ublox.c index 4eb4b837..5ea205d6 100644 --- a/src/test/ao_gps_test_ublox.c +++ b/src/test/ao_gps_test_ublox.c @@ -16,6 +16,7 @@ */ #define AO_GPS_TEST +#define HAS_GPS 1 #include "ao_host.h" #include #include @@ -44,7 +45,7 @@ struct ao_telemetry_location { uint8_t flags; int32_t latitude; /* degrees * 10⁷ */ int32_t longitude; /* degrees * 10⁷ */ - int16_t altitude; /* m */ + int16_t altitude_low; /* m */ uint16_t ground_speed; /* cm/s */ uint8_t course; /* degrees / 2 */ uint8_t pdop; /* * 5 */ @@ -53,8 +54,14 @@ struct ao_telemetry_location { int16_t climb_rate; /* cm/s */ uint16_t h_error; /* m */ uint16_t v_error; /* m */ + int16_t altitude_high; /* m */ }; +typedef int32_t gps_alt_t; +#define AO_TELEMETRY_LOCATION_ALTITUDE(l) (((gps_alt_t) (l)->altitude_high << 16) | ((l)->altitude_low)) +#define AO_TELEMETRY_LOCATION_SET_ALTITUDE(l,a) (((l)->altitude_high = (a) >> 16), \ + ((l)->altitude_low = (a))) + #define UBLOX_SAT_STATE_ACQUIRED (1 << 0) #define UBLOX_SAT_STATE_CARRIER_PHASE_VALID (1 << 1) #define UBLOX_SAT_BIT_SYNC_COMPLETE (1 << 2) -- cgit v1.2.3 From ed2a08c50d6b8ebcc8c1d2f15e73c1f2a1e25041 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:10:49 -0700 Subject: altoslib: Handle wide GPS altitude values in eeprom and telemetry Detect when the wider data is present and handle it correctly Signed-off-by: Keith Packard --- altoslib/AltosEepromGPS.java | 8 ++++++-- altoslib/AltosEepromMega.java | 9 +++++++-- altoslib/AltosEepromMetrum2.java | 8 ++++++-- altoslib/AltosTelemetryLocation.java | 8 +++++++- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java index 46a2173d..482f0b5f 100644 --- a/altoslib/AltosEepromGPS.java +++ b/altoslib/AltosEepromGPS.java @@ -37,7 +37,7 @@ public class AltosEepromGPS extends AltosEeprom { /* AO_LOG_GPS_TIME elements */ public int latitude() { return data32(0); } public int longitude() { return data32(4); } - public int altitude() { return data16(8); } + public int altitude_low() { return data16(8); } public int hour() { return data8(10); } public int minute() { return data8(11); } public int second() { return data8(12); } @@ -52,6 +52,7 @@ public class AltosEepromGPS extends AltosEeprom { public int hdop() { return data8(23); } public int vdop() { return data8(24); } public int mode() { return data8(25); } + public int altitude_high() { return data16(26); } public boolean has_seconds() { return cmd == AltosLib.AO_LOG_GPS_TIME; } @@ -99,7 +100,10 @@ public class AltosEepromGPS extends AltosEeprom { gps = state.make_temp_gps(false); gps.lat = latitude() / 1e7; gps.lon = longitude() / 1e7; - gps.alt = altitude(); + if (state.altitude_32()) + gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16); + else + gps.alt = altitude_low(); gps.hour = hour(); gps.minute = minute(); diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java index 1616de77..adaa7f31 100644 --- a/altoslib/AltosEepromMega.java +++ b/altoslib/AltosEepromMega.java @@ -67,7 +67,7 @@ public class AltosEepromMega extends AltosEeprom { /* AO_LOG_GPS_TIME elements */ public int latitude() { return data32(0); } public int longitude() { return data32(4); } - public int altitude() { return data16(8); } + public int altitude_low() { return data16(8); } public int hour() { return data8(10); } public int minute() { return data8(11); } public int second() { return data8(12); } @@ -82,6 +82,7 @@ public class AltosEepromMega extends AltosEeprom { public int hdop() { return data8(23); } public int vdop() { return data8(24); } public int mode() { return data8(25); } + public int altitude_high() { return data16(26); } /* AO_LOG_GPS_SAT elements */ public int nsat() { return data16(0); } @@ -168,7 +169,11 @@ public class AltosEepromMega extends AltosEeprom { gps = state.make_temp_gps(false); gps.lat = latitude() / 1e7; gps.lon = longitude() / 1e7; - gps.alt = altitude(); + + if (state.altitude_32()) + gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16); + else + gps.alt = altitude_low(); gps.hour = hour(); gps.minute = minute(); diff --git a/altoslib/AltosEepromMetrum2.java b/altoslib/AltosEepromMetrum2.java index 2f43879e..d9a65989 100644 --- a/altoslib/AltosEepromMetrum2.java +++ b/altoslib/AltosEepromMetrum2.java @@ -49,7 +49,8 @@ public class AltosEepromMetrum2 extends AltosEeprom { /* AO_LOG_GPS_POS elements */ public int latitude() { return data32(0); } public int longitude() { return data32(4); } - public int altitude() { return data16(8); } + public int altitude_low() { return data16(8); } + public int altitude_high() { return data16(10); } /* AO_LOG_GPS_TIME elements */ public int hour() { return data8(0); } @@ -118,7 +119,10 @@ public class AltosEepromMetrum2 extends AltosEeprom { gps = state.make_temp_gps(false); gps.lat = latitude() / 1e7; gps.lon = longitude() / 1e7; - gps.alt = altitude(); + if (state.altitude_32()) + gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16); + else + gps.alt = altitude_low(); break; case AltosLib.AO_LOG_GPS_TIME: gps = state.make_temp_gps(false); diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java index 9d50e2fa..427ae16e 100644 --- a/altoslib/AltosTelemetryLocation.java +++ b/altoslib/AltosTelemetryLocation.java @@ -37,11 +37,12 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { int climb_rate; int course; + public static final int AO_GPS_MODE_ALTITUDE_24 = (1 << 0); /* Reports 24-bits of altitude */ + public AltosTelemetryLocation(int[] bytes) { super(bytes); flags = uint8(5); - altitude = int16(6); latitude = uint32(8); longitude = uint32(12); year = uint8(16); @@ -57,6 +58,11 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { ground_speed = uint16(26); climb_rate = int16(28); course = uint8(30); + + if ((mode & AO_GPS_MODE_ALTITUDE_24) != 0) { + altitude = (int8(31) << 16) | uint16(6); + } else + altitude = int16(6); } public void update_state(AltosState state) { -- cgit v1.2.3 From 47e62bb26984f6c84660c1d0451f77c2d6ad7e5a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:13:09 -0700 Subject: altos: Scale DOP values by 10 in GPS drivers sky traq was scaling by 5, ublox was scaling by 100. Signed-off-by: Keith Packard --- src/drivers/ao_gps_skytraq.c | 6 +++--- src/drivers/ao_gps_ublox.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c index 81178051..066df6ff 100644 --- a/src/drivers/ao_gps_skytraq.c +++ b/src/drivers/ao_gps_skytraq.c @@ -278,10 +278,10 @@ ao_nmea_gga(void) ao_gps_lexchar(); i = ao_gps_decimal(0xff); - if (i <= 50) { - i = (uint8_t) 5 * i; + if (i <= 25) { + i = (uint8_t) 10 * i; if (ao_gps_char == '.') - i = (i + ((uint8_t) ao_gps_decimal(1) >> 1)); + i = (i + ((uint8_t) ao_gps_decimal(1))); } else i = 255; ao_gps_next.hdop = i; diff --git a/src/drivers/ao_gps_ublox.c b/src/drivers/ao_gps_ublox.c index 48765998..74c29e0a 100644 --- a/src/drivers/ao_gps_ublox.c +++ b/src/drivers/ao_gps_ublox.c @@ -740,11 +740,11 @@ ao_gps(void) __reentrant ao_gps_data.minute = nav_timeutc.min; ao_gps_data.second = nav_timeutc.sec; - ao_gps_data.pdop = nav_dop.pdop; - ao_gps_data.hdop = nav_dop.hdop; - ao_gps_data.vdop = nav_dop.vdop; - - /* mode is not set */ + /* we report dop scaled by 10, but ublox provides dop scaled by 100 + */ + ao_gps_data.pdop = nav_dop.pdop / 10; + ao_gps_data.hdop = nav_dop.hdop / 10; + ao_gps_data.vdop = nav_dop.vdop / 10; ao_gps_data.ground_speed = nav_velned.g_speed; ao_gps_data.climb_rate = -nav_velned.vel_d; -- cgit v1.2.3 From 31ae24b5da3e198e7555ea3768d3cbdec3a28a5f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:15:09 -0700 Subject: altos: Record pdop value in TeleMetrumV2 log There's only one byte free, so we'll record the pdop value Signed-off-by: Keith Packard --- src/kernel/ao_gps_report_metrum.c | 1 + src/kernel/ao_log.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kernel/ao_gps_report_metrum.c b/src/kernel/ao_gps_report_metrum.c index 31939385..8ce074fe 100644 --- a/src/kernel/ao_gps_report_metrum.c +++ b/src/kernel/ao_gps_report_metrum.c @@ -56,6 +56,7 @@ ao_gps_report_metrum(void) gps_log.u.gps_time.year = gps_data.year; gps_log.u.gps_time.month = gps_data.month; gps_log.u.gps_time.day = gps_data.day; + gps_log.u.gps_time.pdop = gps_data.pdop; ao_log_metrum(&gps_log); } diff --git a/src/kernel/ao_log.h b/src/kernel/ao_log.h index 080cfb02..da20e067 100644 --- a/src/kernel/ao_log.h +++ b/src/kernel/ao_log.h @@ -324,7 +324,7 @@ struct ao_log_metrum { uint8_t year; /* 8 */ uint8_t month; /* 9 */ uint8_t day; /* 10 */ - uint8_t pad; /* 11 */ + uint8_t pdop; /* 11 */ } gps_time; /* 12 */ /* AO_LOG_GPS_SAT (up to three packets) */ struct { -- cgit v1.2.3 From 013e9ccfbe76dc46e8c69ea314950bed83d9a39f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:18:38 -0700 Subject: altos: Use 32-bits for flight state data (alt/speed/accel) Stores 32-bits for all of the flight parameters. Uses 64-bit intermediates for kalman computation. Signed-off-by: Keith Packard --- src/Makefile | 2 +- src/cc1111/ao_pins.h | 1 + src/kalman/kalman.5c | 2 +- src/kalman/kalman_micro.5c | 2 +- src/kernel/ao.h | 14 ++-- src/kernel/ao_cmd.c | 3 + src/kernel/ao_convert.c | 10 +-- src/kernel/ao_convert_pa.c | 16 ++--- src/kernel/ao_convert_pa_test.c | 1 + src/kernel/ao_data.h | 6 -- src/kernel/ao_flight.c | 12 ++-- src/kernel/ao_kalman.c | 147 ++++++++++++++++++++-------------------- src/kernel/ao_microkalman.c | 12 ++-- src/kernel/ao_sample.c | 2 +- src/kernel/ao_sample.h | 56 +++++++++++---- src/product/Makefile.telemetrum | 1 + src/telefire-v0.1/Makefile | 1 - src/telefire-v0.2/Makefile | 1 - src/telemega-v1.0/Makefile | 1 + src/telemini-v2.0/ao_pins.h | 1 + src/teleterra-v0.2/ao_pins.h | 2 + src/test/ao_flight_test.c | 5 +- src/test/ao_micropeak_test.c | 1 + 23 files changed, 170 insertions(+), 129 deletions(-) diff --git a/src/Makefile b/src/Makefile index a7a26b26..3494ba62 100644 --- a/src/Makefile +++ b/src/Makefile @@ -109,7 +109,7 @@ altitude-pa.h: make-altitude-pa altitude-pa-small.h: make-altitude-pa nickle $< --sample 3 > $@ -ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c +ao_kalman.h: make-kalman kalman.5c kalman_micro.5c kalman_filter.5c load_csv.5c matrix.5c bash $< kalman > $@ ao_whiten.h: make-whiten diff --git a/src/cc1111/ao_pins.h b/src/cc1111/ao_pins.h index 4db49215..e12f813f 100644 --- a/src/cc1111/ao_pins.h +++ b/src/cc1111/ao_pins.h @@ -20,6 +20,7 @@ #define HAS_RADIO 1 #define DISABLE_LOG_SPACE 1 +#define AO_VALUE_32 0 #define HAS_WIDE_GPS 0 #if defined(TELEMETRUM_V_1_0) diff --git a/src/kalman/kalman.5c b/src/kalman/kalman.5c index 46fa8e1f..55fde04c 100755 --- a/src/kalman/kalman.5c +++ b/src/kalman/kalman.5c @@ -457,7 +457,7 @@ void main() { name = sprintf("%s_K%d_%d", prefix, i, time_inc); else name = sprintf("%s_K%d%d_%d", prefix, i, j, time_inc); - printf ("#define %s to_fix32(%12.10f)\n", name, k[i,j]); + printf ("#define %s to_fix_k(%12.10f)\n", name, k[i,j]); } printf ("\n"); exit(0); diff --git a/src/kalman/kalman_micro.5c b/src/kalman/kalman_micro.5c index 266a1182..1b080384 100644 --- a/src/kalman/kalman_micro.5c +++ b/src/kalman/kalman_micro.5c @@ -307,7 +307,7 @@ void main() { name = sprintf("%s_K%d_%d", prefix, i, time_inc); else name = sprintf("%s_K%d%d_%d", prefix, i, j, time_inc); - printf ("#define %s to_fix32(%12.10f)\n", name, k[i,j]); + printf ("#define %s to_fix_k(%12.10f)\n", name, k[i,j]); } printf ("\n"); exit(0); diff --git a/src/kernel/ao.h b/src/kernel/ao.h index a225bc4a..ad5bbf8e 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -278,15 +278,17 @@ ao_report_init(void); * Given raw data, convert to SI units */ +#if HAS_BARO /* pressure from the sensor to altitude in meters */ -int16_t -ao_pres_to_altitude(int16_t pres) __reentrant; +alt_t +ao_pres_to_altitude(pres_t pres) __reentrant; -int16_t -ao_altitude_to_pres(int16_t alt) __reentrant; +pres_t +ao_altitude_to_pres(alt_t alt) __reentrant; int16_t ao_temp_to_dC(int16_t temp) __reentrant; +#endif /* * ao_convert_pa.c @@ -296,11 +298,13 @@ ao_temp_to_dC(int16_t temp) __reentrant; #include +#if HAS_BARO alt_t -ao_pa_to_altitude(int32_t pa); +ao_pa_to_altitude(pres_t pa); int32_t ao_altitude_to_pa(alt_t alt); +#endif #if HAS_DBG #include diff --git a/src/kernel/ao_cmd.c b/src/kernel/ao_cmd.c index 0052bdce..d2f583ef 100644 --- a/src/kernel/ao_cmd.c +++ b/src/kernel/ao_cmd.c @@ -289,6 +289,9 @@ version(void) #endif #if defined(AO_BOOT_APPLICATION_BASE) && defined(AO_BOOT_APPLICATION_BOUND) "program-space %u\n" +#endif +#if AO_VALUE_32 + "altitude-32 1\n" #endif , ao_manufacturer , ao_product diff --git a/src/kernel/ao_convert.c b/src/kernel/ao_convert.c index aa9b5f48..db1f2301 100644 --- a/src/kernel/ao_convert.c +++ b/src/kernel/ao_convert.c @@ -19,14 +19,16 @@ #include "ao.h" #endif -static const int16_t altitude_table[] = { +#include + +static const ao_v_t altitude_table[] = { #include "altitude.h" }; #define ALT_FRAC_SCALE (1 << ALT_FRAC_BITS) #define ALT_FRAC_MASK (ALT_FRAC_SCALE - 1) -int16_t +ao_v_t ao_pres_to_altitude(int16_t pres) __reentrant { uint8_t o; @@ -43,9 +45,9 @@ ao_pres_to_altitude(int16_t pres) __reentrant #if AO_NEED_ALTITUDE_TO_PRES int16_t -ao_altitude_to_pres(int16_t alt) __reentrant +ao_altitude_to_pres(ao_v_t alt) __reentrant { - int16_t span, sub_span; + ao_v_t span, sub_span; uint8_t l, h, m; int32_t pres; diff --git a/src/kernel/ao_convert_pa.c b/src/kernel/ao_convert_pa.c index 20162c1f..410815b6 100644 --- a/src/kernel/ao_convert_pa.c +++ b/src/kernel/ao_convert_pa.c @@ -39,11 +39,11 @@ static const alt_t altitude_table[] AO_CONST_ATTRIB = { #define ALT_MASK (ALT_SCALE - 1) alt_t -ao_pa_to_altitude(int32_t pa) +ao_pa_to_altitude(pres_t pa) { int16_t o; int16_t part; - int32_t low, high; + alt_t low, high; if (pa < 0) pa = 0; @@ -52,16 +52,16 @@ ao_pa_to_altitude(int32_t pa) o = pa >> ALT_SHIFT; part = pa & ALT_MASK; - low = (int32_t) FETCH_ALT(o) * (ALT_SCALE - part); - high = (int32_t) FETCH_ALT(o+1) * part + (ALT_SCALE >> 1); + low = (alt_t) FETCH_ALT(o) * (ALT_SCALE - part); + high = (alt_t) FETCH_ALT(o+1) * part + (ALT_SCALE >> 1); return (low + high) >> ALT_SHIFT; } #ifdef AO_CONVERT_TEST -int32_t -ao_altitude_to_pa(int32_t alt) +pres_t +ao_altitude_to_pa(alt_t alt) { - int32_t span, sub_span; + alt_t span, sub_span; uint16_t l, h, m; int32_t pa; @@ -76,7 +76,7 @@ ao_altitude_to_pa(int32_t alt) } span = altitude_table[l] - altitude_table[h]; sub_span = altitude_table[l] - alt; - pa = ((((int32_t) l * (span - sub_span) + (int32_t) h * sub_span) << ALT_SHIFT) + (span >> 1)) / span; + pa = ((((alt_t) l * (span - sub_span) + (alt_t) h * sub_span) << ALT_SHIFT) + (span >> 1)) / span; if (pa > 120000) pa = 120000; if (pa < 0) diff --git a/src/kernel/ao_convert_pa_test.c b/src/kernel/ao_convert_pa_test.c index 7d5b1922..95422862 100644 --- a/src/kernel/ao_convert_pa_test.c +++ b/src/kernel/ao_convert_pa_test.c @@ -18,6 +18,7 @@ #include #define AO_CONVERT_TEST typedef int32_t alt_t; +typedef int32_t pres_t; #include "ao_host.h" #include "ao_convert_pa.c" diff --git a/src/kernel/ao_data.h b/src/kernel/ao_data.h index c4b062fd..8f75ad87 100644 --- a/src/kernel/ao_data.h +++ b/src/kernel/ao_data.h @@ -117,9 +117,7 @@ extern volatile __data uint8_t ao_data_count; typedef int32_t pres_t; -#ifndef AO_ALT_TYPE #define AO_ALT_TYPE int32_t -#endif typedef AO_ALT_TYPE alt_t; @@ -146,10 +144,6 @@ typedef int16_t alt_t; #endif -#if !HAS_BARO -typedef int16_t alt_t; -#endif - /* * Need a few macros to pull data from the sensors: * diff --git a/src/kernel/ao_flight.c b/src/kernel/ao_flight.c index 2b433ee9..251dbc02 100644 --- a/src/kernel/ao_flight.c +++ b/src/kernel/ao_flight.c @@ -60,10 +60,10 @@ __xdata uint8_t ao_sensor_errors; * resting */ static __data uint16_t ao_interval_end; -static __data int16_t ao_interval_min_height; -static __data int16_t ao_interval_max_height; +static __data ao_v_t ao_interval_min_height; +static __data ao_v_t ao_interval_max_height; #if HAS_ACCEL -static __data int16_t ao_coast_avg_accel; +static __data ao_v_t ao_coast_avg_accel; #endif __pdata uint8_t ao_flight_force_idle; @@ -398,14 +398,14 @@ ao_flight(void) } #if HAS_FLIGHT_DEBUG -static inline int int_part(int16_t i) { return i >> 4; } -static inline int frac_part(int16_t i) { return ((i & 0xf) * 100 + 8) / 16; } +static inline int int_part(ao_v_t i) { return i >> 4; } +static inline int frac_part(ao_v_t i) { return ((i & 0xf) * 100 + 8) / 16; } static void ao_flight_dump(void) { #if HAS_ACCEL - int16_t accel; + ao_v_t accel; accel = ((ao_config.accel_plus_g - ao_sample_accel) * ao_accel_scale) >> 16; #endif diff --git a/src/kernel/ao_kalman.c b/src/kernel/ao_kalman.c index 9aea1f14..7b0f8145 100644 --- a/src/kernel/ao_kalman.c +++ b/src/kernel/ao_kalman.c @@ -23,32 +23,31 @@ #include "ao_sample.h" #include "ao_kalman.h" +static __pdata ao_k_t ao_k_height; +static __pdata ao_k_t ao_k_speed; +static __pdata ao_k_t ao_k_accel; -static __pdata int32_t ao_k_height; -static __pdata int32_t ao_k_speed; -static __pdata int32_t ao_k_accel; +#define AO_K_STEP_100 to_fix_v(0.01) +#define AO_K_STEP_2_2_100 to_fix_v(0.00005) -#define AO_K_STEP_100 to_fix16(0.01) -#define AO_K_STEP_2_2_100 to_fix16(0.00005) +#define AO_K_STEP_10 to_fix_v(0.1) +#define AO_K_STEP_2_2_10 to_fix_v(0.005) -#define AO_K_STEP_10 to_fix16(0.1) -#define AO_K_STEP_2_2_10 to_fix16(0.005) +#define AO_K_STEP_1 to_fix_v(1) +#define AO_K_STEP_2_2_1 to_fix_v(0.5) -#define AO_K_STEP_1 to_fix16(1) -#define AO_K_STEP_2_2_1 to_fix16(0.5) +__pdata ao_v_t ao_height; +__pdata ao_v_t ao_speed; +__pdata ao_v_t ao_accel; +__xdata ao_v_t ao_max_height; +static __pdata ao_k_t ao_avg_height_scaled; +__xdata ao_v_t ao_avg_height; -__pdata int16_t ao_height; -__pdata int16_t ao_speed; -__pdata int16_t ao_accel; -__xdata int16_t ao_max_height; -static __pdata int32_t ao_avg_height_scaled; -__xdata int16_t ao_avg_height; - -__pdata int16_t ao_error_h; -__pdata int16_t ao_error_h_sq_avg; +__pdata ao_v_t ao_error_h; +__pdata ao_v_t ao_error_h_sq_avg; #if HAS_ACCEL -__pdata int16_t ao_error_a; +__pdata ao_v_t ao_error_a; #endif static void @@ -56,40 +55,40 @@ ao_kalman_predict(void) { #ifdef AO_FLIGHT_TEST if (ao_sample_tick - ao_sample_prev_tick > 50) { - ao_k_height += ((int32_t) ao_speed * AO_K_STEP_1 + - (int32_t) ao_accel * AO_K_STEP_2_2_1) >> 4; - ao_k_speed += (int32_t) ao_accel * AO_K_STEP_1; + ao_k_height += ((ao_k_t) ao_speed * AO_K_STEP_1 + + (ao_k_t) ao_accel * AO_K_STEP_2_2_1) >> 4; + ao_k_speed += (ao_k_t) ao_accel * AO_K_STEP_1; return; } if (ao_sample_tick - ao_sample_prev_tick > 5) { - ao_k_height += ((int32_t) ao_speed * AO_K_STEP_10 + - (int32_t) ao_accel * AO_K_STEP_2_2_10) >> 4; - ao_k_speed += (int32_t) ao_accel * AO_K_STEP_10; + ao_k_height += ((ao_k_t) ao_speed * AO_K_STEP_10 + + (ao_k_t) ao_accel * AO_K_STEP_2_2_10) >> 4; + ao_k_speed += (ao_k_t) ao_accel * AO_K_STEP_10; return; } if (ao_flight_debug) { printf ("predict speed %g + (%g * %g) = %g\n", ao_k_speed / (65536.0 * 16.0), ao_accel / 16.0, AO_K_STEP_100 / 65536.0, - (ao_k_speed + (int32_t) ao_accel * AO_K_STEP_100) / (65536.0 * 16.0)); + (ao_k_speed + (ao_k_t) ao_accel * AO_K_STEP_100) / (65536.0 * 16.0)); } #endif - ao_k_height += ((int32_t) ao_speed * AO_K_STEP_100 + - (int32_t) ao_accel * AO_K_STEP_2_2_100) >> 4; - ao_k_speed += (int32_t) ao_accel * AO_K_STEP_100; + ao_k_height += ((ao_k_t) ao_speed * AO_K_STEP_100 + + (ao_k_t) ao_accel * AO_K_STEP_2_2_100) >> 4; + ao_k_speed += (ao_k_t) ao_accel * AO_K_STEP_100; } static void ao_kalman_err_height(void) { - int16_t e; - int16_t height_distrust; + ao_v_t e; + ao_v_t height_distrust; #if HAS_ACCEL - int16_t speed_distrust; + ao_v_t speed_distrust; #endif - ao_error_h = ao_sample_height - (int16_t) (ao_k_height >> 16); + ao_error_h = ao_sample_height - (ao_v_t) (ao_k_height >> 16); e = ao_error_h; if (e < 0) @@ -123,7 +122,7 @@ ao_kalman_err_height(void) #endif if (height_distrust > 0x100) height_distrust = 0x100; - ao_error_h = (int16_t) (((int32_t) ao_error_h * (0x100 - height_distrust)) >> 8); + ao_error_h = (ao_v_t) (((ao_k_t) ao_error_h * (0x100 - height_distrust)) >> 8); #ifdef AO_FLIGHT_TEST if (ao_flight_debug) { printf("over height %g over speed %g distrust: %g height: error %d -> %d\n", @@ -142,21 +141,21 @@ ao_kalman_correct_baro(void) ao_kalman_err_height(); #ifdef AO_FLIGHT_TEST if (ao_sample_tick - ao_sample_prev_tick > 50) { - ao_k_height += (int32_t) AO_BARO_K0_1 * ao_error_h; - ao_k_speed += (int32_t) AO_BARO_K1_1 * ao_error_h; - ao_k_accel += (int32_t) AO_BARO_K2_1 * ao_error_h; + ao_k_height += (ao_k_t) AO_BARO_K0_1 * ao_error_h; + ao_k_speed += (ao_k_t) AO_BARO_K1_1 * ao_error_h; + ao_k_accel += (ao_k_t) AO_BARO_K2_1 * ao_error_h; return; } if (ao_sample_tick - ao_sample_prev_tick > 5) { - ao_k_height += (int32_t) AO_BARO_K0_10 * ao_error_h; - ao_k_speed += (int32_t) AO_BARO_K1_10 * ao_error_h; - ao_k_accel += (int32_t) AO_BARO_K2_10 * ao_error_h; + ao_k_height += (ao_k_t) AO_BARO_K0_10 * ao_error_h; + ao_k_speed += (ao_k_t) AO_BARO_K1_10 * ao_error_h; + ao_k_accel += (ao_k_t) AO_BARO_K2_10 * ao_error_h; return; } #endif - ao_k_height += (int32_t) AO_BARO_K0_100 * ao_error_h; - ao_k_speed += (int32_t) AO_BARO_K1_100 * ao_error_h; - ao_k_accel += (int32_t) AO_BARO_K2_100 * ao_error_h; + ao_k_height += (ao_k_t) AO_BARO_K0_100 * ao_error_h; + ao_k_speed += (ao_k_t) AO_BARO_K1_100 * ao_error_h; + ao_k_accel += (ao_k_t) AO_BARO_K2_100 * ao_error_h; } #if HAS_ACCEL @@ -164,7 +163,7 @@ ao_kalman_correct_baro(void) static void ao_kalman_err_accel(void) { - int32_t accel; + ao_k_t accel; accel = (ao_config.accel_plus_g - ao_sample_accel) * ao_accel_scale; @@ -187,18 +186,18 @@ ao_kalman_correct_both(void) (double) ao_error_h, AO_BOTH_K10_1 / 65536.0, (double) ao_error_a, AO_BOTH_K11_1 / 65536.0, (ao_k_speed + - (int32_t) AO_BOTH_K10_1 * ao_error_h + - (int32_t) AO_BOTH_K11_1 * ao_error_a) / (65536.0 * 16.0)); + (ao_k_t) AO_BOTH_K10_1 * ao_error_h + + (ao_k_t) AO_BOTH_K11_1 * ao_error_a) / (65536.0 * 16.0)); } ao_k_height += - (int32_t) AO_BOTH_K00_1 * ao_error_h + - (int32_t) AO_BOTH_K01_1 * ao_error_a; + (ao_k_t) AO_BOTH_K00_1 * ao_error_h + + (ao_k_t) AO_BOTH_K01_1 * ao_error_a; ao_k_speed += - (int32_t) AO_BOTH_K10_1 * ao_error_h + - (int32_t) AO_BOTH_K11_1 * ao_error_a; + (ao_k_t) AO_BOTH_K10_1 * ao_error_h + + (ao_k_t) AO_BOTH_K11_1 * ao_error_a; ao_k_accel += - (int32_t) AO_BOTH_K20_1 * ao_error_h + - (int32_t) AO_BOTH_K21_1 * ao_error_a; + (ao_k_t) AO_BOTH_K20_1 * ao_error_h + + (ao_k_t) AO_BOTH_K21_1 * ao_error_a; return; } if (ao_sample_tick - ao_sample_prev_tick > 5) { @@ -208,18 +207,18 @@ ao_kalman_correct_both(void) (double) ao_error_h, AO_BOTH_K10_10 / 65536.0, (double) ao_error_a, AO_BOTH_K11_10 / 65536.0, (ao_k_speed + - (int32_t) AO_BOTH_K10_10 * ao_error_h + - (int32_t) AO_BOTH_K11_10 * ao_error_a) / (65536.0 * 16.0)); + (ao_k_t) AO_BOTH_K10_10 * ao_error_h + + (ao_k_t) AO_BOTH_K11_10 * ao_error_a) / (65536.0 * 16.0)); } ao_k_height += - (int32_t) AO_BOTH_K00_10 * ao_error_h + - (int32_t) AO_BOTH_K01_10 * ao_error_a; + (ao_k_t) AO_BOTH_K00_10 * ao_error_h + + (ao_k_t) AO_BOTH_K01_10 * ao_error_a; ao_k_speed += - (int32_t) AO_BOTH_K10_10 * ao_error_h + - (int32_t) AO_BOTH_K11_10 * ao_error_a; + (ao_k_t) AO_BOTH_K10_10 * ao_error_h + + (ao_k_t) AO_BOTH_K11_10 * ao_error_a; ao_k_accel += - (int32_t) AO_BOTH_K20_10 * ao_error_h + - (int32_t) AO_BOTH_K21_10 * ao_error_a; + (ao_k_t) AO_BOTH_K20_10 * ao_error_h + + (ao_k_t) AO_BOTH_K21_10 * ao_error_a; return; } if (ao_flight_debug) { @@ -228,19 +227,19 @@ ao_kalman_correct_both(void) (double) ao_error_h, AO_BOTH_K10_100 / 65536.0, (double) ao_error_a, AO_BOTH_K11_100 / 65536.0, (ao_k_speed + - (int32_t) AO_BOTH_K10_100 * ao_error_h + - (int32_t) AO_BOTH_K11_100 * ao_error_a) / (65536.0 * 16.0)); + (ao_k_t) AO_BOTH_K10_100 * ao_error_h + + (ao_k_t) AO_BOTH_K11_100 * ao_error_a) / (65536.0 * 16.0)); } #endif ao_k_height += - (int32_t) AO_BOTH_K00_100 * ao_error_h + - (int32_t) AO_BOTH_K01_100 * ao_error_a; + (ao_k_t) AO_BOTH_K00_100 * ao_error_h + + (ao_k_t) AO_BOTH_K01_100 * ao_error_a; ao_k_speed += - (int32_t) AO_BOTH_K10_100 * ao_error_h + - (int32_t) AO_BOTH_K11_100 * ao_error_a; + (ao_k_t) AO_BOTH_K10_100 * ao_error_h + + (ao_k_t) AO_BOTH_K11_100 * ao_error_a; ao_k_accel += - (int32_t) AO_BOTH_K20_100 * ao_error_h + - (int32_t) AO_BOTH_K21_100 * ao_error_a; + (ao_k_t) AO_BOTH_K20_100 * ao_error_h + + (ao_k_t) AO_BOTH_K21_100 * ao_error_a; } #else @@ -251,14 +250,14 @@ ao_kalman_correct_accel(void) ao_kalman_err_accel(); if (ao_sample_tick - ao_sample_prev_tick > 5) { - ao_k_height +=(int32_t) AO_ACCEL_K0_10 * ao_error_a; - ao_k_speed += (int32_t) AO_ACCEL_K1_10 * ao_error_a; - ao_k_accel += (int32_t) AO_ACCEL_K2_10 * ao_error_a; + ao_k_height +=(ao_k_t) AO_ACCEL_K0_10 * ao_error_a; + ao_k_speed += (ao_k_t) AO_ACCEL_K1_10 * ao_error_a; + ao_k_accel += (ao_k_t) AO_ACCEL_K2_10 * ao_error_a; return; } - ao_k_height += (int32_t) AO_ACCEL_K0_100 * ao_error_a; - ao_k_speed += (int32_t) AO_ACCEL_K1_100 * ao_error_a; - ao_k_accel += (int32_t) AO_ACCEL_K2_100 * ao_error_a; + ao_k_height += (ao_k_t) AO_ACCEL_K0_100 * ao_error_a; + ao_k_speed += (ao_k_t) AO_ACCEL_K1_100 * ao_error_a; + ao_k_accel += (ao_k_t) AO_ACCEL_K2_100 * ao_error_a; } #endif /* else FORCE_ACCEL */ diff --git a/src/kernel/ao_microkalman.c b/src/kernel/ao_microkalman.c index 0684ea2b..75a29cc4 100644 --- a/src/kernel/ao_microkalman.c +++ b/src/kernel/ao_microkalman.c @@ -22,19 +22,19 @@ #define FIX_BITS 16 -#define to_fix16(x) ((int16_t) ((x) * 65536.0 + 0.5)) -#define to_fix32(x) ((int32_t) ((x) * 65536.0 + 0.5)) +#define to_fix_v(x) ((int16_t) ((x) * 65536.0 + 0.5)) +#define to_fix_k(x) ((int32_t) ((x) * 65536.0 + 0.5)) #define from_fix8(x) ((x) >> 8) #define from_fix(x) ((x) >> 16) -#define fix8_to_fix16(x) ((x) << 8) +#define fix8_to_fix_v(x) ((x) << 8) #define fix16_to_fix8(x) ((x) >> 8) #include /* Basic time step (96ms) */ -#define AO_MK_STEP to_fix16(0.096) +#define AO_MK_STEP to_fix_v(0.096) /* step ** 2 / 2 */ -#define AO_MK_STEP_2_2 to_fix16(0.004608) +#define AO_MK_STEP_2_2 to_fix_v(0.004608) uint32_t ao_k_pa; /* 24.8 fixed point */ int32_t ao_k_pa_speed; /* 16.16 fixed point */ @@ -49,7 +49,7 @@ ao_microkalman_init(void) { ao_pa = pa; ao_k_pa = pa << 8; -} +} void ao_microkalman_predict(void) diff --git a/src/kernel/ao_sample.c b/src/kernel/ao_sample.c index 34658951..29bf2bf6 100644 --- a/src/kernel/ao_sample.c +++ b/src/kernel/ao_sample.c @@ -245,7 +245,7 @@ ao_sample_preflight(void) } else { #if HAS_ACCEL ao_accel_2g = ao_config.accel_minus_g - ao_config.accel_plus_g; - ao_accel_scale = to_fix32(GRAVITY * 2 * 16) / ao_accel_2g; + ao_accel_scale = to_fix_32(GRAVITY * 2 * 16) / ao_accel_2g; #endif ao_sample_preflight_set(); ao_preflight = FALSE; diff --git a/src/kernel/ao_sample.h b/src/kernel/ao_sample.h index 16d4c507..2ec998bd 100644 --- a/src/kernel/ao_sample.h +++ b/src/kernel/ao_sample.h @@ -24,6 +24,24 @@ * ao_sample.c */ +#ifndef AO_VALUE_32 +#define AO_VALUE_32 1 +#endif + +#if AO_VALUE_32 +/* + * For 32-bit computed values, use 64-bit intermediates. + */ +typedef int64_t ao_k_t; +typedef int32_t ao_v_t; +#else +/* + * For 16-bit computed values, use 32-bit intermediates. + */ +typedef int32_t ao_k_t; +typedef int16_t ao_v_t; +#endif + /* * Barometer calibration * @@ -87,9 +105,9 @@ * 2047m/s² (over 200g) */ -#define AO_M_TO_HEIGHT(m) ((int16_t) (m)) -#define AO_MS_TO_SPEED(ms) ((int16_t) ((ms) * 16)) -#define AO_MSS_TO_ACCEL(mss) ((int16_t) ((mss) * 16)) +#define AO_M_TO_HEIGHT(m) ((ao_v_t) (m)) +#define AO_MS_TO_SPEED(ms) ((ao_v_t) ((ms) * 16)) +#define AO_MSS_TO_ACCEL(mss) ((ao_v_t) ((mss) * 16)) extern __pdata uint16_t ao_sample_tick; /* time of last data */ extern __data uint8_t ao_sample_adc; /* Ring position of last processed sample */ @@ -134,21 +152,33 @@ uint8_t ao_sample(void); * ao_kalman.c */ -#define to_fix16(x) ((int16_t) ((x) * 65536.0 + 0.5)) -#define to_fix32(x) ((int32_t) ((x) * 65536.0 + 0.5)) +#define to_fix_16(x) ((int16_t) ((x) * 65536.0 + 0.5)) +#define to_fix_32(x) ((int32_t) ((x) * 65536.0 + 0.5)) +#define to_fix_64(x) ((int64_t) ((x) * 65536.0 + 0.5)) + +#ifdef AO_VALUE_32 +#if AO_VALUE_32 +#define to_fix_v(x) to_fix_32(x) +#define to_fix_k(x) to_fix_64(x) +#else +#define to_fix_v(x) to_fix_16(x) +#define to_fix_k(x) to_fix_32(x) +#endif + #define from_fix(x) ((x) >> 16) -extern __pdata int16_t ao_height; /* meters */ -extern __pdata int16_t ao_speed; /* m/s * 16 */ -extern __pdata int16_t ao_accel; /* m/s² * 16 */ -extern __xdata int16_t ao_max_height; /* max of ao_height */ -extern __xdata int16_t ao_avg_height; /* running average of height */ +extern __pdata ao_v_t ao_height; /* meters */ +extern __pdata ao_v_t ao_speed; /* m/s * 16 */ +extern __pdata ao_v_t ao_accel; /* m/s² * 16 */ +extern __xdata ao_v_t ao_max_height; /* max of ao_height */ +extern __xdata ao_v_t ao_avg_height; /* running average of height */ -extern __pdata int16_t ao_error_h; -extern __pdata int16_t ao_error_h_sq_avg; +extern __pdata ao_v_t ao_error_h; +extern __pdata ao_v_t ao_error_h_sq_avg; #if HAS_ACCEL -extern __pdata int16_t ao_error_a; +extern __pdata ao_v_t ao_error_a; +#endif #endif void ao_kalman(void); diff --git a/src/product/Makefile.telemetrum b/src/product/Makefile.telemetrum index dbbf57d8..e9b144c0 100644 --- a/src/product/Makefile.telemetrum +++ b/src/product/Makefile.telemetrum @@ -24,6 +24,7 @@ INC = \ altitude.h \ ao_kalman.h \ ao_product.h \ + ao_telemetry.h \ $(TM_INC) CORE_SRC = \ diff --git a/src/telefire-v0.1/Makefile b/src/telefire-v0.1/Makefile index 25267268..99d29826 100644 --- a/src/telefire-v0.1/Makefile +++ b/src/telefire-v0.1/Makefile @@ -25,7 +25,6 @@ INC = \ CORE_SRC = \ ao_cmd.c \ ao_config.c \ - ao_convert.c \ ao_mutex.c \ ao_panic.c \ ao_stdio.c \ diff --git a/src/telefire-v0.2/Makefile b/src/telefire-v0.2/Makefile index ad5065c1..944543c5 100644 --- a/src/telefire-v0.2/Makefile +++ b/src/telefire-v0.2/Makefile @@ -25,7 +25,6 @@ INC = \ CORE_SRC = \ ao_cmd.c \ ao_config.c \ - ao_convert.c \ ao_mutex.c \ ao_panic.c \ ao_stdio.c \ diff --git a/src/telemega-v1.0/Makefile b/src/telemega-v1.0/Makefile index 46c768e4..4a1b3908 100644 --- a/src/telemega-v1.0/Makefile +++ b/src/telemega-v1.0/Makefile @@ -31,6 +31,7 @@ INC = \ ao_mpu.h \ stm32l.h \ math.h \ + ao_ms5607_convert.c \ Makefile # diff --git a/src/telemini-v2.0/ao_pins.h b/src/telemini-v2.0/ao_pins.h index 948310e5..ed911798 100644 --- a/src/telemini-v2.0/ao_pins.h +++ b/src/telemini-v2.0/ao_pins.h @@ -22,6 +22,7 @@ #define HAS_FLIGHT 1 #define HAS_USB 1 +#define AO_VALUE_32 0 #define HAS_USB_PULLUP 1 #define AO_USB_PULLUP_PORT P1 diff --git a/src/teleterra-v0.2/ao_pins.h b/src/teleterra-v0.2/ao_pins.h index 60d627ad..472af534 100644 --- a/src/teleterra-v0.2/ao_pins.h +++ b/src/teleterra-v0.2/ao_pins.h @@ -72,6 +72,8 @@ #define BATTERY_PIN 5 #define HAS_TELEMETRY 0 + + #define AO_VALUE_32 0 #endif #if DBG_ON_P1 diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index 314998c1..bb5c3a7d 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -34,9 +34,11 @@ #define ao_data_ring_next(n) (((n) + 1) & (AO_DATA_RING - 1)) #define ao_data_ring_prev(n) (((n) - 1) & (AO_DATA_RING - 1)) +#if 0 #define AO_M_TO_HEIGHT(m) ((int16_t) (m)) #define AO_MS_TO_SPEED(ms) ((int16_t) ((ms) * 16)) #define AO_MSS_TO_ACCEL(mss) ((int16_t) ((mss) * 16)) +#endif #define AO_GPS_NEW_DATA 1 #define AO_GPS_NEW_TRACKING 2 @@ -93,6 +95,7 @@ struct ao_adc { #include #include #include +#include #if TELEMEGA int ao_gps_count; @@ -234,7 +237,7 @@ double main_time; int tick_offset; -static int32_t ao_k_height; +static ao_k_t ao_k_height; int16_t ao_time(void) diff --git a/src/test/ao_micropeak_test.c b/src/test/ao_micropeak_test.c index 5961bd93..f4af707e 100644 --- a/src/test/ao_micropeak_test.c +++ b/src/test/ao_micropeak_test.c @@ -33,6 +33,7 @@ uint8_t ao_flight_debug; #define AO_FLIGHT_TEST typedef int32_t alt_t; +typedef int32_t pres_t; #define AO_MS_TO_TICKS(ms) ((ms) / 10) -- cgit v1.2.3 From 6dc58c63d202e918f16d5fbe9b188d422edcdd9c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:26:19 -0700 Subject: altosui: Fix the 'Graph' button on the landed tab It hasn't been getting enabled since the state tabs were rewritten. Signed-off-by: Keith Packard --- altosui/AltosLanded.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java index 50c1ea31..7c50adac 100644 --- a/altosui/AltosLanded.java +++ b/altosui/AltosLanded.java @@ -151,6 +151,12 @@ public class AltosLanded extends AltosUIFlightTab implements ActionListener { return "Landed"; } + public void show(AltosState state, AltosListenerState listener_state) { + super.show(state, listener_state); + if (reader.backing_file() != null) + graph.setEnabled(true); + } + public AltosLanded(AltosFlightReader in_reader) { reader = in_reader; -- cgit v1.2.3 From 59702e5ff8d0522b0aa9dcca863309eaafbcda09 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 17:27:43 -0700 Subject: altoslib: Extend telemetry heights from 16 to 32 bits Uses the GPS data and/or previous kalman data to compute the upper 16 bits of the truncated telemetry altitude value. Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 3 +++ altoslib/AltosConfigValues.java | 2 ++ altoslib/AltosState.java | 28 ++++++++++++++++++++++++---- altoslib/AltosTelemetry.java | 29 +++++++++++++++++++++++++++++ altoslib/AltosTelemetryMegaData.java | 13 ++++++++++--- altoslib/AltosTelemetryMetrumSensor.java | 7 ++++--- altosui/AltosConfigUI.java | 3 +++ 7 files changed, 75 insertions(+), 10 deletions(-) diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 847436cd..134a0ed2 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -31,6 +31,7 @@ public class AltosConfigData implements Iterable { public int log_format; public int log_space; public String version; + public int altitude_32; /* Strings returned */ public LinkedList lines; @@ -274,6 +275,7 @@ public class AltosConfigData implements Iterable { try { flight = get_int(line, "current-flight"); } catch (Exception e) {} try { log_format = get_int(line, "log-format"); } catch (Exception e) {} try { log_space = get_int(line, "log-space"); } catch (Exception e) {} + try { altitude_32 = get_int(line, "altitude-32"); } catch (Exception e) {} try { version = get_string(line, "software-version"); } catch (Exception e) {} /* Version also contains MS5607 info, which we ignore here */ @@ -484,6 +486,7 @@ public class AltosConfigData implements Iterable { dest.set_serial(serial); dest.set_product(product); dest.set_version(version); + dest.set_altitude_32(altitude_32); dest.set_main_deploy(main_deploy); dest.set_apogee_delay(apogee_delay); dest.set_apogee_lockout(apogee_lockout); diff --git a/altoslib/AltosConfigValues.java b/altoslib/AltosConfigValues.java index 987da53b..3f0a7075 100644 --- a/altoslib/AltosConfigValues.java +++ b/altoslib/AltosConfigValues.java @@ -25,6 +25,8 @@ public interface AltosConfigValues { public abstract void set_serial(int serial); + public abstract void set_altitude_32(int altitude_32); + public abstract void set_main_deploy(int new_main_deploy); public abstract int main_deploy() throws AltosConfigDataException; diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index 2fc13b44..5fce15c4 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -271,6 +271,7 @@ public class AltosState implements Cloneable { public int state; public int flight; public int serial; + public int altitude_32; public int receiver_serial; public boolean landed; public boolean ascent; /* going up? */ @@ -472,15 +473,23 @@ public class AltosState implements Cloneable { pressure.set(p, time); } + public double baro_height() { + double a = altitude(); + double g = ground_altitude(); + if (a != AltosLib.MISSING && g != AltosLib.MISSING) + return a - g; + return AltosLib.MISSING; + } + public double height() { double k = kalman_height.value(); if (k != AltosLib.MISSING) return k; - double a = altitude(); - double g = ground_altitude(); - if (a != AltosLib.MISSING && g != AltosLib.MISSING) - return a - g; + double b = baro_height(); + if (b != AltosLib.MISSING) + return b; + return gps_height(); } @@ -762,6 +771,7 @@ public class AltosState implements Cloneable { product = null; serial = AltosLib.MISSING; receiver_serial = AltosLib.MISSING; + altitude_32 = AltosLib.MISSING; baro = null; companion = null; @@ -899,6 +909,7 @@ public class AltosState implements Cloneable { product = old.product; serial = old.serial; receiver_serial = old.receiver_serial; + altitude_32 = old.altitude_32; baro = old.baro; companion = old.companion; @@ -1066,6 +1077,15 @@ public class AltosState implements Cloneable { receiver_serial = serial; } + public boolean altitude_32() { + return altitude_32 == 1; + } + + public void set_altitude_32(int altitude_32) { + if (altitude_32 != AltosLib.MISSING) + this.altitude_32 = altitude_32; + } + public int rssi() { if (rssi == AltosLib.MISSING) return 0; diff --git a/altoslib/AltosTelemetry.java b/altoslib/AltosTelemetry.java index 4d50a059..2f15cd89 100644 --- a/altoslib/AltosTelemetry.java +++ b/altoslib/AltosTelemetry.java @@ -114,6 +114,35 @@ public abstract class AltosTelemetry implements AltosStateUpdate { return telem; } + public static int extend_height(AltosState state, int height_16) { + double compare_height; + int height = height_16; + + System.out.printf("state kalman height %g altitude %g ground_altitude %g gps_height %g\n", + state.kalman_height.value(), state.altitude(), state.ground_altitude(), state.gps_height()); + if (state.gps != null && state.gps.alt != AltosLib.MISSING) { + compare_height = state.gps_height(); + } else { + compare_height = state.height(); + } + + if (compare_height != AltosLib.MISSING) { + int high_bits = (int) Math.floor (compare_height / 65536.0); + + height = (high_bits << 16) | (height_16 & 0xffff); + + if (Math.abs(height + 65536 - compare_height) < Math.abs(height - compare_height)) + height += 65536; + else if (Math.abs(height - 65536 - compare_height) < Math.abs(height - compare_height)) + height -= 65536; + if (height != height_16) { + System.out.printf("Height adjusted from %d to %d with %g\n", + height_16, height, compare_height); + } + } + return height; + } + public static AltosTelemetry parse(String line) throws ParseException, AltosCRCException { String[] word = line.split("\\s+"); int i =0; diff --git a/altoslib/AltosTelemetryMegaData.java b/altoslib/AltosTelemetryMegaData.java index 93610118..8b1869bb 100644 --- a/altoslib/AltosTelemetryMegaData.java +++ b/altoslib/AltosTelemetryMegaData.java @@ -31,7 +31,7 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { int acceleration; int speed; - int height; + int height_16; public AltosTelemetryMegaData(int[] bytes) { super(bytes); @@ -55,7 +55,8 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { acceleration = int16(26); speed = int16(28); - height = int16(30); + + height_16 = int16(30); } public void update_state(AltosState state) { @@ -79,7 +80,13 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { state.set_ground_pressure(ground_pres); state.set_accel_g(accel_plus_g, accel_minus_g); - state.set_kalman(height, speed/16.0, acceleration / 16.0); + /* Fill in the high bits of height from recent GPS + * data if available, otherwise guess using the + * previous kalman height + */ + + state.set_kalman(extend_height(state, height_16), + speed/16.0, acceleration / 16.0); } } diff --git a/altoslib/AltosTelemetryMetrumSensor.java b/altoslib/AltosTelemetryMetrumSensor.java index 3e0abedc..beab6da9 100644 --- a/altoslib/AltosTelemetryMetrumSensor.java +++ b/altoslib/AltosTelemetryMetrumSensor.java @@ -27,7 +27,7 @@ public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { int acceleration; int speed; - int height; + int height_16; int v_batt; int sense_a; @@ -43,7 +43,7 @@ public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { acceleration = int16(14); speed = int16(16); - height = int16(18); + height_16 = int16(18); v_batt = int16(20); sense_a = int16(22); @@ -59,7 +59,8 @@ public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard { state.set_pressure(pres); state.set_temperature(temp/100.0); - state.set_kalman(height, speed/16.0, acceleration/16.0); + state.set_kalman(extend_height(state, height_16), + speed/16.0, acceleration/16.0); state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt)); diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 043cb876..9fcace61 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -926,6 +926,9 @@ public class AltosConfigUI serial_value.setText(String.format("%d", serial)); } + public void set_altitude_32(int altitude_32) { + } + public void set_main_deploy(int new_main_deploy) { main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy)); main_deploy_value.setEnabled(new_main_deploy >= 0); -- cgit v1.2.3 From aac3fdce54233993c91d326df3732a7c448ac54a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 18:42:37 -0700 Subject: libaltos: Bind to libbluetooth at runtime on demand This lets us reliably start and run without libbluetooth present. Signed-off-by: Keith Packard --- libaltos/Makefile.am | 3 +-- libaltos/libaltos.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/libaltos/Makefile.am b/libaltos/Makefile.am index d2531133..1db2d486 100644 --- a/libaltos/Makefile.am +++ b/libaltos/Makefile.am @@ -41,8 +41,7 @@ cjnitest64_LDADD=libaltos64.la endif - -LIBS=-lbluetooth +LIBS=-ldl HFILES=libaltos.h diff --git a/libaltos/libaltos.c b/libaltos/libaltos.c index b7ec98fc..a1f1ee4c 100644 --- a/libaltos/libaltos.c +++ b/libaltos/libaltos.c @@ -643,6 +643,49 @@ altos_list_finish(struct altos_list *usbdevs) free(usbdevs); } +#include + +static void *libbt; +static int bt_initialized; + +static int init_bt(void) { + if (!bt_initialized) { + bt_initialized = 1; + libbt = dlopen("libbluetooth.so.3", RTLD_LAZY); + if (!libbt) + printf("failed to find bluetooth library\n"); + } + return libbt != NULL; +} + +#define join(a,b) a ## b +#define bt_func(name, ret, fail, formals, actuals) \ + static ret join(altos_, name) formals { \ + static ret (*name) formals; \ + if (!init_bt()) return fail; \ + name = dlsym(libbt, #name); \ + if (!name) return fail; \ + return name actuals; \ + } + +bt_func(ba2str, int, -1, (const bdaddr_t *ba, char *str), (ba, str)) +#define ba2str altos_ba2str + +bt_func(str2ba, int, -1, (const char *str, bdaddr_t *ba), (str, ba)) +#define str2ba altos_str2ba + +bt_func(hci_read_remote_name, int, -1, (int sock, const bdaddr_t *ba, int len, char *name, int timeout), (sock, ba, len, name, timeout)) +#define hci_read_remote altos_hci_read_remote + +bt_func(hci_open_dev, int, -1, (int dev_id), (dev_id)) +#define hci_open_dev altos_hci_open_dev + +bt_func(hci_get_route, int, -1, (bdaddr_t *bdaddr), (bdaddr)) +#define hci_get_route altos_hci_get_route + +bt_func(hci_inquiry, int, -1, (int adapter_id, int len, int max_rsp, const uint8_t *lap, inquiry_info **devs, long flags), (adapter_id, len, max_rsp, lap, devs, flags)) +#define hci_inquiry altos_hci_inquiry + struct altos_bt_list { inquiry_info *ii; int sock; @@ -706,7 +749,8 @@ altos_bt_list_next(struct altos_bt_list *bt_list, return 0; ii = &bt_list->ii[bt_list->rsp]; - ba2str(&ii->bdaddr, device->addr); + if (ba2str(&ii->bdaddr, device->addr) < 0) + return 0; memset(&device->name, '\0', sizeof (device->name)); if (hci_read_remote_name(bt_list->sock, &ii->bdaddr, sizeof (device->name), @@ -742,11 +786,17 @@ altos_bt_open(struct altos_bt_device *device) struct altos_file *file; file = calloc(1, sizeof (struct altos_file)); - if (!file) + if (!file) { + errno = ENOMEM; + altos_set_last_posix_error(); goto no_file; + } addr.rc_family = AF_BLUETOOTH; addr.rc_channel = 1; - str2ba(device->addr, &addr.rc_bdaddr); + if (str2ba(device->addr, &addr.rc_bdaddr) < 0) { + altos_set_last_posix_error(); + goto no_sock; + } for (i = 0; i < 5; i++) { file->fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); -- cgit v1.2.3 From 5f5b03879d9daa68a56498b45ae87a804cb1926b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 18:43:31 -0700 Subject: altosui: Don't show bluetooth UI bits on mac/windows This just confuses people into thinking that bluetooth is supported on those machines. Signed-off-by: Keith Packard --- altosui/AltosConfigureUI.java | 8 +++++++- altosuilib/AltosDeviceDialog.java | 3 ++- altosuilib/AltosUIConfigure.java | 3 ++- altosuilib/AltosUILib.java | 8 ++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index 80d6d341..85a3f6c0 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -89,6 +89,8 @@ public class AltosConfigureUI row++; } + boolean has_bluetooth; + public void add_bluetooth() { JButton manage_bluetooth = new JButton("Manage Bluetooth"); manage_bluetooth.addActionListener(new ActionListener() { @@ -98,6 +100,7 @@ public class AltosConfigureUI }); pane.add(manage_bluetooth, constraints(0, 2)); /* in the same row as add_frequencies, so don't bump row */ + has_bluetooth = true; } public void add_frequencies() { @@ -108,7 +111,10 @@ public class AltosConfigureUI } }); manage_frequencies.setToolTipText("Configure which values are shown in frequency menus"); - pane.add(manage_frequencies, constraints(2, 1)); + if (has_bluetooth) + pane.add(manage_frequencies, constraints(2, 1)); + else + pane.add(manage_frequencies, constraints(0, 3)); row++; } diff --git a/altosuilib/AltosDeviceDialog.java b/altosuilib/AltosDeviceDialog.java index 0875bea7..d2ccd5e7 100644 --- a/altosuilib/AltosDeviceDialog.java +++ b/altosuilib/AltosDeviceDialog.java @@ -131,7 +131,8 @@ public abstract class AltosDeviceDialog extends AltosUIDialog implements ActionL buttonPane.add(cancel_button); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); - add_bluetooth(); + if (AltosUILib.has_bluetooth) + add_bluetooth(); buttonPane.add(select_button); diff --git a/altosuilib/AltosUIConfigure.java b/altosuilib/AltosUIConfigure.java index 5648d1df..9c0f3bc7 100644 --- a/altosuilib/AltosUIConfigure.java +++ b/altosuilib/AltosUIConfigure.java @@ -283,7 +283,8 @@ public class AltosUIConfigure add_look_and_feel(); add_position(); add_map_cache(); - add_bluetooth(); + if (AltosUILib.has_bluetooth) + add_bluetooth(); add_frequencies(); /* And a close button at the bottom */ diff --git a/altosuilib/AltosUILib.java b/altosuilib/AltosUILib.java index 0050f12c..8fa7dfe6 100644 --- a/altosuilib/AltosUILib.java +++ b/altosuilib/AltosUILib.java @@ -80,6 +80,7 @@ public class AltosUILib extends AltosLib { static public boolean initialized = false; static public boolean loaded_library = false; + static public boolean has_bluetooth = false; static final String[] library_names = { "altos", "altos32", "altos64" }; @@ -96,6 +97,13 @@ public class AltosUILib extends AltosLib { loaded_library = false; } } + + String OS = System.getProperty("os.name"); + + if (OS.startsWith("Linux")) { + has_bluetooth = true; + } + initialized = true; } return loaded_library; -- cgit v1.2.3 From 405626971b47d4d4031312232bf13ad3d4bace7f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 21:13:49 -0700 Subject: libaltos: typo in libaltos broke the build When converting this to use dlopen, I mis-typed the name hci_read_remote_name Signed-off-by: Keith Packard --- libaltos/libaltos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libaltos/libaltos.c b/libaltos/libaltos.c index a1f1ee4c..4e3bc2c5 100644 --- a/libaltos/libaltos.c +++ b/libaltos/libaltos.c @@ -675,7 +675,7 @@ bt_func(str2ba, int, -1, (const char *str, bdaddr_t *ba), (str, ba)) #define str2ba altos_str2ba bt_func(hci_read_remote_name, int, -1, (int sock, const bdaddr_t *ba, int len, char *name, int timeout), (sock, ba, len, name, timeout)) -#define hci_read_remote altos_hci_read_remote +#define hci_read_remote_name altos_hci_read_remote_name bt_func(hci_open_dev, int, -1, (int dev_id), (dev_id)) #define hci_open_dev altos_hci_open_dev -- cgit v1.2.3 From fa155693282746861b227afd6cbccc83dfd1bbed Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 10 Jul 2014 21:27:30 -0700 Subject: telegps: Missing function in TeleGPSConfigUI set_altitude_32 was added to the abstract class but not here. Signed-off-by: Keith Packard --- telegps/TeleGPSConfigUI.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java index 2bd1d2df..7a59bf48 100644 --- a/telegps/TeleGPSConfigUI.java +++ b/telegps/TeleGPSConfigUI.java @@ -670,6 +670,9 @@ public class TeleGPSConfigUI serial_value.setText(String.format("%d", serial)); } + public void set_altitude_32(int altitude_32) { + } + public void set_main_deploy(int new_main_deploy) { } -- cgit v1.2.3 From a60ba449ec237ad3b8dade9dcea603b349dbccb1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 12 Jul 2014 23:52:05 -0700 Subject: altos/telefire,telelco: Add HAS_RADIO_RATE to launch system software This lets us set the rate to a lower value to improve range. 9600 baud works great; 2400 baud makes the initial search take a long time. Signed-off-by: Keith Packard --- src/drivers/ao_lco_func.c | 16 +++++++++++++++- src/telefire-v0.2/ao_pins.h | 1 + src/telelco-v0.2/ao_lco.c | 2 +- src/telelco-v0.2/ao_pins.h | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/drivers/ao_lco_func.c b/src/drivers/ao_lco_func.c index 9e642836..32c00068 100644 --- a/src/drivers/ao_lco_func.c +++ b/src/drivers/ao_lco_func.c @@ -28,7 +28,21 @@ ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset) { int8_t r; uint16_t sent_time; + uint16_t timeout = AO_MS_TO_TICKS(10); +#if HAS_RADIO_RATE + switch (ao_config.radio_rate) { + case AO_RADIO_RATE_38400: + default: + break; + case AO_RADIO_RATE_9600: + timeout = AO_MS_TO_TICKS(20); + break; + case AO_RADIO_RATE_2400: + timeout = AO_MS_TO_TICKS(80); + break; + } +#endif ao_mutex_get(&ao_lco_mutex); command.tick = ao_time() - *tick_offset; command.box = box; @@ -36,7 +50,7 @@ ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset) command.channels = 0; ao_radio_cmac_send(&command, sizeof (command)); sent_time = ao_time(); - r = ao_radio_cmac_recv(query, sizeof (*query), AO_MS_TO_TICKS(10)); + r = ao_radio_cmac_recv(query, sizeof (*query), timeout); if (r == AO_RADIO_CMAC_OK) *tick_offset = sent_time - query->tick; ao_mutex_put(&ao_lco_mutex); diff --git a/src/telefire-v0.2/ao_pins.h b/src/telefire-v0.2/ao_pins.h index 9e6631ce..ef2d4822 100644 --- a/src/telefire-v0.2/ao_pins.h +++ b/src/telefire-v0.2/ao_pins.h @@ -19,6 +19,7 @@ #define _AO_PINS_H_ #define HAS_RADIO 1 +#define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 #define HAS_FLIGHT 0 diff --git a/src/telelco-v0.2/ao_lco.c b/src/telelco-v0.2/ao_lco.c index b3f5bb16..4b5f7a9b 100644 --- a/src/telelco-v0.2/ao_lco.c +++ b/src/telelco-v0.2/ao_lco.c @@ -258,7 +258,7 @@ ao_lco_search(void) for (box = 0; box < AO_PAD_MAX_BOXES; box++) { if ((box % 10) == 0) ao_lco_set_box(box); - for (try = 0; try < 5; try++) { + for (try = 0; try < 3; try++) { tick_offset = 0; r = ao_lco_query(box, &ao_pad_query, &tick_offset); PRINTD("box %d result %d\n", box, r); diff --git a/src/telelco-v0.2/ao_pins.h b/src/telelco-v0.2/ao_pins.h index a6fd4ff8..da790b14 100644 --- a/src/telelco-v0.2/ao_pins.h +++ b/src/telelco-v0.2/ao_pins.h @@ -48,6 +48,7 @@ #define HAS_USB 1 #define HAS_BEEP 1 #define HAS_RADIO 1 +#define HAS_RADIO_RATE 1 #define HAS_TELEMETRY 0 #define HAS_AES 1 -- cgit v1.2.3 From e447e1e5c90d3fc1be9c5a1c966c7c688a87ba18 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 13 Jul 2014 11:06:29 -0700 Subject: ao-tools: Add TMv2 and Tgps log formats to cc.h Signed-off-by: Keith Packard --- ao-tools/lib/cc.h | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/ao-tools/lib/cc.h b/ao-tools/lib/cc.h index c07f8cd0..c434b102 100644 --- a/ao-tools/lib/cc.h +++ b/ao-tools/lib/cc.h @@ -346,6 +346,143 @@ struct ao_log_mega { } u; }; +struct ao_log_metrum { + 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 */ + uint32_t ground_pres; /* 8 */ + uint32_t ground_temp; /* 12 */ + } flight; /* 16 */ + /* AO_LOG_STATE */ + struct { + uint16_t state; /* 4 */ + uint16_t reason; /* 6 */ + } state; /* 8 */ + /* AO_LOG_SENSOR */ + struct { + uint32_t pres; /* 4 */ + uint32_t temp; /* 8 */ + int16_t accel; /* 12 */ + } sensor; /* 14 */ + /* AO_LOG_TEMP_VOLT */ + struct { + int16_t v_batt; /* 4 */ + int16_t sense_a; /* 6 */ + int16_t sense_m; /* 8 */ + } volt; /* 10 */ + /* AO_LOG_GPS_POS */ + struct { + int32_t latitude; /* 4 */ + int32_t longitude; /* 8 */ + uint16_t altitude_low; /* 12 */ + int16_t altitude_high; /* 14 */ + } gps; /* 16 */ + /* AO_LOG_GPS_TIME */ + struct { + uint8_t hour; /* 4 */ + uint8_t minute; /* 5 */ + uint8_t second; /* 6 */ + uint8_t flags; /* 7 */ + uint8_t year; /* 8 */ + uint8_t month; /* 9 */ + uint8_t day; /* 10 */ + uint8_t pdop; /* 11 */ + } gps_time; /* 12 */ + /* AO_LOG_GPS_SAT (up to three packets) */ + struct { + uint8_t channels; /* 4 */ + uint8_t more; /* 5 */ + struct { + uint8_t svid; + uint8_t c_n; + } sats[4]; /* 6 */ + } gps_sat; /* 14 */ + uint8_t raw[12]; /* 4 */ + } u; /* 16 */ +}; + +struct ao_log_mini { + char type; /* 0 */ + uint8_t csum; /* 1 */ + uint16_t tick; /* 2 */ + union { /* 4 */ + /* AO_LOG_FLIGHT */ + struct { + uint16_t flight; /* 4 */ + uint16_t r6; + uint32_t ground_pres; /* 8 */ + } flight; + /* AO_LOG_STATE */ + struct { + uint16_t state; /* 4 */ + uint16_t reason; /* 6 */ + } state; + /* AO_LOG_SENSOR */ + struct { + uint8_t pres[3]; /* 4 */ + uint8_t temp[3]; /* 7 */ + int16_t sense_a; /* 10 */ + int16_t sense_m; /* 12 */ + int16_t v_batt; /* 14 */ + } sensor; /* 16 */ + } u; /* 16 */ +}; /* 16 */ + +#define ao_log_pack24(dst,value) do { \ + (dst)[0] = (value); \ + (dst)[1] = (value) >> 8; \ + (dst)[2] = (value) >> 16; \ + } while (0) + +struct ao_log_gps { + char type; /* 0 */ + uint8_t csum; /* 1 */ + uint16_t tick; /* 2 */ + union { /* 4 */ + /* AO_LOG_FLIGHT */ + struct { + uint16_t flight; /* 4 */ + int16_t start_altitude; /* 6 */ + int32_t start_latitude; /* 8 */ + int32_t start_longitude; /* 12 */ + } flight; /* 16 */ + /* AO_LOG_GPS_TIME */ + struct { + int32_t latitude; /* 4 */ + int32_t longitude; /* 8 */ + uint16_t altitude_low; /* 12 */ + uint8_t hour; /* 14 */ + uint8_t minute; /* 15 */ + uint8_t second; /* 16 */ + uint8_t flags; /* 17 */ + uint8_t year; /* 18 */ + uint8_t month; /* 19 */ + uint8_t day; /* 20 */ + uint8_t course; /* 21 */ + uint16_t ground_speed; /* 22 */ + int16_t climb_rate; /* 24 */ + uint8_t pdop; /* 26 */ + uint8_t hdop; /* 27 */ + uint8_t vdop; /* 28 */ + uint8_t mode; /* 29 */ + int16_t altitude_high; /* 30 */ + } gps; /* 31 */ + /* AO_LOG_GPS_SAT */ + struct { + uint16_t channels; /* 4 */ + struct { + uint8_t svid; + uint8_t c_n; + } sats[12]; /* 6 */ + } gps_sat; /* 30 */ + } u; +}; + #define AO_CONFIG_CONFIG 1 #define AO_CONFIG_MAIN 2 #define AO_CONFIG_APOGEE 3 @@ -383,6 +520,18 @@ struct ao_log_mega { #define AO_LOG_CONFIG 'c' +#define AO_LOG_FORMAT_UNKNOWN 0 /* unknown; altosui will have to guess */ +#define AO_LOG_FORMAT_FULL 1 /* 8 byte typed log records */ +#define AO_LOG_FORMAT_TINY 2 /* two byte state/baro records */ +#define AO_LOG_FORMAT_TELEMETRY 3 /* 32 byte ao_telemetry records */ +#define AO_LOG_FORMAT_TELESCIENCE 4 /* 32 byte typed telescience records */ +#define AO_LOG_FORMAT_TELEMEGA 5 /* 32 byte typed telemega records */ +#define AO_LOG_FORMAT_EASYMINI 6 /* 16-byte MS5607 baro only, 3.0V supply */ +#define AO_LOG_FORMAT_TELEMETRUM 7 /* 16-byte typed telemetrum records */ +#define AO_LOG_FORMAT_TELEMINI 8 /* 16-byte MS5607 baro only, 3.3V supply */ +#define AO_LOG_FORMAT_TELEGPS 9 /* 32 byte telegps records */ +#define AO_LOG_FORMAT_NONE 127 /* No log at all */ + int cc_mega_parse(const char *input_line, struct ao_log_mega *l); @@ -398,6 +547,9 @@ cc_pressure_to_altitude(double pressure); double cc_altitude_to_pressure(double altitude); +double +cc_altitude_to_temperature(double altitude); + double cc_barometer_to_pressure(double baro); -- cgit v1.2.3 From 6c9daa4f471ac90ffce3bfe8876c9008f79a5b7f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 13 Jul 2014 20:40:40 -0700 Subject: ao-tools: Provide altitude to temperature conversion function This takes altitude and computes the 'normal' temperature for that. Signed-off-by: Keith Packard --- ao-tools/lib/cc-convert.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ao-tools/lib/cc-convert.c b/ao-tools/lib/cc-convert.c index 8d6876a0..b82dd778 100644 --- a/ao-tools/lib/cc-convert.c +++ b/ao-tools/lib/cc-convert.c @@ -108,6 +108,29 @@ cc_altitude_to_pressure(double altitude) return pressure; } +double +cc_altitude_to_temperature(double altitude) +{ + + double base_temperature = LAYER0_BASE_TEMPERATURE; + double temperature; + + int layer_number; /* identifies layer in the atmosphere */ + double delta_z; /* difference between two altitudes */ + + /* calculate the base temperature for the atmospheric layer + associated with the inputted altitude */ + for(layer_number = 0; layer_number < NUMBER_OF_LAYERS - 1 && altitude > base_altitude[layer_number + 1]; layer_number++) { + delta_z = base_altitude[layer_number + 1] - base_altitude[layer_number]; + base_temperature += delta_z * lapse_rate[layer_number]; + } + + /* calculate the pressure at the inputted altitude */ + delta_z = altitude - base_altitude[layer_number]; + temperature = base_temperature + lapse_rate[layer_number] * delta_z; + + return temperature - 273.15; +} /* outputs the altitude associated with the given pressure. the altitude returned is measured with respect to the mean sea level */ -- cgit v1.2.3 From 5d1adc6775a66633661af747bc4176e06f97630f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 13 Jul 2014 20:41:36 -0700 Subject: ao-tools: Add a few GPS telem/eeprom constants These make it possible to encode/decode GPS data from telemetry and eeprom files Signed-off-by: Keith Packard --- ao-tools/lib/cc.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ao-tools/lib/cc.h b/ao-tools/lib/cc.h index c434b102..bff4b2c9 100644 --- a/ao-tools/lib/cc.h +++ b/ao-tools/lib/cc.h @@ -517,9 +517,18 @@ struct ao_log_gps { #define AO_LOG_GPS_ALT 'H' #define AO_LOG_GPS_SAT 'V' #define AO_LOG_GPS_DATE 'Y' +#define AO_LOG_GPS_POS 'P' #define AO_LOG_CONFIG 'c' +#define AO_GPS_NUM_SAT_MASK (0xf << 0) +#define AO_GPS_NUM_SAT_SHIFT (0) + +#define AO_GPS_VALID (1 << 4) +#define AO_GPS_RUNNING (1 << 5) +#define AO_GPS_DATE_VALID (1 << 6) +#define AO_GPS_COURSE_VALID (1 << 7) + #define AO_LOG_FORMAT_UNKNOWN 0 /* unknown; altosui will have to guess */ #define AO_LOG_FORMAT_FULL 1 /* 8 byte typed log records */ #define AO_LOG_FORMAT_TINY 2 /* two byte state/baro records */ -- cgit v1.2.3 From 6c3d09bf40f2af6e8722f33a70b41e5d94ceaf9f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 13 Jul 2014 20:42:41 -0700 Subject: altos: Interrupt radio receive when changing data rate This aborts any pending radio receive when changing the data rate so that the radio can be reprogrammed to receive at the correct rate. Signed-off-by: Keith Packard --- src/kernel/ao_config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index 32a0967c..d73a3733 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -518,6 +518,9 @@ ao_config_radio_rate_set(void) __reentrant ao_telemetry_reset_interval(); #endif _ao_config_edit_finish(); +#if HAS_RADIO_RECV + ao_radio_recv_abort(); +#endif } #endif -- cgit v1.2.3 From 50aec54bdc35962145eff9b465f9cd7b3d9fea0b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 13 Jul 2014 20:43:27 -0700 Subject: altos: Make ao_gps_print deal with telem containing 32-bit altitude values ao_gps_print is used with new telem packets from a few places; use AO_TELEMETRY_LOCATION_ALTITUDE when necessary. Signed-off-by: Keith Packard --- src/kernel/ao_gps_print.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kernel/ao_gps_print.c b/src/kernel/ao_gps_print.c index 47c945d7..d26021da 100644 --- a/src/kernel/ao_gps_print.c +++ b/src/kernel/ao_gps_print.c @@ -20,6 +20,10 @@ #endif #include "ao_telem.h" +#ifndef AO_TELEMETRY_LOCATION_ALTITUDE +#define AO_TELEMETRY_LOCATION_ALTITUDE(l) ((l)->altitude) +#endif + void ao_gps_print(__xdata struct ao_gps_orig *gps_data) __reentrant { @@ -42,7 +46,7 @@ ao_gps_print(__xdata struct ao_gps_orig *gps_data) __reentrant AO_TELEM_GPS_ALTITUDE " %d ", (long) gps_data->latitude, (long) gps_data->longitude, - gps_data->altitude); + AO_TELEMETRY_LOCATION_ALTITUDE(gps_data)); if (gps_data->flags & AO_GPS_DATE_VALID) printf(AO_TELEM_GPS_YEAR " %d " -- cgit v1.2.3 From 0fd867f504dd7df62e95da98ded511bb7b9e4c66 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 13 Jul 2014 20:44:39 -0700 Subject: altos/test: Build TeleMetrumV2 flight test variant Parses TeleMetrumV2 eeprom files and runs the TeleMetrumV2 flight code. Signed-off-by: Keith Packard --- src/test/Makefile | 4 ++ src/test/ao_flight_test.c | 108 ++++++++++++++++++++++++++++++++++++---------- src/test/plottest | 6 +-- 3 files changed, 93 insertions(+), 25 deletions(-) diff --git a/src/test/Makefile b/src/test/Makefile index 017f7f71..02e1d22b 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -1,6 +1,7 @@ vpath % ..:../kernel:../drivers:../util:../micropeak:../aes:../product PROGS=ao_flight_test ao_flight_test_baro ao_flight_test_accel ao_flight_test_noisy_accel ao_flight_test_mm \ + ao_flight_test_metrum \ ao_gps_test ao_gps_test_skytraq ao_gps_test_ublox ao_convert_test ao_convert_pa_test ao_fec_test \ ao_aprs_test ao_micropeak_test ao_fat_test ao_aes_test ao_int64_test \ ao_ms5607_convert_test ao_quaternion_test @@ -33,6 +34,9 @@ ao_flight_test_accel: ao_flight_test.c ao_host.h ao_flight.c ao_sample.c ao_kal ao_flight_test_mm: ao_flight_test.c ao_host.h ao_flight.c ao_sample.c ao_kalman.c ao_pyro.c ao_pyro.h $(INCS) cc -DTELEMEGA=1 $(CFLAGS) -o $@ $< -lm +ao_flight_test_metrum: ao_flight_test.c ao_host.h ao_flight.c ao_sample.c ao_kalman.c ao_pyro.c ao_pyro.h $(INCS) + cc -DTELEMETRUM_V2=1 $(CFLAGS) -o $@ $< -lm + ao_gps_test: ao_gps_test.c ao_gps_sirf.c ao_gps_print.c ao_host.h cc $(CFLAGS) -o $@ $< diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index bb5c3a7d..8b737ca1 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -45,6 +45,10 @@ int ao_gps_new; +#if !defined(TELEMEGA) && !defined(TELEMETRUM_V2) +#define TELEMETRUM_V1 1 +#endif + #if TELEMEGA #define AO_ADC_NUM_SENSE 6 #define HAS_MS5607 1 @@ -60,7 +64,25 @@ struct ao_adc { int16_t v_pbatt; int16_t temp; }; -#else +#endif + +#if TELEMETRUM_V2 +#define AO_ADC_NUM_SENSE 2 +#define HAS_MS5607 1 +#define HAS_MMA655X 1 +#define HAS_BEEP 1 +#define AO_CONFIG_MAX_SIZE 1024 + +struct ao_adc { + int16_t sense_a; + int16_t sense_m; + int16_t v_batt; + int16_t temp; +}; +#endif + + +#if TELEMETRUM_V1 /* * One set of samples read from the A/D converter */ @@ -189,17 +211,6 @@ ao_gps_angle(void) #define to_fix32(x) ((int32_t) ((x) * 65536.0 + 0.5)) #define from_fix(x) ((x) >> 16) -/* - * Above this height, the baro sensor doesn't work - */ -#define AO_BARO_SATURATE 13000 -#define AO_MIN_BARO_VALUE ao_altitude_to_pres(AO_BARO_SATURATE) - -/* - * Above this speed, baro measurements are unreliable - */ -#define AO_MAX_BARO_SPEED 200 - #define ACCEL_NOSE_UP (ao_accel_2g >> 2) extern enum ao_flight_state ao_flight_state; @@ -309,7 +320,7 @@ struct ao_cmds { #define ao_xmemcmp(d,s,c) memcmp(d,s,c) #define AO_NEED_ALTITUDE_TO_PRES 1 -#if TELEMEGA +#if TELEMEGA || TELEMETRUM_V2 #include "ao_convert_pa.c" #include struct ao_ms5607_prom ao_ms5607_prom; @@ -459,7 +470,7 @@ ao_insert(void) #else double accel = 0.0; #endif -#if TELEMEGA +#if TELEMEGA || TELEMETRUM_V2 double height; ao_ms5607_convert(&ao_data_static.ms5607_raw, &ao_data_static.ms5607_cooked); @@ -554,6 +565,7 @@ ao_insert(void) mag_azel.el, mag_azel.az); #endif +#if 0 printf ("%7.2f state %-8.8s height %8.4f tilt %4d rot %4d dist %12.2f gps_tilt %4d gps_sats %2d\n", time, ao_state_names[ao_flight_state], @@ -563,6 +575,7 @@ ao_insert(void) (int) floor (ao_gps_angle() + 0.5), (ao_gps_static.flags & 0xf) * 10); +#endif #if 0 printf ("\t\tstate %-8.8s ground az: %4d el %4d mag az %4d el %4d rot az %4d el %4d el_diff %4d az_diff %4d angle %4d tilt %4d ground %8.5f %8.5f %8.5f cur %8.5f %8.5f %8.5f rot %8.5f %8.5f %8.5f\n", ao_state_names[ao_flight_state], @@ -585,9 +598,9 @@ ao_insert(void) #endif #endif -#if 0 +#if 1 printf("%7.2f height %8.2f accel %8.3f " -#if TELEMEGA +#if TELEMEGA && 0 "angle %5d " "accel_x %8.3f accel_y %8.3f accel_z %8.3f gyro_x %8.3f gyro_y %8.3f gyro_z %8.3f mag_x %8d mag_y %8d, mag_z %8d mag_angle %4d " #endif @@ -595,7 +608,7 @@ ao_insert(void) time, height, accel, -#if TELEMEGA +#if TELEMEGA && 0 ao_sample_orient, ao_mpu6000_accel(ao_data_static.mpu6000.accel_x), @@ -678,7 +691,8 @@ ao_sleep(void *wchan) { #if TELEMEGA ao_data_static.mpu6000 = ao_ground_mpu6000; -#else +#endif +#if TELEMETRUM_V1 ao_data_static.adc.accel = ao_flight_ground_accel; #endif ao_insert(); @@ -807,7 +821,59 @@ ao_sleep(void *wchan) } } } -#else +#endif +#if TELEMETRUM_V2 + if (log_format == AO_LOG_FORMAT_TELEMETRUM && nword == 14 && strlen(words[0]) == 1) { + int i; + struct ao_ms5607_value value; + + type = words[0][0]; + tick = strtoul(words[1], NULL, 16); +// printf ("%c %04x", type, tick); + for (i = 2; i < nword; i++) { + bytes[i - 2] = strtoul(words[i], NULL, 16); +// printf(" %02x", bytes[i-2]); + } +// printf ("\n"); + switch (type) { + case 'F': + ao_flight_ground_accel = int16(bytes, 2); + ao_flight_started = 1; + ao_ground_pres = int32(bytes, 4); + ao_ground_height = ao_pa_to_altitude(ao_ground_pres); + break; + case 'A': + ao_data_static.tick = tick; + ao_data_static.ms5607_raw.pres = int32(bytes, 0); + ao_data_static.ms5607_raw.temp = int32(bytes, 4); + ao_ms5607_convert(&ao_data_static.ms5607_raw, &value); + ao_data_static.mma655x = int16(bytes, 8); + ao_records_read++; + ao_insert(); + return; + } + continue; + } else if (nword == 3 && strcmp(words[0], "ms5607") == 0) { + if (strcmp(words[1], "reserved:") == 0) + ao_ms5607_prom.reserved = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "sens:") == 0) + ao_ms5607_prom.sens = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "off:") == 0) + ao_ms5607_prom.off = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "tcs:") == 0) + ao_ms5607_prom.tcs = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "tco:") == 0) + ao_ms5607_prom.tco = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "tref:") == 0) + ao_ms5607_prom.tref = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "tempsens:") == 0) + ao_ms5607_prom.tempsens = strtoul(words[2], NULL, 10); + else if (strcmp(words[1], "crc:") == 0) + ao_ms5607_prom.crc = strtoul(words[2], NULL, 10); + continue; + } +#endif +#if TELEMETRUM_V1 if (nword == 4 && log_format != AO_LOG_FORMAT_TELEMEGA) { type = words[0][0]; tick = strtoul(words[1], NULL, 16); @@ -932,7 +998,7 @@ ao_sleep(void *wchan) if (type != 'F' && !ao_flight_started) continue; -#if TELEMEGA +#if TELEMEGA || TELEMETRUM_V2 (void) a; (void) b; #else @@ -953,8 +1019,6 @@ ao_sleep(void *wchan) ao_data_static.tick = tick; ao_data_static.adc.accel = a; ao_data_static.adc.pres_real = b; - if (b < AO_MIN_BARO_VALUE) - b = AO_MIN_BARO_VALUE; ao_data_static.adc.pres = b; ao_records_read++; ao_insert(); diff --git a/src/test/plottest b/src/test/plottest index 76af5ee7..7d253ff1 100755 --- a/src/test/plottest +++ b/src/test/plottest @@ -10,7 +10,7 @@ plot "$1" using 1:3 with lines axes x1y1 title "raw height",\ "$1" using 1:9 with lines axes x1y1 title "height",\ "$1" using 1:11 with lines axes x1y2 title "speed",\ "$1" using 1:13 with lines axes x1y2 title "accel",\ -"$1" using 1:15 with lines axes x1y1 title "drogue",\ -"$1" using 1:17 with lines axes x1y1 title "main",\ -"$1" using 1:19 with lines axes x1y1 title "error" +"$1" using 1:17 with lines axes x1y1 title "drogue",\ +"$1" using 1:19 with lines axes x1y1 title "main",\ +"$1" using 1:21 with lines axes x1y1 title "error" EOF -- cgit v1.2.3 From 9e9151c3b4bb9ce329e1b44440a7aceb9f39b9a0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 14 Jul 2014 00:45:13 -0700 Subject: altoslib: Parse eeprom 'altitude-32' fields This lets us tell if the altimeter supports 32-bit GPS altitudes in the eeprom log. Signed-off-by: Keith Packard --- altoslib/AltosEepromHeader.java | 35 +++++++++++++++++++++++++++++++++++ altoslib/AltosLib.java | 14 ++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/altoslib/AltosEepromHeader.java b/altoslib/AltosEepromHeader.java index 47e9eceb..71030655 100644 --- a/altoslib/AltosEepromHeader.java +++ b/altoslib/AltosEepromHeader.java @@ -96,6 +96,22 @@ public class AltosEepromHeader extends AltosEeprom { case AltosLib.AO_LOG_SOFTWARE_VERSION: state.set_firmware_version(data); break; + case AltosLib.AO_LOG_FREQUENCY: + case AltosLib.AO_LOG_APOGEE_LOCKOUT: + case AltosLib.AO_LOG_RADIO_RATE: + case AltosLib.AO_LOG_IGNITE_MODE: + case AltosLib.AO_LOG_PAD_ORIENTATION: + case AltosLib.AO_LOG_RADIO_ENABLE: + case AltosLib.AO_LOG_AES_KEY: + case AltosLib.AO_LOG_APRS: + case AltosLib.AO_LOG_BEEP_SETTING: + case AltosLib.AO_LOG_TRACKER_SETTING: + case AltosLib.AO_LOG_PYRO_TIME: + case AltosLib.AO_LOG_APRS_ID: + break; + case AltosLib.AO_LOG_ALTITUDE_32: + state.set_altitude_32(config_a); + break; } } @@ -161,6 +177,22 @@ public class AltosEepromHeader extends AltosEeprom { case AltosLib.AO_LOG_BARO_CRC: out.printf ("# Baro crc: %d\n", config_a); break; + case AltosLib.AO_LOG_FREQUENCY: + case AltosLib.AO_LOG_APOGEE_LOCKOUT: + case AltosLib.AO_LOG_RADIO_RATE: + case AltosLib.AO_LOG_IGNITE_MODE: + case AltosLib.AO_LOG_PAD_ORIENTATION: + case AltosLib.AO_LOG_RADIO_ENABLE: + case AltosLib.AO_LOG_AES_KEY: + case AltosLib.AO_LOG_APRS: + case AltosLib.AO_LOG_BEEP_SETTING: + case AltosLib.AO_LOG_TRACKER_SETTING: + case AltosLib.AO_LOG_PYRO_TIME: + case AltosLib.AO_LOG_APRS_ID: + break; + case AltosLib.AO_LOG_ALTITUDE_32: + out.printf("# Altitude-32: %d\n", config_a); + break; } } @@ -205,6 +237,9 @@ public class AltosEepromHeader extends AltosEeprom { } else if (tokens[0].equals("log-format")) { cmd = AltosLib.AO_LOG_LOG_FORMAT; config_a = Integer.parseInt(tokens[1]); + } else if (tokens[0].equals("altitude-32")) { + cmd = AltosLib.AO_LOG_ALTITUDE_32; + config_a = Integer.parseInt(tokens[1]); } else if (tokens[0].equals("software-version")) { cmd = AltosLib.AO_LOG_SOFTWARE_VERSION; data = tokens[1]; diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index eb188d6b..68bdd17f 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -51,6 +51,20 @@ public class AltosLib { public static final int AO_LOG_SERIAL_NUMBER = 2002; public static final int AO_LOG_LOG_FORMAT = 2003; + public static final int AO_LOG_FREQUENCY = 2004; + public static final int AO_LOG_APOGEE_LOCKOUT = 2005; + public static final int AO_LOG_RADIO_RATE = 2006; + public static final int AO_LOG_IGNITE_MODE = 2007; + public static final int AO_LOG_PAD_ORIENTATION = 2008; + public static final int AO_LOG_RADIO_ENABLE = 2009; + public static final int AO_LOG_AES_KEY = 2010; + public static final int AO_LOG_APRS = 2011; + public static final int AO_LOG_BEEP_SETTING = 2012; + public static final int AO_LOG_TRACKER_SETTING = 2013; + public static final int AO_LOG_PYRO_TIME = 2014; + public static final int AO_LOG_APRS_ID = 2015; + public static final int AO_LOG_ALTITUDE_32 = 2016; + /* Added for header fields in telemega files */ public static final int AO_LOG_BARO_RESERVED = 3000; public static final int AO_LOG_BARO_SENS = 3001; -- cgit v1.2.3 From 54b58e925e27e87bf2903678f87b7544ee2e8167 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 14 Jul 2014 00:46:41 -0700 Subject: Set version to 1.4.9.2 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8cc5adc1..c2b8b55c 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([altos], 1.4.9.1) +AC_INIT([altos], 1.4.9.2) AC_CONFIG_SRCDIR([src/kernel/ao.h]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE -- cgit v1.2.3 From fb914d37018a585a879161483609d3c0be556d1e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 14 Jul 2014 02:32:03 -0700 Subject: altosuilib: Fix minor scan UI nits Wasn't computing geometry correctly and overlapped the 2400 baud entry with the list of scan results. Was not saving the telemetry rate/telemetry style when switching to monitor mode, which caused the new monitor to come up with the wrong values. Signed-off-by: Keith Packard --- altosuilib/AltosScanUI.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/altosuilib/AltosScanUI.java b/altosuilib/AltosScanUI.java index 7b5f2c7e..7e51a55a 100644 --- a/altosuilib/AltosScanUI.java +++ b/altosuilib/AltosScanUI.java @@ -356,10 +356,13 @@ public class AltosScanUI if (r != null) { if (device != null) { if (reader != null) { + System.out.printf("frequency %g rate %d\n", r.frequency.frequency, r.rate); reader.set_telemetry(r.telemetry); reader.set_telemetry_rate(r.rate); reader.set_frequency(r.frequency.frequency); reader.save_frequency(); + reader.save_telemetry(); + reader.save_telemetry_rate(); owner.scan_device_selected(device); } } @@ -519,7 +522,7 @@ public class AltosScanUI rate_boxes[k].addActionListener(this); rate_boxes[k].setSelected((scanning_rate & (1 << k)) != 0); } - y_offset_rate += AltosLib.ao_telemetry_rate_max; + y_offset_rate += AltosLib.ao_telemetry_rate_max + 1; } if (select_telemetry) { -- cgit v1.2.3 From ec7ceb607f5ba7e1ed5cfd32b7a452a5f364b095 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 15 Jul 2014 00:44:14 -0700 Subject: linux-fat: Fix up fat linux install icons, mime types and .desktop files use the standard xdg utilities to install mime type and .desktop files. The standard xdg icon installer doesn't handle svg icons, so we have to do those manually. With this patch, xfce, gnome3 and kde4 all place the applications in user-visible menus, display correct file icons and launch correct applications for our file types. Signed-off-by: Keith Packard --- altosui/Makefile.am | 10 +++++- altosui/linux-install.sh | 79 +++++++++++++++++++++++++----------------------- micropeak/Makefile.am | 9 +++++- telegps/Makefile.am | 10 +++++- 4 files changed, 68 insertions(+), 40 deletions(-) diff --git a/altosui/Makefile.am b/altosui/Makefile.am index c79e27c0..44258fd2 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -104,6 +104,14 @@ MACOSX_ICONS =\ $(ICONDIR)/application-vnd.altusmetrum.eeprom.icns \ $(ICONDIR)/application-vnd.altusmetrum.telemetry.icns +LINUX_ICONS =\ + $(ICONDIR)/altusmetrum-altosui.svg \ + $(ICONDIR)/application-vnd.altusmetrum.eeprom.svg \ + $(ICONDIR)/application-vnd.altusmetrum.telemetry.svg + +LINUX_MIMETYPE =\ + $(ICONDIR)/org-altusmetrum-mimetypes.xml + # Firmware FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx FIRMWARE_TD=$(FIRMWARE_TD_0_2) @@ -152,7 +160,7 @@ FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFR LINUX_LIBS=libaltos32.so libaltos64.so -LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in $(ICONDIR)/altusmetrum-altosui.svg +LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in $(LINUX_ICONS) $(LINUX_MIMETYPE) LINUX_EXTRA=altosui-fat MACOSX_INFO_PLIST=Info.plist diff --git a/altosui/linux-install.sh b/altosui/linux-install.sh index 957b1aad..2e44c2aa 100644 --- a/altosui/linux-install.sh +++ b/altosui/linux-install.sh @@ -130,6 +130,7 @@ esac # # Create the .desktop file by editing the paths # + case "$target" in /*) target_abs="$target" @@ -149,43 +150,46 @@ for infile in "$target"/AltOS/*.desktop.in; do done # -# Figure out where to install the .desktop files. If we can, write it -# to the public /usr/share/applications, otherwise, write it to the -# per-user ~/.local/share/applications +# Install the .desktop file # -public=/usr/share/applications -private=$HOME/.local/share/applications -apps="" +for desktop in "$target"/AltOS/*.desktop; do + case `id -u` in + 0) + xdg-desktop-menu install --mode system "$desktop" + ;; + *) + xdg-desktop-menu install --mode user "$desktop" + ;; + esac +done -if [ -d "$public" -a -w "$public" ]; then - apps="$public" -else - mkdir -p "$private" >/dev/null 2>&1 - if [ -d "$private" -a -w "$private" ]; then - apps="$private" - fi -fi - -case "$apps" in -"") - echo "Cannot install application icon" - finish 1 - ;; -esac +# +# Install mime type file +# + +for mimetype in "$target"/AltOS/*-mimetypes.xml; do + case `id -u` in + 0) + xdg-mime install --mode system "$mimetype" + ;; + *) + xdg-mime install --mode user "$mimetype" + ;; + esac +done -echo -n "Installing .desktop files to $apps..." +# +# Install icons +# -cp "$target"/AltOS/*.desktop "$apps" +for icon_dir in /usr/share/icons/hicolor/scalable/mimetypes "$HOME/.icons" "$HOME/.kde/share/icons"; do + if [ -w "$icon_dir" ]; then + cp "$target"/AltOS/*.svg "$icon_dir" + update-icon-caches "$icon_dir" + fi +done -case "$?" in -0) - echo " done." - ;; -*) - echo " failed." - ;; -esac # # Install icon to desktop if desired @@ -222,13 +226,14 @@ if [ -d $HOME/Desktop ]; then esac done - echo -n "Installing desktop icons..." case "$do_desktop" in - [yY]*) - for d in "$target"/AltOS/*.desktop; do - ln -f -s "$d" "$HOME/Desktop/" - done - ;; + [yY]*) + echo -n "Installing desktop icons..." + for d in "$target"/AltOS/*.desktop; do + base=`basename $d` + cp --remove-destination "$d" "$HOME/Desktop/" + done + ;; esac echo " done." diff --git a/micropeak/Makefile.am b/micropeak/Makefile.am index e3b77c8a..15865606 100644 --- a/micropeak/Makefile.am +++ b/micropeak/Makefile.am @@ -82,6 +82,13 @@ MACOSX_ICONS =\ ../icon/altusmetrum-micropeak.icns \ ../icon/application-vnd.altusmetrum.micropeak.icns +LINUX_ICONS =\ + $(ICONDIR)/altusmetrum-micropeak.svg \ + $(ICONDIR)/application-vnd.altusmetrum.micropeak.svg + +LINUX_MIMETYPE =\ + $(ICONDIR)/org-altusmetrum-mimetypes.xml + desktopdir = $(datadir)/applications desktop_file = altusmetrum-micropeak.desktop desktop_SCRIPTS = $(desktop_file) @@ -114,7 +121,7 @@ DOC=$(MICROPEAK_DOC) FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) -LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/altusmetrum-micropeak.svg +LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in $(LINUX_ICONS) $(LINUX_MIMETYPE) LINUX_EXTRA=micropeak-fat $(desktop_file).in MACOSX_DRIVER_URL=http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_2_18.dmg diff --git a/telegps/Makefile.am b/telegps/Makefile.am index 6138b004..3b33428e 100644 --- a/telegps/Makefile.am +++ b/telegps/Makefile.am @@ -87,6 +87,14 @@ MACOSX_ICONS =\ ../icon/application-vnd.altusmetrum.eeprom.icns \ ../icon/application-vnd.altusmetrum.telemetry.icns +LINUX_ICONS =\ + $(ICONDIR)/altusmetrum-altosui.svg \ + $(ICONDIR)/application-vnd.altusmetrum.eeprom.svg \ + $(ICONDIR)/application-vnd.altusmetrum.telemetry.svg + +LINUX_MIMETYPE =\ + $(ICONDIR)/org-altusmetrum-mimetypes.xml + # Firmware FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx FIRMWARE_TD=$(FIRMWARE_TD_0_2) @@ -131,7 +139,7 @@ DOC=$(TELEGPS_DOC) FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS) -LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in ../icon/altusmetrum-telegps.svg +LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC) $(desktop_file).in $(LINUX_ICONS) $(LINUX_MIMETYPE) LINUX_EXTRA=telegps-fat $(desktop_file).in MACOSX_INFO_PLIST=Info.plist -- cgit v1.2.3 From 17e894d1b65231d07df009bc4e8ca92864ccf790 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 15 Jul 2014 23:15:50 -0600 Subject: update turnon tools --- ao-bringup/test-telegps | 2 +- ao-bringup/turnon_telemetrum | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ao-bringup/test-telegps b/ao-bringup/test-telegps index f3174485..9295dd06 100755 --- a/ao-bringup/test-telegps +++ b/ao-bringup/test-telegps @@ -42,7 +42,7 @@ ao-list | while read product serial dev; do exit 1 esac - echo "$PRODUCT-v$VERSION" serial "$serial" is ready to ship + echo "$PRODUCT-v$VERSION" serial "$serial" passed functional tests ret=0 ;; *) diff --git a/ao-bringup/turnon_telemetrum b/ao-bringup/turnon_telemetrum index 80193c4c..588c7f31 100755 --- a/ao-bringup/turnon_telemetrum +++ b/ao-bringup/turnon_telemetrum @@ -1,17 +1,13 @@ #!/bin/sh -if [ -x ../ao-tools/ao-stmload/ao-stmload ]; then - STMLOAD=../ao-tools/ao-stmload/ao-stmload -elif [ -x /usr/bin/ao-stmload ]; then - STMLOAD=/usr/bin/ao-stmload +if [ -x /usr/bin/ao-flash-stm ]; then + FLASH_STM=/usr/bin/ao-flash-stm else - echo "Can't find ao-stmload! Aborting." + echo "Can't find ao-flash-stm! 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 +if [ -x /usr/bin/ao-usbload ]; then USBLOAD=/usr/bin/ao-usbload else echo "Can't find ao-usbload! Aborting." @@ -31,9 +27,9 @@ echo echo -n "TeleMetrum-$VERSION serial number: " read SERIAL -echo $STMLOAD +echo $FLASH_STM -$STMLOAD --raw ../src/telemetrum-v$VERSION/flash-loader/*.elf || exit 1 +$FLASH_STM ~/altusmetrumllc/Binaries/loaders/telemetrum-v$VERSION-*.elf || exit 1 sleep 2 -- cgit v1.2.3 From 165b7dcf6fba90b15ff32b891cba4b9111c1965b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 16 Jul 2014 17:13:25 -0700 Subject: altoslib: Handle TeleGPS files for KML export TeleGPS files had state values that couldn't be converted to colors, which resulted in a truncated file that wasn't much use for anything. Signed-off-by: Keith Packard --- altoslib/AltosKML.java | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/altoslib/AltosKML.java b/altoslib/AltosKML.java index e31ddfba..e701fda3 100644 --- a/altoslib/AltosKML.java +++ b/altoslib/AltosKML.java @@ -28,18 +28,25 @@ public class AltosKML implements AltosWriter { double gps_start_altitude; static final String[] kml_state_colors = { - "FF000000", - "FF000000", - "FF000000", - "FF0000FF", - "FF4080FF", - "FF00FFFF", - "FFFF0000", - "FF00FF00", - "FF000000", - "FFFFFFFF" + "FF000000", // startup + "FF000000", // idle + "FF000000", // pad + "FF0000FF", // boost + "FF4080FF", // fast + "FF00FFFF", // coast + "FFFF0000", // drogue + "FF00FF00", // main + "FF000000", // landed + "FFFFFFFF", // invalid + "FFFF0000", // stateless }; + static String state_color(int state) { + if (state < 0 || kml_state_colors.length <= state) + return kml_state_colors[AltosLib.ao_flight_invalid]; + return kml_state_colors[state]; + } + static final String kml_header_start = "\n" + "\n" + @@ -95,7 +102,8 @@ public class AltosKML implements AltosWriter { void state_start(AltosState state) { String state_name = AltosLib.state_name(state.state); - out.printf(kml_style_start, state_name, kml_state_colors[state.state]); + String state_color = state_color(state.state); + out.printf(kml_style_start, state_name, state_color); out.printf("\tState: %s\n", state_name); out.printf("%s", kml_style_end); out.printf(kml_placemark_start, state_name, state_name); -- cgit v1.2.3 From 59976c44d1b6ee6505cfa4efd9a26ec4302f6c33 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Thu, 14 Aug 2014 18:16:14 -0600 Subject: change easymega from v0.1 to v1.0, tweak to build on master, add to Makefile --- ao-bringup/turnon_easymega | 57 +++++ src/Makefile | 1 + src/easymega-v0.1/.gitignore | 2 - src/easymega-v0.1/Makefile | 144 ------------- src/easymega-v0.1/ao_easymega.c | 95 --------- src/easymega-v0.1/ao_pins.h | 352 ------------------------------ src/easymega-v0.1/flash-loader/Makefile | 8 - src/easymega-v0.1/flash-loader/ao_pins.h | 34 --- src/easymega-v1.0/.gitignore | 2 + src/easymega-v1.0/Makefile | 144 +++++++++++++ src/easymega-v1.0/ao_easymega.c | 95 +++++++++ src/easymega-v1.0/ao_pins.h | 355 +++++++++++++++++++++++++++++++ src/easymega-v1.0/flash-loader/Makefile | 8 + src/easymega-v1.0/flash-loader/ao_pins.h | 34 +++ 14 files changed, 696 insertions(+), 635 deletions(-) create mode 100755 ao-bringup/turnon_easymega delete mode 100644 src/easymega-v0.1/.gitignore delete mode 100644 src/easymega-v0.1/Makefile delete mode 100644 src/easymega-v0.1/ao_easymega.c delete mode 100644 src/easymega-v0.1/ao_pins.h delete mode 100644 src/easymega-v0.1/flash-loader/Makefile delete mode 100644 src/easymega-v0.1/flash-loader/ao_pins.h create mode 100644 src/easymega-v1.0/.gitignore create mode 100644 src/easymega-v1.0/Makefile create mode 100644 src/easymega-v1.0/ao_easymega.c create mode 100644 src/easymega-v1.0/ao_pins.h create mode 100644 src/easymega-v1.0/flash-loader/Makefile create mode 100644 src/easymega-v1.0/flash-loader/ao_pins.h diff --git a/ao-bringup/turnon_easymega b/ao-bringup/turnon_easymega new file mode 100755 index 00000000..7d23f5f7 --- /dev/null +++ b/ao-bringup/turnon_easymega @@ -0,0 +1,57 @@ +#!/bin/sh + +if [ -x /usr/bin/ao-flash-stm ]; then + STMLOAD=/usr/bin/ao-flash-stm +else + echo "Can't find ao-flash-stm! Aborting." + exit 1 +fi + +if [ -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 +REPO=~/altusmetrumllc/Binaries + +echo "EasyMega v$VERSION Turn-On and Calibration Program" +echo "Copyright 2014 by Bdale Garbee. Released under GPL v2" +echo +echo "Expectations:" +echo "\tEasyMega v$VERSION" +echo "\t\twith USB cable attached" +echo "\t\twith ST-Link-V2 cabled to debug header" +echo +echo -n "EasyMega-$VERSION serial number: " +read SERIAL + +echo $STMLOAD + +$STMLOAD $REPO/loaders/easymega-v$VERSION*.elf || exit 1 + +sleep 2 + +$USBLOAD --serial=$SERIAL $REPO/easymega-v$VERSION*.elf || exit 1 + +sleep 2 + +dev=`ao-list | awk '/EasyMega-v'"$VERSION"'/ { print $3; exit(0); }'` + +case "$dev" in +/dev/tty*) + echo "EasyMega found on $dev" + ;; +*) + echo 'No EasyMega-v'"$VERSION"' found' + exit 1 + ;; +esac + +echo 'E 0' > $dev + +./cal-accel $dev + +echo 'E 1' > $dev diff --git a/src/Makefile b/src/Makefile index 3494ba62..7f09db02 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,6 +25,7 @@ SDCCDIRS=\ telefire-v0.1 telefire-v0.2 ARMM3DIRS=\ + easymega-v1.0 easymega-v1.0/flash-loader \ telemega-v0.1 telemega-v0.1/flash-loader \ telemega-v1.0 telemega-v1.0/flash-loader \ telemetrum-v2.0 telemetrum-v2.0/flash-loader \ diff --git a/src/easymega-v0.1/.gitignore b/src/easymega-v0.1/.gitignore deleted file mode 100644 index 410943d5..00000000 --- a/src/easymega-v0.1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ao_product.h -easymega-*.elf diff --git a/src/easymega-v0.1/Makefile b/src/easymega-v0.1/Makefile deleted file mode 100644 index 66619852..00000000 --- a/src/easymega-v0.1/Makefile +++ /dev/null @@ -1,144 +0,0 @@ -# -# AltOS build -# -# - -include ../stm/Makefile.defs - -INC = \ - ao.h \ - ao_arch.h \ - ao_arch_funcs.h \ - ao_boot.h \ - ao_companion.h \ - ao_data.h \ - ao_sample.h \ - ao_pins.h \ - altitude-pa.h \ - ao_kalman.h \ - ao_product.h \ - ao_ms5607.h \ - ao_hmc5883.h \ - ao_mpu6000.h \ - ao_mma655x.h \ - ao_profile.h \ - ao_task.h \ - ao_whiten.h \ - ao_sample_profile.h \ - ao_quaternion.h \ - math.h \ - ao_mpu.h \ - stm32l.h \ - math.h \ - Makefile - -# -# Common AltOS sources -# -# ao_hmc5883.c - -#PROFILE=ao_profile.c -#PROFILE_DEF=-DAO_PROFILE=1 - -#SAMPLE_PROFILE=ao_sample_profile.c \ -# ao_sample_profile_timer.c -#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 - -#STACK_GUARD=ao_mpu_stm.c -#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 - -MATH_SRC=\ - ef_acos.c \ - ef_sqrt.c \ - ef_rem_pio2.c \ - kf_cos.c \ - kf_sin.c \ - kf_rem_pio2.c \ - sf_copysign.c \ - sf_cos.c \ - sf_fabs.c \ - sf_floor.c \ - sf_scalbn.c \ - sf_sin.c \ - ef_log.c - -ALTOS_SRC = \ - ao_boot_chain.c \ - ao_interrupt.c \ - ao_product.c \ - ao_romconfig.c \ - ao_cmd.c \ - ao_config.c \ - ao_task.c \ - ao_led.c \ - ao_stdio.c \ - ao_panic.c \ - ao_timer.c \ - ao_mutex.c \ - ao_ignite.c \ - ao_freq.c \ - ao_dma_stm.c \ - ao_spi_stm.c \ - ao_data.c \ - ao_ms5607.c \ - ao_mma655x.c \ - ao_hmc5883.c \ - ao_adc_stm.c \ - ao_beep_stm.c \ - ao_eeprom_stm.c \ - ao_storage.c \ - ao_m25.c \ - ao_usb_stm.c \ - ao_exti_stm.c \ - ao_report.c \ - ao_i2c_stm.c \ - ao_mpu6000.c \ - ao_convert_pa.c \ - ao_convert_volt.c \ - ao_log.c \ - ao_log_mega.c \ - ao_sample.c \ - ao_kalman.c \ - ao_flight.c \ - ao_companion.c \ - ao_pyro.c \ - $(MATH_SRC) \ - $(PROFILE) \ - $(SAMPLE_PROFILE) \ - $(STACK_GUARD) - -PRODUCT=EasyMega-v0.1 -PRODUCT_DEF=-DEASYMEGA -IDPRODUCT=0x0023 - -CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g - -PROGNAME=easymega-v0.1 -PROG=$(PROGNAME)-$(VERSION).elf -HEX=$(PROGNAME)-$(VERSION).ihx - -SRC=$(ALTOS_SRC) ao_easymega.c -OBJ=$(SRC:.c=.o) - -all: $(PROG) $(HEX) - -$(PROG): Makefile $(OBJ) altos.ld - $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) - -../altitude-pa.h: make-altitude-pa - nickle $< > $@ - -$(OBJ): $(INC) - -ao_product.h: ao-make-product.5c ../Version - $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ - -distclean: clean - -clean: - rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx - rm -f ao_product.h - -install: - -uninstall: diff --git a/src/easymega-v0.1/ao_easymega.c b/src/easymega-v0.1/ao_easymega.c deleted file mode 100644 index e217c33c..00000000 --- a/src/easymega-v0.1/ao_easymega.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright © 2014 Bdale Garbee - * - * 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; version 2 of the License. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#if HAS_SAMPLE_PROFILE -#include -#endif -#include -#if HAS_STACK_GUARD -#include -#endif - -int -main(void) -{ - ao_clock_init(); - -#if HAS_STACK_GUARD - ao_mpu_init(); -#endif - - ao_task_init(); - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_GREEN); - ao_timer_init(); - - ao_i2c_init(); - ao_spi_init(); - ao_dma_init(); - ao_exti_init(); - - ao_adc_init(); -#if HAS_BEEP - ao_beep_init(); -#endif - ao_cmd_init(); - -#if HAS_MS5607 - ao_ms5607_init(); -#endif -#if HAS_HMC5883 - ao_hmc5883_init(); -#endif -#if HAS_MPU6000 - ao_mpu6000_init(); -#endif -#if HAS_MMA655X - ao_mma655x_init(); -#endif - - ao_eeprom_init(); - ao_storage_init(); - - ao_flight_init(); - ao_log_init(); - ao_report_init(); - - ao_usb_init(); - ao_igniter_init(); - ao_companion_init(); - ao_pyro_init(); - - ao_config_init(); -#if AO_PROFILE - ao_profile_init(); -#endif -#if HAS_SAMPLE_PROFILE - ao_sample_profile_init(); -#endif - - ao_start_scheduler(); - return 0; -} diff --git a/src/easymega-v0.1/ao_pins.h b/src/easymega-v0.1/ao_pins.h deleted file mode 100644 index cb6e3980..00000000 --- a/src/easymega-v0.1/ao_pins.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright © 2014 Bdale Garbee - * - * 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; version 2 of the License. - * - * 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 - -/* 8MHz High speed external crystal */ -#define AO_HSE 8000000 - -/* PLLVCO = 96MHz (so that USB will work) */ -#define AO_PLLMUL 12 -#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) - -/* SYSCLK = 32MHz (no need to go faster than CPU) */ -#define AO_PLLDIV 3 -#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) - -/* HCLK = 32MHz (CPU clock) */ -#define AO_AHB_PRESCALER 1 -#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 - -/* Run APB1 at 16MHz (HCLK/2) */ -#define AO_APB1_PRESCALER 2 -#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -/* Run APB2 at 16MHz (HCLK/2) */ -#define AO_APB2_PRESCALER 2 -#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 - -#define HAS_SERIAL_1 0 -#define USE_SERIAL_1_STDIN 0 -#define SERIAL_1_PB6_PB7 0 -#define SERIAL_1_PA9_PA10 0 - -#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 0 -#define SERIAL_3_PC10_PC11 0 -#define SERIAL_3_PD8_PD9 0 - -#define ao_gps_getchar ao_serial1_getchar -#define ao_gps_putchar ao_serial1_putchar -#define ao_gps_set_speed ao_serial1_set_speed -#define ao_gps_fifo (ao_stm_usart1.rx_fifo) - -#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024) -#define HAS_EEPROM 1 -#define USE_INTERNAL_FLASH 0 -#define USE_EEPROM_CONFIG 1 -#define USE_STORAGE_CONFIG 0 -#define HAS_USB 1 -#define HAS_BEEP 1 -#define HAS_BATTERY_REPORT 1 -#define HAS_RADIO 0 -#define HAS_TELEMETRY 0 -#define HAS_APRS 0 - -#define HAS_SPI_1 1 -#define SPI_1_PA5_PA6_PA7 1 /* Barometer */ -#define SPI_1_PB3_PB4_PB5 1 /* Accelerometer, Gyro */ -#define SPI_1_PE13_PE14_PE15 0 -#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz - -#define HAS_SPI_2 1 -#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ -#define SPI_2_PD1_PD3_PD4 0 -#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz - -#define SPI_2_PORT (&stm_gpiob) -#define SPI_2_SCK_PIN 13 -#define SPI_2_MISO_PIN 14 -#define SPI_2_MOSI_PIN 15 - -#define HAS_I2C_1 1 -#define I2C_1_PB8_PB9 1 - -#define HAS_I2C_2 0 -#define I2C_2_PB10_PB11 0 - -#define PACKET_HAS_SLAVE 0 -#define PACKET_HAS_MASTER 0 - -#define LOW_LEVEL_DEBUG 0 - -#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOAEN -#define LED_PORT (&stm_gpioa) -#define LED_PIN_RED 9 -#define LED_PIN_GREEN 10 -#define AO_LED_RED (1 << LED_PIN_RED) -#define AO_LED_GREEN (1 << LED_PIN_GREEN) - -#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) - -#define HAS_GPS 0 -#define HAS_FLIGHT 1 -#define HAS_ADC 1 -#define HAS_ADC_TEMP 1 -#define HAS_LOG 1 - -/* - * Igniter - */ - -#define HAS_IGNITE 1 -#define HAS_IGNITE_REPORT 1 - -#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n]) -#define AO_SENSE_DROGUE(p) ((p)->adc.sense[4]) -#define AO_SENSE_MAIN(p) ((p)->adc.sense[5]) -#define AO_IGNITER_CLOSED 400 -#define AO_IGNITER_OPEN 60 - -/* Pyro A */ -#define AO_PYRO_PORT_0 (&stm_gpioa) -#define AO_PYRO_PIN_0 15 - -/* Pyro B */ -#define AO_PYRO_PORT_1 (&stm_gpioc) -#define AO_PYRO_PIN_1 10 - -/* Pyro C */ -#define AO_PYRO_PORT_2 (&stm_gpiob) -#define AO_PYRO_PIN_2 11 - -/* Pyro D */ -#define AO_PYRO_PORT_3 (&stm_gpiob) -#define AO_PYRO_PIN_3 10 - -/* Drogue */ -#define AO_IGNITER_DROGUE_PORT (&stm_gpioa) -#define AO_IGNITER_DROGUE_PIN 0 - -/* Main */ -#define AO_IGNITER_MAIN_PORT (&stm_gpioa) -#define AO_IGNITER_MAIN_PIN 1 - -/* Number of general purpose pyro channels available */ -#define AO_PYRO_NUM 4 - -#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) -#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) - -/* - * ADC - */ -#define AO_DATA_RING 32 -#define AO_ADC_NUM_SENSE 6 - -struct ao_adc { - int16_t sense[AO_ADC_NUM_SENSE]; - int16_t v_batt; - int16_t v_pbatt; - int16_t temp; -}; - -#define AO_ADC_DUMP(p) \ - printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ - (p)->tick, \ - (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \ - (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \ - (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp) - -#define AO_ADC_SENSE_A 14 -#define AO_ADC_SENSE_A_PORT (&stm_gpioc) -#define AO_ADC_SENSE_A_PIN 4 - -#define AO_ADC_SENSE_B 15 -#define AO_ADC_SENSE_B_PORT (&stm_gpioc) -#define AO_ADC_SENSE_B_PIN 5 - -#define AO_ADC_SENSE_C 13 -#define AO_ADC_SENSE_C_PORT (&stm_gpioc) -#define AO_ADC_SENSE_C_PIN 3 - -#define AO_ADC_SENSE_D 12 -#define AO_ADC_SENSE_D_PORT (&stm_gpioc) -#define AO_ADC_SENSE_D_PIN 2 - -#define AO_ADC_SENSE_DROGUE 11 -#define AO_ADC_SENSE_DROGUE_PORT (&stm_gpioc) -#define AO_ADC_SENSE_DROGUE_PIN 1 - -#define AO_ADC_SENSE_MAIN 10 -#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioc) -#define AO_ADC_SENSE_MAIN_PIN 0 - -#define AO_ADC_V_BATT 8 -#define AO_ADC_V_BATT_PORT (&stm_gpiob) -#define AO_ADC_V_BATT_PIN 0 - -#define AO_ADC_V_PBATT 9 -#define AO_ADC_V_PBATT_PORT (&stm_gpiob) -#define AO_ADC_V_PBATT_PIN 1 - -#define AO_ADC_TEMP 16 - -#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_GPIOAEN) | \ - (1 << STM_RCC_AHBENR_GPIOEEN) | \ - (1 << STM_RCC_AHBENR_GPIOBEN)) - -#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 2) - -#define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT -#define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN -#define AO_ADC_PIN1_PORT AO_ADC_SENSE_B_PORT -#define AO_ADC_PIN1_PIN AO_ADC_SENSE_B_PIN -#define AO_ADC_PIN2_PORT AO_ADC_SENSE_C_PORT -#define AO_ADC_PIN2_PIN AO_ADC_SENSE_C_PIN -#define AO_ADC_PIN3_PORT AO_ADC_SENSE_D_PORT -#define AO_ADC_PIN3_PIN AO_ADC_SENSE_D_PIN -#define AO_ADC_PIN4_PORT AO_ADC_SENSE_DROGUE_PORT -#define AO_ADC_PIN4_PIN AO_ADC_SENSE_DROGUE_PIN -#define AO_ADC_PIN5_PORT AO_ADC_SENSE_MAIN_PORT -#define AO_ADC_PIN5_PIN AO_ADC_SENSE_MAIN_PIN -#define AO_ADC_PIN6_PORT AO_ADC_V_BATT_PORT -#define AO_ADC_PIN6_PIN AO_ADC_V_BATT_PIN -#define AO_ADC_PIN7_PORT AO_ADC_V_PBATT_PORT -#define AO_ADC_PIN7_PIN AO_ADC_V_PBATT_PIN - -#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 3) - -#define AO_ADC_SQ1 AO_ADC_SENSE_A -#define AO_ADC_SQ2 AO_ADC_SENSE_B -#define AO_ADC_SQ3 AO_ADC_SENSE_C -#define AO_ADC_SQ4 AO_ADC_SENSE_D -#define AO_ADC_SQ5 AO_ADC_SENSE_DROGUE -#define AO_ADC_SQ6 AO_ADC_SENSE_MAIN -#define AO_ADC_SQ7 AO_ADC_V_BATT -#define AO_ADC_SQ8 AO_ADC_V_PBATT -#define AO_ADC_SQ9 AO_ADC_TEMP - -/* - * Voltage divider on ADC battery sampler - */ -#define AO_BATTERY_DIV_PLUS 56 /* 5.6k */ -#define AO_BATTERY_DIV_MINUS 100 /* 10k */ - -/* - * Voltage divider on ADC igniter samplers - */ -#define AO_IGNITE_DIV_PLUS 100 /* 100k */ -#define AO_IGNITE_DIV_MINUS 27 /* 27k */ - -/* - * ADC reference in decivolts - */ -#define AO_ADC_REFERENCE_DV 33 - -/* - * Pressure sensor settings - */ -#define HAS_MS5607 1 -#define HAS_MS5611 0 -#define AO_MS5607_PRIVATE_PINS 1 -#define AO_MS5607_CS_PORT (&stm_gpioa) -#define AO_MS5607_CS_PIN 3 -#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) -#define AO_MS5607_MISO_PORT (&stm_gpioa) -#define AO_MS5607_MISO_PIN 6 -#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN) -#define AO_MS5607_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 - -/* - * SPI Flash memory - */ - -#define M25_MAX_CHIPS 1 -#define AO_M25_SPI_CS_PORT (&stm_gpiob) -#define AO_M25_SPI_CS_PIN 12 -#define AO_M25_SPI_CS_MASK (1 << AO_M25_SPI_CS_PIN) -#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 - -/* - * Mag sensor (hmc5883) - */ - -#define HAS_HMC5883 1 -#define AO_HMC5883_INT_PORT (&stm_gpioc) -#define AO_HMC5883_INT_PIN 14 -#define AO_HMC5883_I2C_INDEX STM_I2C_INDEX(1) - -/* - * mpu6000 - */ - -#define HAS_MPU6000 1 -#define AO_MPU6000_INT_PORT (&stm_gpioc) -#define AO_MPU6000_INT_PIN 15 -#define AO_MPU6000_SPI_BUS AO_SPI_1_PB3_PB4_PB5 -#define AO_MPU6000_SPI_CS_PORT (&stm_gpioc) -#define AO_MPU6000_SPI_CS_PIN 13 -#define HAS_IMU 1 - -/* - * mma655x - */ - -#define HAS_MMA655X 1 -#define AO_MMA655X_SPI_INDEX AO_SPI_1_PB3_PB4_PB5 -#define AO_MMA655X_CS_PORT (&stm_gpioc) -#define AO_MMA655X_CS_PIN 12 - -#define NUM_CMDS 16 - -/* - * Companion - */ - -#define AO_COMPANION_CS_PORT (&stm_gpiob) -#define AO_COMPANION_CS_PIN (6) -#define AO_COMPANION_SPI_BUS AO_SPI_2_PB13_PB14_PB15 - -/* - * Monitor - */ - -#define HAS_MONITOR 0 -#define LEGACY_MONITOR 0 -#define HAS_MONITOR_PUT 0 -#define AO_MONITOR_LED 0 -#define HAS_RSSI 0 - -/* - * Profiling Viterbi decoding - */ - -#ifndef AO_PROFILE -#define AO_PROFILE 0 -#endif - -#endif /* _AO_PINS_H_ */ diff --git a/src/easymega-v0.1/flash-loader/Makefile b/src/easymega-v0.1/flash-loader/Makefile deleted file mode 100644 index 35312fd6..00000000 --- a/src/easymega-v0.1/flash-loader/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# AltOS flash loader build -# -# - -TOPDIR=../.. -HARDWARE=easymega-v0.1 -include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/easymega-v0.1/flash-loader/ao_pins.h b/src/easymega-v0.1/flash-loader/ao_pins.h deleted file mode 100644 index 445289bf..00000000 --- a/src/easymega-v0.1/flash-loader/ao_pins.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright © 2013 Keith Packard - * - * 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; version 2 of the License. - * - * 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_ - -/* External crystal at 8MHz */ -#define AO_HSE 8000000 - -#include - -/* Companion port cs_companion0 PD0 */ - -#define AO_BOOT_PIN 1 -#define AO_BOOT_APPLICATION_GPIO stm_gpiob -#define AO_BOOT_APPLICATION_PIN 6 -#define AO_BOOT_APPLICATION_VALUE 1 -#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP - -#endif /* _AO_PINS_H_ */ diff --git a/src/easymega-v1.0/.gitignore b/src/easymega-v1.0/.gitignore new file mode 100644 index 00000000..410943d5 --- /dev/null +++ b/src/easymega-v1.0/.gitignore @@ -0,0 +1,2 @@ +ao_product.h +easymega-*.elf diff --git a/src/easymega-v1.0/Makefile b/src/easymega-v1.0/Makefile new file mode 100644 index 00000000..708ce1c6 --- /dev/null +++ b/src/easymega-v1.0/Makefile @@ -0,0 +1,144 @@ +# +# AltOS build +# +# + +include ../stm/Makefile.defs + +INC = \ + ao.h \ + ao_arch.h \ + ao_arch_funcs.h \ + ao_boot.h \ + ao_companion.h \ + ao_data.h \ + ao_sample.h \ + ao_pins.h \ + altitude-pa.h \ + ao_kalman.h \ + ao_product.h \ + ao_ms5607.h \ + ao_hmc5883.h \ + ao_mpu6000.h \ + ao_mma655x.h \ + ao_profile.h \ + ao_task.h \ + ao_whiten.h \ + ao_sample_profile.h \ + ao_quaternion.h \ + math.h \ + ao_mpu.h \ + stm32l.h \ + math.h \ + Makefile + +# +# Common AltOS sources +# +# ao_hmc5883.c + +#PROFILE=ao_profile.c +#PROFILE_DEF=-DAO_PROFILE=1 + +#SAMPLE_PROFILE=ao_sample_profile.c \ +# ao_sample_profile_timer.c +#SAMPLE_PROFILE_DEF=-DHAS_SAMPLE_PROFILE=1 + +#STACK_GUARD=ao_mpu_stm.c +#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1 + +MATH_SRC=\ + ef_acos.c \ + ef_sqrt.c \ + ef_rem_pio2.c \ + kf_cos.c \ + kf_sin.c \ + kf_rem_pio2.c \ + sf_copysign.c \ + sf_cos.c \ + sf_fabs.c \ + sf_floor.c \ + sf_scalbn.c \ + sf_sin.c \ + ef_log.c + +ALTOS_SRC = \ + ao_boot_chain.c \ + ao_interrupt.c \ + ao_product.c \ + ao_romconfig.c \ + ao_cmd.c \ + ao_config.c \ + ao_task.c \ + ao_led.c \ + ao_stdio.c \ + ao_panic.c \ + ao_timer.c \ + ao_mutex.c \ + ao_ignite.c \ + ao_freq.c \ + ao_dma_stm.c \ + ao_spi_stm.c \ + ao_data.c \ + ao_ms5607.c \ + ao_mma655x.c \ + ao_hmc5883.c \ + ao_adc_stm.c \ + ao_beep_stm.c \ + ao_eeprom_stm.c \ + ao_storage.c \ + ao_m25.c \ + ao_usb_stm.c \ + ao_exti_stm.c \ + ao_report.c \ + ao_i2c_stm.c \ + ao_mpu6000.c \ + ao_convert_pa.c \ + ao_convert_volt.c \ + ao_log.c \ + ao_log_mega.c \ + ao_sample.c \ + ao_kalman.c \ + ao_flight.c \ + ao_companion.c \ + ao_pyro.c \ + $(MATH_SRC) \ + $(PROFILE) \ + $(SAMPLE_PROFILE) \ + $(STACK_GUARD) + +PRODUCT=EasyMega-v1.0 +PRODUCT_DEF=-DEASYMEGA +IDPRODUCT=0x0023 + +CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STACK_GUARD_DEF) -Os -g + +PROGNAME=easymega-v1.0 +PROG=$(PROGNAME)-$(VERSION).elf +HEX=$(PROGNAME)-$(VERSION).ihx + +SRC=$(ALTOS_SRC) ao_easymega.c +OBJ=$(SRC:.c=.o) + +all: $(PROG) $(HEX) + +$(PROG): Makefile $(OBJ) altos.ld + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) + +../altitude-pa.h: make-altitude-pa + nickle $< > $@ + +$(OBJ): $(INC) + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: + rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx + rm -f ao_product.h + +install: + +uninstall: diff --git a/src/easymega-v1.0/ao_easymega.c b/src/easymega-v1.0/ao_easymega.c new file mode 100644 index 00000000..e217c33c --- /dev/null +++ b/src/easymega-v1.0/ao_easymega.c @@ -0,0 +1,95 @@ +/* + * Copyright © 2014 Bdale Garbee + * + * 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; version 2 of the License. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#if HAS_SAMPLE_PROFILE +#include +#endif +#include +#if HAS_STACK_GUARD +#include +#endif + +int +main(void) +{ + ao_clock_init(); + +#if HAS_STACK_GUARD + ao_mpu_init(); +#endif + + ao_task_init(); + ao_led_init(LEDS_AVAILABLE); + ao_led_on(AO_LED_GREEN); + ao_timer_init(); + + ao_i2c_init(); + ao_spi_init(); + ao_dma_init(); + ao_exti_init(); + + ao_adc_init(); +#if HAS_BEEP + ao_beep_init(); +#endif + ao_cmd_init(); + +#if HAS_MS5607 + ao_ms5607_init(); +#endif +#if HAS_HMC5883 + ao_hmc5883_init(); +#endif +#if HAS_MPU6000 + ao_mpu6000_init(); +#endif +#if HAS_MMA655X + ao_mma655x_init(); +#endif + + ao_eeprom_init(); + ao_storage_init(); + + ao_flight_init(); + ao_log_init(); + ao_report_init(); + + ao_usb_init(); + ao_igniter_init(); + ao_companion_init(); + ao_pyro_init(); + + ao_config_init(); +#if AO_PROFILE + ao_profile_init(); +#endif +#if HAS_SAMPLE_PROFILE + ao_sample_profile_init(); +#endif + + ao_start_scheduler(); + return 0; +} diff --git a/src/easymega-v1.0/ao_pins.h b/src/easymega-v1.0/ao_pins.h new file mode 100644 index 00000000..d6490ba5 --- /dev/null +++ b/src/easymega-v1.0/ao_pins.h @@ -0,0 +1,355 @@ +/* + * Copyright © 2014 Bdale Garbee + * + * 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; version 2 of the License. + * + * 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 + +/* 8MHz High speed external crystal */ +#define AO_HSE 8000000 + +/* PLLVCO = 96MHz (so that USB will work) */ +#define AO_PLLMUL 12 +#define AO_RCC_CFGR_PLLMUL (STM_RCC_CFGR_PLLMUL_12) + +/* SYSCLK = 32MHz (no need to go faster than CPU) */ +#define AO_PLLDIV 3 +#define AO_RCC_CFGR_PLLDIV (STM_RCC_CFGR_PLLDIV_3) + +/* HCLK = 32MHz (CPU clock) */ +#define AO_AHB_PRESCALER 1 +#define AO_RCC_CFGR_HPRE_DIV STM_RCC_CFGR_HPRE_DIV_1 + +/* Run APB1 at 16MHz (HCLK/2) */ +#define AO_APB1_PRESCALER 2 +#define AO_RCC_CFGR_PPRE1_DIV STM_RCC_CFGR_PPRE2_DIV_2 + +/* Run APB2 at 16MHz (HCLK/2) */ +#define AO_APB2_PRESCALER 2 +#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_2 + +#define HAS_SERIAL_1 0 +#define USE_SERIAL_1_STDIN 0 +#define SERIAL_1_PB6_PB7 0 +#define SERIAL_1_PA9_PA10 0 + +#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 0 +#define SERIAL_3_PC10_PC11 0 +#define SERIAL_3_PD8_PD9 0 + +#define ao_gps_getchar ao_serial1_getchar +#define ao_gps_putchar ao_serial1_putchar +#define ao_gps_set_speed ao_serial1_set_speed +#define ao_gps_fifo (ao_stm_usart1.rx_fifo) + +#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024) +#define AO_CONFIG_MAX_SIZE 1024 +#define LOG_ERASE_MARK 0x55 +#define LOG_MAX_ERASE 128 +#define HAS_EEPROM 1 +#define USE_INTERNAL_FLASH 0 +#define USE_EEPROM_CONFIG 1 +#define USE_STORAGE_CONFIG 0 +#define HAS_USB 1 +#define HAS_BEEP 1 +#define HAS_BATTERY_REPORT 1 +#define HAS_RADIO 0 +#define HAS_TELEMETRY 0 +#define HAS_APRS 0 + +#define HAS_SPI_1 1 +#define SPI_1_PA5_PA6_PA7 1 /* Barometer */ +#define SPI_1_PB3_PB4_PB5 1 /* Accelerometer, Gyro */ +#define SPI_1_PE13_PE14_PE15 0 +#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz + +#define HAS_SPI_2 1 +#define SPI_2_PB13_PB14_PB15 1 /* Flash, Companion */ +#define SPI_2_PD1_PD3_PD4 0 +#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz + +#define SPI_2_PORT (&stm_gpiob) +#define SPI_2_SCK_PIN 13 +#define SPI_2_MISO_PIN 14 +#define SPI_2_MOSI_PIN 15 + +#define HAS_I2C_1 1 +#define I2C_1_PB8_PB9 1 + +#define HAS_I2C_2 0 +#define I2C_2_PB10_PB11 0 + +#define PACKET_HAS_SLAVE 0 +#define PACKET_HAS_MASTER 0 + +#define LOW_LEVEL_DEBUG 0 + +#define LED_PORT_ENABLE STM_RCC_AHBENR_GPIOAEN +#define LED_PORT (&stm_gpioa) +#define LED_PIN_RED 9 +#define LED_PIN_GREEN 10 +#define AO_LED_RED (1 << LED_PIN_RED) +#define AO_LED_GREEN (1 << LED_PIN_GREEN) + +#define LEDS_AVAILABLE (AO_LED_RED | AO_LED_GREEN) + +#define HAS_GPS 0 +#define HAS_FLIGHT 1 +#define HAS_ADC 1 +#define HAS_ADC_TEMP 1 +#define HAS_LOG 1 + +/* + * Igniter + */ + +#define HAS_IGNITE 1 +#define HAS_IGNITE_REPORT 1 + +#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n]) +#define AO_SENSE_DROGUE(p) ((p)->adc.sense[4]) +#define AO_SENSE_MAIN(p) ((p)->adc.sense[5]) +#define AO_IGNITER_CLOSED 400 +#define AO_IGNITER_OPEN 60 + +/* Pyro A */ +#define AO_PYRO_PORT_0 (&stm_gpioa) +#define AO_PYRO_PIN_0 15 + +/* Pyro B */ +#define AO_PYRO_PORT_1 (&stm_gpioc) +#define AO_PYRO_PIN_1 10 + +/* Pyro C */ +#define AO_PYRO_PORT_2 (&stm_gpiob) +#define AO_PYRO_PIN_2 11 + +/* Pyro D */ +#define AO_PYRO_PORT_3 (&stm_gpiob) +#define AO_PYRO_PIN_3 10 + +/* Drogue */ +#define AO_IGNITER_DROGUE_PORT (&stm_gpioa) +#define AO_IGNITER_DROGUE_PIN 0 + +/* Main */ +#define AO_IGNITER_MAIN_PORT (&stm_gpioa) +#define AO_IGNITER_MAIN_PIN 1 + +/* Number of general purpose pyro channels available */ +#define AO_PYRO_NUM 4 + +#define AO_IGNITER_SET_DROGUE(v) stm_gpio_set(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, v) +#define AO_IGNITER_SET_MAIN(v) stm_gpio_set(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, v) + +/* + * ADC + */ +#define AO_DATA_RING 32 +#define AO_ADC_NUM_SENSE 6 + +struct ao_adc { + int16_t sense[AO_ADC_NUM_SENSE]; + int16_t v_batt; + int16_t v_pbatt; + int16_t temp; +}; + +#define AO_ADC_DUMP(p) \ + printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ + (p)->tick, \ + (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \ + (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \ + (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp) + +#define AO_ADC_SENSE_A 14 +#define AO_ADC_SENSE_A_PORT (&stm_gpioc) +#define AO_ADC_SENSE_A_PIN 4 + +#define AO_ADC_SENSE_B 15 +#define AO_ADC_SENSE_B_PORT (&stm_gpioc) +#define AO_ADC_SENSE_B_PIN 5 + +#define AO_ADC_SENSE_C 13 +#define AO_ADC_SENSE_C_PORT (&stm_gpioc) +#define AO_ADC_SENSE_C_PIN 3 + +#define AO_ADC_SENSE_D 12 +#define AO_ADC_SENSE_D_PORT (&stm_gpioc) +#define AO_ADC_SENSE_D_PIN 2 + +#define AO_ADC_SENSE_DROGUE 11 +#define AO_ADC_SENSE_DROGUE_PORT (&stm_gpioc) +#define AO_ADC_SENSE_DROGUE_PIN 1 + +#define AO_ADC_SENSE_MAIN 10 +#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioc) +#define AO_ADC_SENSE_MAIN_PIN 0 + +#define AO_ADC_V_BATT 8 +#define AO_ADC_V_BATT_PORT (&stm_gpiob) +#define AO_ADC_V_BATT_PIN 0 + +#define AO_ADC_V_PBATT 9 +#define AO_ADC_V_PBATT_PORT (&stm_gpiob) +#define AO_ADC_V_PBATT_PIN 1 + +#define AO_ADC_TEMP 16 + +#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_GPIOAEN) | \ + (1 << STM_RCC_AHBENR_GPIOEEN) | \ + (1 << STM_RCC_AHBENR_GPIOBEN)) + +#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 2) + +#define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT +#define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN +#define AO_ADC_PIN1_PORT AO_ADC_SENSE_B_PORT +#define AO_ADC_PIN1_PIN AO_ADC_SENSE_B_PIN +#define AO_ADC_PIN2_PORT AO_ADC_SENSE_C_PORT +#define AO_ADC_PIN2_PIN AO_ADC_SENSE_C_PIN +#define AO_ADC_PIN3_PORT AO_ADC_SENSE_D_PORT +#define AO_ADC_PIN3_PIN AO_ADC_SENSE_D_PIN +#define AO_ADC_PIN4_PORT AO_ADC_SENSE_DROGUE_PORT +#define AO_ADC_PIN4_PIN AO_ADC_SENSE_DROGUE_PIN +#define AO_ADC_PIN5_PORT AO_ADC_SENSE_MAIN_PORT +#define AO_ADC_PIN5_PIN AO_ADC_SENSE_MAIN_PIN +#define AO_ADC_PIN6_PORT AO_ADC_V_BATT_PORT +#define AO_ADC_PIN6_PIN AO_ADC_V_BATT_PIN +#define AO_ADC_PIN7_PORT AO_ADC_V_PBATT_PORT +#define AO_ADC_PIN7_PIN AO_ADC_V_PBATT_PIN + +#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 3) + +#define AO_ADC_SQ1 AO_ADC_SENSE_A +#define AO_ADC_SQ2 AO_ADC_SENSE_B +#define AO_ADC_SQ3 AO_ADC_SENSE_C +#define AO_ADC_SQ4 AO_ADC_SENSE_D +#define AO_ADC_SQ5 AO_ADC_SENSE_DROGUE +#define AO_ADC_SQ6 AO_ADC_SENSE_MAIN +#define AO_ADC_SQ7 AO_ADC_V_BATT +#define AO_ADC_SQ8 AO_ADC_V_PBATT +#define AO_ADC_SQ9 AO_ADC_TEMP + +/* + * Voltage divider on ADC battery sampler + */ +#define AO_BATTERY_DIV_PLUS 56 /* 5.6k */ +#define AO_BATTERY_DIV_MINUS 100 /* 10k */ + +/* + * Voltage divider on ADC igniter samplers + */ +#define AO_IGNITE_DIV_PLUS 100 /* 100k */ +#define AO_IGNITE_DIV_MINUS 27 /* 27k */ + +/* + * ADC reference in decivolts + */ +#define AO_ADC_REFERENCE_DV 33 + +/* + * Pressure sensor settings + */ +#define HAS_MS5607 1 +#define HAS_MS5611 0 +#define AO_MS5607_PRIVATE_PINS 1 +#define AO_MS5607_CS_PORT (&stm_gpioa) +#define AO_MS5607_CS_PIN 3 +#define AO_MS5607_CS_MASK (1 << AO_MS5607_CS_PIN) +#define AO_MS5607_MISO_PORT (&stm_gpioa) +#define AO_MS5607_MISO_PIN 6 +#define AO_MS5607_MISO_MASK (1 << AO_MS5607_MISO_PIN) +#define AO_MS5607_SPI_INDEX AO_SPI_1_PA5_PA6_PA7 + +/* + * SPI Flash memory + */ + +#define M25_MAX_CHIPS 1 +#define AO_M25_SPI_CS_PORT (&stm_gpiob) +#define AO_M25_SPI_CS_PIN 12 +#define AO_M25_SPI_CS_MASK (1 << AO_M25_SPI_CS_PIN) +#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + +/* + * Mag sensor (hmc5883) + */ + +#define HAS_HMC5883 1 +#define AO_HMC5883_INT_PORT (&stm_gpioc) +#define AO_HMC5883_INT_PIN 14 +#define AO_HMC5883_I2C_INDEX STM_I2C_INDEX(1) + +/* + * mpu6000 + */ + +#define HAS_MPU6000 1 +#define AO_MPU6000_INT_PORT (&stm_gpioc) +#define AO_MPU6000_INT_PIN 15 +#define AO_MPU6000_SPI_BUS AO_SPI_1_PB3_PB4_PB5 +#define AO_MPU6000_SPI_CS_PORT (&stm_gpioc) +#define AO_MPU6000_SPI_CS_PIN 13 +#define HAS_IMU 1 + +/* + * mma655x + */ + +#define HAS_MMA655X 1 +#define AO_MMA655X_SPI_INDEX AO_SPI_1_PB3_PB4_PB5 +#define AO_MMA655X_CS_PORT (&stm_gpioc) +#define AO_MMA655X_CS_PIN 12 + +#define NUM_CMDS 16 + +/* + * Companion + */ + +#define AO_COMPANION_CS_PORT (&stm_gpiob) +#define AO_COMPANION_CS_PIN (6) +#define AO_COMPANION_SPI_BUS AO_SPI_2_PB13_PB14_PB15 + +/* + * Monitor + */ + +#define HAS_MONITOR 0 +#define LEGACY_MONITOR 0 +#define HAS_MONITOR_PUT 0 +#define AO_MONITOR_LED 0 +#define HAS_RSSI 0 + +/* + * Profiling Viterbi decoding + */ + +#ifndef AO_PROFILE +#define AO_PROFILE 0 +#endif + +#endif /* _AO_PINS_H_ */ diff --git a/src/easymega-v1.0/flash-loader/Makefile b/src/easymega-v1.0/flash-loader/Makefile new file mode 100644 index 00000000..d83cb70a --- /dev/null +++ b/src/easymega-v1.0/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=easymega-v1.0 +include $(TOPDIR)/stm/Makefile-flash.defs diff --git a/src/easymega-v1.0/flash-loader/ao_pins.h b/src/easymega-v1.0/flash-loader/ao_pins.h new file mode 100644 index 00000000..445289bf --- /dev/null +++ b/src/easymega-v1.0/flash-loader/ao_pins.h @@ -0,0 +1,34 @@ +/* + * Copyright © 2013 Keith Packard + * + * 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; version 2 of the License. + * + * 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_ + +/* External crystal at 8MHz */ +#define AO_HSE 8000000 + +#include + +/* Companion port cs_companion0 PD0 */ + +#define AO_BOOT_PIN 1 +#define AO_BOOT_APPLICATION_GPIO stm_gpiob +#define AO_BOOT_APPLICATION_PIN 6 +#define AO_BOOT_APPLICATION_VALUE 1 +#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP + +#endif /* _AO_PINS_H_ */ -- cgit v1.2.3 From d8e2b661e895fc59ded002a02191dcccce75f548 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 19 Jul 2014 22:35:30 -0700 Subject: altos: Have MicroKite just start recording at startup This avoids having MicroKite try to detect boost and has it just start recording data immediately. Signed-off-by: Keith Packard --- src/kernel/ao_microflight.c | 9 +++++++++ src/microkite/ao_pins.h | 3 ++- src/product/ao_micropeak.c | 3 ++- src/product/ao_micropeak.h | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/kernel/ao_microflight.c b/src/kernel/ao_microflight.c index df624e79..f7521f21 100644 --- a/src/kernel/ao_microflight.c +++ b/src/kernel/ao_microflight.c @@ -62,19 +62,25 @@ ao_microflight(void) h = 0; for (;;) { time += SAMPLE_SLEEP; +#if BOOST_DETECT if ((sample_count & 0x1f) == 0) ao_led_on(AO_LED_REPORT); +#endif ao_delay_until(time); ao_microsample(); +#if BOOST_DETECT if ((sample_count & 0x1f) == 0) ao_led_off(AO_LED_REPORT); +#endif pa_hist[h] = pa; h = SKIP_PA_HIST(h,1); pa_diff = pa_ground - ao_pa; +#if BOOST_DETECT /* Check for a significant pressure change */ if (pa_diff > BOOST_DETECT) break; +#endif if (sample_count < GROUND_AVG * 2) { if (sample_count < GROUND_AVG) @@ -84,6 +90,9 @@ ao_microflight(void) pa_ground = pa_sum >> GROUND_AVG_SHIFT; pa_sum = 0; sample_count = 0; +#if !BOOST_DETECT + break; +#endif } } diff --git a/src/microkite/ao_pins.h b/src/microkite/ao_pins.h index 3c56dfb8..346b63a1 100644 --- a/src/microkite/ao_pins.h +++ b/src/microkite/ao_pins.h @@ -62,8 +62,9 @@ typedef int32_t alt_t; #define AO_ALT_VALUE(x) ((x) * (alt_t) 10) -#define BOOST_DETECT 1200 /* 100m (ish) */ +#define BOOST_DETECT 0 /* none */ #define LOG_INTERVAL 200 /* 19.2 seconds */ +#define BOOST_DELAY 0 #define AO_LOG_ID AO_LOG_ID_MICROKITE diff --git a/src/product/ao_micropeak.c b/src/product/ao_micropeak.c index 10f0d192..54522d86 100644 --- a/src/product/ao_micropeak.c +++ b/src/product/ao_micropeak.c @@ -73,8 +73,9 @@ main(void) ao_report_altitude(); ao_pips(); ao_log_micro_dump(); - +#if BOOST_DELAY ao_delay(BOOST_DELAY); +#endif ao_microflight(); diff --git a/src/product/ao_micropeak.h b/src/product/ao_micropeak.h index 396b9a23..622f5a69 100644 --- a/src/product/ao_micropeak.h +++ b/src/product/ao_micropeak.h @@ -41,7 +41,9 @@ #endif /* Wait after power on before doing anything to give the user time to assemble the rocket */ +#ifndef BOOST_DELAY #define BOOST_DELAY AO_SEC_TO_TICKS(60) +#endif /* Pressure change (in Pa) to detect landing */ #define LAND_DETECT 24 /* 2m at sea level, 2.4m at 2000m */ -- cgit v1.2.3 From c4dd29fcbbb93e991993a0aa444748dba4ee7dde Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 22 Jul 2014 14:18:06 -0700 Subject: altos: Document which TeleFire alarm pins are which Signed-off-by: Keith Packard --- src/telefire-v0.2/ao_pins.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/telefire-v0.2/ao_pins.h b/src/telefire-v0.2/ao_pins.h index ef2d4822..28cc65b9 100644 --- a/src/telefire-v0.2/ao_pins.h +++ b/src/telefire-v0.2/ao_pins.h @@ -97,11 +97,13 @@ #define AO_PAD_ALL_PINS ((1 << AO_PAD_PIN_0) | (1 << AO_PAD_PIN_1) | (1 << AO_PAD_PIN_2) | (1 << AO_PAD_PIN_3)) #define AO_PAD_ALL_CHANNELS ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) +/* Alarm 2 */ #define AO_SIREN_PORT P2 #define AO_SIREN_DIR P2DIR #define AO_SIREN_PIN 3 #define AO_SIREN P2_3 +/* Alarm 1 */ #define AO_STROBE_PORT P2 #define AO_STROBE_DIR P2DIR #define AO_STROBE_PIN 4 -- cgit v1.2.3 From e935ebe55705cb0506aac0859583d54fd8e5ca46 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 14 Aug 2014 19:03:29 -0700 Subject: altos: Report additional pyro channels via beeper Send a beep for each additional pyro channel, low for no igniter, mid for igniter. Does not change the reporting for the apogee/main channels. Signed-off-by: Keith Packard --- src/kernel/ao_pyro.h | 3 +++ src/kernel/ao_report.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/kernel/ao_pyro.h b/src/kernel/ao_pyro.h index b37aaeb1..0fde725a 100644 --- a/src/kernel/ao_pyro.h +++ b/src/kernel/ao_pyro.h @@ -83,6 +83,9 @@ ao_pyro_init(void); void ao_pyro_manual(uint8_t p); +enum ao_igniter_status +ao_pyro_status(uint8_t p); + void ao_pyro_print_status(void); diff --git a/src/kernel/ao_report.c b/src/kernel/ao_report.c index f2263154..5314fc8f 100644 --- a/src/kernel/ao_report.c +++ b/src/kernel/ao_report.c @@ -211,12 +211,23 @@ ao_report_continuity(void) __reentrant pause(AO_MS_TO_TICKS(100)); } } else { - c = 10; + c = 5; while (c--) { high(AO_MS_TO_TICKS(20)); low(AO_MS_TO_TICKS(20)); } } +#if AO_PYRO_NUM + pause(AO_MS_TO_TICKS(250)); + for(c = 0; c < AO_PYRO_NUM; c++) { + enum ao_igniter_status status = ao_pyro_status(c); + if (status == ao_igniter_ready) + mid(AO_MS_TO_TICKS(25)); + else + low(AO_MS_TO_TICKS(25)); + pause(AO_MS_TO_TICKS(200)); + } +#endif #if HAS_LOG if (ao_log_full()) { pause(AO_MS_TO_TICKS(100)); -- cgit v1.2.3 From b1f1844aa514893228080704da3b3ccf855bda1e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:46:48 -0700 Subject: altosdroid: Add telemetry rate support Provides a menu to select the receiver telemetry bit rate Signed-off-by: Keith Packard --- altosdroid/res/menu/option_menu.xml | 3 ++ altosdroid/res/values/strings.xml | 1 + .../src/org/altusmetrum/AltosDroid/AltosDroid.java | 57 ++++++++++++++++++++-- .../altusmetrum/AltosDroid/TelemetryService.java | 6 +++ 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/altosdroid/res/menu/option_menu.xml b/altosdroid/res/menu/option_menu.xml index d7ba8305..ee9d475f 100644 --- a/altosdroid/res/menu/option_menu.xml +++ b/altosdroid/res/menu/option_menu.xml @@ -20,4 +20,7 @@ + diff --git a/altosdroid/res/values/strings.xml b/altosdroid/res/values/strings.xml index 90da617b..ce335b76 100644 --- a/altosdroid/res/values/strings.xml +++ b/altosdroid/res/values/strings.xml @@ -28,6 +28,7 @@ Connect a device Select radio frequency + Select data rate scanning for devices… diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index 1b49ba95..563ccd5a 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -476,6 +476,33 @@ public class AltosDroid extends FragmentActivity { } } + void setBaud(int baud) { + try { + mService.send(Message.obtain(null, TelemetryService.MSG_SETBAUD, baud)); + } catch (RemoteException e) { + } + } + + void setBaud(String baud) { + try { + int value = Integer.parseInt(baud); + int rate = AltosLib.ao_telemetry_rate_38400; + switch (value) { + case 2400: + rate = AltosLib.ao_telemetry_rate_2400; + break; + case 9600: + rate = AltosLib.ao_telemetry_rate_9600; + break; + case 38400: + rate = AltosLib.ao_telemetry_rate_38400; + break; + } + setBaud(rate); + } catch (NumberFormatException e) { + } + } + @Override public boolean onOptionsItemSelected(MenuItem item) { Intent serverIntent = null; @@ -501,16 +528,36 @@ public class AltosDroid extends FragmentActivity { "Channel 9 (435.450MHz)" }; - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle("Pick a frequency"); - builder.setItems(frequencies, + AlertDialog.Builder builder_freq = new AlertDialog.Builder(this); + builder_freq.setTitle("Pick a frequency"); + builder_freq.setItems(frequencies, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { setFrequency(frequencies[item]); } }); - AlertDialog alert = builder.create(); - alert.show(); + AlertDialog alert_freq = builder_freq.create(); + alert_freq.show(); + return true; + case R.id.select_rate: + // Set the TBT baud rate + + final String[] rates = { + "38400", + "9600", + "2400", + }; + + AlertDialog.Builder builder_rate = new AlertDialog.Builder(this); + builder_rate.setTitle("Pick a baud rate"); + builder_rate.setItems(rates, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int item) { + setBaud(rates[item]); + } + }); + AlertDialog alert_rate = builder_rate.create(); + alert_rate.show(); return true; } return false; diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java index f06ed213..4ec353e3 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java @@ -61,6 +61,7 @@ public class TelemetryService extends Service implements LocationListener { static final int MSG_TELEMETRY = 7; static final int MSG_SETFREQUENCY = 8; static final int MSG_CRC_ERROR = 9; + static final int MSG_SETBAUD = 10; public static final int STATE_NONE = 0; public static final int STATE_READY = 1; @@ -162,6 +163,11 @@ public class TelemetryService extends Service implements LocationListener { } } break; + case MSG_SETBAUD: + if (s.state == STATE_CONNECTED) { + s.mAltosBluetooth.set_telemetry_rate((Integer) msg.obj); + } + break; default: super.handleMessage(msg); } -- cgit v1.2.3 From 59dfe661fcb504f390d9726378c676f2b5b005f3 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:48:23 -0700 Subject: altosdroid: Skip updating hidden UI elements Instead of updating everything in the UI, only update the visible UI elements to save a bunch of computation. Signed-off-by: Keith Packard --- .../org/altusmetrum/AltosDroid/AltosBluetooth.java | 29 +++++++---- .../src/org/altusmetrum/AltosDroid/AltosDroid.java | 56 ++++++++++++++++++---- .../org/altusmetrum/AltosDroid/AltosDroidTab.java | 54 ++++++++++++++++++++- .../src/org/altusmetrum/AltosDroid/AltosVoice.java | 26 ++++++---- .../src/org/altusmetrum/AltosDroid/TabAscent.java | 8 +++- .../src/org/altusmetrum/AltosDroid/TabDescent.java | 6 ++- .../src/org/altusmetrum/AltosDroid/TabLanded.java | 9 ++-- .../src/org/altusmetrum/AltosDroid/TabMap.java | 11 +++-- .../src/org/altusmetrum/AltosDroid/TabPad.java | 6 ++- .../org/altusmetrum/AltosDroid/TabsAdapter.java | 33 +++++++++++-- 10 files changed, 190 insertions(+), 48 deletions(-) diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java index a599698f..484efaf8 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosBluetooth.java @@ -174,18 +174,29 @@ public class AltosBluetooth extends AltosLink { } catch (InterruptedException e) { connection_lost(); } - } + } + + private static final int buffer_size = 1024; + + private byte[] buffer = new byte[buffer_size]; + private int buffer_len = 0; + private int buffer_off = 0; public int getchar() { - try { - wait_connected(); - return input.read(); - } catch (IOException e) { - connection_lost(); - } catch (java.lang.InterruptedException e) { - connection_lost(); + while (buffer_off == buffer_len) { + try { + wait_connected(); + buffer_len = input.read(buffer); + buffer_off = 0; + } catch (IOException e) { + connection_lost(); + return AltosLink.ERROR; + } catch (java.lang.InterruptedException e) { + connection_lost(); + return AltosLink.ERROR; + } } - return AltosLink.ERROR; + return buffer[buffer_off++]; } public void close() { diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index 563ccd5a..c9c38d98 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -37,6 +37,7 @@ import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.support.v4.app.FragmentActivity; +import android.support.v4.app.FragmentManager; import android.util.DisplayMetrics; import android.util.Log; import android.view.Menu; @@ -53,8 +54,8 @@ import org.altusmetrum.altoslib_5.*; public class AltosDroid extends FragmentActivity { // Debugging - private static final String TAG = "AltosDroid"; - private static final boolean D = true; + static final String TAG = "AltosDroid"; + static final boolean D = true; // Message types received by our Handler public static final int MSG_STATE_CHANGE = 1; @@ -67,6 +68,8 @@ public class AltosDroid extends FragmentActivity { private static final int REQUEST_CONNECT_DEVICE = 1; private static final int REQUEST_ENABLE_BT = 2; + public static FragmentManager fm; + // Layout Views private TextView mTitle; @@ -145,6 +148,7 @@ public class AltosDroid extends FragmentActivity { ad.set_location((Location) msg.obj); break; case MSG_CRC_ERROR: + break; case MSG_UPDATE_AGE: if (ad.saved_state != null) { ad.mAgeView.setText(String.format("%d", (System.currentTimeMillis() - ad.saved_state.received_time + 500) / 1000)); @@ -206,13 +210,29 @@ public class AltosDroid extends FragmentActivity { void set_location(Location location) { saved_location = location; + Log.d(TAG, "set_location"); update_ui(saved_state); } + boolean same_string(String a, String b) { + if (a == null) { + if (b == null) + return true; + return false; + } else { + if (b == null) + return false; + return a.equals(b); + } + } + void update_ui(AltosState state) { + + Log.d(TAG, "update_ui"); if (state != null && saved_state != null) { if (saved_state.state != state.state) { String currentTab = mTabHost.getCurrentTabTag(); + Log.d(TAG, "switch state"); switch (state.state) { case AltosLib.ao_flight_boost: if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("ascent"); @@ -226,7 +246,6 @@ public class AltosDroid extends FragmentActivity { } } } - saved_state = state; AltosGreatCircle from_receiver = null; @@ -243,18 +262,35 @@ public class AltosDroid extends FragmentActivity { } if (state != null) { - mCallsignView.setText(state.callsign); - mSerialView.setText(String.format("%d", state.serial)); - mFlightView.setText(String.format("%d", state.flight)); - mStateView.setText(state.state_name()); - mRSSIView.setText(String.format("%d", state.rssi)); + if (saved_state == null || !same_string(saved_state.callsign, state.callsign)) { + Log.d(TAG, "update callsign"); + mCallsignView.setText(state.callsign); + } + if (saved_state == null || state.serial != saved_state.serial) { + Log.d(TAG, "update serial"); + mSerialView.setText(String.format("%d", state.serial)); + } + if (saved_state == null || state.flight != saved_state.flight) { + Log.d(TAG, "update flight"); + mFlightView.setText(String.format("%d", state.flight)); + } + if (saved_state == null || state.state != saved_state.state) { + Log.d(TAG, "update state"); + mStateView.setText(state.state_name()); + } + if (saved_state == null || state.rssi != saved_state.rssi) { + Log.d(TAG, "update rssi"); + mRSSIView.setText(String.format("%d", state.rssi)); + } } for (AltosDroidTab mTab : mTabs) - mTab.update_ui(state, from_receiver, saved_location); + mTab.update_ui(state, from_receiver, saved_location, mTab == mTabsAdapter.currentItem()); if (state != null) mAltosVoice.tell(state); + + saved_state = state; } private void onTimerTick() { @@ -294,6 +330,8 @@ public class AltosDroid extends FragmentActivity { super.onCreate(savedInstanceState); if(D) Log.e(TAG, "+++ ON CREATE +++"); + fm = getSupportFragmentManager(); + // Get local Bluetooth adapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java index 20593bd5..b960eb1a 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidTab.java @@ -19,7 +19,57 @@ package org.altusmetrum.AltosDroid; import org.altusmetrum.altoslib_5.*; import android.location.Location; +import android.app.Activity; +import android.graphics.Color; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; +import android.support.v4.app.FragmentManager; +import android.location.Location; +import android.util.Log; + +public abstract class AltosDroidTab extends Fragment { + AltosState last_state; + AltosGreatCircle last_from_receiver; + Location last_receiver; + + public abstract void show(AltosState state, AltosGreatCircle from_receiver, Location receiver); + + public abstract String tab_name(); + + public void set_visible(boolean visible) { + FragmentTransaction ft = AltosDroid.fm.beginTransaction(); + if (visible) + ft.show(this); + else + ft.hide(this); + ft.commit(); + } + + public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver, boolean is_current) { + if (is_current) { + Log.d(AltosDroid.TAG, String.format("%s: visible, performing update", tab_name())); + + show(state, from_receiver, receiver); + } else { + Log.d(AltosDroid.TAG, String.format("%s: not visible, skipping update", tab_name())); + last_state = state; + last_from_receiver = from_receiver; + last_receiver = receiver; + return; + } + } + + public void onHiddenChanged(boolean hidden) { + if (last_state != null && isVisible()) { + AltosState state = last_state; + AltosGreatCircle from_receiver = last_from_receiver; + Location receiver = last_receiver; -public interface AltosDroidTab { - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver); + last_state = null; + last_from_receiver = null; + last_receiver = null; + show(state, from_receiver, receiver); + } + } } diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java index 147405f6..b05913b6 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosVoice.java @@ -45,7 +45,7 @@ public class AltosVoice { } - public void speak(String s) { + public synchronized void speak(String s) { if (!tts_enabled) return; tts.speak(s, TextToSpeech.QUEUE_ADD, null); } @@ -87,7 +87,8 @@ public class AltosVoice { } } old_state = state; - idle_thread.notice(state, spoke); + if (idle_thread != null) + idle_thread.notice(state, spoke); } @@ -117,13 +118,20 @@ public class AltosVoice { state.state == AltosLib.ao_flight_stateless) && state.range >= 0) { - speak(String.format("Height %d, bearing %s %d, elevation %d, range %d.\n", - (int) (state.height() + 0.5), - state.from_pad.bearing_words( - AltosGreatCircle.BEARING_VOICE), - (int) (state.from_pad.bearing + 0.5), - (int) (state.elevation + 0.5), - (int) (state.range + 0.5))); + if (state.from_pad != null) { + speak(String.format("Height %d, bearing %s %d, elevation %d, range %d.\n", + (int) (state.height() + 0.5), + state.from_pad.bearing_words( + AltosGreatCircle.BEARING_VOICE), + (int) (state.from_pad.bearing + 0.5), + (int) (state.elevation + 0.5), + (int) (state.range + 0.5))); + } else { + speak(String.format("Height %d, elevation %d, range %d.\n", + (int) (state.height() + 0.5), + (int) (state.elevation + 0.5), + (int) (state.range + 0.5))); + } } else if (state.state > AltosLib.ao_flight_pad) { if (state.height() != AltosLib.MISSING) speak(String.format("%d meters", (int) (state.height() + 0.5))); diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java index cb9fd5c8..c146c277 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java @@ -29,7 +29,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.location.Location; -public class TabAscent extends Fragment implements AltosDroidTab { +public class TabAscent extends AltosDroidTab { AltosDroid mAltosDroid; private TextView mHeightView; @@ -85,7 +85,11 @@ public class TabAscent extends Fragment implements AltosDroidTab { mAltosDroid = null; } - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + public String tab_name() { + return "ascent"; + } + + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (state != null) { mHeightView.setText(AltosDroid.number("%6.0f m", state.height())); mMaxHeightView.setText(AltosDroid.number("%6.0f m", state.max_height())); diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java index 2171afa4..6d781efd 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java @@ -29,7 +29,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.location.Location; -public class TabDescent extends Fragment implements AltosDroidTab { +public class TabDescent extends AltosDroidTab { AltosDroid mAltosDroid; private TextView mSpeedView; @@ -89,7 +89,9 @@ public class TabDescent extends Fragment implements AltosDroidTab { mAltosDroid = null; } - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + public String tab_name() { return "descent"; } + + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (state != null) { mSpeedView.setText(AltosDroid.number("%6.0f m/s", state.speed())); mHeightView.setText(AltosDroid.number("%6.0f m", state.height())); diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java index 47e41d59..16427d8b 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java @@ -28,7 +28,7 @@ import android.view.ViewGroup; import android.widget.TextView; import android.location.Location; -public class TabLanded extends Fragment implements AltosDroidTab { +public class TabLanded extends AltosDroidTab { AltosDroid mAltosDroid; private TextView mBearingView; @@ -73,7 +73,9 @@ public class TabLanded extends Fragment implements AltosDroidTab { mAltosDroid = null; } - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + public String tab_name() { return "landed"; } + + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (from_receiver != null) { mBearingView.setText(String.format("%3.0f°", from_receiver.bearing)); mDistanceView.setText(String.format("%6.0f m", from_receiver.distance)); @@ -87,12 +89,11 @@ public class TabLanded extends Fragment implements AltosDroidTab { mReceiverLatitudeView.setText(AltosDroid.pos(receiver.getLatitude(), "N", "S")); mReceiverLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "W", "E")); } - + if (state != null) { mMaxHeightView.setText(String.format("%6.0f m", state.max_height())); mMaxAccelView.setText(String.format("%6.0f m/s²", state.max_acceleration())); mMaxSpeedView.setText(String.format("%6.0f m/s", state.max_speed())); } } - } diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java index 15dc8bf7..811e5482 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java @@ -42,7 +42,7 @@ import android.view.ViewGroup; import android.widget.TextView; import android.location.Location; -public class TabMap extends Fragment implements AltosDroidTab { +public class TabMap extends AltosDroidTab { AltosDroid mAltosDroid; private SupportMapFragment mMapFragment; @@ -51,6 +51,7 @@ public class TabMap extends Fragment implements AltosDroidTab { private Marker mRocketMarker; private Marker mPadMarker; + private boolean pad_set; private Polyline mPolyline; private TextView mDistanceView; @@ -152,7 +153,9 @@ public class TabMap extends Fragment implements AltosDroidTab { } } - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + public String tab_name() { return "map"; } + + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (from_receiver != null) { mBearingView.setText(String.format("%3.0f°", from_receiver.bearing)); mDistanceView.setText(String.format("%6.0f m", from_receiver.distance)); @@ -168,7 +171,8 @@ public class TabMap extends Fragment implements AltosDroidTab { mPolyline.setVisible(true); } - if (state.state == AltosLib.ao_flight_pad) { + if (!pad_set && state.pad_lat != AltosLib.MISSING) { + pad_set = true; mPadMarker.setPosition(new LatLng(state.pad_lat, state.pad_lon)); mPadMarker.setVisible(true); } @@ -194,5 +198,4 @@ public class TabMap extends Fragment implements AltosDroidTab { } } - } diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java index 175a41de..03b78b75 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabPad.java @@ -29,7 +29,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.location.Location; -public class TabPad extends Fragment implements AltosDroidTab { +public class TabPad extends AltosDroidTab { AltosDroid mAltosDroid; private TextView mBatteryVoltageView; @@ -101,7 +101,9 @@ public class TabPad extends Fragment implements AltosDroidTab { mAltosDroid = null; } - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + public String tab_name() { return "pad"; } + + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (state != null) { mBatteryVoltageView.setText(AltosDroid.number("%4.2f V", state.battery_voltage)); mBatteryLights.set(state.battery_voltage >= AltosLib.ao_battery_good, state.battery_voltage == AltosLib.MISSING); diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabsAdapter.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabsAdapter.java index a4758c37..1ac34f9d 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabsAdapter.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabsAdapter.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; @@ -28,8 +29,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TabHost; import android.widget.TabWidget; - - +import android.util.Log; /** * This is a helper class that implements the management of tabs and all @@ -48,11 +48,13 @@ public class TabsAdapter extends FragmentPagerAdapter private final TabHost mTabHost; private final ViewPager mViewPager; private final ArrayList mTabs = new ArrayList(); + private int position; - static final class TabInfo { + static class TabInfo { private final String tag; private final Class clss; private final Bundle args; + private Fragment fragment; TabInfo(String _tag, Class _class, Bundle _args) { tag = _tag; @@ -104,11 +106,32 @@ public class TabsAdapter extends FragmentPagerAdapter @Override public Fragment getItem(int position) { TabInfo info = mTabs.get(position); - return Fragment.instantiate(mContext, info.clss.getName(), info.args); + Log.d(AltosDroid.TAG, String.format("TabsAdapter.getItem(%d)", position)); + info.fragment = Fragment.instantiate(mContext, info.clss.getName(), info.args); + return info.fragment; + } + + public Fragment currentItem() { + TabInfo info = mTabs.get(position); + return info.fragment; } public void onTabChanged(String tabId) { - int position = mTabHost.getCurrentTab(); + AltosDroidTab prev_frag = (AltosDroidTab) mTabs.get(position).fragment; + + position = mTabHost.getCurrentTab(); + + AltosDroidTab cur_frag = (AltosDroidTab) mTabs.get(position).fragment; + + if (prev_frag != cur_frag) { + if (prev_frag != null) { + prev_frag.set_visible(false); + } + } + if (cur_frag != null) { + cur_frag.set_visible(true); + } + Log.d(AltosDroid.TAG, String.format("TabsAdapter.onTabChanged(%s) = %d", tabId, position)); mViewPager.setCurrentItem(position); } -- cgit v1.2.3 From 935f769fee351545622e223a283fca64608ca410 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:49:27 -0700 Subject: altoslib: Parse 'Log fixed:' configuration value TeleGPS holds a single flight record and constantly appends data to it instead of having separate flight records on the board. It reports 'Log fixed: 1' to let AltosLib know that the size of the per-flight log is not configurable. Signed-off-by: Keith Packard --- altoslib/AltosConfigData.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index 134a0ed2..fd38635c 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -58,6 +58,7 @@ public class AltosConfigData implements Iterable { /* HAS_LOG */ public int flight_log_max; + public int log_fixed; /* HAS_IGNITE */ public int ignite_mode; @@ -244,6 +245,7 @@ public class AltosConfigData implements Iterable { pad_orientation = -1; flight_log_max = -1; + log_fixed = -1; ignite_mode = -1; aes_key = ""; @@ -316,6 +318,7 @@ public class AltosConfigData implements Iterable { /* HAS_LOG */ try { flight_log_max = get_int(line, "Max flight log:"); } catch (Exception e) {} + try { log_fixed = get_int(line, "Log fixed:"); } catch (Exception e) {} /* HAS_IGNITE */ try { ignite_mode = get_int(line, "Ignite mode:"); } catch (Exception e) {} @@ -498,6 +501,9 @@ public class AltosConfigData implements Iterable { if (log_space() == 0) max_enabled = false; + if (log_fixed > 0) + max_enabled = false; + switch (log_format) { case AltosLib.AO_LOG_FORMAT_TINY: max_enabled = false; -- cgit v1.2.3 From 76fd424e4624cb376ac2cf84b01b77599756680a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:50:38 -0700 Subject: altoslib: Handle link timeout in AltosDebug.read_memory link.get_reply returns null on a link error; don't crash in read_memory when this happens. Signed-off-by: Keith Packard --- altoslib/AltosDebug.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/altoslib/AltosDebug.java b/altoslib/AltosDebug.java index 6784f60a..e58fbaf2 100644 --- a/altoslib/AltosDebug.java +++ b/altoslib/AltosDebug.java @@ -52,7 +52,7 @@ public class AltosDebug { public static final byte GET_CHIP_ID = 0x68; - AltosLink link; + private AltosLink link; boolean debug_mode; @@ -112,7 +112,11 @@ public class AltosDebug { int i = 0; int start = 0; while (i < length) { - String line = link.get_reply().trim(); + String line = link.get_reply(); + if (line == null) + throw new IOException("No reply"); + + line = line.trim(); if (!AltosLib.ishex(line) || line.length() % 2 != 0) throw new IOException( String.format @@ -277,4 +281,4 @@ public class AltosDebug { public AltosDebug (AltosLink link) { this.link = link; } -} \ No newline at end of file +} -- cgit v1.2.3 From ee9f68ec877e3e5a67179f8c8abafbccc80eb804 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:51:36 -0700 Subject: altoslib: Close serial port when AltosFlash fails to detect a target AltosDebug.check_connection raises an exception when the link fails, but the AltosFlash constructor didn't close the serial port in this case, causing the serial port to appear to be busy. Signed-off-by: Keith Packard --- altoslib/AltosFlash.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/altoslib/AltosFlash.java b/altoslib/AltosFlash.java index bd4fb6d0..a8519550 100644 --- a/altoslib/AltosFlash.java +++ b/altoslib/AltosFlash.java @@ -345,9 +345,23 @@ public class AltosFlash extends AltosProgrammer { debug = new AltosDebug(link); input = new FileInputStream(file); image = new AltosHexfile(input); - if (debug != null && !debug.check_connection()) { + + boolean connection_ok = true; + + if (debug != null) { + try { + connection_ok = debug.check_connection(); + } catch (IOException ie) { + debug.close(); + throw ie; + } catch (InterruptedException ie) { + debug.close(); + throw ie; + } + } + if (!connection_ok) { debug.close(); throw new IOException("Debug port not connected"); } } -} \ No newline at end of file +} -- cgit v1.2.3 From ef1dd370564b99da033109f2fb5f7bf29711a13f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:53:31 -0700 Subject: altoslib: Improve performance of AltosLib.hexbytes On an android device, this function was spending quite a bit of time calling hexbyte. Open code the conversion to improve performance. Signed-off-by: Keith Packard --- altoslib/AltosLib.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index 68bdd17f..c3c1226e 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -329,7 +329,7 @@ public class AltosLib { return false; } - public static boolean ishex(int c) { + public static final boolean ishex(int c) { if ('0' <= c && c <= '9') return true; if ('a' <= c && c <= 'f') @@ -339,7 +339,7 @@ public class AltosLib { return false; } - public static boolean ishex(String s) { + public static final boolean ishex(String s) { for (int i = 0; i < s.length(); i++) if (!ishex(s.charAt(i))) return false; @@ -463,10 +463,17 @@ public class AltosLib { if ((s.length() & 1) != 0) throw new NumberFormatException(String.format("invalid line \"%s\"", s)); - n = s.length() / 2; + byte[] bytes = s.getBytes(unicode_set); + n = bytes.length / 2; r = new int[n]; - for (i = 0; i < n; i++) - r[i] = hexbyte(s, i * 2); + for (i = 0; i < n; i++) { + int h = fromhex(bytes[(i << 1)]); + int l = fromhex(bytes[(i << 1) + 1]); + if (h < 0 || l < 0) + throw new NumberFormatException(String.format("invalid hex \"%c%c\"", + bytes[(i<<1)], bytes[(i<<1) + 1])); + r[i] = (h << 4) + l; + } return r; } -- cgit v1.2.3 From 629b29b2718c174be9c811f224d0acf73fba4aff Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:54:44 -0700 Subject: altoslib: Remove some debug printfs Signed-off-by: Keith Packard --- altoslib/AltosTelemetry.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/altoslib/AltosTelemetry.java b/altoslib/AltosTelemetry.java index 2f15cd89..a123d752 100644 --- a/altoslib/AltosTelemetry.java +++ b/altoslib/AltosTelemetry.java @@ -118,8 +118,6 @@ public abstract class AltosTelemetry implements AltosStateUpdate { double compare_height; int height = height_16; - System.out.printf("state kalman height %g altitude %g ground_altitude %g gps_height %g\n", - state.kalman_height.value(), state.altitude(), state.ground_altitude(), state.gps_height()); if (state.gps != null && state.gps.alt != AltosLib.MISSING) { compare_height = state.gps_height(); } else { @@ -135,10 +133,6 @@ public abstract class AltosTelemetry implements AltosStateUpdate { height += 65536; else if (Math.abs(height - 65536 - compare_height) < Math.abs(height - compare_height)) height -= 65536; - if (height != height_16) { - System.out.printf("Height adjusted from %d to %d with %g\n", - height_16, height, compare_height); - } } return height; } -- cgit v1.2.3 From 830f31fd6dc280e7a63ba689b7a48beff5c49072 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:55:34 -0700 Subject: ao-tools/ao-send-telem: Support sending TM v2 and Tm v2 telemetry Add state tracking so the telemetry sending code works. Signed-off-by: Keith Packard --- ao-tools/ao-send-telem/ao-send-telem.c | 6 ++++++ ao-tools/lib/cc-telemetry.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ao-tools/ao-send-telem/ao-send-telem.c b/ao-tools/ao-send-telem/ao-send-telem.c index 3db44542..26c3263e 100644 --- a/ao-tools/ao-send-telem/ao-send-telem.c +++ b/ao-tools/ao-send-telem/ao-send-telem.c @@ -85,6 +85,12 @@ packet_state(union ao_telemetry_all *telem) case AO_TELEMETRY_MEGA_DATA: cur_state = telem->mega_data.state; break; + case AO_TELEMETRY_METRUM_SENSOR: + cur_state = telem->metrum_sensor.state; + break; + case AO_TELEMETRY_MINI: + cur_state = telem->mini.state; + break; } return cur_state; } diff --git a/ao-tools/lib/cc-telemetry.c b/ao-tools/lib/cc-telemetry.c index 88da7f03..45c10dcb 100644 --- a/ao-tools/lib/cc-telemetry.c +++ b/ao-tools/lib/cc-telemetry.c @@ -89,4 +89,3 @@ cc_telemetry_unparse(const union ao_telemetry_all *telemetry, char output_line[C p += 2; } } - -- cgit v1.2.3 From 80e20b241359452028298567c76b2f644da5ad23 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:56:22 -0700 Subject: Use -ldl when testing whether -m32 and -m64 builds work We only need -ldl, and not -lbluetooth now that libaltos uses dlopen on the bluetooth library Signed-off-by: Keith Packard --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c2b8b55c..38bab8e1 100644 --- a/configure.ac +++ b/configure.ac @@ -459,7 +459,7 @@ xauto) xx86_64|xi*86) save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" - LIBS="-lbluetooth" + LIBS="-ldl" CFLAGS="-m64" AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs]) AC_LINK_IFELSE([AC_LANG_PROGRAM([])], -- cgit v1.2.3 From 1530c24cc75cdf9ba87c7e153ff28bf7beb4384c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:57:16 -0700 Subject: cc1111: Wait for internal flash write to complete This ensures that we don't try to start another write too soon. Signed-off-by: Keith Packard --- src/cc1111/ao_intflash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cc1111/ao_intflash.c b/src/cc1111/ao_intflash.c index 632e2a85..eb3535c6 100644 --- a/src/cc1111/ao_intflash.c +++ b/src/cc1111/ao_intflash.c @@ -129,6 +129,8 @@ ao_intflash_write_aligned(uint16_t pos, __xdata void *d, uint16_t len) __reentra nop _endasm; } + __critical while (!ao_intflash_dma_done) + ao_sleep(&ao_intflash_dma_done); } static void -- cgit v1.2.3 From bb7522acf040f41740ecd059e3d5d2480b652420 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 20:59:45 -0700 Subject: telegps-v1.0: Provide one log and append to it Instead of creating per-flight logs, create a single log and append data to it each time TeleGPS is powered on. This avoids potentially running out of log space just because the device is powered off/on. Signed-off-by: Keith Packard --- src/kernel/ao_config.c | 38 +++++++++++-- src/kernel/ao_config.h | 7 +++ src/kernel/ao_log.c | 134 +++++++++++++++++++++++++++++++++------------ src/kernel/ao_log.h | 5 ++ src/kernel/ao_log_gps.c | 14 +++++ src/telegps-v1.0/ao_pins.h | 2 +- 6 files changed, 160 insertions(+), 40 deletions(-) diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index d73a3733..d1b93122 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -50,13 +50,19 @@ __xdata uint8_t ao_config_mutex; #error Please define USE_INTERNAL_FLASH #endif #endif + #ifndef AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX -#if USE_INTERNAL_FLASH -#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ao_storage_config -#else -#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ((uint32_t) 192 * (uint32_t) 1024) -#endif +# if FLIGHT_LOG_APPEND +# define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ao_storage_log_max +# else +# if USE_INTERNAL_FLASH +# define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ao_storage_config +# else +# define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX ((uint32_t) 192 * (uint32_t) 1024) +# endif +# endif #endif + #ifndef AO_CONFIG_DEFAULT_RADIO_POWER #define AO_CONFIG_DEFAULT_RADIO_POWER 0x60 #endif @@ -525,15 +531,36 @@ ao_config_radio_rate_set(void) __reentrant #endif #if HAS_LOG + void ao_config_log_show(void) __reentrant { printf("Max flight log: %d kB\n", (int16_t) (ao_config.flight_log_max >> 10)); +#if FLIGHT_LOG_APPEND + printf("Log fixed: 1\n"); +#endif +} + +#if FLIGHT_LOG_APPEND +void +ao_config_log_fix_append(void) +{ + _ao_config_edit_start(); + ao_config.flight_log_max = ao_storage_log_max; + _ao_config_edit_finish(); + ao_mutex_get(&ao_config_mutex); + _ao_config_put(); + ao_config_dirty = 0; + ao_mutex_put(&ao_config_mutex); } +#endif void ao_config_log_set(void) __reentrant { +#if FLIGHT_LOG_APPEND + printf("Flight log fixed size %d kB\n", ao_storage_log_max >> 10); +#else uint16_t block = (uint16_t) (ao_storage_block >> 10); uint16_t log_max = (uint16_t) (ao_storage_log_max >> 10); @@ -551,6 +578,7 @@ ao_config_log_set(void) __reentrant ao_config.flight_log_max = (uint32_t) ao_cmd_lex_i << 10; _ao_config_edit_finish(); } +#endif } #endif /* HAS_LOG */ diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h index a650ffc6..0be3e14d 100644 --- a/src/kernel/ao_config.h +++ b/src/kernel/ao_config.h @@ -28,6 +28,10 @@ #define USE_EEPROM_CONFIG 0 #endif +#ifndef FLIGHT_LOG_APPEND +#define FLIGHT_LOG_APPEND 0 +#endif + #if USE_STORAGE_CONFIG #include @@ -146,6 +150,9 @@ ao_config_put(void); void ao_config_set_radio(void); +void +ao_config_log_fix_append(void); + void ao_config_init(void); diff --git a/src/kernel/ao_log.c b/src/kernel/ao_log.c index 91617d93..dc3b6486 100644 --- a/src/kernel/ao_log.c +++ b/src/kernel/ao_log.c @@ -142,19 +142,39 @@ ao_log_max_flight(void) return max_flight; } -void -ao_log_scan(void) __reentrant +static void +ao_log_erase(uint8_t slot) __reentrant { - uint8_t log_slot; - uint8_t log_slots; - uint8_t log_want; + uint32_t log_current_pos, log_end_pos; - ao_config_get(); + ao_log_erase_mark(); + log_current_pos = ao_log_pos(slot); + log_end_pos = log_current_pos + ao_config.flight_log_max; + while (log_current_pos < log_end_pos) { + uint8_t i; + static __xdata uint8_t b; + + /* + * Check to see if we've reached the end of + * the used memory to avoid re-erasing the same + * memory over and over again + */ + for (i = 0; i < 16; i++) { + if (ao_storage_read(log_current_pos + i, &b, 1)) + if (b != 0xff) + break; + } + if (i == 16) + break; + ao_storage_erase(log_current_pos); + log_current_pos += ao_storage_block; + } +} - ao_flight_number = ao_log_max_flight(); - if (ao_flight_number) - if (++ao_flight_number == 0) - ao_flight_number = 1; +static void +ao_log_find_max_erase_flight(void) __reentrant +{ + uint8_t log_slot; /* Now look through the log of flight numbers from erase operations and * see if the last one is bigger than what we found above @@ -170,6 +190,74 @@ ao_log_scan(void) __reentrant } if (ao_flight_number == 0) ao_flight_number = 1; +} + +void +ao_log_scan(void) __reentrant +{ + uint8_t log_slot; + uint8_t log_slots; +#if !FLIGHT_LOG_APPEND + uint8_t log_want; +#endif + + ao_config_get(); + + /* Get any existing flight number */ + ao_flight_number = ao_log_max_flight(); + +#if FLIGHT_LOG_APPEND + + /* Deal with older OS versions which stored multiple + * flights in rom by erasing everything after the first + * slot + */ + if (ao_config.flight_log_max != ao_storage_log_max) { + log_slots = ao_log_slots(); + for (log_slot = 1; log_slot < log_slots; log_slot++) { + if (ao_log_flight(log_slot) != 0) + ao_log_erase(log_slot); + } + ao_config_log_fix_append(); + } + ao_log_current_pos = ao_log_pos(0); + ao_log_end_pos = ao_log_current_pos + ao_storage_log_max; + + if (ao_flight_number) { + uint32_t full = ao_log_current_pos; + uint32_t empty = ao_log_end_pos - ao_log_size; + + /* If there's already a flight started, then find the + * end of it + */ + for (;;) { + ao_log_current_pos = (full + empty) >> 1; + ao_log_current_pos -= ao_log_current_pos % ao_log_size; + + if (ao_log_current_pos == full) { + if (ao_log_check(ao_log_current_pos)) + ao_log_current_pos += ao_log_size; + break; + } + if (ao_log_current_pos == empty) + break; + + if (ao_log_check(ao_log_current_pos)) { + full = ao_log_current_pos; + } else { + empty = ao_log_current_pos; + } + } + } else { + ao_log_find_max_erase_flight(); + } +#else + + if (ao_flight_number) + if (++ao_flight_number == 0) + ao_flight_number = 1; + + ao_log_find_max_erase_flight(); /* With a flight number in hand, find a place to write a new log, * use the target flight number to index the available log slots so @@ -190,7 +278,7 @@ ao_log_scan(void) __reentrant if (++log_slot >= log_slots) log_slot = 0; } while (log_slot != log_want); - +#endif ao_wakeup(&ao_flight_number); } @@ -254,7 +342,6 @@ ao_log_delete(void) __reentrant { uint8_t slot; uint8_t slots; - uint32_t log_current_pos, log_end_pos; ao_cmd_decimal(); if (ao_cmd_status != ao_cmd_success) @@ -268,28 +355,7 @@ ao_log_delete(void) __reentrant #if HAS_TRACKER ao_tracker_erase_start(ao_cmd_lex_i); #endif - ao_log_erase_mark(); - log_current_pos = ao_log_pos(slot); - log_end_pos = log_current_pos + ao_config.flight_log_max; - while (log_current_pos < log_end_pos) { - uint8_t i; - static __xdata uint8_t b; - - /* - * Check to see if we've reached the end of - * the used memory to avoid re-erasing the same - * memory over and over again - */ - for (i = 0; i < 16; i++) { - if (ao_storage_read(log_current_pos + i, &b, 1)) - if (b != 0xff) - break; - } - if (i == 16) - break; - ao_storage_erase(log_current_pos); - log_current_pos += ao_storage_block; - } + ao_log_erase(slot); #if HAS_TRACKER ao_tracker_erase_end(); #endif diff --git a/src/kernel/ao_log.h b/src/kernel/ao_log.h index da20e067..c5fa7fab 100644 --- a/src/kernel/ao_log.h +++ b/src/kernel/ao_log.h @@ -51,11 +51,16 @@ extern __pdata enum ao_flight_state ao_log_state; #define AO_LOG_FORMAT_NONE 127 /* No log at all */ extern __code uint8_t ao_log_format; +extern __code uint8_t ao_log_size; /* Return the flight number from the given log slot, 0 if none */ uint16_t ao_log_flight(uint8_t slot); +/* Check if there is valid log data at the specified location */ +uint8_t +ao_log_check(uint32_t pos); + /* Flush the log */ void ao_log_flush(void); diff --git a/src/kernel/ao_log_gps.c b/src/kernel/ao_log_gps.c index a5a6358b..7643091c 100644 --- a/src/kernel/ao_log_gps.c +++ b/src/kernel/ao_log_gps.c @@ -26,6 +26,7 @@ static __xdata struct ao_log_gps log; __code uint8_t ao_log_format = AO_LOG_FORMAT_TELEGPS; +__code uint8_t ao_log_size = sizeof (struct ao_log_gps); static uint8_t ao_log_csum(__xdata uint8_t *b) __reentrant @@ -136,3 +137,16 @@ ao_log_flight(uint8_t slot) return log.u.flight.flight; return 0; } + +uint8_t +ao_log_check(uint32_t pos) +{ + if (!ao_storage_read(pos, + &log, + sizeof (struct ao_log_gps))) + return 0; + + if (ao_log_dump_check_data()) + return 1; + return 0; +} diff --git a/src/telegps-v1.0/ao_pins.h b/src/telegps-v1.0/ao_pins.h index 5f53dd9d..d2382a56 100644 --- a/src/telegps-v1.0/ao_pins.h +++ b/src/telegps-v1.0/ao_pins.h @@ -71,11 +71,11 @@ #define HAS_GPS 1 #define HAS_FLIGHT 0 #define HAS_LOG 1 +#define FLIGHT_LOG_APPEND 1 #define HAS_TRACKER 1 #define AO_CONFIG_DEFAULT_APRS_INTERVAL 0 #define AO_CONFIG_DEFAULT_RADIO_POWER 0xc0 -#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX 496 * 1024 /* * GPS -- cgit v1.2.3 From 5a51efd7f9b49ffadc91ccaf7a0d69566301c009 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 26 Jun 2014 16:29:37 -0700 Subject: altosui: Make Windows java test "smarter" Or at least have it try more options, and then finally ask the user before downloading and installing java Signed-off-by: Keith Packard --- altosui/Instdrv/NSIS/Includes/java.nsh | 126 +++++++++++++++++++++++++++++++-- altosui/Makefile.am | 2 +- 2 files changed, 122 insertions(+), 6 deletions(-) diff --git a/altosui/Instdrv/NSIS/Includes/java.nsh b/altosui/Instdrv/NSIS/Includes/java.nsh index ebf1c5b9..cd47c1b5 100644 --- a/altosui/Instdrv/NSIS/Includes/java.nsh +++ b/altosui/Instdrv/NSIS/Includes/java.nsh @@ -32,19 +32,135 @@ Function GetJRE Delete $2 FunctionEnd -Function DetectJRE +Function DoDetectJRE + + DetailPrint "Desired Java version ${JRE_VERSION}" + + ; Check in HKCU for CurrentVersion + + ClearErrors + ReadRegStr $2 HKCU "SOFTWARE\JavaSoft\Java Runtime Environment" \ + "CurrentVersion" + + IfErrors hklm_version + + DetailPrint "HKEY_CURRENT_USER Java version $2" + + ${VersionCompare} $2 ${JRE_VERSION} $3 + + IntCmp $3 1 yes yes no + +hklm_version: + + ; Check in HKLM for CurrentVersion + + ClearErrors ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ "CurrentVersion" + + IfErrors hkcu_any - DetailPrint "Desired Java version ${JRE_VERSION}" - DetailPrint "Actual Java version $2" + DetailPrint "HKEY_LOCAL_MACHINE Java version $2" ${VersionCompare} $2 ${JRE_VERSION} $3 - IntCmp $3 1 done done + IntCmp $3 1 yes yes no - Call GetJRE +hkcu_any: + + ; Check in HKCU for any Java install + + StrCpy $0 0 + +hkcu_any_loop: + EnumRegKey $1 HKCU "SOFTWARE\JavaSoft" $0 + + StrCmp $1 "Java Runtime Environment" found_hkcu + + StrCmp $1 "" hklm_any + + IntOp $0 $0 + 1 + + Goto hkcu_any_loop + +found_hkcu: + + DetailPrint "HKEY_CURRENT_USER has SOFTWARE\JavaSoft\$1" + + Goto maybe + +hklm_any: + + ; Check in HKCU for any Java install + + StrCpy $0 0 + +hklm_any_loop: + EnumRegKey $1 HKLM "SOFTWARE\JavaSoft" $0 + + StrCmp $1 "Java Runtime Environment" found_hklm + + StrCmp $1 "" no + + IntOp $0 $0 + 1 + + Goto hklm_any_loop + +found_hklm: + + DetailPrint "HKEY_CURRENT_USER has SOFTWARE\JavaSoft\$1" + + Goto maybe + +yes: + StrCpy $0 2 + Goto done + +maybe: + StrCpy $0 1 + Goto done + +no: + StrCpy $0 0 + Goto done done: FunctionEnd + +var dialog +var hwnd +var null + +var install +var quit +var skip + +Function DetectJRE + + Call DoDetectJRE + + IntCmp $0 1 ask_maybe ask_no yes + +ask_no: + StrCpy $0 "No Java detected. Download and install?" + Goto ask + +ask_maybe: + StrCpy $0 "Cannot determine installed Java version. Download and install?" + Goto ask + +ask: + MessageBox MB_YESNOCANCEL $0 IDYES do_java IDNO skip_java + +bail: + Abort + +do_java: + Call GetJRE + + +skip_java: +yes: + +FunctionEnd diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 44258fd2..77be1640 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -354,6 +354,6 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile cp -p $(MACOSX_EXTRA) macosx/AltOS-$(VERSION) genisoimage -D -V AltOS-$(VERSION) -no-pad -r -apple -o $@ macosx -$(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi +$(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi Instdrv/NSIS/Includes/java.nsh -rm -f $@ makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi || (cat altos-windows.log && exit 1) -- cgit v1.2.3 From 44e389c31e5958c1a050fbe0dce5d7971a9d6a86 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Aug 2014 21:03:12 -0700 Subject: altos: Add telerepeat-v1.0 This uses TeleBT hardware to provide a telemetry repeater, receiving packets on one frequency and re-transmitting them on another. Signed-off-by: Keith Packard --- src/Makefile | 3 +- src/kernel/ao_config.c | 41 +++++++++++++ src/kernel/ao_config.h | 9 ++- src/kernel/ao_forward.c | 48 ++++++++++++++++ src/kernel/ao_forward.h | 24 ++++++++ src/telerepeat-v1.0/Makefile | 100 ++++++++++++++++++++++++++++++++ src/telerepeat-v1.0/ao_pins.h | 111 ++++++++++++++++++++++++++++++++++++ src/telerepeat-v1.0/ao_telerepeat.c | 47 +++++++++++++++ 8 files changed, 381 insertions(+), 2 deletions(-) create mode 100644 src/kernel/ao_forward.c create mode 100644 src/kernel/ao_forward.h create mode 100644 src/telerepeat-v1.0/Makefile create mode 100644 src/telerepeat-v1.0/ao_pins.h create mode 100644 src/telerepeat-v1.0/ao_telerepeat.c diff --git a/src/Makefile b/src/Makefile index 7f09db02..20126de6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,7 +22,8 @@ SDCCDIRS=\ telemini-v1.0 telemini-v2.0 \ telebt-v1.0 \ teleterra-v0.2 teleshield-v0.1 \ - telefire-v0.1 telefire-v0.2 + telefire-v0.1 telefire-v0.2 \ + telerepeat-v1.0 ARMM3DIRS=\ easymega-v1.0 easymega-v1.0/flash-loader \ diff --git a/src/kernel/ao_config.c b/src/kernel/ao_config.c index d1b93122..6b8a1813 100644 --- a/src/kernel/ao_config.c +++ b/src/kernel/ao_config.c @@ -93,10 +93,18 @@ ao_config_put(void) #endif #if HAS_RADIO + +#if HAS_RADIO_FORWARD +__xdata uint32_t ao_send_radio_setting; +#endif + void ao_config_set_radio(void) { ao_config.radio_setting = ao_freq_to_set(ao_config.frequency, ao_config.radio_cal); +#if HAS_RADIO_FORWARD + ao_send_radio_setting = ao_freq_to_set(ao_config.send_frequency, ao_config.radio_cal); +#endif } #endif /* HAS_RADIO */ @@ -207,6 +215,10 @@ _ao_config_get(void) #if HAS_RADIO_RATE if (minor < 20) ao_config.radio_rate = AO_CONFIG_DEFAULT_RADIO_RATE; +#endif +#if HAS_RADIO_FORWARD + if (minor < 21) + ao_config.send_frequency = 434550; #endif ao_config.minor = AO_CONFIG_MINOR; ao_config_dirty = 1; @@ -302,6 +314,31 @@ ao_config_frequency_set(void) __reentrant #endif +#if HAS_RADIO_FORWARD +void +ao_config_send_frequency_show(void) __reentrant +{ + printf("Send frequency: %ld\n", + ao_config.send_frequency); +} + +void +ao_config_send_frequency_set(void) __reentrant +{ + ao_cmd_decimal(); + if (ao_cmd_status != ao_cmd_success) + return; + _ao_config_edit_start(); + ao_config.send_frequency = ao_cmd_lex_u32; + ao_config_set_radio(); + _ao_config_edit_finish(); +#if HAS_RADIO_RECV + ao_radio_recv_abort(); +#endif +} + +#endif + #if HAS_FLIGHT void @@ -863,6 +900,10 @@ __code struct ao_config_var ao_config_vars[] = { #if HAS_RADIO { "F \0Frequency (kHz)", ao_config_frequency_set, ao_config_frequency_show }, +#if HAS_RADIO_FORWARD + { "R \0Repeater output frequency (kHz)", + ao_config_send_frequency_set, ao_config_send_frequency_show }, +#endif { "c \0Callsign (8 char max)", ao_config_callsign_set, ao_config_callsign_show }, { "e <0 disable, 1 enable>\0Enable telemetry and RDF", diff --git a/src/kernel/ao_config.h b/src/kernel/ao_config.h index 0be3e14d..164584a5 100644 --- a/src/kernel/ao_config.h +++ b/src/kernel/ao_config.h @@ -57,7 +57,7 @@ #endif #define AO_CONFIG_MAJOR 1 -#define AO_CONFIG_MINOR 20 +#define AO_CONFIG_MINOR 21 #define AO_AES_LEN 16 @@ -112,8 +112,15 @@ struct ao_config { #if HAS_RADIO_RATE uint8_t radio_rate; /* minor version 20 */ #endif +#if HAS_RADIO_FORWARD + uint32_t send_frequency; /* minor version 21 */ +#endif }; +#if HAS_RADIO_FORWARD +extern __xdata uint32_t ao_send_radio_setting; +#endif + #define AO_IGNITE_MODE_DUAL 0 #define AO_IGNITE_MODE_APOGEE 1 #define AO_IGNITE_MODE_MAIN 2 diff --git a/src/kernel/ao_forward.c b/src/kernel/ao_forward.c new file mode 100644 index 00000000..2a937183 --- /dev/null +++ b/src/kernel/ao_forward.c @@ -0,0 +1,48 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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_telem.h" + +static void +ao_monitor_forward(void) +{ + uint32_t recv_radio_setting; + static __xdata struct ao_telemetry_all_recv packet; + + for (;;) { + while (ao_monitoring) + ao_sleep(DATA_TO_XDATA(&ao_monitoring)); + + if (!ao_radio_recv(&packet, sizeof(packet), 0)) + continue; + if (!(packet.status & PKT_APPEND_STATUS_1_CRC_OK)) + continue; + recv_radio_setting = ao_config.radio_setting; + ao_config.radio_setting = ao_send_radio_setting; + ao_radio_send(&packet.telemetry, sizeof (packet.telemetry)); + ao_config.radio_setting = recv_radio_setting; + } +} + +static __xdata struct ao_task ao_monitor_forward_task; + +void +ao_monitor_forward_init(void) __reentrant +{ + ao_add_task(&ao_monitor_forward_task, ao_monitor_forward, "monitor_forward"); +} diff --git a/src/kernel/ao_forward.h b/src/kernel/ao_forward.h new file mode 100644 index 00000000..1897dc08 --- /dev/null +++ b/src/kernel/ao_forward.h @@ -0,0 +1,24 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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_FORWARD_H_ +#define _AO_FORWARD_H_ + +void +ao_monitor_forward_init(void) __reentrant; + +#endif /* _AO_FORWARD_H_ */ diff --git a/src/telerepeat-v1.0/Makefile b/src/telerepeat-v1.0/Makefile new file mode 100644 index 00000000..17f68377 --- /dev/null +++ b/src/telerepeat-v1.0/Makefile @@ -0,0 +1,100 @@ +# +# TeleRepeat build file +# + +TELEREPEAT_VER=1.0 +TELEREPEAT_DEF=1_0 + +vpath %.c ..:../kernel:../cc1111:../drivers:../product +vpath %.h ..:../kernel:../cc1111:../drivers:../product +vpath ao-make-product.5c ../util + +ifndef VERSION +include ../Version +endif + +INC = \ + ao.h \ + ao_pins.h \ + ao_arch.h \ + ao_arch_funcs.h \ + cc1111.h \ + ao_product.h + +CORE_SRC = \ + ao_cmd.c \ + ao_config.c \ + ao_monitor.c \ + ao_mutex.c \ + ao_panic.c \ + ao_state.c \ + ao_stdio.c \ + ao_task.c \ + ao_forward.c \ + ao_storage.c \ + ao_freq.c + +CC1111_SRC = \ + ao_dbg.c \ + ao_adc.c \ + ao_dma.c \ + ao_led.c \ + ao_packet.c \ + ao_intflash.c \ + ao_packet_master.c \ + ao_radio.c \ + ao_romconfig.c \ + ao_serial.c \ + ao_string.c \ + ao_timer.c \ + ao_usb.c \ + _bp.c + +DRIVER_SRC = \ + ao_btm.c + +PRODUCT_SRC = \ + ao_telerepeat.c + +SRC = \ + $(CORE_SRC) \ + $(CC1111_SRC) \ + $(DRIVER_SRC) \ + $(PRODUCT_SRC) + +PROGNAME = telerepeat-v$(TELEREPEAT_VER) +PROG = $(PROGNAME)-$(VERSION).ihx +PRODUCT=TeleRepeat-v$(TELEREPEAT_VER) +PRODUCT_DEF=-DTELEREPEAT_V_$(TELEREPEAT_DEF) +IDPRODUCT=0x000e +CODESIZE=0x7800 + +include ../cc1111/Makefile.cc1111 + +NICKLE=nickle +CHECK_STACK=sh ../util/check-stack + +V=0 +# The user has explicitly enabled quiet compilation. +ifeq ($(V),0) +quiet = @printf " $1 $2 $@\n"; $($1) +endif +# Otherwise, print the full command line. +quiet ?= $($1) + +all: $(PROG) + +$(PROG): $(REL) Makefile + $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) + $(call quiet,CHECK_STACK) ../cc1111/ao_arch.h $(PMEM) || rm $@ + +ao_product.h: ao-make-product.5c ../Version + $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@ + +distclean: clean + +clean: clean-cc1111 + +install: + +uninstall: diff --git a/src/telerepeat-v1.0/ao_pins.h b/src/telerepeat-v1.0/ao_pins.h new file mode 100644 index 00000000..2a7dbd3b --- /dev/null +++ b/src/telerepeat-v1.0/ao_pins.h @@ -0,0 +1,111 @@ +/* + * Copyright © 2010 Keith Packard + * + * 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; version 2 of the License. + * + * 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_RADIO 1 +#define HAS_RADIO_FORWARD 1 +#define HAS_FLIGHT 0 +#define HAS_USB 1 +#define HAS_BEEP 0 +#define HAS_SERIAL_1 1 +#define HAS_SERIAL_1_ALT_1 1 +#define HAS_SERIAL_1_ALT_2 0 +#define HAS_SERIAL_1_HW_FLOW 1 +#define USE_SERIAL_1_STDIN 1 +#define DELAY_SERIAL_1_STDIN 1 +#define HAS_DBG 1 +#define HAS_EEPROM 1 +#define HAS_LOG 0 +#define USE_INTERNAL_FLASH 1 +#define HAS_BTM 1 +#define DBG_ON_P1 1 +#define DBG_ON_P0 0 +#define PACKET_HAS_MASTER 1 +#define PACKET_HAS_SLAVE 0 +#define AO_LED_RED 1 +#define AO_LED_BLUE 2 +#define LEDS_AVAILABLE (AO_LED_RED|AO_LED_BLUE) +#define AO_MONITOR_LED AO_LED_RED +#define AO_BT_LED AO_LED_BLUE +#define BT_LINK_ON_P2 0 +#define BT_LINK_ON_P1 1 +#define BT_LINK_PIN_INDEX 7 +#define BT_LINK_PIN P1_7 +#define HAS_MONITOR 1 +#define HAS_MONITOR_PUT 1 +#define LEGACY_MONITOR 0 +#define HAS_TELEMETRY 0 +#define AO_RADIO_REG_TEST 1 + +#define HAS_ADC 1 +#define AO_PAD_ADC_BATT 0 +#define AO_ADC_PINS (1 << AO_PAD_ADC_BATT) + +struct ao_adc { + int16_t batt; +}; + +#define AO_ADC_DUMP(p) \ + printf ("tick: %5u batt %5d\n", \ + (p)->tick, \ + (p)->adc.batt) + +#define FETCH_ADC() do { \ + a = (uint8_t __xdata *) (&ao_data_ring[ao_data_head].adc.batt); \ + a[0] = ADCL; \ + a[1] = ADCH; \ + } while (0) + +#if DBG_ON_P1 + + #define DBG_CLOCK (1 << 4) /* mi0 */ + #define DBG_DATA (1 << 5) /* mo0 */ + #define DBG_RESET_N (1 << 3) /* c0 */ + + #define DBG_CLOCK_PIN (P1_4) + #define DBG_DATA_PIN (P1_5) + #define DBG_RESET_N_PIN (P1_3) + + #define DBG_PORT_NUM 1 + #define DBG_PORT P1 + #define DBG_PORT_SEL P1SEL + #define DBG_PORT_INP P1INP + #define DBG_PORT_DIR P1DIR + +#endif /* DBG_ON_P1 */ + +#if DBG_ON_P0 + + #define DBG_CLOCK (1 << 3) + #define DBG_DATA (1 << 4) + #define DBG_RESET_N (1 << 5) + + #define DBG_CLOCK_PIN (P0_3) + #define DBG_DATA_PIN (P0_4) + #define DBG_RESET_N_PIN (P0_5) + + #define DBG_PORT_NUM 0 + #define DBG_PORT P0 + #define DBG_PORT_SEL P0SEL + #define DBG_PORT_INP P0INP + #define DBG_PORT_DIR P0DIR + +#endif /* DBG_ON_P0 */ + +#endif /* _AO_PINS_H_ */ diff --git a/src/telerepeat-v1.0/ao_telerepeat.c b/src/telerepeat-v1.0/ao_telerepeat.c new file mode 100644 index 00000000..21bf8a73 --- /dev/null +++ b/src/telerepeat-v1.0/ao_telerepeat.c @@ -0,0 +1,47 @@ +/* + * Copyright © 2011 Keith Packard + * + * 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; version 2 of the License. + * + * 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_forward.h" + +void +main(void) +{ + ao_clock_init(); + + /* Turn on the LED until the system is stable */ + ao_led_init(LEDS_AVAILABLE); + ao_led_on(AO_LED_RED); + + ao_task_init(); + + ao_timer_init(); + ao_cmd_init(); + ao_usb_init(); + ao_monitor_init(); + ao_radio_init(); + ao_packet_master_init(); + ao_adc_init(); + ao_btm_init(); + ao_monitor_forward_init(); + ao_storage_init(); +#if HAS_DBG + ao_dbg_init(); +#endif + ao_config_init(); + ao_start_scheduler(); +} -- cgit v1.2.3 From b357544dd64f5b0f209c6cc6cb4fa392a2c3e1fa Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Mon, 18 Aug 2014 11:25:32 -0600 Subject: turn echo back on after accel cal in turnon_telemetrum so rest is easier --- ao-bringup/turnon_telemetrum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ao-bringup/turnon_telemetrum b/ao-bringup/turnon_telemetrum index 588c7f31..c6e7d1cc 100755 --- a/ao-bringup/turnon_telemetrum +++ b/ao-bringup/turnon_telemetrum @@ -54,3 +54,5 @@ echo 'E 0' > $dev SERIAL=$SERIAL ./cal-freq $dev ./cal-accel $dev + +echo 'E 1' > $dev -- cgit v1.2.3 From fac03ae9762f2af95b1ce5d99894173f9d9146f0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 18 Aug 2014 10:53:04 -0700 Subject: Add ao-tools/ao-cal-accel This C version may be more reliable than the nickle version Signed-off-by: Keith Packard --- ao-tools/Makefile.am | 2 +- ao-tools/ao-cal-accel/.gitignore | 1 + ao-tools/ao-cal-accel/Makefile.am | 11 ++ ao-tools/ao-cal-accel/ao-cal-accel.1 | 58 +++++++ ao-tools/ao-cal-accel/ao-cal-accel.c | 284 +++++++++++++++++++++++++++++++++++ configure.ac | 1 + 6 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 ao-tools/ao-cal-accel/.gitignore create mode 100644 ao-tools/ao-cal-accel/Makefile.am create mode 100644 ao-tools/ao-cal-accel/ao-cal-accel.1 create mode 100644 ao-tools/ao-cal-accel/ao-cal-accel.c diff --git a/ao-tools/Makefile.am b/ao-tools/Makefile.am index 4526f514..2d873e50 100644 --- a/ao-tools/Makefile.am +++ b/ao-tools/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS=lib ao-rawload ao-dbg ao-bitbang ao-eeprom ao-list \ ao-load ao-telem ao-send-telem ao-sky-flash \ ao-dumpflash ao-edit-telem ao-dump-up ao-elftohex \ ao-flash ao-usbload ao-test-igniter ao-test-baro \ - ao-test-flash + ao-test-flash ao-cal-accel if LIBSTLINK SUBDIRS += ao-stmload endif diff --git a/ao-tools/ao-cal-accel/.gitignore b/ao-tools/ao-cal-accel/.gitignore new file mode 100644 index 00000000..73402b2b --- /dev/null +++ b/ao-tools/ao-cal-accel/.gitignore @@ -0,0 +1 @@ +ao-cal-accel diff --git a/ao-tools/ao-cal-accel/Makefile.am b/ao-tools/ao-cal-accel/Makefile.am new file mode 100644 index 00000000..d278097a --- /dev/null +++ b/ao-tools/ao-cal-accel/Makefile.am @@ -0,0 +1,11 @@ +bin_PROGRAMS=ao-cal-accel + +AM_CFLAGS=-I$(top_srcdir)/ao-tools/lib $(LIBUSB_CFLAGS) + +ao_cal_accel_DEPENDENCIES = $(top_builddir)/ao-tools/lib/libao-tools.a + +ao_cal_accel_LDADD=$(top_builddir)/ao-tools/lib/libao-tools.a $(LIBUSB_LIBS) + +ao_cal_accel_SOURCES=ao-cal-accel.c + +man_MANS = ao-cal-accel.1 diff --git a/ao-tools/ao-cal-accel/ao-cal-accel.1 b/ao-tools/ao-cal-accel/ao-cal-accel.1 new file mode 100644 index 00000000..eb75d7c7 --- /dev/null +++ b/ao-tools/ao-cal-accel/ao-cal-accel.1 @@ -0,0 +1,58 @@ +.\" +.\" Copyright © 2009 Keith Packard +.\" +.\" 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. +.\" +.\" +.TH AO-LOAD 1 "ao-cal-accel" "" +.SH NAME +ao-cal-accel \- Calibrate AltOS flight computer accelerometers +.SH SYNOPSIS +.B "ao-cal-accel" +[\-T \fItty-device\fP] +[\--tty \fItty-device\fP] +[\-D \fIaltos-device\fP] +[\--device \fIaltos-device\fP] +.SH DESCRIPTION +.I ao-cal-accel +drives the built-in accelerometer calibration and validates the results. +.SH OPTIONS +.TP +\-T tty-device | --tty tty-device +This selects which tty device the debugger uses to communicate with +the target device. The special name 'BITBANG' directs ao-dbg to use +the cp2103 connection, otherwise this should be a usb serial port +connected to a suitable cc1111 debug node. +.TP +\-D AltOS-device | --device AltOS-device +Search for a connected device. This requires an argument of one of the +following forms: +.IP +TeleMega:2 +.br +TeleMega +.br +2 +.IP +Leaving out the product name will cause the tool to select a suitable +product, leaving out the serial number will cause the tool to match +one of the available devices. +.SH USAGE +.I ao-cal-accel +opens the target device, executes the accelerometer calibration +command, verifies that it executed correctly, then shows the resulting +calibration values and saves them to configuration memory. +.SH AUTHOR +Keith Packard diff --git a/ao-tools/ao-cal-accel/ao-cal-accel.c b/ao-tools/ao-cal-accel/ao-cal-accel.c new file mode 100644 index 00000000..9a988648 --- /dev/null +++ b/ao-tools/ao-cal-accel/ao-cal-accel.c @@ -0,0 +1,284 @@ +/* + * Copyright © 2014 Keith Packard + * + * 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; version 2 of the License. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ao-elf.h" +#include "ccdbg.h" +#include "cc-usb.h" +#include "cc.h" +#include "ao-verbose.h" + +static const struct option options[] = { + { .name = "tty", .has_arg = 1, .val = 'T' }, + { .name = "device", .has_arg = 1, .val = 'D' }, + { .name = "raw", .has_arg = 0, .val = 'r' }, + { .name = "verbose", .has_arg = 1, .val = 'v' }, + { 0, 0, 0, 0}, +}; + +static void usage(char *program) +{ + fprintf(stderr, "usage: %s [--verbose=] [--device=] [-tty=]\n", program); + exit(1); +} + +void +done(struct cc_usb *cc, int code) +{ + cc_usb_close(cc); + exit (code); +} + +static int +ends_with(char *whole, char *suffix) +{ + int whole_len = strlen(whole); + int suffix_len = strlen(suffix); + + if (suffix_len > whole_len) + return 0; + return strcmp(whole + whole_len - suffix_len, suffix) == 0; +} + +static int +starts_with(char *whole, char *prefix) +{ + int whole_len = strlen(whole); + int prefix_len = strlen(prefix); + + if (prefix_len > whole_len) + return 0; + return strncmp(whole, prefix, prefix_len) == 0; +} + +static char ** +tok(char *line) { + char **strs = malloc (sizeof (char *)), *str; + int n = 0; + + while ((str = strtok(line, " \t"))) { + line = NULL; + strs = realloc(strs, (n + 2) * sizeof (char *)); + strs[n] = strdup(str); + n++; + } + strs[n] = '\0'; + return strs; +} + +static void +free_strs(char **strs) { + char *str; + int i; + + for (i = 0; (str = strs[i]) != NULL; i++) + free(str); + free(strs); +} + +struct flash { + struct flash *next; + char line[512]; + char **strs; +}; + +static struct flash * +flash(struct cc_usb *usb) +{ + struct flash *head = NULL, **tail = &head; + cc_usb_printf(usb, "c s\nv\n"); + for (;;) { + char line[512]; + struct flash *b; + + cc_usb_getline(usb, line, sizeof (line)); + b = malloc (sizeof (struct flash)); + strcpy(b->line, line); + b->strs = tok(line); + b->next = NULL; + *tail = b; + tail = &b->next; + if (strstr(line, "software-version")) + break; + } + return head; +} + +static void +free_flash(struct flash *b) { + struct flash *n; + + while (b) { + n = b->next; + free_strs(b->strs); + free(b); + b = n; + } +} + +char ** +find_flash(struct flash *b, char *word0) { + int i; + for (;b; b = b->next) { + if (strstr(b->line, word0)) + return b->strs; + } + return NULL; +} + +void +await_key(void) +{ + struct termios termios, termios_save; + char buf[512]; + + tcgetattr(0, &termios); + termios_save = termios; + cfmakeraw(&termios); + tcsetattr(0, TCSAFLUSH, &termios); + read(0, buf, sizeof (buf)); + tcsetattr(0, TCSAFLUSH, &termios_save); +} + +int +do_cal(struct cc_usb *usb) { + struct flash *b; + char **accel; + char line[1024]; + int l; + int running = 0; + int worked = 1; + + cc_usb_printf(usb, "E 1\nc a 0\n"); + + for (;;) { + int c = cc_usb_getchar_timeout(usb, 20*1000); + + if (c == '\n') + l = 0; + else if (l < sizeof (line) - 1) + line[l++] = c; + line[l] = '\0'; + putchar(c); fflush(stdout); + if (strstr(line, "press a key...")) { + await_key(); + cc_usb_printf(usb, " "); + l = 0; + running = 1; + } + else if (strstr(line, "Invalid")) + worked = 0; + if (running && strstr(line, ">")) { + printf("\n"); + break; + } + } + cc_usb_printf(usb, "E 0\n"); + + if (!worked) { + printf("Calibration failed\n"); + return 0; + } + + b = flash(usb); + + accel = find_flash(b, "Accel cal"); + if (!accel) { + printf("no response\n"); + return 0; + } + + printf ("Accel cal +1g: %s -1g: %s\n", + accel[3], accel[5]); + + printf ("Saving..."); fflush(stdout); + cc_usb_printf (usb, "c w\n"); + cc_usb_sync(usb); + b = flash(usb); + printf ("done\n"); + + return worked; +} + +int +main (int argc, char **argv) +{ + char *device = NULL; + char *filename; + Elf *e; + unsigned int s; + int i; + int c; + int tries; + struct cc_usb *cc = NULL; + char *tty = NULL; + int success; + int verbose = 0; + int ret = 0; + int expected_size; + + while ((c = getopt_long(argc, argv, "rT:D:c:s:v:", options, NULL)) != -1) { + switch (c) { + case 'T': + tty = optarg; + break; + case 'D': + device = optarg; + break; + case 'v': + verbose++; + break; + default: + usage(argv[0]); + break; + } + } + + ao_verbose = verbose; + + if (verbose > 1) + ccdbg_add_debug(CC_DEBUG_BITBANG); + + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "AltosFlash"); + if (!tty) + tty = cc_usbdevs_find_by_arg(device, "TeleMega"); + if (!tty) + tty = getenv("ALTOS_TTY"); + if (!tty) + tty="/dev/ttyACM0"; + + cc = cc_usb_open(tty); + + if (!cc) + exit(1); + + if (!do_cal(cc)) + ret = 1; + done(cc, ret); +} diff --git a/configure.ac b/configure.ac index 38bab8e1..683da846 100644 --- a/configure.ac +++ b/configure.ac @@ -537,6 +537,7 @@ ao-tools/ao-flash/Makefile ao-tools/ao-test-igniter/Makefile ao-tools/ao-test-baro/Makefile ao-tools/ao-test-flash/Makefile +ao-tools/ao-cal-accel/Makefile ao-utils/Makefile src/Version ]) -- cgit v1.2.3 From 3c9cb4836edd4811fcdbb6ebbd25eb507a2ef5b1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 18 Aug 2014 10:57:26 -0700 Subject: ao-bringup: Use ao-cal-accel instead of cal-accel in turnon scripts Signed-off-by: Keith Packard --- ao-bringup/turnon_easymega | 2 +- ao-bringup/turnon_telemega | 2 +- ao-bringup/turnon_telemetrum | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ao-bringup/turnon_easymega b/ao-bringup/turnon_easymega index 7d23f5f7..3fdb942d 100755 --- a/ao-bringup/turnon_easymega +++ b/ao-bringup/turnon_easymega @@ -52,6 +52,6 @@ esac echo 'E 0' > $dev -./cal-accel $dev +../ao-tools/ao-cal-accel/ao-cal-accel $dev echo 'E 1' > $dev diff --git a/ao-bringup/turnon_telemega b/ao-bringup/turnon_telemega index 39a63642..9705798a 100755 --- a/ao-bringup/turnon_telemega +++ b/ao-bringup/turnon_telemega @@ -54,4 +54,4 @@ echo 'E 0' > $dev SERIAL=$SERIAL ./cal-freq $dev -./cal-accel $dev +../ao-tools/ao-cal-accel/ao-cal-accel $dev diff --git a/ao-bringup/turnon_telemetrum b/ao-bringup/turnon_telemetrum index c6e7d1cc..48ff1e27 100755 --- a/ao-bringup/turnon_telemetrum +++ b/ao-bringup/turnon_telemetrum @@ -20,7 +20,7 @@ echo "TeleMetrum v$VERSION Turn-On and Calibration Program" echo "Copyright 2014 by Bdale Garbee. Released under GPL v2" echo echo "Expectations:" -echo "\tTeleMetrum v$VERSIOn powered from USB" +echo "\tTeleMetrum v$VERSION powered from USB" echo "\t\twith ST-Link-V2 cabled to debug header" echo "\t\twith coax from UHF to frequency counter" echo @@ -53,6 +53,6 @@ echo 'E 0' > $dev SERIAL=$SERIAL ./cal-freq $dev -./cal-accel $dev +../ao-tools/ao-cal-accel/ao-cal-accel $dev echo 'E 1' > $dev -- cgit v1.2.3 From 54994d02a5ca5bb91512f31748a48a0140d3a640 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 28 Aug 2014 19:52:30 -0700 Subject: ao-bringup: Test EasyMega boards --- ao-bringup/test-easymega | 68 ++++++++++++++++++++++++++++++++++++++++++++++ ao-bringup/turnon_easymega | 4 +++ 2 files changed, 72 insertions(+) create mode 100755 ao-bringup/test-easymega diff --git a/ao-bringup/test-easymega b/ao-bringup/test-easymega new file mode 100755 index 00000000..eabe1ee5 --- /dev/null +++ b/ao-bringup/test-easymega @@ -0,0 +1,68 @@ +#!/bin/sh + +VERSION=1.0 +PRODUCT=EasyMega +BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'` + +echo "$PRODUCT-v$VERSION Test Program" +echo "Copyright 2014 by Keith Packard. Released under GPL v2" +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" + + for igniter in drogue main 0 1 2 3; do + echo "Testing $igniter igniter." + echo -n "Press enter to continue..." + read foo < /dev/tty + ../ao-tools/ao-test-igniter/ao-test-igniter --tty="$dev" $igniter + + case $? in + 0) + ;; + *) + echo "failed" + exit 1 + ;; + esac + done + + echo "Testing baro sensor" + ../ao-tools/ao-test-baro/ao-test-baro --tty="$dev" + + case $? in + 0) + ;; + *) + echo "failed" + exit 1 + esac + + 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 "$PRODUCT-v$VERSION" serial "$serial" is ready to ship + ret=0 + ;; + *) + echo "Skipping $product $serial $dev" + ;; + esac +done diff --git a/ao-bringup/turnon_easymega b/ao-bringup/turnon_easymega index 3fdb942d..b313e162 100755 --- a/ao-bringup/turnon_easymega +++ b/ao-bringup/turnon_easymega @@ -55,3 +55,7 @@ echo 'E 0' > $dev ../ao-tools/ao-cal-accel/ao-cal-accel $dev echo 'E 1' > $dev + +./test-easymega + +exit $? -- cgit v1.2.3 From 5872bd10df14b47de0e541bff16d9220af0558aa Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 29 Aug 2014 15:12:38 -0500 Subject: altos: Make sure pyro remains valid during delay Keep checking pyro status while waiting for delay to expire to make sure nothing changes. Disable pyro channel if something does. Signed-off-by: Keith Packard --- src/kernel/ao_pyro.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/kernel/ao_pyro.c b/src/kernel/ao_pyro.c index 0b286466..154edad5 100644 --- a/src/kernel/ao_pyro.c +++ b/src/kernel/ao_pyro.c @@ -252,7 +252,7 @@ ao_pyro_check(void) struct ao_pyro *pyro; uint8_t p, any_waiting; uint16_t fire = 0; - + any_waiting = 0; for (p = 0; p < AO_PYRO_NUM; p++) { pyro = &ao_config.pyro[p]; @@ -288,6 +288,16 @@ ao_pyro_check(void) * the delay to expire */ if (pyro->delay_done) { + + /* Check to make sure the required conditions + * remain valid. If not, inhibit the channel + * by setting the fired bit + */ + if (!ao_pyro_ready(pyro)) { + pyro->fired = 1; + continue; + } + if ((int16_t) (ao_time() - pyro->delay_done) < 0) continue; } @@ -465,7 +475,7 @@ ao_pyro_set(void) printf ("invalid pyro channel %d\n", p); return; } - pyro_tmp.flags = 0; + memset(&pyro_tmp, '\0', sizeof (pyro_tmp)); for (;;) { ao_cmd_white(); if (ao_cmd_lex_c == '\n') -- cgit v1.2.3 From 810f9a4f79b0480973d84595140d3f8948ce26d9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 29 Aug 2014 15:22:43 -0500 Subject: altosdroid: start restoring from log data on startup Remember which flight was last being received and reload that file Signed-off-by: Keith Packard --- .../src/org/altusmetrum/AltosDroid/AltosDroid.java | 16 ++-- .../AltosDroid/AltosDroidPreferences.java | 89 +++++----------------- altoslib/AltosFlightReader.java | 8 +- altoslib/AltosLog.java | 1 + altoslib/AltosPreferences.java | 27 +++++++ altoslib/AltosReplayReader.java | 11 ++- altoslib/AltosStateIterable.java | 14 ++++ altoslib/AltosTelemetryReader.java | 31 +++++++- 8 files changed, 111 insertions(+), 86 deletions(-) diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index c9c38d98..c94f36fd 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -101,9 +101,6 @@ public class AltosDroid extends FragmentActivity { private Messenger mService = null; final Messenger mMessenger = new Messenger(new IncomingHandler(this)); - // Preferences - private AltosDroidPreferences prefs = null; - // TeleBT Config data private AltosConfigData mConfigData = null; // Local Bluetooth adapter @@ -343,8 +340,7 @@ public class AltosDroid extends FragmentActivity { } // Initialise preferences - prefs = new AltosDroidPreferences(this); - AltosPreferences.init(prefs); + AltosDroidPreferences.init(this); // Set up the window layout requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); @@ -480,9 +476,7 @@ public class AltosDroid extends FragmentActivity { } } - private void connectDevice(Intent data) { - // Get the device MAC address - String address = data.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS); + private void connectDevice(String address) { // Get the BLuetoothDevice object BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address); // Attempt to connect to the device @@ -493,6 +487,12 @@ public class AltosDroid extends FragmentActivity { } } + private void connectDevice(Intent data) { + // Get the device MAC address + String address = data.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS); + connectDevice(address); + } + @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java index 70d7def8..7c12c9a0 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright © 2012 Mike Beattie + * Copyright © 2014 Keith Packard * * 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 @@ -14,88 +14,35 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ - package org.altusmetrum.AltosDroid; -import java.io.File; -import java.util.Map; import android.content.Context; -import android.content.SharedPreferences; -import android.os.Environment; - import org.altusmetrum.altoslib_5.*; -public class AltosDroidPreferences implements AltosPreferencesBackend { - public final static String NAME = "org.altusmetrum.AltosDroid"; - private Context context = null; - private SharedPreferences prefs = null; - private SharedPreferences.Editor editor = null; +public class AltosDroidPreferences extends AltosPreferences { - public AltosDroidPreferences(Context in_context) { - this(in_context, NAME); - } + /* Active device preference name */ + final static String activeDevicePreference = "ACTIVE-DEVICE"; - public AltosDroidPreferences(Context in_context, String in_prefs) { - context = in_context; - prefs = context.getSharedPreferences(in_prefs, 0); - editor = prefs.edit(); - } + static String active_device_address; - public String[] keys() { - Map all = prefs.getAll(); - return (String[])all.keySet().toArray(); - } - - public AltosPreferencesBackend node(String key) { - return new AltosDroidPreferences(context, key); - } - - public boolean nodeExists(String key) { - return prefs.contains(key); - } - - public boolean getBoolean(String key, boolean def) { - return prefs.getBoolean(key, def); - } - - public double getDouble(String key, double def) { - Float f = Float.valueOf(prefs.getFloat(key, (float)def)); - return f.doubleValue(); - } - - public int getInt(String key, int def) { - return prefs.getInt(key, def); - } - - public String getString(String key, String def) { - return prefs.getString(key, def); - } - - public void putBoolean(String key, boolean value) { - editor.putBoolean(key, value); - } - - public void putDouble(String key, double value) { - editor.putFloat(key, (float)value); - } - - public void putInt(String key, int value) { - editor.putInt(key, value); - } - - public void putString(String key, String value) { - editor.putString(key, value); - } + public static void init(Context context) { + AltosPreferences.init(new AltosDroidPreferencesBackend(context)); - public void remove(String key) { - editor.remove(key); + active_device_address = backend.getGetString(activeDevicePreference, null); } - public void flush() { - editor.apply(); + public static void set_active_device(String address) { + synchronized(backend) { + active_device_address = address; + backend.putString(activeDevicePreference, active_device_address); + flush_preferences(); + } } - public File homeDirectory() { - return Environment.getExternalStorageDirectory(); + public static String active_device() { + synchronized(backend) { + return active_device_address; + } } } diff --git a/altoslib/AltosFlightReader.java b/altoslib/AltosFlightReader.java index c0565e88..be103838 100644 --- a/altoslib/AltosFlightReader.java +++ b/altoslib/AltosFlightReader.java @@ -21,16 +21,16 @@ import java.text.*; import java.io.*; import java.util.concurrent.*; -public class AltosFlightReader { +public abstract class AltosFlightReader { public String name; public int serial; - public void init() { } + public void init() {} - public AltosState read() throws InterruptedException, ParseException, AltosCRCException, IOException { return null; } + public abstract AltosState read() throws InterruptedException, ParseException, AltosCRCException, IOException; - public void close(boolean interrupted) { } + public abstract void close(boolean interrupted); public void set_frequency(double frequency) throws InterruptedException, TimeoutException { } diff --git a/altoslib/AltosLog.java b/altoslib/AltosLog.java index 1cac6b52..28116e3d 100644 --- a/altoslib/AltosLog.java +++ b/altoslib/AltosLog.java @@ -72,6 +72,7 @@ public class AltosLog implements Runnable { } log_file.flush(); file = a; + AltosPreferences.set_logfile(link.serial, file); } return log_file != null; } diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index 72cfeb4b..0e91e4f4 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -38,6 +38,9 @@ public class AltosPreferences { /* telemetry rate format preference name */ public final static String telemetryRatePreferenceFormat = "RATE-%d"; + /* log file format preference name */ + public final static String logfilePreferenceFormat = "LOGFILE-%d"; + /* voice preference name */ public final static String voicePreference = "VOICE"; @@ -83,6 +86,9 @@ public class AltosPreferences { /* Telemetry rate (map serial to telemetry format) */ public static Hashtable telemetry_rates; + /* Log file (map serial to logfile name) */ + public static Hashtable logfiles; + /* Voice preference */ public static boolean voice; @@ -300,6 +306,27 @@ public class AltosPreferences { } } + public static void set_logfile(int serial, File new_logfile) { + synchronized(backend) { + logfiles.put(serial, new_logfile); + backend.putString(String.format(logfilePreferenceFormat, serial), new_logfile.getPath()); + flush_preferences(); + } + } + + public static File logfile(int serial) { + synchronized(backend) { + if (logfiles.containsKey(serial)) + return logfiles.get(serial); + String logfile_string = backend.getString(String.format(logfilePreferenceFormat, serial), null); + if (logfile_string == null) + return null; + File logfile = new File(logfile_string); + logfiles.put(serial, logfile); + return logfile; + } + } + public static void set_scanning_telemetry(int new_scanning_telemetry) { synchronized (backend) { scanning_telemetry = new_scanning_telemetry; diff --git a/altoslib/AltosReplayReader.java b/altoslib/AltosReplayReader.java index 15093af1..2864e02a 100644 --- a/altoslib/AltosReplayReader.java +++ b/altoslib/AltosReplayReader.java @@ -27,6 +27,7 @@ import java.util.*; public class AltosReplayReader extends AltosFlightReader { Iterator iterator; File file; + boolean real_time; public AltosState read() { if (iterator.hasNext()) @@ -39,16 +40,22 @@ public class AltosReplayReader extends AltosFlightReader { public void update(AltosState state) throws InterruptedException { /* Make it run in realtime after the rocket leaves the pad */ - if (state.state > AltosLib.ao_flight_pad && state.time_change > 0) + if (real_time && state.state > AltosLib.ao_flight_pad && state.time_change > 0) Thread.sleep((int) (Math.min(state.time_change,10) * 1000)); state.set_received_time(System.currentTimeMillis()); } public File backing_file() { return file; } - public AltosReplayReader(Iterator in_iterator, File in_file) { + public AltosReplayReader(Iterator in_iterator, File in_file, + boolean in_real_time) { iterator = in_iterator; file = in_file; + real_time = in_real_time; name = file.getName(); } + + public AltosReplayReader(Iterator in_iterator, File in_file) { + this(in_iterator, in_file, false); + } } diff --git a/altoslib/AltosStateIterable.java b/altoslib/AltosStateIterable.java index f7cd424d..4154b71c 100644 --- a/altoslib/AltosStateIterable.java +++ b/altoslib/AltosStateIterable.java @@ -26,4 +26,18 @@ public abstract class AltosStateIterable implements Iterable { } public abstract void write(PrintStream out); + + public static AltosStateIterable iterable(File file) { + FileInputStream in; + try { + in = new FileInputStream(file); + } catch (Exception e) { + System.out.printf("Failed to open file '%s'\n", file); + return null; + } + if (file.getName().endsWith("telem")) + return new AltosTelemetryFile(in); + else + return new AltosEepromFile(in); + } } diff --git a/altoslib/AltosTelemetryReader.java b/altoslib/AltosTelemetryReader.java index 5ed50134..8803e19f 100644 --- a/altoslib/AltosTelemetryReader.java +++ b/altoslib/AltosTelemetryReader.java @@ -28,10 +28,17 @@ public class AltosTelemetryReader extends AltosFlightReader { int telemetry; int telemetry_rate; AltosState state = null; + AltosFlightReader stacked; LinkedBlockingQueue telem; public AltosState read() throws InterruptedException, ParseException, AltosCRCException, IOException { + if (stacked != null) { + state = stacked.read(); + if (state != null) + return state; + stacked = null; + } AltosLine l = telem.take(); if (l.line == null) throw new IOException("IO error"); @@ -53,6 +60,12 @@ public class AltosTelemetryReader extends AltosFlightReader { } public void close(boolean interrupted) { + + if (stacked != null) { + stacked.close(interrupted); + stacked = null; + } + link.remove_monitor(telem); log.close(); try { @@ -148,9 +161,10 @@ public class AltosTelemetryReader extends AltosFlightReader { return link.monitor_battery(); } - public AltosTelemetryReader (AltosLink in_link) + public AltosTelemetryReader (AltosLink in_link, AltosFlightReader in_stacked) throws IOException, InterruptedException, TimeoutException { link = in_link; + stacked = in_stacked; boolean success = false; try { log = new AltosLog(link); @@ -169,4 +183,19 @@ public class AltosTelemetryReader extends AltosFlightReader { close(true); } } + + private static AltosFlightReader existing_data(AltosLink link) { + File file = AltosPreferences.logfile(link.serial); + if (file != null) { + AltosStateIterable iterable = AltosStateIterable.iterable(file); + if (iterable != null) + return new AltosReplayReader(iterable.iterator(), file, false); + } + return null; + } + + public AltosTelemetryReader(AltosLink link) + throws IOException, InterruptedException, TimeoutException { + this(link, existing_data(link)); + } } -- cgit v1.2.3 From 0014addf3356bad1eff76cffc396fb120308646c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 29 Aug 2014 22:08:43 -0500 Subject: altoslib: TeleMega telemetry pyro voltages are uint8 Using int8 means that voltages over about 6V are reported incorrectly. Signed-off-by: Keith Packard --- altoslib/AltosTelemetryMegaData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/altoslib/AltosTelemetryMegaData.java b/altoslib/AltosTelemetryMegaData.java index 8b1869bb..d949c02f 100644 --- a/altoslib/AltosTelemetryMegaData.java +++ b/altoslib/AltosTelemetryMegaData.java @@ -36,7 +36,7 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { public AltosTelemetryMegaData(int[] bytes) { super(bytes); - state = int8(5); + state = uint8(5); v_batt = int16(6); v_pyro = int16(8); @@ -44,7 +44,7 @@ public class AltosTelemetryMegaData extends AltosTelemetryStandard { sense = new int[6]; for (int i = 0; i < 6; i++) { - sense[i] = int8(10 + i) << 4; + sense[i] = uint8(10 + i) << 4; sense[i] |= sense[i] >> 8; } -- cgit v1.2.3 From 0b70ea04e807c69a987d5976ab217f9f65fb1e09 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 29 Aug 2014 22:33:36 -0500 Subject: altosdroid: fixup fetching active device address Signed-off-by: Keith Packard --- altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java index 7c12c9a0..72b8488b 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroidPreferences.java @@ -29,7 +29,7 @@ public class AltosDroidPreferences extends AltosPreferences { public static void init(Context context) { AltosPreferences.init(new AltosDroidPreferencesBackend(context)); - active_device_address = backend.getGetString(activeDevicePreference, null); + active_device_address = backend.getString(activeDevicePreference, null); } public static void set_active_device(String address) { -- cgit v1.2.3 From bc3fbcb35090be3856284ccf4d908ebf39d02bec Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 31 Aug 2014 00:08:33 -0500 Subject: altosdroid: Add quit. Restart. Show freq in title. Add a quit button to menu. When restarting, reconnect to previous device. When connecting, set the freq/rate to previous values. Signed-off-by: Keith Packard --- altosdroid/res/layout/device_list.xml | 30 ++++---- altosdroid/res/menu/option_menu.xml | 3 + altosdroid/res/values/strings.xml | 1 + .../org/altusmetrum/AltosDroid/AltosBluetooth.java | 17 +++++ .../src/org/altusmetrum/AltosDroid/AltosDroid.java | 79 +++++++++++++++++++--- .../org/altusmetrum/AltosDroid/GoNoGoLights.java | 14 ++++ .../src/org/altusmetrum/AltosDroid/TabLanded.java | 5 +- .../src/org/altusmetrum/AltosDroid/TabPad.java | 26 +++++-- .../altusmetrum/AltosDroid/TelemetryReader.java | 11 ++- .../altusmetrum/AltosDroid/TelemetryService.java | 36 ++++++++-- 10 files changed, 188 insertions(+), 34 deletions(-) diff --git a/altosdroid/res/layout/device_list.xml b/altosdroid/res/layout/device_list.xml index 395695f8..93d65517 100644 --- a/altosdroid/res/layout/device_list.xml +++ b/altosdroid/res/layout/device_list.xml @@ -18,39 +18,39 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - + - - - -