Modified formula for voltage calculation on dfm17

pull/81/head
Mike Hojnowski 2023-12-30 22:59:18 -05:00
rodzic 149141fb46
commit c7c6104c02
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -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()