altoslib: Define 3.8 as a good battery and 3.5 as a good igniter
authorKeith Packard <keithp@keithp.com>
Wed, 18 Dec 2013 21:22:45 +0000 (13:22 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Dec 2013 21:22:45 +0000 (13:22 -0800)
Use defined values everywhere instead of copying. Adjust battery up to
3.8 to ensure there's enough voltage to not trip the comparators

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosLib.java
altosui/AltosAscent.java
altosui/AltosDescent.java
altosui/AltosPad.java

index 36a2ab3289598ba7e23d877b670a47895dcfed2b..efbc3ddbe69c15f57bee5ae272673d2749c14b77 100644 (file)
@@ -143,6 +143,11 @@ public class AltosLib {
        /* Bluetooth "identifier" (bluetooth sucks) */
        public final static String bt_product_telebt = "TeleBT";
 
        /* Bluetooth "identifier" (bluetooth sucks) */
        public final static String bt_product_telebt = "TeleBT";
 
+       /* "good" voltages */
+
+       public final static double ao_battery_good = 3.8;
+       public final static double ao_igniter_good = 3.5;
+
        /* Telemetry modes */
        public static final int ao_telemetry_off = 0;
        public static final int ao_telemetry_min = 1;
        /* Telemetry modes */
        public static final int ao_telemetry_off = 0;
        public static final int ao_telemetry_min = 1;
index 1d9af54679d4f637a82aadb7d32306eed069337d..ba4fc614bfc70646ddbbcda8e3a7eebf05459964 100644 (file)
@@ -285,7 +285,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
        class Apogee extends AscentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.apogee_voltage);
        class Apogee extends AscentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.apogee_voltage);
-                       lights.set(state.apogee_voltage > 3.7);
+                       lights.set(state.apogee_voltage >= AltosLib.ao_igniter_good);
                }
                public Apogee (GridBagLayout layout, int y) {
                        super(layout, y, "Apogee Igniter Voltage");
                }
                public Apogee (GridBagLayout layout, int y) {
                        super(layout, y, "Apogee Igniter Voltage");
@@ -297,7 +297,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
        class Main extends AscentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.main_voltage);
        class Main extends AscentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.main_voltage);
-                       lights.set(state.main_voltage > 3.7);
+                       lights.set(state.main_voltage >= AltosLib.ao_igniter_good);
                }
                public Main (GridBagLayout layout, int y) {
                        super(layout, y, "Main Igniter Voltage");
                }
                public Main (GridBagLayout layout, int y) {
                        super(layout, y, "Main Igniter Voltage");
index 77776ff2ce3417d8b847874505dd1c8572228dc3..e73d990cb5ccde177ee73e818ae5514b30195c6a 100644 (file)
@@ -323,7 +323,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
        class Apogee extends DescentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.apogee_voltage);
        class Apogee extends DescentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.apogee_voltage);
-                       lights.set(state.apogee_voltage > 3.7);
+                       lights.set(state.apogee_voltage >= AltosLib.ao_igniter_good);
                }
                public Apogee (GridBagLayout layout, int y) {
                        super(layout, y, "Apogee Igniter Voltage");
                }
                public Apogee (GridBagLayout layout, int y) {
                        super(layout, y, "Apogee Igniter Voltage");
@@ -335,7 +335,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
        class Main extends DescentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.main_voltage);
        class Main extends DescentStatus {
                void show (AltosState state, AltosListenerState listener_state) {
                        show("%4.2f V", state.main_voltage);
-                       lights.set(state.main_voltage > 3.7);
+                       lights.set(state.main_voltage >= AltosLib.ao_igniter_good);
                }
                public Main (GridBagLayout layout, int y) {
                        super(layout, y, "Main Igniter Voltage");
                }
                public Main (GridBagLayout layout, int y) {
                        super(layout, y, "Main Igniter Voltage");
index b35bd23a8626f14032344b671dcd91575a385c1a..06a0f1efa2bc9c3855c2760bbfb3b71ff9a2b0e3 100644 (file)
@@ -180,7 +180,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                hide();
                        else {
                                show("%4.2f V", state.battery_voltage);
                                hide();
                        else {
                                show("%4.2f V", state.battery_voltage);
-                               lights.set(state.battery_voltage > 3.7);
+                               lights.set(state.battery_voltage >= AltosLib.ao_battery_good);
                        }
                }
                public Battery (GridBagLayout layout, int y) {
                        }
                }
                public Battery (GridBagLayout layout, int y) {
@@ -196,7 +196,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                hide();
                        else {
                                show("%4.2f V", state.apogee_voltage);
                                hide();
                        else {
                                show("%4.2f V", state.apogee_voltage);
-                               lights.set(state.apogee_voltage > 3.7);
+                               lights.set(state.apogee_voltage >= AltosLib.ao_igniter_good);
                        }
                }
                public Apogee (GridBagLayout layout, int y) {
                        }
                }
                public Apogee (GridBagLayout layout, int y) {
@@ -212,7 +212,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                hide();
                        else {
                                show("%4.2f V", state.main_voltage);
                                hide();
                        else {
                                show("%4.2f V", state.main_voltage);
-                               lights.set(state.main_voltage > 3.7);
+                               lights.set(state.main_voltage >= AltosLib.ao_igniter_good);
                        }
                }
                public Main (GridBagLayout layout, int y) {
                        }
                }
                public Main (GridBagLayout layout, int y) {
@@ -287,7 +287,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
                                hide();
                        else {
                                show("%4.2f V", listener_state.battery);
                                hide();
                        else {
                                show("%4.2f V", listener_state.battery);
-                               lights.set(listener_state.battery > 3.7);
+                               lights.set(listener_state.battery > AltosLib.ao_battery_good);
                        }
                }
                public ReceiverBattery (GridBagLayout layout, int y) {
                        }
                }
                public ReceiverBattery (GridBagLayout layout, int y) {