altos: Allow for pad boxes with different sensor configurations
authorKeith Packard <keithp@keithp.com>
Tue, 22 Dec 2015 05:47:10 +0000 (21:47 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 20 Apr 2016 03:21:30 +0000 (23:21 -0400)
This allows for a pad box without a resistor from power to each
FET. That resistor is needed to detect welded relays, but in a
solid-state system, that's not a possibility.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_pad.c

index e51d237b63c94e12650042e5dc106f29d20d1db4..99a90e7739970d3954f460c28e7d3c2924801c79 100644 (file)
@@ -155,14 +155,16 @@ ao_pad_monitor(void)
                if (pyro > VOLTS_TO_PYRO(10)) {
                        query.arm_status = AO_PAD_ARM_STATUS_ARMED;
                        cur |= AO_LED_ARMED;
-               } else if (pyro < VOLTS_TO_PYRO(5)) {
-                       query.arm_status = AO_PAD_ARM_STATUS_DISARMED;
-                       arm_beep_time = 0;
-               } else {
+#if AO_FIRE_R_POWER_FET
+               } else if (pyro > VOLTS_TO_PYRO(5)) {
                        if ((ao_time() % 100) < 50)
                                cur |= AO_LED_ARMED;
                        query.arm_status = AO_PAD_ARM_STATUS_UNKNOWN;
                        arm_beep_time = 0;
+#endif
+               } else {
+                       query.arm_status = AO_PAD_ARM_STATUS_DISARMED;
+                       arm_beep_time = 0;
                }
                if ((ao_time() - ao_pad_packet_time) > AO_SEC_TO_TICKS(2))
                        cur |= AO_LED_RED;
@@ -279,8 +281,10 @@ ao_pad_read_box(void)
        l = byte & 0xf;
        return h * 10 + l;
 }
-#else
-#define ao_pad_read_box()      0
+#endif
+
+#if HAS_FIXED_PAD_BOX
+#define ao_pad_read_box()      ao_config.pad_box
 #endif
 
 #ifdef PAD_BOX