mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
[Horus] Draft for stats menu
This commit is contained in:
parent
b6e8b73589
commit
ccb4db4c70
5 changed files with 188 additions and 113 deletions
|
@ -76,6 +76,47 @@ const uint8_t LBM_RSCALE[] = {
|
||||||
#include "mask_rscale.lbm"
|
#include "mask_rscale.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stats / Debug menu bitmaps
|
||||||
|
*/
|
||||||
|
|
||||||
|
const uint8_t LBM_STATS_ICON[] = {
|
||||||
|
#include "mask_stats.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_STATS_GRAPH_ICON[] = {
|
||||||
|
#include "mask_stats_graph.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_STATS_VALUE_ICON[] = {
|
||||||
|
#include "mask_stats_value.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_STATS_TIME_ICON[] = {
|
||||||
|
#include "mask_stats_time.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_STATS_LUA_ICON[] = {
|
||||||
|
#include "mask_stats_lua.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_STATS_DEBUG_ICON[] = {
|
||||||
|
#include "mask_stats_debug.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t * const LBM_STATS_ICONS[] = {
|
||||||
|
LBM_STATS_ICON,
|
||||||
|
LBM_STATS_GRAPH_ICON,
|
||||||
|
LBM_STATS_VALUE_ICON,
|
||||||
|
LBM_STATS_TIME_ICON,
|
||||||
|
#if defined(LUA)
|
||||||
|
LBM_STATS_LUA_ICON,
|
||||||
|
#endif
|
||||||
|
#if defined(DEBUG_TRACE_BUFFER)
|
||||||
|
LBM_STATS_DEBUG_ICON
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Radio menu bitmaps
|
* Radio menu bitmaps
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,6 +42,7 @@ extern const uint8_t LBM_RSCALE[];
|
||||||
// Menu icons
|
// Menu icons
|
||||||
extern const uint8_t * const LBM_RADIO_ICONS[];
|
extern const uint8_t * const LBM_RADIO_ICONS[];
|
||||||
extern const uint8_t * const LBM_MODEL_ICONS[];
|
extern const uint8_t * const LBM_MODEL_ICONS[];
|
||||||
|
extern const uint8_t * const LBM_STATS_ICONS[];
|
||||||
extern const uint8_t LBM_RADIO_ICON[];
|
extern const uint8_t LBM_RADIO_ICON[];
|
||||||
extern const uint8_t LBM_SD_BROWSER_ICON[];
|
extern const uint8_t LBM_SD_BROWSER_ICON[];
|
||||||
extern const uint8_t LBM_CALIBRATION_ICON[];
|
extern const uint8_t LBM_CALIBRATION_ICON[];
|
||||||
|
|
|
@ -144,14 +144,43 @@ static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
|
||||||
menuGeneralVersion,
|
menuGeneralVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EnumTabDiag
|
||||||
|
{
|
||||||
|
e_StatsGraph,
|
||||||
|
e_StatsValue,
|
||||||
|
e_StatsTime,
|
||||||
|
#if defined(LUA)
|
||||||
|
e_StatsLua,
|
||||||
|
#endif
|
||||||
|
#if defined(DEBUG_TRACE_BUFFER)
|
||||||
|
s_StatsDebug,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
bool menuStatsGraph(evt_t event);
|
||||||
|
bool menuStatsValue(evt_t event);
|
||||||
|
bool menuStatsTime(evt_t event);
|
||||||
|
bool menuStatsLua(evt_t event);
|
||||||
|
bool menuStatsDebug(evt_t event);
|
||||||
|
|
||||||
|
static const MenuHandlerFunc menuTabStats[] PROGMEM = {
|
||||||
|
menuStatsGraph,
|
||||||
|
menuStatsValue,
|
||||||
|
menuStatsTime,
|
||||||
|
#if defined(LUA)
|
||||||
|
menuStatsLua,
|
||||||
|
#endif
|
||||||
|
#if defined(DEBUG_TRACE_BUFFER)
|
||||||
|
menuStatsDebug,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] PROGMEM;
|
extern const MenuHandlerFunc menuTabScreensSetup[1+MAX_CUSTOM_SCREENS] PROGMEM;
|
||||||
|
|
||||||
bool menuFirstCalib(evt_t event);
|
bool menuFirstCalib(evt_t event);
|
||||||
bool menuMainView(evt_t event);
|
bool menuMainView(evt_t event);
|
||||||
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||||
bool menuModelSelect(evt_t event);
|
bool menuModelSelect(evt_t event);
|
||||||
bool menuStatisticsView(evt_t event);
|
|
||||||
bool menuStatisticsDebug(evt_t event);
|
|
||||||
bool menuAboutView(evt_t event);
|
bool menuAboutView(evt_t event);
|
||||||
bool menuMainViewChannelsMonitor(evt_t event);
|
bool menuMainViewChannelsMonitor(evt_t event);
|
||||||
bool menuChannelsView(evt_t event);
|
bool menuChannelsView(evt_t event);
|
||||||
|
@ -159,10 +188,6 @@ bool menuChannelsView(evt_t event);
|
||||||
bool menuTextView(evt_t event);
|
bool menuTextView(evt_t event);
|
||||||
bool menuScreensTheme(evt_t event);
|
bool menuScreensTheme(evt_t event);
|
||||||
|
|
||||||
#if defined(DEBUG_TRACE_BUFFER)
|
|
||||||
void menuTraceBuffer(evt_t event);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef uint16_t FlightModesType;
|
typedef uint16_t FlightModesType;
|
||||||
|
|
||||||
extern int8_t checkIncDec_Ret; // global helper vars
|
extern int8_t checkIncDec_Ret; // global helper vars
|
||||||
|
|
|
@ -108,7 +108,7 @@ void onMainViewMenu(const char *result)
|
||||||
flightReset();
|
flightReset();
|
||||||
}
|
}
|
||||||
else if (result == STR_STATISTICS) {
|
else if (result == STR_STATISTICS) {
|
||||||
chainMenu(menuStatisticsView);
|
pushMenu(menuTabStats[0]);
|
||||||
}
|
}
|
||||||
else if (result == STR_SETUP_SCREENS) {
|
else if (result == STR_SETUP_SCREENS) {
|
||||||
pushMenu(menuTabScreensSetup[1]);
|
pushMenu(menuTabScreensSetup[1]);
|
||||||
|
@ -155,12 +155,12 @@ bool menuMainView(evt_t event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_MENU):
|
case EVT_KEY_BREAK(KEY_MENU):
|
||||||
pushMenu(menuModelSetup);
|
pushMenu(menuTabModel[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_MENU):
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
pushMenu(menuGeneralSetup);
|
pushMenu(menuTabGeneral[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_DOWN):
|
case EVT_KEY_BREAK(KEY_DOWN):
|
||||||
|
|
|
@ -18,40 +18,15 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../opentx.h"
|
#include "opentx.h"
|
||||||
|
#include "stamp.h"
|
||||||
|
|
||||||
bool menuStatisticsView(evt_t event)
|
#define MENU_STATS_COLUMN1 (MENUS_MARGIN_LEFT + 120)
|
||||||
|
|
||||||
|
bool menuStatsGraph(evt_t event)
|
||||||
{
|
{
|
||||||
switch(event) {
|
MENU("Throttle graph", LBM_STATS_ICONS, menuTabStats, e_StatsGraph, 0, { 0 });
|
||||||
case EVT_KEY_FIRST(KEY_UP):
|
|
||||||
chainMenu(menuStatisticsDebug);
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_MENU):
|
|
||||||
g_eeGeneral.globalTimer = 0;
|
|
||||||
storageDirty(EE_GENERAL);
|
|
||||||
sessionTimer = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
|
||||||
chainMenu(menuMainView);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawScreenTemplate("Statistics", LBM_RADIO_ICON, OPTION_MENU_NO_SCROLLBAR);
|
|
||||||
|
|
||||||
lcdDrawText( 10, MENU_CONTENT_TOP + FH*0, "\037\145TOT:\037\317BATT:", HEADER_COLOR);
|
|
||||||
lcdDrawText( 10, MENU_CONTENT_TOP + FH*1, "TM1:\037\145TM2:", HEADER_COLOR);
|
|
||||||
lcdDrawText( 10, MENU_CONTENT_TOP + FH*2, "THR:\037\145TH%:", HEADER_COLOR);
|
|
||||||
|
|
||||||
putsTimer( 45, MENU_CONTENT_TOP + FH*1, timersStates[0].val);
|
|
||||||
putsTimer( 140, MENU_CONTENT_TOP + FH*1, timersStates[1].val);
|
|
||||||
putsTimer( 45, MENU_CONTENT_TOP + FH*2, s_timeCumThr);
|
|
||||||
putsTimer( 140, MENU_CONTENT_TOP + FH*2, s_timeCum16ThrP/16);
|
|
||||||
putsTimer( 140, MENU_CONTENT_TOP + FH*0, sessionTimer);
|
|
||||||
putsTimer( 250, MENU_CONTENT_TOP + 0*FH, g_eeGeneral.globalTimer+sessionTimer, TIMEHOUR);
|
|
||||||
|
|
||||||
#if defined(THRTRACE)
|
|
||||||
coord_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0);
|
coord_t traceRd = (s_traceCnt < 0 ? s_traceWr : 0);
|
||||||
const coord_t x = 4;
|
const coord_t x = 4;
|
||||||
const coord_t y = 200;
|
const coord_t y = 200;
|
||||||
|
@ -67,19 +42,11 @@ bool menuStatisticsView(evt_t event)
|
||||||
if (traceRd>=MAXTRACE) traceRd = 0;
|
if (traceRd>=MAXTRACE) traceRd = 0;
|
||||||
if (traceRd==s_traceWr) break;
|
if (traceRd==s_traceWr) break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MENU_DEBUG_COL1_OFS (11*10-2)
|
bool menuStatsValue(evt_t event)
|
||||||
#define MENU_DEBUG_Y_MIXMAX (MENU_CONTENT_TOP + 2*FH)
|
|
||||||
#define MENU_DEBUG_Y_LUA (MENU_CONTENT_TOP + 3*FH)
|
|
||||||
#define MENU_DEBUG_Y_FREE_RAM (MENU_CONTENT_TOP + 4*FH)
|
|
||||||
#define MENU_DEBUG_Y_STACK (MENU_CONTENT_TOP + 5*FH)
|
|
||||||
#define MENU_DEBUG_Y_RTOS (MENU_CONTENT_TOP + 6*FH)
|
|
||||||
|
|
||||||
bool menuStatisticsDebug(evt_t event)
|
|
||||||
{
|
{
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
|
@ -92,63 +59,110 @@ bool menuStatisticsDebug(evt_t event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_ENTER):
|
case EVT_KEY_FIRST(KEY_ENTER):
|
||||||
#if defined(LUA)
|
|
||||||
maxLuaInterval = 0;
|
|
||||||
maxLuaDuration = 0;
|
|
||||||
#endif
|
|
||||||
maxMixerDuration = 0;
|
maxMixerDuration = 0;
|
||||||
AUDIO_KEYPAD_UP();
|
AUDIO_KEYPAD_UP();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(DEBUG_TRACE_BUFFER)
|
|
||||||
case EVT_KEY_FIRST(KEY_UP):
|
|
||||||
pushMenu(menuTraceBuffer);
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_DOWN):
|
|
||||||
chainMenu(menuStatisticsView);
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
|
||||||
chainMenu(menuMainView);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawScreenTemplate(STR_MENUDEBUG, LBM_RADIO_ICON, OPTION_MENU_NO_SCROLLBAR);
|
MENU("Values", LBM_STATS_ICONS, menuTabStats, e_StatsValue, 0, { 0 });
|
||||||
|
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_DEBUG_Y_FREE_RAM, "Free Mem");
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Free Mem");
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT, 0, NULL, "b");
|
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, availableMemory(), LEFT, 0, NULL, "b");
|
||||||
|
|
||||||
#if defined(LUA)
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+FH, STR_TMIXMAXMS);
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_DEBUG_Y_LUA, "Lua scripts");
|
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+FH, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT, 0, NULL, "ms");
|
||||||
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", HEADER_COLOR|SMLSIZE);
|
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+30, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT);
|
|
||||||
lcdDrawText(MENU_DEBUG_COL1_OFS+60, MENU_DEBUG_Y_LUA+1, "[Interval]", HEADER_COLOR|SMLSIZE);
|
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+90, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+2*FH, STR_FREESTACKMINB);
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT, 0, NULL, "ms");
|
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);
|
||||||
|
|
||||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
lcdDrawText(LCD_W/2, MENU_FOOTER_TOP+2, STR_MENUTORESET, CENTERED);
|
||||||
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[Menus]", HEADER_COLOR|SMLSIZE);
|
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+30, MENU_DEBUG_Y_RTOS, menusStack.available(), LEFT);
|
|
||||||
lcdDrawText(MENU_DEBUG_COL1_OFS+60, MENU_DEBUG_Y_RTOS+1, "[Mix]", HEADER_COLOR|SMLSIZE);
|
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+90, MENU_DEBUG_Y_RTOS, mixerStack.available(), LEFT);
|
|
||||||
lcdDrawText(MENU_DEBUG_COL1_OFS+120, MENU_DEBUG_Y_RTOS+1, "[Audio]", HEADER_COLOR|SMLSIZE);
|
|
||||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+150, MENU_DEBUG_Y_RTOS, audioStack.available(), LEFT);
|
|
||||||
|
|
||||||
// TODO lcd_putsCenter(7*FH+1, STR_MENUTORESET);
|
|
||||||
// lcdInvertLastLine();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG_TRACE_BUFFER)
|
bool menuStatsTime(evt_t event)
|
||||||
#include "stamp-opentx.h"
|
{
|
||||||
|
switch(event) {
|
||||||
|
case EVT_KEY_LONG(KEY_MENU):
|
||||||
|
g_eeGeneral.globalTimer = 0;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
sessionTimer = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
bool menuTraceBuffer(evt_t event)
|
MENU("Time Stats", LBM_STATS_ICONS, menuTabStats, e_StatsTime, 0, { 0 });
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Session", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, sessionTimer, TIMEHOUR);
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+FH, "Battery", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+FH, g_eeGeneral.globalTimer+sessionTimer, TIMEHOUR);
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+2*FH, "Timer1", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+2*FH, timersStates[0].val);
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+3*FH, "Timer2", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+3*FH, timersStates[2].val);
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+4*FH, "Timer3", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+4*FH, timersStates[3].val);
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+5*FH, "Throttle", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+5*FH, s_timeCumThr);
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+6*FH, "Throttle %", HEADER_COLOR);
|
||||||
|
putsTimer(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+6*FH, s_timeCum16ThrP/16);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(LUA)
|
||||||
|
bool menuStatsLua(evt_t event)
|
||||||
|
{
|
||||||
|
switch(event)
|
||||||
|
{
|
||||||
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
|
g_eeGeneral.globalTimer = 0;
|
||||||
|
storageDirty(EE_GENERAL);
|
||||||
|
sessionTimer = 0;
|
||||||
|
killEvents(event);
|
||||||
|
AUDIO_KEYPAD_UP();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_FIRST(KEY_ENTER):
|
||||||
|
maxLuaInterval = 0;
|
||||||
|
maxLuaDuration = 0;
|
||||||
|
AUDIO_KEYPAD_UP();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
MENU("LUA", LBM_STATS_ICONS, menuTabStats, e_StatsLua, 0, { 0 });
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, "Free Mem");
|
||||||
|
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP, availableMemory(), LEFT, 0, NULL, "b");
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+FH, "Duration");
|
||||||
|
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+FH, 10*maxLuaDuration, LEFT, 0, NULL, "ms");
|
||||||
|
|
||||||
|
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP+2*FH, "Interval");
|
||||||
|
lcdDrawNumber(MENU_STATS_COLUMN1, MENU_CONTENT_TOP+2*FH, 10*maxLuaInterval, LEFT, 0, NULL, "ms");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(DEBUG_TRACE_BUFFER)
|
||||||
|
#define STATS_TRACES_INDEX_POS MENUS_MARGIN_LEFT
|
||||||
|
#define STATS_TRACES_TIME_POS MENUS_MARGIN_LEFT + 4*10
|
||||||
|
#define STATS_TRACES_EVENT_POS MENUS_MARGIN_LEFT + 14*10
|
||||||
|
#define STATS_TRACES_DATA_POS MENUS_MARGIN_LEFT + 20*10
|
||||||
|
|
||||||
|
bool menuStatsDebug(evt_t event)
|
||||||
{
|
{
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
|
@ -158,40 +172,34 @@ bool menuTraceBuffer(evt_t event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIMPLE_SUBMENU("Trace Buffer " VERSION, TRACE_BUFFER_LEN);
|
SIMPLE_MENU("", LBM_STATS_ICONS, menuTabStats, s_StatsDebug, TRACE_BUFFER_LEN);
|
||||||
|
|
||||||
/* RTC time */
|
|
||||||
struct gtm t;
|
|
||||||
gettime(&t);
|
|
||||||
putsTime(LCD_W+1, 0, t, TIMEBLINK);
|
|
||||||
|
|
||||||
uint8_t y = 0;
|
|
||||||
uint8_t k = 0;
|
uint8_t k = 0;
|
||||||
int8_t sub = menuVerticalPosition;
|
int8_t sub = menuVerticalPosition;
|
||||||
|
|
||||||
lcdDrawChar(0, FH, '#', TEXT_COLOR);
|
lcdDrawChar(STATS_TRACES_INDEX_POS, MENU_TITLE_TOP+2, '#', MENU_TITLE_COLOR);
|
||||||
lcdDrawText(4*10, FH, "Time");
|
lcdDrawText(STATS_TRACES_TIME_POS, MENU_TITLE_TOP+2, "Time", MENU_TITLE_COLOR);
|
||||||
lcdDrawText(14*10, FH, "Event");
|
lcdDrawText(STATS_TRACES_EVENT_POS, MENU_TITLE_TOP+2, "Event", MENU_TITLE_COLOR);
|
||||||
lcdDrawText(20*10, FH, "Data");
|
lcdDrawText(STATS_TRACES_DATA_POS, MENU_TITLE_TOP+2, "Data", MENU_TITLE_COLOR);
|
||||||
|
|
||||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||||
y = 1 + (i+2)*FH;
|
coord_t y = MENU_CONTENT_TOP + i * FH;
|
||||||
k = i+menuVerticalOffset;
|
k = i+menuVerticalOffset;
|
||||||
|
|
||||||
// item
|
// item
|
||||||
lcdDrawNumber(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
lcdDrawNumber(STATS_TRACES_INDEX_POS, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||||
|
|
||||||
const struct TraceElement * te = getTraceElement(k);
|
const struct TraceElement * te = getTraceElement(k);
|
||||||
if (te) {
|
if (te) {
|
||||||
//time
|
// time
|
||||||
putstime_t tme = te->time % SECS_PER_DAY;
|
putstime_t tme = te->time % SECS_PER_DAY;
|
||||||
putsTimer(4*10, y, tme, TIMEHOUR|LEFT);
|
putsTimer(STATS_TRACES_TIME_POS, y, tme, TIMEHOUR|LEFT);
|
||||||
//event
|
// event
|
||||||
lcdDrawNumber(14*10, y, te->event, LEADING0|LEFT, 3);
|
lcdDrawNumber(STATS_TRACES_EVENT_POS, y, te->event, LEADING0|LEFT, 3);
|
||||||
//data
|
// data
|
||||||
lcdDrawSizedText (20*10, y, "0x", 2);
|
lcdDrawSizedText(STATS_TRACES_DATA_POS, y, "0x", 2);
|
||||||
lcdDrawHexNumber(22*10-2, y, (uint16_t)(te->data >> 16));
|
lcdDrawHexNumber(STATS_TRACES_DATA_POS + 20, y, (uint16_t)(te->data >> 16));
|
||||||
lcdDrawHexNumber(25*10, y, (uint16_t)(te->data & 0xFFFF));
|
lcdDrawHexNumber(STATS_TRACES_DATA_POS+ 60, y, (uint16_t)(te->data & 0xFFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue