From: Keith Packard Date: Tue, 19 Apr 2011 21:06:39 +0000 (-0700) Subject: Merge branch 'telemini' into telebt X-Git-Tag: 0.9.3~50 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=44fb71ca3e5bccd5f601fc5a2d5da7292050b1d6;hp=-c Merge branch 'telemini' into telebt --- 44fb71ca3e5bccd5f601fc5a2d5da7292050b1d6 diff --combined altosui/Altos.java index a087f73a,54aced32..6a2d9b9b --- a/altosui/Altos.java +++ b/altosui/Altos.java @@@ -21,8 -21,6 +21,8 @@@ import java.awt.* import java.util.*; import java.text.*; +import libaltosJNI.*; + public class Altos { /* EEProm command letters */ static final int AO_LOG_FLIGHT = 'F'; @@@ -36,7 -34,7 +36,7 @@@ static final int AO_LOG_GPS_ALT = 'H'; static final int AO_LOG_GPS_SAT = 'V'; static final int AO_LOG_GPS_DATE = 'Y'; - static final int AO_LOG_HEIGHT = 'h'; + static final int AO_LOG_PRESSURE = 'P'; /* Added for header fields in eeprom files */ static final int AO_LOG_CONFIG_VERSION = 1000; @@@ -224,91 -222,4 +224,91 @@@ input = input.substring(0,dot); return input.concat(extension); } + + static public boolean initialized = false; + static public boolean loaded_library = false; + + public static boolean load_library() { + if (!initialized) { + try { + System.loadLibrary("altos"); + libaltos.altos_init(); + loaded_library = true; + } catch (UnsatisfiedLinkError e) { + loaded_library = false; + } + initialized = true; + } + return loaded_library; + } + + static int usb_vendor_altusmetrum() { + if (load_library()) + return libaltosConstants.USB_VENDOR_ALTUSMETRUM; + return 0x000a; + } + + static int usb_product_altusmetrum() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_ALTUSMETRUM; + return 0x000a; + } + + static int usb_product_altusmetrum_min() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_ALTUSMETRUM_MIN; + return 0x000a; + } + + static int usb_product_altusmetrum_max() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_ALTUSMETRUM_MAX; + return 0x000d; + } + + static int usb_product_telemetrum() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_TELEMETRUM; + return 0x000b; + } + + static int usb_product_teledongle() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_TELEDONGLE; + return 0x000c; + } + + static int usb_product_teleterra() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_TELETERRA; + return 0x000d; + } + + static int usb_product_telebt() { + if (load_library()) + return libaltosConstants.USB_PRODUCT_TELEBT; + return 0x000e; + } + + public final static int vendor_altusmetrum = usb_vendor_altusmetrum(); + public final static int product_altusmetrum = usb_product_altusmetrum(); + public final static int product_telemetrum = usb_product_telemetrum(); + public final static int product_teledongle = usb_product_teledongle(); + public final static int product_teleterra = usb_product_teleterra(); + public final static int product_telebt = usb_product_telebt(); + public final static int product_altusmetrum_min = usb_product_altusmetrum_min(); + public final static int product_altusmetrum_max = usb_product_altusmetrum_max(); + + public final static int product_any = 0x10000; + public final static int product_basestation = 0x10000 + 1; + + static String bt_product_telebt() { + if (load_library()) + return libaltosConstants.BLUETOOTH_PRODUCT_TELEBT; + return "TeleBT"; + } + + public final static String bt_product_telebt = bt_product_telebt(); + + public static AltosBTKnown bt_known = new AltosBTKnown(); } diff --combined altosui/AltosEepromDownload.java index 5c704968,3dd5b12f..82f01ef5 --- a/altosui/AltosEepromDownload.java +++ b/altosui/AltosEepromDownload.java @@@ -155,15 -155,16 +155,17 @@@ public class AltosEepromDownload implem int s = v ^ 0x8000; if (Altos.ao_flight_startup <= s && s <= Altos.ao_flight_invalid) { - r = new AltosEepromRecord(Altos.AO_LOG_STATE, tiny_tick, s, 0); - if (s == Altos.ao_flight_landed) + state = s; + r = new AltosEepromRecord(Altos.AO_LOG_STATE, tiny_tick, state, 0); + if (state == Altos.ao_flight_landed) done = true; + state = s; any_valid = true; } else { if (v != 0xffff) any_valid = true; - r = new AltosEepromRecord(Altos.AO_LOG_HEIGHT, tiny_tick, v, 0); + + r = new AltosEepromRecord(Altos.AO_LOG_PRESSURE, tiny_tick, 0, v); /* * The flight software records ascent data every 100ms, and descent diff --combined src/ao_pins.h index 9ee5bdb4,2161c5d2..324d7827 --- a/src/ao_pins.h +++ b/src/ao_pins.h @@@ -25,7 -25,6 +25,7 @@@ #define HAS_GPS 1 #define HAS_SERIAL_1 1 #define HAS_ADC 1 + #define USE_SERIAL_STDIN 0 #define HAS_EEPROM 1 #define USE_INTERNAL_FLASH 0 #define HAS_DBG 1 @@@ -50,7 -49,6 +50,7 @@@ #define HAS_BEEP 1 #define HAS_GPS 1 #define HAS_SERIAL_1 1 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 1 #define HAS_EEPROM 1 #define USE_INTERNAL_FLASH 0 @@@ -79,7 -77,6 +79,7 @@@ #define HAS_USB 1 #define HAS_BEEP 0 #define HAS_SERIAL_1 0 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 0 #define HAS_DBG 1 #define HAS_EEPROM 0 @@@ -103,7 -100,6 +103,7 @@@ #define HAS_BEEP 0 #define HAS_GPS 0 #define HAS_SERIAL_1 0 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 1 #define HAS_EEPROM 1 #define USE_INTERNAL_FLASH 1 @@@ -112,6 -108,7 +112,7 @@@ #define IGNITE_ON_P0 1 #define PACKET_HAS_MASTER 0 #define PACKET_HAS_SLAVE 1 + #define USE_FAST_ASCENT_LOG 1 #define AO_LED_GREEN 1 #define AO_LED_RED 2 @@@ -127,7 -124,6 +128,7 @@@ #define HAS_BEEP 0 #define HAS_GPS 0 #define HAS_SERIAL_1 0 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 1 #define HAS_EEPROM 1 #define USE_INTERNAL_FLASH 1 @@@ -151,7 -147,6 +152,7 @@@ #define HAS_BEEP 1 #define HAS_GPS 1 #define HAS_SERIAL_1 1 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 1 #define HAS_DBG 0 #define HAS_EEPROM 1 @@@ -178,7 -173,6 +179,7 @@@ #define HAS_USB 1 #define HAS_BEEP 0 #define HAS_SERIAL_1 0 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 0 #define HAS_DBG 0 #define HAS_EEPROM 0 @@@ -201,7 -195,6 +202,7 @@@ #define HAS_USB 1 #define HAS_BEEP 0 #define HAS_SERIAL_1 0 + #define USE_SERIAL_STDIN 0 #define HAS_ADC 0 #define HAS_DBG 1 #define HAS_EEPROM 0 @@@ -218,30 -211,6 +219,30 @@@ #define HAS_IGNITE 0 #endif +#if defined(TELEBT_V_0_0) + #define HAS_FLIGHT 0 + #define HAS_USB 1 + #define HAS_BEEP 0 + #define HAS_SERIAL_1 1 + #define USE_SERIAL_STDIN 1 + #define HAS_ADC 0 + #define HAS_DBG 1 + #define HAS_EEPROM 0 + #define HAS_BTM 1 + #define DBG_ON_P1 0 + #define DBG_ON_P0 1 + #define IGNITE_ON_P2 0 + #define IGNITE_ON_P0 0 + #define PACKET_HAS_MASTER 1 + #define PACKET_HAS_SLAVE 0 + #define AO_LED_RED 2 + #define AO_LED_GREEN 1 + #define LEDS_AVAILABLE (AO_LED_RED|AO_LED_GREEN) + #define SPI_CS_ON_P1 1 + #define SPI_CS_ON_P0 0 + #define HAS_IGNITE 0 +#endif + #if DBG_ON_P1 #define DBG_CLOCK (1 << 4) /* mi0 */ @@@ -302,10 -271,6 +303,10 @@@ #error Please define HAS_SERIAL_1 #endif +#ifndef USE_SERIAL_STDIN +#error Please define USE_SERIAL_STDIN +#endif + #ifndef HAS_ADC #error Please define HAS_ADC #endif