altos: Oops. Turn *off* pad channel after launching rockets
authorKeith Packard <keithp@keithp.com>
Fri, 15 Oct 2021 05:36:52 +0000 (22:36 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 15 Oct 2021 05:38:58 +0000 (22:38 -0700)
Somehow this line got switched so that pads were getting stuck
on. This is very not good.

Very useful for boxes which have busted rotary switches.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_pad.c
src/telefire-v0.2/ao_pins.h

index c6efc311fd9e8ea2cd29828206f28218dbc0305a..e9b54b047c944713dd3cfcad70d9fe9bdf7b8a13 100644 (file)
@@ -39,8 +39,8 @@ static __pdata uint16_t       ao_pad_packet_time;
 
 #if DEBUG
 static __pdata uint8_t ao_pad_debug;
-#define PRINTD(...) (ao_pad_debug ? (printf(__VA_ARGS__), 0) : 0)
-#define FLUSHD()    (ao_pad_debug ? (flush(), 0) : 0)
+#define PRINTD(...) do { if (ao_pad_debug) { printf(__VA_ARGS__); flush(); } } while(0)
+#define FLUSHD()
 #else
 #define PRINTD(...)
 #define FLUSHD()
@@ -139,13 +139,14 @@ ao_pad_run(void)
                        ao_pad_ignite = 0;
 
                        ao_delay(AO_PAD_FIRE_TIME);
+                       PRINTD("ao_pad_ignite now %d\n", ao_pad_ignite);
                }
 #ifdef AO_PAD_PORT_1
                ao_gpio_clr_bits(AO_PAD_PORT_0, pins0);
                ao_gpio_clr_bits(AO_PAD_PORT_1, pins1);
                PRINTD("turn off pins 0x%x 0x%x\n", pins0, pins1);
 #else
-               ao_gpio_set_bits(AO_PAD_PORT_0, pins0);
+               ao_gpio_clr_bits(AO_PAD_PORT_0, pins0);
                PRINTD("turn off pins 0x%x\n", pins0);
 #endif
        }
@@ -281,9 +282,9 @@ ao_pad_monitor(void)
                        query.igniter_status[c] = status;
                }
                if (cur != prev) {
-                       PRINTD("change leds from %02x to %02x\n",
-                              prev, cur);
-                       FLUSHD();
+//                     PRINTD("change leds from %02x to %02x\n",
+//                            prev, cur);
+//                     FLUSHD();
                        ao_led_set(cur);
                        prev = cur;
                }
index 65f5bdcc17f1f4e3aa1da412e911e78b3ebf704f..8050668f847d197b4020dff61a3c9a3e4ee4a688 100644 (file)
@@ -33,6 +33,7 @@
 #define HAS_EEPROM             1
 #define HAS_LOG                        0
 #define HAS_PAD                        1
+#define HAS_FIXED_PAD_BOX      1
 #define USE_INTERNAL_FLASH     1
 #define DBG_ON_P1              0
 #define IGNITE_ON_P2           0