Debug timers added (use -DDEBUG_TIMERS=YES to enable and CLI command "print dt" to see them)

This commit is contained in:
Damjan Adamic
2016-04-03 19:27:47 +02:00
parent a8aa6148e5
commit 2990e9b9a3
11 changed files with 517 additions and 276 deletions
+5
View File
@@ -487,6 +487,7 @@ if(ARCH STREQUAL ARM)
option(SUPPORT_D16_EU_ONLY "XJT module only supports D16-EU and LR12-EU" OFF) # TODO rename to XJT_EU_ONLY option(SUPPORT_D16_EU_ONLY "XJT module only supports D16-EU and LR12-EU" OFF) # TODO rename to XJT_EU_ONLY
option(DEBUG_INTERRUPTS "Count interrupts" OFF) option(DEBUG_INTERRUPTS "Count interrupts" OFF)
option(DEBUG_TASKS "Task switching statistics" OFF) option(DEBUG_TASKS "Task switching statistics" OFF)
option(DEBUG_TIMERS "Time critical parts of the code" OFF)
if(TIMERS EQUAL 3) if(TIMERS EQUAL 3)
add_definitions(-DTIMERS=3) add_definitions(-DTIMERS=3)
@@ -522,6 +523,10 @@ if(ARCH STREQUAL ARM)
add_definitions(-DDEBUG_TASKS) add_definitions(-DDEBUG_TASKS)
set(DEBUG ON) set(DEBUG ON)
endif() endif()
if(DEBUG_TIMERS)
add_definitions(-DDEBUG_TIMERS)
set(DEBUG ON)
endif()
if(CLI) if(CLI)
add_definitions(-DCLI) add_definitions(-DCLI)
set(FIRMWARE_SRC ${FIRMWARE_SRC} cli.cpp) set(FIRMWARE_SRC ${FIRMWARE_SRC} cli.cpp)
+39 -4
View File
@@ -423,10 +423,37 @@ void printTaskSwitchLog()
delete[] tsl; delete[] tsl;
serialCrlf(); serialCrlf();
} }
#endif // #if defined(DEBUG_TASKS) #endif // #if defined(DEBUG_TASKS)
#if defined(DEBUG_TIMERS)
void printDebugTime(uint32_t time)
{
if (time >= 30000) {
serialPrintf("%dms", time/1000);
}
else {
serialPrintf("%d.%03dms", time/1000, time%1000);
}
}
void printDebugTimer(const char * name, DebugTimer & timer)
{
serialPrintf("%s: ", name);
printDebugTime( timer.getMin());
serialPrintf(" - ");
printDebugTime(timer.getMax());
serialCrlf();
timer.reset();
}
void printDebugTimers()
{
for(int n = 0; n < DEBUG_TIMERS_COUNT; n++) {
printDebugTimer(debugTimerNames[n], debugTimers[n]);
}
}
#endif
int cliDisplay(const char ** argv) int cliDisplay(const char ** argv)
{ {
long long int address = 0; long long int address = 0;
@@ -531,6 +558,9 @@ int cliDisplay(const char ** argv)
case 2: case 2:
tim = TIM2; tim = TIM2;
break; break;
case 13:
tim = TIM13;
break;
default: default:
return 0; return 0;
} }
@@ -558,12 +588,17 @@ int cliDisplay(const char ** argv)
else if (!strcmp(argv[1], "int")) { else if (!strcmp(argv[1], "int")) {
printInterrupts(); printInterrupts();
} }
#endif //#if defined(DEBUG_INTERRUPTS) #endif
#if defined(DEBUG_TASKS) #if defined(DEBUG_TASKS)
else if (!strcmp(argv[1], "tsl")) { else if (!strcmp(argv[1], "tsl")) {
printTaskSwitchLog(); printTaskSwitchLog();
} }
#endif //#if defined(DEBUG_TASKS) #endif
#if defined(DEBUG_TIMERS)
else if (!strcmp(argv[1], "dt")) {
printDebugTimers();
}
#endif
else if (toLongLongInt(argv, 1, &address) > 0) { else if (toLongLongInt(argv, 1, &address) > 0) {
int size = 256; int size = 256;
if (toInt(argv, 2, &size) >= 0) { if (toInt(argv, 2, &size) >= 0) {
+61
View File
@@ -165,3 +165,64 @@ void CoTaskSwitchHook(uint8_t taskID)
} }
#endif // #if defined(DEBUG_TASKS) #endif // #if defined(DEBUG_TASKS)
#if defined(DEBUG_TIMERS)
void DebugTimer::start()
{
_start_hiprec = getTmr2MHz();
_start_loprec = get_tmr10ms();
}
void DebugTimer::stop()
{
// getTmr2MHz is 16 bit timer, resolution 0.5us, max measurable value 32.7675 milli seconds
// tmr10ms_t tmr10ms = get_tmr10ms(); 32 bit timer, resolution 10ms, max measurable value: 42949672.95 s = 1.3 years
// if time difference is bigger than 30ms, then use low resolution timer
// otherwise use high resolution
if ((_start_hiprec == 0) && (_start_loprec == 0)) return;
last = get_tmr10ms() - _start_loprec; //use low precision timer
if (last < 3) {
//use high precision
last = (uint16_t)(getTmr2MHz() - _start_hiprec) / 2;
}
else {
last *= 10000ul; //adjust unit to 1us
}
evalStats();
}
DebugTimer debugTimers[DEBUG_TIMERS_COUNT];
const char * debugTimerNames[DEBUG_TIMERS_COUNT] = {
"Pulses int." // debugTimerIntPulses,
,"Pulses dur." // debugTimerIntPulsesDuration,
,"10ms dur. " // debugTimerPer10ms,
,"Rotary enc." // debugTimerRotEnc,
,"Haptic " // debugTimerHaptic,
,"Mixer calc " // debugTimerMixer,
,"Tel. wakeup" // debugTimerTelemetryWakeup,
,"perMain dur" // debugTimerPerMain,
," perMain s1" // debugTimerPerMain1,
," guiMain " // debugTimerGuiMain,
," LUA bg " // debugTimerLuaBg,
," LCD wait " // debugTimerLcdRefreshWait,
," LUA fg " // debugTimerLuaFg,
," LCD refr." // debugTimerLcdRefresh,
," Menus " // debugTimerMenus,
," Menu hnd" // debugTimerMenuHandlers,
,"Menu Vers. " // debugTimerVersion,
,"Menu simple" // debugTimerSimpleMenu,
,"Menu drawte" // debugTimerDrawText,
,"Menu drawt1" // debugTimerDrawText1,
,"Mix ADC " // debugTimerGetAdc,
,"Mix getsw " // debugTimerGetSwitches,
,"Mix eval " // debugTimerEvalMixes,
,"Mix 10ms " // debugTimerMixes10ms,
,"ADC read " // debugTimerAdcRead,
,"ADC loop " // debugTimerAdcLoop,
,"ADC wait " // debugTimerAdcWait,
};
#endif
+89
View File
@@ -256,5 +256,94 @@ extern void CoTaskSwitchHook(uint8_t taskID);
#endif // #if defined(DEBUG_TASKS) #endif // #if defined(DEBUG_TASKS)
#if defined(DEBUG_TIMERS)
#if defined(__cplusplus)
typedef uint32_t debug_timer_t;
class DebugTimer
{
private:
debug_timer_t min;
debug_timer_t max;
// debug_timer_t avg;
debug_timer_t last; //unit 1us
uint16_t _start_hiprec;
uint32_t _start_loprec;
void evalStats() {
if (min > last) min = last;
if (max < last) max = last;
//todo avg
}
public:
DebugTimer(): min(-1), max(0), /*avg(0),*/ last(0), _start_hiprec(0), _start_loprec(0) {};
void start();
void stop();
void sample() { stop(); start(); }
void reset() { min = -1; max = last = 0; }
debug_timer_t getMin() const { return min; }
debug_timer_t getMax() const { return max; }
debug_timer_t getLast() const { return last; }
};
enum DebugTimers {
debugTimerIntPulses,
debugTimerIntPulsesDuration,
debugTimerPer10ms,
debugTimerRotEnc,
debugTimerHaptic,
debugTimerMixer,
debugTimerTelemetryWakeup,
debugTimerPerMain,
debugTimerPerMain1,
debugTimerGuiMain,
debugTimerLuaBg,
debugTimerLcdRefreshWait,
debugTimerLuaFg,
debugTimerLcdRefresh,
debugTimerMenus,
debugTimerMenuHandlers,
debugTimerVersion,
debugTimerSimpleMenu,
debugTimerDrawText,
debugTimerDrawText1,
debugTimerGetAdc,
debugTimerGetSwitches,
debugTimerEvalMixes,
debugTimerMixes10ms,
debugTimerAdcRead,
debugTimerAdcLoop,
debugTimerAdcWait,
DEBUG_TIMERS_COUNT
};
extern DebugTimer debugTimers[DEBUG_TIMERS_COUNT];
extern const char * debugTimerNames[DEBUG_TIMERS_COUNT];
#endif // #if defined(__cplusplus)
#define DEBUG_TIMER_START(timer) debugTimers[timer].start()
#define DEBUG_TIMER_STOP(timer) debugTimers[timer].stop()
#define DEBUG_TIMER_SAMPLE(timer) debugTimers[timer].sample()
#else //#if defined(DEBUG_TIMERS)
#define DEBUG_TIMER_START(timer)
#define DEBUG_TIMER_STOP(timer)
#define DEBUG_TIMER_SAMPLE(timer)
#endif //#if defined(DEBUG_TIMERS)
#endif // _DEBUG_H_ #endif // _DEBUG_H_
+8 -1
View File
@@ -22,18 +22,25 @@
bool menuGeneralVersion(evt_t event) bool menuGeneralVersion(evt_t event)
{ {
DEBUG_TIMER_START(debugTimerVersion);
DEBUG_TIMER_START(debugTimerSimpleMenu);
SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 0); SIMPLE_MENU(STR_MENUVERSION, LBM_RADIO_ICONS, menuTabGeneral, e_Vers, 0);
DEBUG_TIMER_STOP(debugTimerSimpleMenu);
DEBUG_TIMER_START(debugTimerDrawText);
DEBUG_TIMER_START(debugTimerDrawText1);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, vers_stamp);
DEBUG_TIMER_STOP(debugTimerDrawText1);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 2*FH, date_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp); lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp);
DEBUG_TIMER_STOP(debugTimerDrawText);
// TODO EEPROM erase + backup // TODO EEPROM erase + backup
// lcd_putsCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP); // lcd_putsCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP);
// if (event == EVT_KEY_LONG(KEY_ENTER)) { // if (event == EVT_KEY_LONG(KEY_ENTER)) {
// backupEeprom(); // backupEeprom();
// } // }
DEBUG_TIMER_STOP(debugTimerVersion);
return true; return true;
} }
+16 -1
View File
@@ -178,22 +178,27 @@ void guiMain(evt_t evt)
} }
// run Lua scripts that don't use LCD (to use CPU time while LCD DMA is running) // run Lua scripts that don't use LCD (to use CPU time while LCD DMA is running)
DEBUG_TIMER_START(debugTimerLuaBg);
luaTask(0, RUN_MIX_SCRIPT | RUN_FUNC_SCRIPT | RUN_TELEM_BG_SCRIPT, false); luaTask(0, RUN_MIX_SCRIPT | RUN_FUNC_SCRIPT | RUN_TELEM_BG_SCRIPT, false);
DEBUG_TIMER_STOP(debugTimerLuaBg);
// wait for LCD DMA to finish before continuing, because code from this point // wait for LCD DMA to finish before continuing, because code from this point
// is allowed to change the contents of LCD buffer // is allowed to change the contents of LCD buffer
// //
// WARNING: make sure no code above this line does any change to the LCD display buffer! // WARNING: make sure no code above this line does any change to the LCD display buffer!
// //
DEBUG_TIMER_START(debugTimerLcdRefreshWait);
lcdRefreshWait(); lcdRefreshWait();
DEBUG_TIMER_STOP(debugTimerLcdRefreshWait);
// draw LCD from menus or from Lua script // draw LCD from menus or from Lua script
// run Lua scripts that use LCD // run Lua scripts that use LCD
DEBUG_TIMER_START(debugTimerLuaFg);
refreshNeeded = luaTask(evt, RUN_STNDAL_SCRIPT, true); refreshNeeded = luaTask(evt, RUN_STNDAL_SCRIPT, true);
if (!refreshNeeded) { if (!refreshNeeded) {
refreshNeeded = luaTask(evt, RUN_TELEM_FG_SCRIPT, true); refreshNeeded = luaTask(evt, RUN_TELEM_FG_SCRIPT, true);
} }
DEBUG_TIMER_STOP(debugTimerLuaFg);
t0 = get_tmr10ms() - t0; t0 = get_tmr10ms() - t0;
if (t0 > maxLuaDuration) { if (t0 > maxLuaDuration) {
@@ -204,6 +209,7 @@ void guiMain(evt_t evt)
#endif #endif
if (!refreshNeeded) { if (!refreshNeeded) {
DEBUG_TIMER_START(debugTimerMenus);
while (1) { while (1) {
// normal GUI from menus // normal GUI from menus
const char * warn = warningText; const char * warn = warningText;
@@ -241,7 +247,9 @@ void guiMain(evt_t evt)
} }
popupDisplayed = false; popupDisplayed = false;
} }
DEBUG_TIMER_START(debugTimerMenuHandlers);
refreshNeeded = menuHandlers[menuLevel](evt); refreshNeeded = menuHandlers[menuLevel](evt);
DEBUG_TIMER_STOP(debugTimerMenuHandlers);
} }
if (menuEvent == EVT_ENTRY) { if (menuEvent == EVT_ENTRY) {
@@ -260,10 +268,13 @@ void guiMain(evt_t evt)
break; break;
} }
} }
DEBUG_TIMER_STOP(debugTimerMenus);
} }
if (refreshNeeded) { if (refreshNeeded) {
DEBUG_TIMER_START(debugTimerLcdRefresh);
lcdRefresh(); lcdRefresh();
DEBUG_TIMER_STOP(debugTimerLcdRefresh);
} }
} }
#elif defined(GUI) #elif defined(GUI)
@@ -384,6 +395,7 @@ void guiMain(evt_t evt)
void perMain() void perMain()
{ {
DEBUG_TIMER_START(debugTimerPerMain1);
#if defined(PCBSKY9X) && !defined(REVA) #if defined(PCBSKY9X) && !defined(REVA)
calcConsumption(); calcConsumption();
#endif #endif
@@ -394,6 +406,7 @@ void perMain()
handleUsbConnection(); handleUsbConnection();
checkTrainerSettings(); checkTrainerSettings();
periodicTick(); periodicTick();
DEBUG_TIMER_STOP(debugTimerPerMain1);
evt_t evt = getEvent(false); evt_t evt = getEvent(false);
if (evt && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) backlightOn(); // on keypress turn the light on if (evt && (g_eeGeneral.backlightMode & e_backlight_mode_keys)) backlightOn(); // on keypress turn the light on
@@ -423,7 +436,9 @@ void perMain()
#endif #endif
#if defined(GUI) #if defined(GUI)
DEBUG_TIMER_START(debugTimerGuiMain);
guiMain(evt); guiMain(evt);
DEBUG_TIMER_STOP(debugTimerGuiMain);
#endif #endif
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
+10
View File
@@ -1588,6 +1588,7 @@ void getADC()
} }
#endif #endif
DEBUG_TIMER_START(debugTimerAdcRead);
for (uint8_t i=0; i<4; i++) { for (uint8_t i=0; i<4; i++) {
adcRead(); adcRead();
for (uint8_t x=0; x<NUMBER_ANALOG; x++) { for (uint8_t x=0; x<NUMBER_ANALOG; x++) {
@@ -1600,6 +1601,7 @@ void getADC()
temp[x] += val; temp[x] += val;
} }
} }
DEBUG_TIMER_STOP(debugTimerAdcRead);
for (uint32_t x=0; x<NUMBER_ANALOG; x++) { for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
uint16_t v = temp[x] >> (3 - ANALOG_SCALE); uint16_t v = temp[x] >> (3 - ANALOG_SCALE);
@@ -1773,13 +1775,17 @@ void doMixerCalculations()
// therefore forget the exact calculation and use only 1 instead; good compromise // therefore forget the exact calculation and use only 1 instead; good compromise
lastTMR = tmr10ms; lastTMR = tmr10ms;
DEBUG_TIMER_START(debugTimerGetAdc);
getADC(); getADC();
DEBUG_TIMER_STOP(debugTimerGetAdc);
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
processSbusInput(); processSbusInput();
#endif #endif
DEBUG_TIMER_START(debugTimerGetSwitches);
getSwitchesPosition(!s_mixer_first_run_done); getSwitchesPosition(!s_mixer_first_run_done);
DEBUG_TIMER_STOP(debugTimerGetSwitches);
#if defined(PCBSKY9X) && !defined(REVA) && !defined(SIMU) #if defined(PCBSKY9X) && !defined(REVA) && !defined(SIMU)
Current_analogue = (Current_analogue*31 + s_anaFilt[8] ) >> 5 ; Current_analogue = (Current_analogue*31 + s_anaFilt[8] ) >> 5 ;
@@ -1791,13 +1797,16 @@ void doMixerCalculations()
adcPrepareBandgap(); adcPrepareBandgap();
#endif #endif
DEBUG_TIMER_START(debugTimerEvalMixes);
evalMixes(tick10ms); evalMixes(tick10ms);
DEBUG_TIMER_STOP(debugTimerEvalMixes);
#if !defined(CPUARM) #if !defined(CPUARM)
// Bandgap has had plenty of time to settle... // Bandgap has had plenty of time to settle...
getADC_bandgap(); getADC_bandgap();
#endif #endif
DEBUG_TIMER_START(debugTimerMixes10ms);
if (tick10ms) { if (tick10ms) {
#if !defined(CPUM64) && !defined(ACCURAT_THROTTLE_TIMER) #if !defined(CPUM64) && !defined(ACCURAT_THROTTLE_TIMER)
@@ -1942,6 +1951,7 @@ void doMixerCalculations()
checkTrims(); checkTrims();
#endif #endif
} }
DEBUG_TIMER_STOP(debugTimerMixes10ms);
s_mixer_first_run_done = true; s_mixer_first_run_done = true;
} }
+4
View File
@@ -178,6 +178,7 @@ void adcRead()
ADC_CS_HIGH(); ADC_CS_HIGH();
delay_01us(1); delay_01us(1);
DEBUG_TIMER_START(debugTimerAdcLoop);
for (uint32_t adcIndex=0; adcIndex<MOUSE1; adcIndex++) { for (uint32_t adcIndex=0; adcIndex<MOUSE1; adcIndex++) {
// MUX is changed to the channel that was sent in the previous command // MUX is changed to the channel that was sent in the previous command
// but the data is from the old MUX position // but the data is from the old MUX position
@@ -211,12 +212,15 @@ void adcRead()
ADC_CS_HIGH(); ADC_CS_HIGH();
delay_01us(1); delay_01us(1);
} }
DEBUG_TIMER_STOP(debugTimerAdcLoop);
DEBUG_TIMER_START(debugTimerAdcWait);
for (uint32_t i=0; i<20000; i++) { for (uint32_t i=0; i<20000; i++) {
if (DMA2->LISR & DMA_LISR_TCIF1) { if (DMA2->LISR & DMA_LISR_TCIF1) {
break; break;
} }
} }
DEBUG_TIMER_STOP(debugTimerAdcWait);
// On chip ADC read should have finished // On chip ADC read should have finished
} }
+6
View File
@@ -82,17 +82,23 @@ void interrupt1ms()
if (pre_scale == 5 || pre_scale == 10) { if (pre_scale == 5 || pre_scale == 10) {
#if defined(HAPTIC) #if defined(HAPTIC)
DEBUG_TIMER_START(debugTimerHaptic);
HAPTIC_HEARTBEAT(); HAPTIC_HEARTBEAT();
DEBUG_TIMER_STOP(debugTimerHaptic);
#endif #endif
} }
if ( pre_scale == 10 ) { if ( pre_scale == 10 ) {
pre_scale = 0 ; pre_scale = 0 ;
DEBUG_TIMER_START(debugTimerPer10ms);
per10ms(); per10ms();
DEBUG_TIMER_STOP(debugTimerPer10ms);
} }
DEBUG_TIMER_START(debugTimerRotEnc);
checkRotaryEncoder(); checkRotaryEncoder();
DEBUG_TIMER_STOP(debugTimerRotEnc);
} }
#if !defined(SIMU) #if !defined(SIMU)
@@ -175,6 +175,8 @@ extern "C" void DMA2_Stream7_IRQHandler(void)
extern "C" void TIM1_CC_IRQHandler() extern "C" void TIM1_CC_IRQHandler()
{ {
DEBUG_INTERRUPT(INT_TIM1CC); DEBUG_INTERRUPT(INT_TIM1CC);
DEBUG_TIMER_SAMPLE(debugTimerIntPulses);
DEBUG_TIMER_START(debugTimerIntPulsesDuration);
INTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // stop this interrupt INTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // stop this interrupt
INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // clear flag INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // clear flag
@@ -206,6 +208,7 @@ extern "C" void TIM1_CC_IRQHandler()
} }
INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE;
DEBUG_TIMER_STOP(debugTimerIntPulsesDuration);
} }
#endif #endif
+8 -2
View File
@@ -105,12 +105,16 @@ void mixerTask(void * pdata)
if (!s_pulses_paused) { if (!s_pulses_paused) {
uint16_t t0 = getTmr2MHz(); uint16_t t0 = getTmr2MHz();
DEBUG_TIMER_START(debugTimerMixer);
CoEnterMutexSection(mixerMutex); CoEnterMutexSection(mixerMutex);
doMixerCalculations(); doMixerCalculations();
CoLeaveMutexSection(mixerMutex); CoLeaveMutexSection(mixerMutex);
DEBUG_TIMER_STOP(debugTimerMixer);
#if defined(FRSKY) || defined(MAVLINK) #if defined(FRSKY) || defined(MAVLINK)
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
telemetryWakeup(); telemetryWakeup();
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
#endif #endif
if (heartbeat == HEART_WDT_CHECK) { if (heartbeat == HEART_WDT_CHECK) {
@@ -145,10 +149,12 @@ void menusTask(void * pdata)
#else #else
while (pwrCheck() != e_power_off) { while (pwrCheck() != e_power_off) {
#endif #endif
U64 start = CoGetOSTime(); uint32_t start = (uint32_t)CoGetOSTime();
DEBUG_TIMER_START(debugTimerPerMain);
perMain(); perMain();
DEBUG_TIMER_STOP(debugTimerPerMain);
// TODO remove completely massstorage from sky9x firmware // TODO remove completely massstorage from sky9x firmware
U32 runtime = (U32)(CoGetOSTime() - start); uint32_t runtime = ((uint32_t)CoGetOSTime() - start);
// deduct the thread run-time from the wait, if run-time was more than // deduct the thread run-time from the wait, if run-time was more than
// desired period, then skip the wait all together // desired period, then skip the wait all together
if (runtime < MENU_TASK_PERIOD_TICKS) { if (runtime < MENU_TASK_PERIOD_TICKS) {