mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 20:10:08 +03:00
* Fixes #3937: When executed from Special Functions, Flight Reset caused a GUI lockup * Cosmetics
This commit is contained in:
parent
81e9fe5201
commit
f4b54ea332
4 changed files with 27 additions and 14 deletions
|
@ -42,23 +42,21 @@ TEST(SpecialFunctions, FlightReset)
|
|||
g_model.customFn[0].all.val = FUNC_RESET_FLIGHT;
|
||||
g_model.customFn[0].active = true;
|
||||
|
||||
// we (mis)use s_mixer_first_run_done for the flight reset detection
|
||||
s_mixer_first_run_done = true;
|
||||
mainRequestFlags = 0;
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext);
|
||||
EXPECT_EQ(s_mixer_first_run_done, true);
|
||||
EXPECT_EQ((bool)(mainRequestFlags & (1 << REQUEST_FLIGHT_RESET)), false);
|
||||
|
||||
// now trigger SA0
|
||||
simuSetSwitch(0, -1);
|
||||
|
||||
// flightReset() should be called
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext);
|
||||
EXPECT_EQ(s_mixer_first_run_done, false);
|
||||
EXPECT_EQ((bool)(mainRequestFlags & (1 << REQUEST_FLIGHT_RESET)), true);
|
||||
|
||||
// now set s_mixer_first_run_done to true, and it should stay true (flightReset() should not be called again)
|
||||
s_mixer_first_run_done = true;
|
||||
// now reset mainRequestFlags, and it should stay reset (flightReset() should not be called again)
|
||||
mainRequestFlags = 0;
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext);
|
||||
EXPECT_EQ(s_mixer_first_run_done, true) << "Flight Reset repeats!";
|
||||
|
||||
EXPECT_EQ((bool)(mainRequestFlags & (1 << REQUEST_FLIGHT_RESET)), false);
|
||||
}
|
||||
|
||||
#if defined(GVARS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue