diff --git a/src/hal/system.c b/src/hal/system.c index 152f69f..ced3bcf 100644 --- a/src/hal/system.c +++ b/src/hal/system.c @@ -211,7 +211,14 @@ static void dma_adc_init() uint16_t system_get_battery_voltage_millivolts() { +#ifdef RS41 return (uint16_t) (((float) dma_buffer_adc[0]) * 10.0f * 600.0f / 4096.0f); +#else //DFM17 + // Kludge: DFM17 voltage is more than 5 volts, so cut the value in half. + // Changed 600 to 690 to try and get it more accurate to actual voltage + // 690 yields fairly linear, accurate results between 5v6 and 6v6 + return (uint16_t) ( ((float) dma_buffer_adc[0]) * 10.0f * 690.0f / 8192.0f ); +#endif } uint16_t system_get_button_adc_value()