Merge branch 'telemini' into telebt
authorKeith Packard <keithp@keithp.com>
Tue, 19 Apr 2011 21:06:39 +0000 (14:06 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 19 Apr 2011 21:06:39 +0000 (14:06 -0700)
1  2 
altosui/Altos.java
altosui/AltosEepromDownload.java
src/ao_pins.h

diff --combined altosui/Altos.java
index a087f73a2f662c6aa738e7008bb79e0d937a7972,54aced3222fa27571cc02acefebd826990bae7e3..6a2d9b9b202ff2ce0dddff09526316da14ef3616
@@@ -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;
                        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();
  }
index 5c7049683008fc8107c0fdd0d1191130b43838e0,3dd5b12f4794d15dacd38e59274757d27807226e..82f01ef52ea360dc53dc59ecda51203777c5067a
@@@ -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 9ee5bdb44820601dab56ddb1d8060ad3780c7256,2161c5d2de5b30a229d41c4659a9854f293cae27..324d78273daaca46c9900446ade5299a1a5d2ed8
@@@ -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
        #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