import java.util.*;
import java.text.*;
+import libaltosJNI.*;
+
public class Altos {
/* EEProm command letters */
static final int AO_LOG_FLIGHT = 'F';
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;
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();
}
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
#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
#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
#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
#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
#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
#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
#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
#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
#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
#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 */
#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