No more voltage alarms on simu

This commit is contained in:
Bertrand Songis
2019-08-12 14:23:03 +02:00
parent bd6ba97707
commit 185532f05e
15 changed files with 147 additions and 128 deletions
+13 -10
View File
@@ -721,16 +721,7 @@ extern const char vers_stamp[];
* @param buffer If non-null find the firmware version in the buffer instead
* @return The opentx version string starting with "opentx-" or "no version found" if the version string is not found
*/
const char* getOtherVersion(char* buffer);
extern uint8_t g_vbat100mV;
#if LCD_W > 128
#define GET_TXBATT_BARS() (limit<int8_t>(0, div_and_round(10 * (g_vbat100mV - g_eeGeneral.vBatMin - 90), 30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin), 10))
#else
#define GET_TXBATT_BARS() (limit<int8_t>(2, 20 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin), 20))
#endif
#define IS_TXBATT_WARNING() (g_vbat100mV <= g_eeGeneral.vBatWarn)
const char * getOtherVersion(char * buffer);
#define g_blinkTmr10ms (*(uint8_t*)&g_tmr10ms)
extern uint8_t g_beepCnt;
@@ -1260,6 +1251,18 @@ inline int div_and_round(int num, int den)
return num / den;
}
extern uint8_t g_vbat100mV;
inline uint8_t GET_TXBATT_BARS(uint8_t barsMax)
{
return limit<int8_t>(0, div_and_round(barsMax * (g_vbat100mV - g_eeGeneral.vBatMin - 90), 30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin), barsMax);
}
inline bool IS_TXBATT_WARNING()
{
return g_vbat100mV <= g_eeGeneral.vBatWarn;
}
#if defined(TELEMETRY_FRSKY)
enum TelemetryViews {
TELEMETRY_CUSTOM_SCREEN_1,