From 3d9553d5f3534847e26d7fc4e0d0f3bb9ff813cb Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 6 Jan 2016 23:03:51 +0100 Subject: [PATCH] #3206 - Statistics view reworked --- radio/src/CMakeLists.txt | 5 +- radio/src/gui/taranis/view_statistics.cpp | 75 +++++++++++++---------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 1731056db..0d88f8f7d 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -132,7 +132,7 @@ elseif(PCB STREQUAL TARANIS) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} taranis_bitmaps) add_definitions(-DPCBTARANIS) add_definitions(-DAUDIO -DVOICE -DRTCLOCK) - add_definitions(-DDBLKEYS -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DVARIO -DBOLD_FONT) + add_definitions(-DDBLKEYS -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DVARIO) set(SRC ${SRC} bmp.cpp) set(GUI_SRC ${GUI_SRC} menu_general_diagkeys.cpp menu_general_diaganas.cpp menu_general_hardware.cpp view_channels.cpp view_telemetry.cpp view_text.cpp view_about.cpp) set(TARGET_SRC ${TARGET_SRC} board_taranis.cpp rtc_driver.cpp) @@ -192,7 +192,7 @@ elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X) set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} 9x_bitmaps) add_definitions(-DPCBSKY9X) add_definitions(-DAUDIO -DVOICE -DRTCLOCK) - add_definitions(-DDBLKEYS -DVARIO -DBOLD_FONT -DBATTGRAPH) + add_definitions(-DDBLKEYS -DVARIO) add_definitions(-DEEPROM_VARIANT=0) set(GUI_SRC ${GUI_SRC} menu_general_diagkeys.cpp menu_general_diaganas.cpp menu_general_hardware.cpp view_telemetry.cpp view_text.cpp view_about.cpp) set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC} core_cm3.c board_lowlevel.c crt.c vectors_sam3s.c) @@ -383,6 +383,7 @@ if(ARCH STREQUAL ARM) endif() add_definitions(-DCPUARM) add_definitions(-DFRSKY -DFRSKY_SPORT -DFRSKY_HUB -DGPS -DPXX -DDSM2) + add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE) include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR}) include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable) foreach(LANGUAGE cz de en es fr it pt sk se pl hu) # TODO add nl diff --git a/radio/src/gui/taranis/view_statistics.cpp b/radio/src/gui/taranis/view_statistics.cpp index a1b39a636..9e44c86ff 100644 --- a/radio/src/gui/taranis/view_statistics.cpp +++ b/radio/src/gui/taranis/view_statistics.cpp @@ -1,26 +1,31 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * 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. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * 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 "../../opentx.h" #include "../../timers.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 8*FW + void menuStatisticsView(uint8_t event) { TITLE(STR_MENUSTAT); @@ -42,21 +47,25 @@ void menuStatisticsView(uint8_t event) break; } - lcdDrawText( 1*FW, FH*0, STR_TOTTM1TM2THRTHP); - putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0); + // Session and Total timers + lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD); + putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0); + lcdDrawText(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD); + putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); - putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0); + // Throttle special timers + lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD); + putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0); + lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD); + putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0); - putsTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, 0, 0); - - lcdDrawText( 24*FW, FH*0, "TOT"); - putsTimer( 28*FW+5*FWNUM+1, FH*0, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); - - if (TIMERS == 3) { - lcdDrawText( 24*FW, FH*1, "TM3"); - putsTimer( 28*FW+5*FWNUM+1, FH*1, timersStates[2].val, TIMEHOUR, 0); + // Timers + for (int i=0; i 3600) + putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0); + else + putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0); } #if defined(THRTRACE)