diff options
| author | Bdale Garbee <bdale@gag.com> | 2015-07-16 13:36:59 -0600 | 
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2015-07-16 13:36:59 -0600 | 
| commit | f4f0f044df1251d64d44bf62d25b488fd04a05c8 (patch) | |
| tree | 12efee1447a67d8cf37b6f447c011708264b8266 /src/drivers/ao_pad.c | |
| parent | b25690062ac04a588ad4d11740597c20e516eb1a (diff) | |
| parent | 570daace9caf7647a09c53d5c75593cc4c98b93b (diff) | |
Merge branch 'branch-1.6' into debian
Diffstat (limited to 'src/drivers/ao_pad.c')
| -rw-r--r-- | src/drivers/ao_pad.c | 14 | 
1 files changed, 10 insertions, 4 deletions
diff --git a/src/drivers/ao_pad.c b/src/drivers/ao_pad.c index dc2c83fe..ffe46c68 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 @@ -123,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; @@ -138,7 +144,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 +261,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",  | 
