Modified formula for voltage calculation on dfm17 (#81)

main
Mike Hojnowski 2024-01-03 05:13:43 -05:00 zatwierdzone przez GitHub
rodzic ce961ae5fb
commit 005dc0b3e5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
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()