altoslib: Track pyro firing state when reading mega eeprom files
authorKeith Packard <keithp@keithp.com>
Thu, 1 May 2014 04:30:46 +0000 (21:30 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 1 May 2014 04:30:46 +0000 (21:30 -0700)
TeleMega records whether each pyro has been fired in the eeprom file;
track that in the AltosState record.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosEepromMega.java
altoslib/AltosState.java

index 35e878852cff480db901314ee5ce15cefeef245c..da5f2a3ea09f076db6a4e6358feae1b4a52adec4 100644 (file)
@@ -150,6 +150,7 @@ public class AltosEepromMega extends AltosEeprom {
                                voltages[i] = AltosConvert.mega_pyro_voltage(sense(i));
 
                        state.set_ignitor_voltage(voltages);
+                       state.set_pyro_fired(pyro());
                        break;
                case AltosLib.AO_LOG_GPS_TIME:
                        state.set_tick(tick);
index d65e3bd88fb2bc466ce97457d3d8c478ebefdfb7..4dbd751bee8d74f78562f4832d2be0fcf656897e 100644 (file)
@@ -619,6 +619,8 @@ public class AltosState implements Cloneable {
 
        public AltosCompanion   companion;
 
+       public int      pyro_fired;
+
        public void set_npad(int npad) {
                this.npad = npad;
                gps_waiting = MIN_PAD_SAMPLES - npad;
@@ -711,6 +713,8 @@ public class AltosState implements Cloneable {
 
                baro = null;
                companion = null;
+
+               pyro_fired = 0;
        }
 
        void finish_update() {
@@ -840,6 +844,8 @@ public class AltosState implements Cloneable {
 
                baro = old.baro;
                companion = old.companion;
+
+               pyro_fired = old.pyro_fired;
        }
 
        void update_time() {
@@ -1114,6 +1120,10 @@ public class AltosState implements Cloneable {
                this.ignitor_voltage = voltage;
        }
 
+       public void set_pyro_fired(int fired) {
+               this.pyro_fired = fired;
+       }
+
        public double time_since_boost() {
                if (tick == AltosLib.MISSING)
                        return 0.0;