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:
parent
6c09828912
commit
2abafbede6
1 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue