mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Gtests KO
This commit is contained in:
parent
1a7ff9239d
commit
49a4d5ecb1
4 changed files with 29 additions and 16 deletions
|
@ -48,14 +48,22 @@ void doMixerCalculations();
|
||||||
s_mixer_first_run_done = false; \
|
s_mixer_first_run_done = false; \
|
||||||
s_last_phase = 255;
|
s_last_phase = 255;
|
||||||
|
|
||||||
#define MIXER_RESET() \
|
int32_t lastAct = 0;
|
||||||
memset(channelOutputs, 0, sizeof(channelOutputs)); \
|
void MIXER_RESET()
|
||||||
memset(ex_chans, 0, sizeof(ex_chans)); \
|
{
|
||||||
memset(act, 0, sizeof(act)); \
|
memset(channelOutputs, 0, sizeof(channelOutputs));
|
||||||
memset(swOn, 0, sizeof(swOn)); \
|
memset(ex_chans, 0, sizeof(ex_chans));
|
||||||
int32_t lastAct = 0; lastAct = lastAct; /* to avoid a warning */ \
|
memset(act, 0, sizeof(act));
|
||||||
s_current_mixer_flight_mode = s_last_phase = 0; \
|
memset(swOn, 0, sizeof(swOn));
|
||||||
|
#if !defined(CPUARM)
|
||||||
|
s_last_switch_used = 0;
|
||||||
|
s_last_switch_value = 0;
|
||||||
|
#endif
|
||||||
|
s_current_mixer_flight_mode = s_last_phase = 0;
|
||||||
|
lastAct = 0;
|
||||||
logicalSwitchesReset();
|
logicalSwitchesReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t anaInValues[NUM_STICKS+NUM_POTS] = { 0 };
|
uint16_t anaInValues[NUM_STICKS+NUM_POTS] = { 0 };
|
||||||
uint16_t anaIn(uint8_t chan)
|
uint16_t anaIn(uint8_t chan)
|
||||||
|
@ -334,18 +342,21 @@ TEST(getSwitch, recursiveSW)
|
||||||
g_model.logicalSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
|
g_model.logicalSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
|
||||||
|
|
||||||
evalLogicalSwitches();
|
evalLogicalSwitches();
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||||
|
|
||||||
|
LS_RECURSIVE_EVALUATION_RESET();
|
||||||
evalLogicalSwitches();
|
evalLogicalSwitches();
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||||
|
|
||||||
simuSetSwitch(1, 1);
|
simuSetSwitch(1, 1);
|
||||||
|
LS_RECURSIVE_EVALUATION_RESET();
|
||||||
evalLogicalSwitches();
|
evalLogicalSwitches();
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||||
|
|
||||||
|
LS_RECURSIVE_EVALUATION_RESET();
|
||||||
evalLogicalSwitches();
|
evalLogicalSwitches();
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
||||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
||||||
|
|
|
@ -525,9 +525,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||||
{
|
{
|
||||||
evalInputs(mode);
|
evalInputs(mode);
|
||||||
|
|
||||||
#if defined(CPUARM)
|
|
||||||
evalLogicalSwitches(mode==e_perout_mode_normal);
|
evalLogicalSwitches(mode==e_perout_mode_normal);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
#if defined(MODULE_ALWAYS_SEND_PULSES)
|
||||||
checkStartupWarnings();
|
checkStartupWarnings();
|
||||||
|
|
|
@ -671,6 +671,7 @@ enum StartupWarningStates {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t s_current_mixer_flight_mode;
|
extern uint8_t s_current_mixer_flight_mode;
|
||||||
|
extern uint8_t s_last_phase;
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define bitfield_channels_t uint32_t
|
#define bitfield_channels_t uint32_t
|
||||||
|
@ -698,9 +699,13 @@ void logicalSwitchesReset();
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
void evalLogicalSwitches(bool isCurrentPhase=true);
|
void evalLogicalSwitches(bool isCurrentPhase=true);
|
||||||
void logicalSwitchesCopyState();
|
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
#define LS_RECURSIVE_EVALUATION_RESET()
|
||||||
#else
|
#else
|
||||||
|
#define evalLogicalSwitches(xxx)
|
||||||
|
#define GETSWITCH_RECURSIVE_TYPE uint16_t
|
||||||
|
extern volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_used;
|
||||||
|
extern volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value;
|
||||||
#define LS_RECURSIVE_EVALUATION_RESET() s_last_switch_used = 0
|
#define LS_RECURSIVE_EVALUATION_RESET() s_last_switch_used = 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,6 @@ LogicalSwitchesFlightModeContext lswFm[MAX_FLIGHT_MODES];
|
||||||
int16_t lsLastValue[NUM_LOGICAL_SWITCH];
|
int16_t lsLastValue[NUM_LOGICAL_SWITCH];
|
||||||
#define LS_LAST_VALUE(fm, idx) lsLastValue[idx]
|
#define LS_LAST_VALUE(fm, idx) lsLastValue[idx]
|
||||||
|
|
||||||
#define GETSWITCH_RECURSIVE_TYPE uint16_t
|
|
||||||
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_used = 0;
|
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_used = 0;
|
||||||
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value = 0;
|
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue