Re #3371: tx battery measuring code moved to board_xxx.cpp, battery check code rewritten for ARM platforms, Horus battery calibrated.

This commit is contained in:
Damjan Adamic
2016-03-20 16:05:27 +01:00
parent 49e70dbf12
commit a3af63edad
8 changed files with 95 additions and 15 deletions
+6
View File
@@ -266,3 +266,9 @@ void checkTrainerSettings()
}
}
}
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) ) / 1637);
}
+1 -6
View File
@@ -242,12 +242,7 @@ extern uint16_t adcValues[NUMBER_ANALOG];
void adcInit(void);
void adcRead(void);
uint16_t getAnalogValue(uint8_t index);
#if defined(REV3)
#define BATT_SCALE 120
#else
#define BATT_SCALE 150
#endif
uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {