diff --git a/radio/src/gui/view_statistics.cpp b/radio/src/gui/view_statistics.cpp index a18c55041..aa3f81b44 100644 --- a/radio/src/gui/view_statistics.cpp +++ b/radio/src/gui/view_statistics.cpp @@ -46,9 +46,11 @@ void menuStatisticsView(uint8_t event) chainMenu(menuStatisticsDebug); return; -#if defined(PCBTARANIS) +#if defined(CPUARM) case EVT_KEY_LONG(KEY_MENU): g_eeGeneral.globalTimer = 0; + eeDirty(EE_GENERAL); + s_timeCumTot = 0; break; #endif case EVT_KEY_FIRST(KEY_EXIT): @@ -65,8 +67,8 @@ void menuStatisticsView(uint8_t event) putsTimer( 12*FW+5*FWNUM+1, FH*0, s_timeCumTot, 0, 0); -#if defined(PCBTARANIS) - putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); +#if defined(CPUARM) + putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + s_timeCumTot, TIMEHOUR, 0); #endif #if defined(THRTRACE) @@ -111,7 +113,7 @@ void menuStatisticsDebug(uint8_t event) #if defined(PCBSKY9X) Current_used = 0; #endif - sessionTimer = 0; + s_timeCumTot = 0; killEvents(event); AUDIO_KEYPAD_UP(); break; @@ -155,7 +157,6 @@ void menuStatisticsDebug(uint8_t event) // consumption lcd_putsLeft(2*FH, STR_CPU_MAH); putsTelemetryValue(MENU_DEBUG_COL1_OFS, 2*FH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1); - putsTimer(MENU_DEBUG_COL2_OFS, 2*FH, g_eeGeneral.globalTimer + sessionTimer, LEFT, 0); #endif #if defined(PCBSKY9X) diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 6735cd0c0..4d4b34c12 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1385,10 +1385,6 @@ uint32_t Current_accumulator; uint32_t Current_used; #endif -#if defined(CPUARM) && !defined(REVA) -uint16_t sessionTimer; -#endif - #if !defined(SIMU) static uint16_t s_anaFilt[NUMBER_ANALOG]; #endif @@ -2653,16 +2649,11 @@ void perMain() static uint32_t OneSecTimer; if (++OneSecTimer >= 100) { OneSecTimer -= 100 ; - sessionTimer += 1; Current_used += Current_accumulator / 100 ; // milliAmpSeconds (but scaled) Current_accumulator = 0 ; } #endif -#if defined(PCBTARANIS) - sessionTimer = s_timeCumTot; -#endif - #if defined(CPUARM) if (currentSpeakerVolume != requiredSpeakerVolume) { currentSpeakerVolume = requiredSpeakerVolume; @@ -3247,8 +3238,10 @@ void saveTimers() } #if defined(CPUARM) && !defined(REVA) - if (sessionTimer > 0) { - g_eeGeneral.globalTimer += sessionTimer; + if (s_timeCumTot > 0) { + g_eeGeneral.globalTimer += s_timeCumTot; + eeDirty(EE_GENERAL); + s_timeCumTot = 0; } #endif }