kopia lustrzana https://github.com/mikaelnousiainen/RS41ng
Modified formula for voltage calculation on dfm17 (#81)
rodzic
ce961ae5fb
commit
005dc0b3e5
|
@ -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()
|
||||
|
|
Ładowanie…
Reference in New Issue