1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Fix battery voltage

This commit is contained in:
Kilrah 2020-04-26 18:06:54 +02:00
parent 6c09828912
commit 2abafbede6

View file

@ -241,8 +241,14 @@ void boardOff()
pwrOff();
}
#if defined (RADIO_TX16S)
#define BATTERY_DIVIDER 1495
#else
#define BATTERY_DIVIDER 1629
#endif
uint16_t getBatteryVoltage()
{
int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / 1629);
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) / BATTERY_DIVIDER);
}