[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:
@@ -227,21 +227,24 @@ extern uint32_t Master_frequency;
|
||||
#define __disable_irq()
|
||||
#define __enable_irq()
|
||||
|
||||
extern uint8_t main_thread_running;
|
||||
extern uint8_t simu_start_mode;
|
||||
extern char * main_thread_error;
|
||||
|
||||
#define OPENTX_START_DEFAULT_ARGS simu_start_mode
|
||||
|
||||
static inline void getADC()
|
||||
{
|
||||
}
|
||||
|
||||
#define SIMU_SLEEP(x) do { if (!main_thread_running) return; sleep(x/*ms*/); } while (0)
|
||||
#define SIMU_SLEEP_NORET(x) do { sleep(x/*ms*/); } while (0)
|
||||
#define SIMU_SLEEP(x) simuSleep(x)
|
||||
|
||||
uint64_t simuTimerMicros(void);
|
||||
|
||||
void simuInit();
|
||||
void StartSimu(bool tests=true, const char * sdPath = 0, const char * settingsPath = 0);
|
||||
void StopSimu();
|
||||
bool simuIsRunning();
|
||||
bool simuSleep(uint32_t ms);
|
||||
|
||||
void simuSetKey(uint8_t key, bool state);
|
||||
void simuSetTrim(uint8_t trim, bool state);
|
||||
@@ -257,7 +260,7 @@ void StopEepromThread();
|
||||
#define StopAudioThread()
|
||||
#endif
|
||||
|
||||
void * simuMain(void * args = NULL);
|
||||
void simuMain();
|
||||
|
||||
#define UART_Stop(...)
|
||||
#define UART3_Stop(...)
|
||||
|
||||
Reference in New Issue
Block a user