1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

[simu] Refactor simu startup and shutdown handling (for 2.3 branch):

* Use pwrCheck() as primary control point for shutdown, centralizes thread control in simpgmspace module;
 * Remove main_thread_running in favor of separate variables for startup mode and shutdown flag;
 * Don't start a thread for ARM startup, just run simuMain() directly (the thread just exits anyway);
 * Refactor SIMU_SLEEP() macro, and remove all unnecessary uses of it, also remove SIMU_SLEEP_NORET;
 * Add startType param to opentxStart() to control splash and startup checks;
 * Fixes backlight never turning off in simulator with "SWITCH" power button type (pwrPressed() was always true);
 * Fixes simu shutdown when model checklist is displayed at startup;
 * Adds stubs to possibly simulate a "soft" power button in the future.
This commit is contained in:
Max Paperno 2018-09-07 14:46:28 -04:00
parent 942ae1847d
commit a2006940db
No known key found for this signature in database
GPG key ID: F5A9DFACA08DD174
12 changed files with 97 additions and 70 deletions

View file

@ -82,20 +82,20 @@ TASK_FUNCTION(mixerTask)
while(1) {
#if defined(SIMU)
if (main_thread_running == 0)
TASK_RETURN();
#endif
#if defined(SBUS)
processSbusInput();
#endif
RTOS_WAIT_TICKS(1);
#if defined(SIMU)
if (pwrCheck() == e_power_off)
TASK_RETURN();
#else
if (isForcePowerOffRequested()) {
pwrOff();
}
#endif
uint32_t now = RTOS_GET_TIME();
bool run = false;
@ -208,11 +208,6 @@ TASK_FUNCTION(menusTask)
}
resetForcePowerOffRequest();
#if defined(SIMU)
if (main_thread_running == 0)
break;
#endif
}
#if defined(PCBX9E)