Add support for radiomaster TX12 (#8080)

* Add tx12 support
This commit is contained in:
3djc
2020-11-14 11:48:46 +01:00
committed by GitHub
parent da0da4b9c9
commit e1e67a9d8c
74 changed files with 893 additions and 120 deletions
+7 -1
View File
@@ -265,10 +265,16 @@ void boardOff()
// this function must not return!
}
#if defined (RADIO_TX12)
#define BATTERY_DIVIDER 22830
#else
#define BATTERY_DIVIDER 26214
#endif
uint16_t getBatteryVoltage()
{
int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose
instant_vbat = (instant_vbat * BATT_SCALE * (128 + g_eeGeneral.txVoltageCalibration) ) / 26214;
instant_vbat = (instant_vbat * BATT_SCALE * (128 + g_eeGeneral.txVoltageCalibration) ) / BATTERY_DIVIDER;
instant_vbat += 20; // add 0.2V because of the diode TODO check if this is needed, but removal will break existing calibrations!
return (uint16_t)instant_vbat;
}