refactor(mixer): Improve mixer "delay" option (#4256)

This commit is contained in:
Raphael Coeffic
2023-11-07 10:50:41 +10:00
committed by GitHub
parent 926dc36d51
commit 6eef2540ff
2 changed files with 128 additions and 62 deletions
+34 -1
View File
@@ -662,10 +662,43 @@ TEST_F(MixerTest, DelayOnSwitch)
g_model.mixData[0].srcRaw = MIXSRC_MAX;
g_model.mixData[0].weight = 100;
g_model.mixData[0].swtch = SWSRC_FIRST_SWITCH + 2;
int switch_index = 0;
g_model.mixData[0].delayUp = 50;
g_model.mixData[0].delayDown = 50;
int switch_index = 0;
simuSetSwitch(switch_index, -1);
evalFlightModeMixes(e_perout_mode_normal, 0);
EXPECT_EQ(chans[0], 0);
simuSetSwitch(switch_index, 1);
CHECK_DELAY(0, 500);
evalFlightModeMixes(e_perout_mode_normal, 1);
EXPECT_EQ(chans[0], CHANNEL_MAX);
simuSetSwitch(switch_index, 0);
CHECK_DELAY(0, 500);
evalFlightModeMixes(e_perout_mode_normal, 1);
EXPECT_EQ(chans[0], 0);
}
TEST_F(MixerTest, DelayOnSwitch2)
{
g_eeGeneral.switchConfig = SWITCH_3POS;
g_model.mixData[0].destCh = 0;
g_model.mixData[0].mltpx = MLTPX_ADD;
g_model.mixData[0].srcRaw = MIXSRC_FIRST_SWITCH;
g_model.mixData[0].weight = 100;
g_model.mixData[0].swtch = SWSRC_ON;
g_model.mixData[0].delayUp = 50;
g_model.mixData[0].delayDown = 50;
int switch_index = 0;
simuSetSwitch(switch_index, -1);
evalFlightModeMixes(e_perout_mode_normal, 0);
EXPECT_EQ(chans[0], 0);