summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-04-30 17:35:28 -0700
committerKeith Packard <keithp@keithp.com>2017-04-30 17:35:28 -0700
commitec963d358895ae46af63d2a6e9a32bdfb4d631c0 (patch)
tree04d76f79a859d94eb30bfe5c86642c6aa4bf384f /src
parent34fda7bff76d59bcfbcec6a44275829c45e42189 (diff)
altos/kernel: Allow TeleGPS v2 to scale battery in telem
TeleGPS v2 uses the STMF0 processor instead of the LPC11, which means the ADC range is different. As the raw ADC value was getting sent to represent battery voltage in the config packet, we need to scale that for the different processor. This patch allows that to happen. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r--src/kernel/ao_telemetry.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/kernel/ao_telemetry.c b/src/kernel/ao_telemetry.c
index fa817824..a4c73a86 100644
--- a/src/kernel/ao_telemetry.c
+++ b/src/kernel/ao_telemetry.c
@@ -296,6 +296,10 @@ static __pdata int8_t ao_telemetry_config_max;
static __pdata int8_t ao_telemetry_config_cur;
static __pdata uint16_t ao_telemetry_flight_number;
+#ifndef ao_telemetry_battery_convert
+#define ao_telemetry_battery_convert(a) (a)
+#endif
+
static void
ao_send_configuration(void)
{
@@ -308,7 +312,7 @@ ao_send_configuration(void)
telemetry.configuration.config_minor = AO_CONFIG_MINOR;
#if AO_idProduct_NUMBER == 0x25 && HAS_ADC
/* TeleGPS gets battery voltage instead of apogee delay */
- telemetry.configuration.apogee_delay = ao_data_ring[ao_data_ring_prev(ao_data_head)].adc.v_batt;
+ telemetry.configuration.apogee_delay = ao_telemetry_battery_convert(ao_data_ring[ao_data_ring_prev(ao_data_head)].adc.v_batt);
#else
telemetry.configuration.apogee_delay = ao_config.apogee_delay;
telemetry.configuration.main_deploy = ao_config.main_deploy;