From: Keith Packard Date: Sun, 23 Oct 2011 22:20:50 +0000 (-0700) Subject: altos: Fix battery voltage computation. X-Git-Tag: 1.0.9.4~97 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=90e738a3379d258a48a7c92f6708040fc39c373a altos: Fix battery voltage computation. Full scale is 4.95V, not 3.333V. Signed-off-by: Keith Packard --- diff --git a/src/cc1111/ao_battery.c b/src/cc1111/ao_battery.c index 070f682f..b9845fb3 100644 --- a/src/cc1111/ao_battery.c +++ b/src/cc1111/ao_battery.c @@ -36,7 +36,7 @@ ao_battery_get(void) ADCCON3 = ADCCON3_EREF_VDD | ADCCON3_EDIV_512 | BATTERY_PIN; ao_sleep(DATA_TO_XDATA(&ao_battery_value)); ); - return (uint16_t) ((int32_t) ao_battery_value.v * (int32_t) 3333 >> 15); + return (uint16_t) ((int32_t) ao_battery_value.v * (int32_t) 4950 >> 15); } static void