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
@@ -20,7 +20,7 @@
#include "opentx.h"
enum menuRadioHwItems {
enum {
ITEM_RADIO_HARDWARE_LABEL_STICKS,
ITEM_RADIO_HARDWARE_STICK1,
ITEM_RADIO_HARDWARE_STICK2,
+1 -1
View File
@@ -477,7 +477,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
@@ -42,7 +42,7 @@ void menuRadioTrainer(event_t event)
y = MENU_HEADER_HEIGHT + 1 + FH;
for (int i=0; i<NUM_STICKS; i++) {
uint8_t chan = channel_order(i+1);
uint8_t chan = channelOrder(i+1);
TrainerMix * td = &g_eeGeneral.trainer.mix[chan-1];
putsStickName(0, y, chan-1, (menuVerticalPosition==i && CURSOR_ON_LINE()) ? INVERS : 0);
+81 -49
View File
@@ -29,8 +29,7 @@ void menuStatisticsView(event_t event)
{
title(STR_MENUSTAT);
switch(event)
{
switch(event) {
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_BREAK(KEY_PAGE):
chainMenu(menuStatisticsDebug);
@@ -46,7 +45,7 @@ void menuStatisticsView(event_t event)
#endif
break;
case EVT_KEY_LONG(KEY_MENU): // historical
case EVT_KEY_LONG(KEY_MENU): // historical
case EVT_KEY_LONG(KEY_ENTER):
g_eeGeneral.globalTimer = 0;
storageDirty(EE_GENERAL);
@@ -116,14 +115,19 @@ void menuStatisticsDebug(event_t event)
}
#endif
switch(event)
{
switch(event) {
case EVT_ENTRY:
case EVT_ENTRY_UP:
enableVBatBridge();
break;
case EVT_KEY_LONG(KEY_ENTER):
g_eeGeneral.globalTimer = 0;
storageDirty(EE_GENERAL);
sessionTimer = 0;
storageDirty(EE_GENERAL);
killEvents(event);
break;
case EVT_KEY_FIRST(KEY_ENTER):
#if defined(LUA)
maxLuaInterval = 0;
@@ -132,20 +136,24 @@ void menuStatisticsDebug(event_t event)
maxMixerDuration = 0;
break;
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_LONG(KEY_PAGE):
killEvents(event);
chainMenu(menuStatisticsView);
break;
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_BREAK(KEY_PAGE):
disableVBatBridge();
chainMenu(menuStatisticsDebug2);
break;
case EVT_KEY_FIRST(KEY_DOWN):
case EVT_KEY_LONG(KEY_PAGE):
killEvents(event);
disableVBatBridge();
chainMenu(menuStatisticsView);
break;
case EVT_KEY_FIRST(KEY_EXIT):
disableVBatBridge();
chainMenu(menuMainView);
break;
#if defined(WATCHDOG_TEST)
case EVT_KEY_LONG(KEY_MENU):
{
@@ -157,44 +165,73 @@ void menuStatisticsDebug(event_t event)
#endif
}
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW3, "Free Mem");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW3, availableMemory(), LEFT);
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW3, "b");
uint8_t y = FH + 1;
#if defined(STM32) && !defined(SIMU) && defined(DEBUG)
lcdDrawTextAlignedLeft(y, "Usb");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, charsWritten, LEFT);
lcdDrawText(lcdLastRightPos, y, " ");
lcdDrawNumber(lcdLastRightPos, y, APP_Rx_ptr_in, LEFT);
lcdDrawText(lcdLastRightPos, y, " ");
lcdDrawNumber(lcdLastRightPos, y, APP_Rx_ptr_out, LEFT);
lcdDrawText(lcdLastRightPos, y, " ");
lcdDrawNumber(lcdLastRightPos, y, usbWraps, LEFT);
y += FH;
#endif
#if defined(STM32)
lcdDrawTextAlignedLeft(y, "Free Mem");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, availableMemory(), LEFT);
lcdDrawText(lcdLastRightPos, y, "b");
y += FH;
#endif
#if defined(LUA)
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW2, "Lua scripts");
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW2+1, "[Duration]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW2, 10*maxLuaDuration, LEFT);
lcdDrawText(lcdLastRightPos+2, MENU_DEBUG_ROW2+1, "[Interval]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW2, 10*maxLuaInterval, LEFT);
lcdDrawTextAlignedLeft(y, "Lua scripts");
lcdDrawText(MENU_DEBUG_COL1_OFS, y+1, "[Duration]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, 10*maxLuaDuration, LEFT);
lcdDrawText(lcdLastRightPos+2, y+1, "[Interval]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, 10*maxLuaInterval, LEFT);
y += FH;
#endif
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW1, STR_TMIXMAXMS);
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW1, "ms");
lcdDrawTextAlignedLeft(y, STR_TMIXMAXMS);
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
lcdDrawText(lcdLastRightPos, y, "ms");
y += FH;
#if !defined(SIMU) && defined(DEBUG)
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW4, "Usb");
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW4, charsWritten, LEFT);
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW4, " ");
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW4, APP_Rx_ptr_in, LEFT);
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW4, " ");
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW4, APP_Rx_ptr_out, LEFT);
lcdDrawText(lcdLastRightPos, MENU_DEBUG_ROW4, " ");
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW4, usbWraps, LEFT);
lcdDrawTextAlignedLeft(y, STR_FREE_STACK);
lcdDrawText(MENU_DEBUG_COL1_OFS, y+1, "[M]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, menusStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, y+1, "[X]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, mixerStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, y+1, "[A]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, audioStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, y+1, "[I]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, y, stackAvailable(), LEFT);
y += FH;
#if defined(DEBUG_LATENCY)
lcdDrawTextAlignedLeft(y, "Hearbeat");
if (heartbeatCapture.valid)
lcdDrawNumber(MENU_DEBUG_COL1_OFS, y, heartbeatCapture.count, LEFT);
else
lcdDrawText(MENU_DEBUG_COL1_OFS, y, "---");
y += FH;
#endif
lcdDrawTextAlignedLeft(MENU_DEBUG_ROW5, STR_FREE_STACK);
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW5+1, "[M]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW5, menusStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, MENU_DEBUG_ROW5+1, "[X]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW5, mixerStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, MENU_DEBUG_ROW5+1, "[A]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW5, audioStack.available(), LEFT);
lcdDrawText(lcdLastRightPos+2, MENU_DEBUG_ROW5+1, "[I]", SMLSIZE);
lcdDrawNumber(lcdLastRightPos, MENU_DEBUG_ROW5, stackAvailable(), LEFT);
#if defined(STM32)
lcdDrawTextAlignedLeft(y, STR_RTC_BATT);
putsVolts(MENU_DEBUG_COL1_OFS, y, getRTCBatteryVoltage(), PREC2|LEFT);
y += FH;
#endif
lcdDrawText(3*FW, 7*FH+1, STR_MENUTORESET);
#if defined(STM32)
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();
}
@@ -202,11 +239,7 @@ void menuStatisticsDebug2(event_t event)
{
title(STR_MENUDEBUG);
switch(event)
{
switch(event) {
case EVT_KEY_FIRST(KEY_UP):
case EVT_KEY_BREAK(KEY_PAGE):
#if defined(DEBUG_TRACE_BUFFER)
@@ -222,7 +255,6 @@ void menuStatisticsDebug2(event_t event)
chainMenu(menuStatisticsDebug);
break;
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
break;
@@ -237,7 +269,7 @@ void menuStatisticsDebug2(event_t event)
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_ROW1, telemetryErrors, RIGHT);
lcdDrawText(3*FW, 7*FH+1, STR_MENUTORESET);
lcdDrawText(LCD_W/2, 7*FH+1, STR_MENUTORESET, CENTERED);
lcdInvertLastLine();
}