Removed sessionTimer and replaced with existing s_timeCumTot.

Corrected bug when saving g_eeGeneral.globalTimer (missing reset of session timer and eeprom dirty)
This commit is contained in:
Damjan Adamic
2014-07-03 19:14:15 +02:00
parent 1fef79ce80
commit b6cbde48be
2 changed files with 10 additions and 16 deletions
+6 -5
View File
@@ -46,9 +46,11 @@ void menuStatisticsView(uint8_t event)
chainMenu(menuStatisticsDebug); chainMenu(menuStatisticsDebug);
return; return;
#if defined(PCBTARANIS) #if defined(CPUARM)
case EVT_KEY_LONG(KEY_MENU): case EVT_KEY_LONG(KEY_MENU):
g_eeGeneral.globalTimer = 0; g_eeGeneral.globalTimer = 0;
eeDirty(EE_GENERAL);
s_timeCumTot = 0;
break; break;
#endif #endif
case EVT_KEY_FIRST(KEY_EXIT): 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); putsTimer( 12*FW+5*FWNUM+1, FH*0, s_timeCumTot, 0, 0);
#if defined(PCBTARANIS) #if defined(CPUARM)
putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0); putsTimer(21*FW+5*FWNUM+1, 0*FH, g_eeGeneral.globalTimer + s_timeCumTot, TIMEHOUR, 0);
#endif #endif
#if defined(THRTRACE) #if defined(THRTRACE)
@@ -111,7 +113,7 @@ void menuStatisticsDebug(uint8_t event)
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
Current_used = 0; Current_used = 0;
#endif #endif
sessionTimer = 0; s_timeCumTot = 0;
killEvents(event); killEvents(event);
AUDIO_KEYPAD_UP(); AUDIO_KEYPAD_UP();
break; break;
@@ -155,7 +157,6 @@ void menuStatisticsDebug(uint8_t event)
// consumption // consumption
lcd_putsLeft(2*FH, STR_CPU_MAH); 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); 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 #endif
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
+4 -11
View File
@@ -1385,10 +1385,6 @@ uint32_t Current_accumulator;
uint32_t Current_used; uint32_t Current_used;
#endif #endif
#if defined(CPUARM) && !defined(REVA)
uint16_t sessionTimer;
#endif
#if !defined(SIMU) #if !defined(SIMU)
static uint16_t s_anaFilt[NUMBER_ANALOG]; static uint16_t s_anaFilt[NUMBER_ANALOG];
#endif #endif
@@ -2653,16 +2649,11 @@ void perMain()
static uint32_t OneSecTimer; static uint32_t OneSecTimer;
if (++OneSecTimer >= 100) { if (++OneSecTimer >= 100) {
OneSecTimer -= 100 ; OneSecTimer -= 100 ;
sessionTimer += 1;
Current_used += Current_accumulator / 100 ; // milliAmpSeconds (but scaled) Current_used += Current_accumulator / 100 ; // milliAmpSeconds (but scaled)
Current_accumulator = 0 ; Current_accumulator = 0 ;
} }
#endif #endif
#if defined(PCBTARANIS)
sessionTimer = s_timeCumTot;
#endif
#if defined(CPUARM) #if defined(CPUARM)
if (currentSpeakerVolume != requiredSpeakerVolume) { if (currentSpeakerVolume != requiredSpeakerVolume) {
currentSpeakerVolume = requiredSpeakerVolume; currentSpeakerVolume = requiredSpeakerVolume;
@@ -3247,8 +3238,10 @@ void saveTimers()
} }
#if defined(CPUARM) && !defined(REVA) #if defined(CPUARM) && !defined(REVA)
if (sessionTimer > 0) { if (s_timeCumTot > 0) {
g_eeGeneral.globalTimer += sessionTimer; g_eeGeneral.globalTimer += s_timeCumTot;
eeDirty(EE_GENERAL);
s_timeCumTot = 0;
} }
#endif #endif
} }