/* * Copyright (C) EdgeTX * * Based on code named * opentx - https://github.com/opentx/opentx * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include "hal/adc_driver.h" #include "opentx.h" #include "tasks.h" #define STATS_1ST_COLUMN FW/2 #define STATS_2ND_COLUMN 12*FW+FW/2 #define STATS_3RD_COLUMN 24*FW+FW/2 #define STATS_LABEL_WIDTH 4*FW void menuStatisticsView(event_t event) { title(STR_MENUSTAT); switch(event) { case EVT_KEY_FIRST(KEY_PLUS): case EVT_KEY_BREAK(KEY_PAGE): chainMenu(menuStatisticsDebug); break; case EVT_KEY_FIRST(KEY_MINUS): case EVT_KEY_LONG(KEY_PAGE): killEvents(event); #if defined(DEBUG_TRACE_BUFFER) chainMenu(menuTraceBuffer); #else chainMenu(menuStatisticsDebug2); #endif break; case EVT_KEY_LONG(KEY_MENU): // historical case EVT_KEY_LONG(KEY_ENTER): g_eeGeneral.globalTimer = 0; storageDirty(EE_GENERAL); sessionTimer = 0; break; case EVT_KEY_FIRST(KEY_EXIT): chainMenu(menuMainView); break; } // Session and Total timers lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD); drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer); lcdDrawText(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD); drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); // Throttle special timers lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD); drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr); lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD); drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16); // Timers for (int i=0; i 3600) drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0); else drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val); } #if defined(THRTRACE) const coord_t x = 5; const coord_t y = 60; lcdDrawSolidHorizontalLine(x-3, y, MAXTRACE+3+3); lcdDrawSolidVerticalLine(x, y-32, 32+3); for (coord_t i=0; i MAXTRACE ? s_traceWr - MAXTRACE : 0; for (coord_t i=1; i<=MAXTRACE && traceRdtime % SECS_PER_DAY; drawTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT); //event lcdDrawNumber(14*FW, y, te->event, LEADING0|LEFT, 3); //data lcdDrawSizedText (20*FW, y, "0x", 2); lcdDrawHexNumber(22*FW-2, y, (uint16_t)(te->data >> 16)); lcdDrawHexNumber(25*FW, y, (uint16_t)(te->data & 0xFFFF)); } } } #endif //#if defined(DEBUG_TRACE_BUFFER)