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
+1 -1
View File
@@ -114,7 +114,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
memclear(mix, sizeof(MixData));
mix->destCh = s_currCh-1;
mix->srcRaw = (s_currCh > 4 ? MIXSRC_Rud - 1 + s_currCh : MIXSRC_Rud - 1 + channel_order(s_currCh));
mix->srcRaw = (s_currCh > 4 ? MIXSRC_Rud - 1 + s_currCh : MIXSRC_Rud - 1 + channelOrder(s_currCh));
mix->weight = 100;
}
resumeMixerCalculations();
+2 -20
View File
@@ -22,7 +22,7 @@
#if defined(PCBSKY9X)
#define HW_SETTINGS_COLUMN (2+(15*FW))
enum MenuRadioHardwareItems {
enum {
ITEM_RADIO_HARDWARE_OPTREX_DISPLAY,
ITEM_RADIO_HARDWARE_STICKS_GAINS_LABELS,
ITEM_RADIO_HARDWARE_STICK_LV_GAIN,
@@ -88,7 +88,7 @@ void menuRadioHardware(event_t event)
#endif // PCBSKY9X
#if defined(PCBTARANIS)
enum MenuRadioHardwareItems {
enum {
ITEM_RADIO_HARDWARE_LABEL_STICKS,
ITEM_RADIO_HARDWARE_STICK1,
ITEM_RADIO_HARDWARE_STICK2,
@@ -115,9 +115,6 @@ enum MenuRadioHardwareItems {
ITEM_RADIO_HARDWARE_SJ,
#endif
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
#if defined(STM32)
ITEM_RADIO_HARDWARE_RTC_BATTERY,
#endif
#if defined(TX_CAPACITY_MEASUREMENT)
ITEM_RADIO_HARDWARE_CAPACITY_CALIB,
#endif
@@ -180,12 +177,6 @@ enum MenuRadioHardwareItems {
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SI-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SJ-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
#endif
#if defined(STM32)
#define RTC_BATT_ROWS READONLY_ROW,
#else
#define RTC_BATT_ROWS
#endif
#if defined(TX_CAPACITY_MEASUREMENT)
#define TX_CAPACITY_MEASUREMENT_ROWS 0,
#else
@@ -222,8 +213,6 @@ void menuRadioHardware(event_t event)
SWITCHES_ROWS,
0 /* battery calib */,
RTC_BATT_ROWS
TX_CAPACITY_MEASUREMENT_ROWS
TEMPERATURE_CALIB_ROWS
@@ -349,13 +338,6 @@ void menuRadioHardware(event_t event)
}
break;
#if defined(STM32)
case ITEM_RADIO_HARDWARE_RTC_BATTERY:
lcdDrawTextAlignedLeft(y, STR_RTC_BATT);
putsVolts(HW_SETTINGS_COLUMN2, y, vbattRTC, PREC2|LEFT);
break;
#endif
#if defined(TX_CAPACITY_MEASUREMENT)
case ITEM_RADIO_HARDWARE_CAPACITY_CALIB:
lcdDrawTextAlignedLeft(y, STR_CURRENT_CALIB);
+1 -1
View File
@@ -597,7 +597,7 @@ void menuRadioSetup(event_t event)
case ITEM_SETUP_RX_CHANNEL_ORD:
lcdDrawTextAlignedLeft(y, STR_RXCHANNELORD); // RAET->AETR
for (uint8_t i=1; i<=4; i++) {
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channel_order(i), attr);
putsChnLetter(RADIO_SETUP_2ND_COLUMN - FW + i*FW, y, channelOrder(i), attr);
}
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.templateSetup, 0, 23);
break;
+1 -1
View File
@@ -39,7 +39,7 @@ void menuRadioTrainer(event_t event)
y = MENU_HEADER_HEIGHT + 1 + FH;
for (uint8_t i=HEADER_LINE; i<HEADER_LINE+NUM_STICKS; i++) {
uint8_t chan = channel_order(i+1-HEADER_LINE);
uint8_t chan = channelOrder(i+1-HEADER_LINE);
volatile TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1];
drawSource(0, y, MIXSRC_Rud-1+chan, (menuVerticalPosition==i && CURSOR_ON_LINE()) ? INVERS : 0);
+33 -12
View File
@@ -57,6 +57,7 @@ void menuStatisticsView(event_t event)
storageDirty(EE_GENERAL);
sessionTimer = 0;
break;
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
break;
@@ -108,6 +109,11 @@ void menuStatisticsDebug(event_t event)
title(STR_MENUDEBUG);
switch (event) {
case EVT_ENTRY:
case EVT_ENTRY_UP:
enableVBatBridge();
break;
case EVT_KEY_LONG(KEY_ENTER):
#if defined(PCBSKY9X)
g_eeGeneral.mAhUsed = 0;
@@ -120,14 +126,19 @@ void menuStatisticsDebug(event_t event)
break;
case EVT_KEY_FIRST(KEY_ENTER):
#if defined(LUA)
maxLuaInterval = 0;
maxLuaDuration = 0;
#endif
maxMixerDuration = 0;
break;
case EVT_KEY_FIRST(KEY_UP):
#if defined(NAVIGATION_X7)
case EVT_KEY_BREAK(KEY_PAGE):
disableVBatBridge();
chainMenu(menuStatisticsDebug2);
return;
break;
#endif
case EVT_KEY_FIRST(KEY_DOWN):
@@ -135,10 +146,12 @@ void menuStatisticsDebug(event_t event)
case EVT_KEY_LONG(KEY_PAGE):
#endif
killEvents(event);
disableVBatBridge();
chainMenu(menuStatisticsView);
break;
case EVT_KEY_FIRST(KEY_EXIT):
disableVBatBridge();
chainMenu(menuMainView);
break;
}
@@ -169,14 +182,6 @@ void menuStatisticsDebug(event_t event)
y += FH;
#endif
#if defined(PCBSKY9X)
lcdDrawTextAlignedLeft(y, STR_CPU_TEMP);
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, getTemperature(), UNIT_TEMPERATURE, LEFT);
lcdDrawChar(MENU_DEBUG_COL2_OFS, y, '>');
drawValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, y, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT);
y += FH;
#endif
#if defined(COPROCESSOR)
lcdDrawTextAlignedLeft(y, STR_COPROC_TEMP);
if (Coproc_read==0) {
@@ -245,7 +250,23 @@ void menuStatisticsDebug(event_t event)
y += FH;
#endif
lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET);
#if defined(STM32)
lcdDrawTextAlignedLeft(y, STR_RTC_BATT);
putsVolts(MENU_DEBUG_COL1_OFS, y, getRTCBatteryVoltage(), PREC2|LEFT);
y += FH;
#endif
#if defined(PCBSKY9X)
lcdDrawTextAlignedLeft(y, STR_CPU_TEMP);
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, getTemperature(), UNIT_TEMPERATURE, LEFT);
lcdDrawChar(MENU_DEBUG_COL2_OFS, y, '>');
drawValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, y, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT);
#else
lcdDrawTextAlignedLeft(y, STR_CPU_TEMP);
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, getTemperature(), UNIT_TEMPERATURE, PREC1|LEFT);
#endif
lcdDrawText(LCD_W/2, 7*FH+1, STR_MENUTORESET, CENTERED);
lcdInvertLastLine();
}
@@ -254,7 +275,7 @@ void menuStatisticsDebug2(event_t event)
{
title(STR_MENUDEBUG);
switch (event) {
switch(event) {
case EVT_KEY_FIRST(KEY_ENTER):
telemetryErrors = 0;
break;
@@ -291,7 +312,7 @@ void menuStatisticsDebug2(event_t event)
y += FH;
#endif
lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET);
lcdDrawText(LCD_W/2, 7*FH+1, STR_MENUTORESET, CENTERED);
lcdInvertLastLine();
}
#endif