Bsongis/adc rtc temperature (#6537)

RTC voltage + CPU temperature + RTC voltage alarm (thanks @schwabe)
This commit is contained in:
Bertrand Songis
2019-07-03 07:58:32 +02:00
committed by GitHub
parent 6ba4b84a45
commit 3a0960c1e3
49 changed files with 568 additions and 447 deletions
+22 -6
View File
@@ -58,14 +58,14 @@ const uint8_t bchout_ar[] = {
0x87, 0x8D, 0x93, 0x9C, 0xB1, 0xB4,
0xC6, 0xC9, 0xD2, 0xD8, 0xE1, 0xE4 };
uint8_t channel_order(uint8_t setup, uint8_t x)
uint8_t channelOrder(uint8_t setup, uint8_t x)
{
return ((*(bchout_ar + setup) >> (6 - (x - 1) * 2)) & 3) + 1;
}
uint8_t channel_order(uint8_t x)
uint8_t channelOrder(uint8_t x)
{
return channel_order(g_eeGeneral.templateSetup, x);
return channelOrder(g_eeGeneral.templateSetup, x);
}
/*
@@ -299,7 +299,7 @@ void generalDefault()
for (int i=0; i<NUM_STICKS; ++i) {
g_eeGeneral.trainer.mix[i].mode = 2;
g_eeGeneral.trainer.mix[i].srcChn = channel_order(i+1) - 1;
g_eeGeneral.trainer.mix[i].srcChn = channelOrder(i+1) - 1;
g_eeGeneral.trainer.mix[i].studWeight = 100;
}
@@ -345,7 +345,7 @@ void defaultInputs()
clearInputs();
for (int i=0; i<NUM_STICKS; i++) {
uint8_t stick_index = channel_order(i+1);
uint8_t stick_index = channelOrder(i+1);
ExpoData *expo = expoAddress(i);
expo->srcRaw = MIXSRC_Rud - 1 + stick_index;
expo->curve.type = CURVE_REF_EXPO;
@@ -843,6 +843,17 @@ void checkSDVersion()
}
#endif
#if defined(STM32)
static void checkRTCBattery()
{
if (getRTCBatteryVoltage() < 200) {
ALERT("BATTERY", STR_WARN_RTC_BATTERY_LOW, AU_ERROR);
}
disableVBatBridge();
}
#endif
#if defined(PCBTARANIS) || defined(PCBHORUS)
void checkFailsafe()
{
@@ -874,8 +885,9 @@ void checkAll()
#endif
// we don't check the throttle stick if the radio is not calibrated
if (g_eeGeneral.chkSum == evalChkSum())
if (g_eeGeneral.chkSum == evalChkSum()) {
checkThrottleStick();
}
checkSwitches();
checkFailsafe();
@@ -885,6 +897,10 @@ void checkAll()
checkSDVersion();
#endif
#if defined(STM32)
checkRTCBattery();
#endif
if (g_model.displayChecklist && modelHasNotes()) {
readModelNotes();
}