summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-05-25 13:23:54 -0700
committerKeith Packard <keithp@keithp.com>2015-05-25 13:23:54 -0700
commit9b268351aee44de959dcc4c792189c10a00428fe (patch)
tree2dbf0cc6357c024dbbb6d5acaf681b452a1d67ee /src
parent0e76cb2a7d5db24b6cecdccb6fb8d5bf5527fadf (diff)
telefire: Report telefire battery voltage over telemetry link
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/ao_pad.c2
-rw-r--r--src/drivers/ao_pad.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c
index 3ad239cc..ffe46c68 100644
--- a/src/drivers/ao_pad.c
+++ b/src/drivers/ao_pad.c
@@ -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;
diff --git a/src/drivers/ao_pad.h b/src/drivers/ao_pad.h
index 23062899..d77d105a 100644
--- a/src/drivers/ao_pad.h
+++ b/src/drivers/ao_pad.h
@@ -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 */
};