1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 16:55:20 +03:00
This commit is contained in:
bsongis 2014-07-28 21:02:18 +02:00
parent de15d0a5a4
commit 9861a08150
2 changed files with 29 additions and 1 deletions

View file

@ -644,7 +644,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
//========== PHASE && SWITCH =====
bool mixCondition = (md->flightModes != 0 || md->swtch);
delayval_t mixEnabled = !(md->flightModes & (1 << mixerCurrentFlightMode)) && getSwitch(md->swtch);
delayval_t mixEnabled = (!(md->flightModes & (1 << mixerCurrentFlightMode)) && getSwitch(md->swtch)) ? DELAY_POS_MARGIN+1 : 0;
if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_TRAINER && md->srcRaw <= MIXSRC_LAST_TRAINER && !ppmInValid) {
mixEnabled = 0;

View file

@ -533,6 +533,34 @@ TEST(Mixer, SlowDisabledOnStartup)
EXPECT_EQ(chans[0], CHANNEL_MAX);
}
TEST(Mixer, DelayOnSwitch)
{
MODEL_RESET();
MIXER_RESET();
g_model.mixData[0].destCh = 0;
g_model.mixData[0].mltpx = MLTPX_ADD;
g_model.mixData[0].srcRaw = MIXSRC_MAX;
g_model.mixData[0].weight = 100;
g_model.mixData[0].swtch = TR(SWSRC_THR, SWSRC_SA2);
g_model.mixData[0].delayUp = DELAY_STEP*5;
g_model.mixData[0].delayDown = DELAY_STEP*5;
evalFlightModeMixes(e_perout_mode_normal, 0);
EXPECT_EQ(chans[0], 0);
simuSetSwitch(0, 1);
CHECK_DELAY(0, 500);
evalFlightModeMixes(e_perout_mode_normal, 1);
EXPECT_EQ(chans[0], CHANNEL_MAX);
simuSetSwitch(0, 0);
CHECK_DELAY(0, 500);
evalFlightModeMixes(e_perout_mode_normal, 1);
EXPECT_EQ(chans[0], 0);
}
#if !defined(CPUARM)
TEST(Mixer, SlowAndDelayOnReplace3POSSource)
{