telefire: Report telefire battery voltage over telemetry link
authorKeith Packard <keithp@keithp.com>
Mon, 25 May 2015 20:23:54 +0000 (13:23 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 25 May 2015 20:23:54 +0000 (13:23 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_pad.c
src/drivers/ao_pad.h

index 3ad239cced3e3c62f07545ba51277982668face2..ffe46c6833723df2279559690e1bec2e7ad6272e 100644 (file)
@@ -127,6 +127,8 @@ ao_pad_monitor(void)
 
 #define VOLTS_TO_PYRO(x) ((int16_t) ((x) * 27.0 / 127.0 / 3.3 * 32767.0))
 
+               /* convert ADC value to voltage in tenths, then add .2 for the diode drop */
+               query.battery = (packet->adc.batt + 96) / 192 + 2;
                cur = 0;
                if (pyro > VOLTS_TO_PYRO(10)) {
                        query.arm_status = AO_PAD_ARM_STATUS_ARMED;
index 23062899bdf29fd0e1140cc3d7f9931e2874ac69..d77d105a524d5aa41da53b10216dc932e545d406 100644 (file)
@@ -39,6 +39,7 @@ struct ao_pad_query {
        uint8_t         channels;       /* which chanels are present */
        uint8_t         armed;          /* which channels are armed */
        uint8_t         arm_status;     /* status of arming switch */
+       uint8_t         battery;        /* battery voltage in decivolts */
        uint8_t         igniter_status[AO_PAD_MAX_CHANNELS];    /* status for each igniter */
 };