altos: Fix telemega v0.3 igniter order (drogue/main moved). Label ADC dump
authorKeith Packard <keithp@keithp.com>
Tue, 14 May 2013 16:56:16 +0000 (09:56 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 16 May 2013 05:11:41 +0000 (22:11 -0700)
telemega moves the igniters around so that E/F are now drogue/main.
Add custom labels for ADC values to make parsing possible

Signed-off-by: Keith Packard <keithp@keithp.com>
src/stm/ao_adc_stm.c
src/telemega-v0.3/ao_pins.h

index 48fc4262f7cb822f298168e7f55d5a9478c757b9..53f19b406d20a884f6c33b6219b2dc55f10e9b76 100644 (file)
@@ -113,11 +113,15 @@ ao_adc_dump(void) __reentrant
        uint8_t i;
 
        ao_data_get(&packet);
+#ifdef AO_ADC_DUMP
+       AO_ADC_DUMP(&packet);
+#else
        printf("tick: %5u",  packet.tick);
        d = (int16_t *) (&packet.adc);
        for (i = 0; i < AO_NUM_ADC; i++)
                printf (" %2d: %5d", i, d[i]);
        printf("\n");
+#endif
 }
 
 __code struct ao_cmds ao_adc_cmds[] = {
index b1504d28ddf0730d731d00e78a76f677766b2726..88b473cc9f2f495f30f2ccc7ad59164edba537cb 100644 (file)
 #define HAS_IGNITE             1
 #define HAS_IGNITE_REPORT      1
 
-#define AO_SENSE_DROGUE(p)     ((p)->adc.sense[0])
-#define AO_SENSE_MAIN(p)       ((p)->adc.sense[1])
+#define AO_SENSE_DROGUE(p)     ((p)->adc.sense[4])
+#define AO_SENSE_MAIN(p)       ((p)->adc.sense[5])
 #define AO_IGNITER_CLOSED      400
 #define AO_IGNITER_OPEN                60
 
-#define AO_IGNITER_DROGUE_PORT (&stm_gpiod)
-#define AO_IGNITER_DROGUE_PIN  6
+/* Pyro A */
+#define AO_PYRO_PORT_0 (&stm_gpiod)
+#define AO_PYRO_PIN_0  6
 
-#define AO_IGNITER_MAIN_PORT   (&stm_gpiod)
-#define AO_IGNITER_MAIN_PIN    7
+/* Pyro B */
+#define AO_PYRO_PORT_1 (&stm_gpiod)
+#define AO_PYRO_PIN_1  7
 
-#define AO_PYRO_PORT_0 (&stm_gpiob)
-#define AO_PYRO_PIN_0  5
+/* Pyro C */
+#define AO_PYRO_PORT_2 (&stm_gpiob)
+#define AO_PYRO_PIN_2  5
 
-#define AO_PYRO_PORT_1 (&stm_gpioe)
-#define AO_PYRO_PIN_1  4
+/* Pyro D */
+#define AO_PYRO_PORT_3 (&stm_gpioe)
+#define AO_PYRO_PIN_3  4
 
-#define AO_PYRO_PORT_2 (&stm_gpioe)
-#define AO_PYRO_PIN_2  6
+/* Drogue */
+#define AO_IGNITER_DROGUE_PORT (&stm_gpioe)
+#define AO_IGNITER_DROGUE_PIN  6
 
-#define AO_PYRO_PORT_3 (&stm_gpioe)
-#define AO_PYRO_PIN_3  5
+/* Main */
+#define AO_IGNITER_MAIN_PORT   (&stm_gpioe)
+#define AO_IGNITER_MAIN_PIN    5
 
 /* Number of general purpose pyro channels available */
 #define AO_PYRO_NUM    4
@@ -163,6 +169,13 @@ struct ao_adc {
        int16_t                 temp;
 };
 
+#define AO_ADC_DUMP(p) \
+       printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \
+              (p)->tick, \
+              (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \
+              (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \
+              (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp)
+
 #define AO_ADC_SENSE_A         0
 #define AO_ADC_SENSE_A_PORT    (&stm_gpioa)
 #define AO_ADC_SENSE_A_PIN     0
@@ -179,13 +192,13 @@ struct ao_adc {
 #define AO_ADC_SENSE_D_PORT    (&stm_gpioa)
 #define AO_ADC_SENSE_D_PIN     3
 
-#define AO_ADC_SENSE_E         4
-#define AO_ADC_SENSE_E_PORT    (&stm_gpioa)
-#define AO_ADC_SENSE_E_PIN     4
+#define AO_ADC_SENSE_DROGUE    4
+#define AO_ADC_SENSE_DROGUE_PORT       (&stm_gpioa)
+#define AO_ADC_SENSE_DROGUE_PIN        4
 
-#define AO_ADC_SENSE_F         22
-#define AO_ADC_SENSE_F_PORT    (&stm_gpioe)
-#define AO_ADC_SENSE_F_PIN     7
+#define AO_ADC_SENSE_MAIN      22
+#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioe)
+#define AO_ADC_SENSE_MAIN_PIN  7
 
 #define AO_ADC_V_BATT          8
 #define AO_ADC_V_BATT_PORT     (&stm_gpiob)
@@ -211,10 +224,10 @@ struct ao_adc {
 #define AO_ADC_PIN2_PIN                AO_ADC_SENSE_C_PIN
 #define AO_ADC_PIN3_PORT       AO_ADC_SENSE_D_PORT
 #define AO_ADC_PIN3_PIN                AO_ADC_SENSE_D_PIN
-#define AO_ADC_PIN4_PORT       AO_ADC_SENSE_E_PORT
-#define AO_ADC_PIN4_PIN                AO_ADC_SENSE_E_PIN
-#define AO_ADC_PIN5_PORT       AO_ADC_SENSE_F_PORT
-#define AO_ADC_PIN5_PIN                AO_ADC_SENSE_F_PIN
+#define AO_ADC_PIN4_PORT       AO_ADC_SENSE_DROGUE_PORT
+#define AO_ADC_PIN4_PIN                AO_ADC_SENSE_DROGUE_PIN
+#define AO_ADC_PIN5_PORT       AO_ADC_SENSE_MAIN_PORT
+#define AO_ADC_PIN5_PIN                AO_ADC_SENSE_MAIN_PIN
 #define AO_ADC_PIN6_PORT       AO_ADC_V_BATT_PORT
 #define AO_ADC_PIN6_PIN                AO_ADC_V_BATT_PIN
 #define AO_ADC_PIN7_PORT       AO_ADC_V_PBATT_PORT
@@ -226,8 +239,8 @@ struct ao_adc {
 #define AO_ADC_SQ2             AO_ADC_SENSE_B
 #define AO_ADC_SQ3             AO_ADC_SENSE_C
 #define AO_ADC_SQ4             AO_ADC_SENSE_D
-#define AO_ADC_SQ5             AO_ADC_SENSE_E
-#define AO_ADC_SQ6             AO_ADC_SENSE_F
+#define AO_ADC_SQ5             AO_ADC_SENSE_DROGUE
+#define AO_ADC_SQ6             AO_ADC_SENSE_MAIN
 #define AO_ADC_SQ7             AO_ADC_V_BATT
 #define AO_ADC_SQ8             AO_ADC_V_PBATT
 #define AO_ADC_SQ9             AO_ADC_TEMP