From e7c25e3ba04b1e9f8e6fa31e2d464fe96a074dad Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 24 May 2015 17:25:25 -0700 Subject: telefire: Make 'good' RSSI value configurable Different radios will have different 'good' RSSI values, so let each product configure it, leaving the default set to -90dBm, which is a solid signal value for the CC1111. Signed-off-by: Keith Packard --- src/drivers/ao_pad.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/drivers/ao_pad.c') diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index dc2c83fe..3ad239cc 100644 --- a/src/drivers/ao_pad.c +++ b/src/drivers/ao_pad.c @@ -29,6 +29,10 @@ static __pdata uint8_t ao_pad_box; static __xdata uint8_t ao_pad_disabled; static __pdata uint16_t ao_pad_packet_time; +#ifndef AO_PAD_RSSI_MINIMUM +#define AO_PAD_RSSI_MINIMUM -90 +#endif + #define DEBUG 1 #if DEBUG @@ -36,8 +40,8 @@ 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) #else -#define PRINTD(...) -#define FLUSHD() +#define PRINTD(...) +#define FLUSHD() #endif static void @@ -138,7 +142,7 @@ ao_pad_monitor(void) } if ((ao_time() - ao_pad_packet_time) > AO_SEC_TO_TICKS(2)) cur |= AO_LED_RED; - else if (ao_radio_cmac_rssi < -90) + else if (ao_radio_cmac_rssi < AO_PAD_RSSI_MINIMUM) cur |= AO_LED_AMBER; else cur |= AO_LED_GREEN; @@ -255,7 +259,7 @@ ao_pad(void) if (ret != AO_RADIO_CMAC_OK) continue; ao_pad_packet_time = ao_time(); - + ao_pad_box = ao_pad_read_box(); PRINTD ("tick %d box %d (me %d) cmd %d channels %02x\n", -- cgit v1.2.3 From 9b268351aee44de959dcc4c792189c10a00428fe Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 25 May 2015 13:23:54 -0700 Subject: telefire: Report telefire battery voltage over telemetry link Signed-off-by: Keith Packard --- src/drivers/ao_pad.c | 2 ++ src/drivers/ao_pad.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src/drivers/ao_pad.c') 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 */ }; -- cgit v1.2.3