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
@@ -95,7 +95,7 @@ void insertExpo(uint8_t idx)
ExpoData * expo = expoAddress(idx);
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(expo, sizeof(ExpoData));
expo->srcRaw = (s_currCh > 4 ? MIXSRC_Rud - 1 + s_currCh : MIXSRC_Rud - 1 + channel_order(s_currCh));
expo->srcRaw = (s_currCh > 4 ? MIXSRC_Rud - 1 + s_currCh : MIXSRC_Rud - 1 + channelOrder(s_currCh));
expo->curve.type = CURVE_REF_EXPO;
expo->mode = 3; // pos+neg
expo->chn = s_currCh - 1;
+1 -1
View File
@@ -84,7 +84,7 @@ void insertMix(uint8_t idx)
mix->destCh = s_currCh-1;
mix->srcRaw = s_currCh;
if (!isSourceAvailable(mix->srcRaw)) {
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));
while (!isSourceAvailable(mix->srcRaw)) {
mix->srcRaw += 1;
}
+1 -1
View File
@@ -457,7 +457,7 @@ bool menuRadioSetup(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RXCHANNELORD); // RAET->AETR
char s[5];
for (uint8_t i=0; i<4; i++) {
s[i] = STR_RETA123[channel_order(i+1)];
s[i] = STR_RETA123[channelOrder(i+1)];
}
s[4] = '\0';
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, s, attr);
+2 -2
View File
@@ -45,10 +45,10 @@ bool menuRadioTrainer(event_t event)
lcdDrawText(TRAINER_COLUMN_3, MENU_HEADER_HEIGHT+1, "Source", HEADER_COLOR);
*/
y = MENU_CONTENT_TOP + FH;
y = MENU_CONTENT_TOP;
for (uint8_t 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];
drawSource(MENUS_MARGIN_LEFT, y, MIXSRC_Rud-1+chan, ((menuVerticalPosition==i && CURSOR_ON_LINE()) ? INVERS : 0));
+7 -6
View File
@@ -23,6 +23,7 @@
bool menuRadioVersion(event_t event)
{
char id[27];
#if 0
if (warningResult) {
warningResult = 0;
@@ -36,12 +37,12 @@ bool menuRadioVersion(event_t event)
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 0);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 5*FH, "UID:");
lcdDrawText(MENUS_MARGIN_LEFT + 64, MENU_CONTENT_TOP + 5*FH, id);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, vers_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, date_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, time_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, eeprom_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, "UID:");
lcdDrawText(MENUS_MARGIN_LEFT + 64, MENU_CONTENT_TOP + 4*FH, id);
#if 0
if (event == EVT_KEY_LONG(KEY_ENTER)) {
+63 -39
View File
@@ -95,8 +95,12 @@ bool menuStatsGraph(event_t event)
bool menuStatsDebug(event_t event)
{
switch(event)
{
switch(event) {
case EVT_ENTRY:
case EVT_ENTRY_UP:
enableVBatBridge();
break;
case EVT_KEY_FIRST(KEY_ENTER):
maxMixerDuration = 0;
#if defined(LUA)
@@ -106,51 +110,71 @@ bool menuStatsDebug(event_t event)
break;
}
SIMPLE_MENU("Debug", STATS_ICONS, menuTabStats, e_StatsDebug, 1);
if (!check_simple(event, e_StatsDebug, menuTabStats, DIM(menuTabStats), 1)) {
disableVBatBridge();
return false;
}
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Free Mem");
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, availableMemory(), LEFT, 0, NULL, "b");
drawMenuTemplate("Debug", 0, STATS_ICONS, OPTION_MENU_TITLE_BAR);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+FH, STR_TMIXMAXMS);
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+FH, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT, 0, NULL, "ms");
coord_t y = MENU_CONTENT_TOP;
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+2*FH, STR_FREE_STACK);
lcdDrawText(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+2*FH+1, "[Menus]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, MENU_CONTENT_TOP+2*FH, menusStack.available(), LEFT);
lcdDrawText(lcdNextPos+20, MENU_CONTENT_TOP+2*FH+1, "[Mix]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, MENU_CONTENT_TOP+2*FH, mixerStack.available(), LEFT);
lcdDrawText(lcdNextPos+20, MENU_CONTENT_TOP+2*FH+1, "[Audio]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, MENU_CONTENT_TOP+2*FH, audioStack.available(), LEFT);
int line = 3;
#if defined(DISK_CACHE)
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "SD cache hits");
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+line*FH, diskCache.getHitRate(), PREC1|LEFT, 0, NULL, "%");
++line;
#endif
lcdDrawText(MENUS_MARGIN_LEFT, y, "Free Mem");
lcdDrawNumber(MENU_STATS_COLUMN1, y, availableMemory(), LEFT, 0, NULL, "b");
y += FH;
#if defined(LUA)
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "Lua duration");
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+line*FH, 10*maxLuaDuration, LEFT, 0, NULL, "ms");
++line;
lcdDrawText(MENUS_MARGIN_LEFT, y, "Lua scripts");
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Duration]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, 10*maxLuaDuration, LEFT, 0, NULL, "ms");
lcdDrawText(lcdNextPos+20, y+1, "[Interval]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, 10*maxLuaDuration, LEFT, 0, NULL, "ms");
y += FH;
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "Lua interval");
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+line*FH, 10*maxLuaInterval, LEFT, 0, NULL, "ms");
++line;
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "Lua memory");
lcdDrawText(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+line*FH+1, "[S]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, MENU_CONTENT_TOP+line*FH, luaGetMemUsed(lsScripts), LEFT);
lcdDrawText(lcdNextPos+20, MENU_CONTENT_TOP+line*FH+1, "[W]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, MENU_CONTENT_TOP+line*FH, luaGetMemUsed(lsWidgets), LEFT);
lcdDrawText(lcdNextPos+20, MENU_CONTENT_TOP+line*FH+1, "[B]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, MENU_CONTENT_TOP+line*FH, luaExtraMemoryUsage, LEFT);
++line;
// lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "Lua memory");
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[S]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, luaGetMemUsed(lsScripts), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[W]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, luaGetMemUsed(lsWidgets), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[B]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, luaExtraMemoryUsage, LEFT);
y += FH;
#endif
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+line*FH, "Tlm RX Errs");
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+line*FH, telemetryErrors, LEFT);
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TMIXMAXMS);
lcdDrawNumber(MENU_STATS_COLUMN1, y, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT, 0, NULL, "ms");
y += FH;
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_FREE_STACK);
lcdDrawText(MENU_STATS_COLUMN1, y+1, "[Menus]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, menusStack.available(), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[Mix]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, mixerStack.available(), LEFT);
lcdDrawText(lcdNextPos+20, y+1, "[Audio]", HEADER_COLOR|SMLSIZE);
lcdDrawNumber(lcdNextPos+5, y, audioStack.available(), LEFT);
y += FH;
#if defined(STM32)
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RTC_BATT);
drawValueWithUnit(MENU_STATS_COLUMN1, y, getRTCBatteryVoltage(), UNIT_VOLTS, PREC2|LEFT);
y += FH;
#endif
//#if defined(STM32)
// lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CPU_TEMP);
// drawValueWithUnit(MENU_STATS_COLUMN1, y, getTemperature(), UNIT_TEMPERATURE, PREC1|LEFT);
// y += FH;
//#endif
#if defined(DISK_CACHE)
lcdDrawText(MENUS_MARGIN_LEFT, y, "SD cache hits");
lcdDrawNumber(MENU_STATS_COLUMN1, y, diskCache.getHitRate(), PREC1|LEFT, 0, NULL, "%");
y += FH;
#endif
lcdDrawText(MENUS_MARGIN_LEFT, y, "Telem RX Errs");
lcdDrawNumber(MENU_STATS_COLUMN1, y, telemetryErrors, LEFT);
// y += FH;
lcdDrawText(LCD_W/2, MENU_FOOTER_TOP, STR_MENUTORESET, MENU_TITLE_COLOR | CENTERED);
return true;