diff --git a/radio/src/mixer.cpp b/radio/src/mixer.cpp index 0e2e274d7..9551389fd 100755 --- a/radio/src/mixer.cpp +++ b/radio/src/mixer.cpp @@ -688,7 +688,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) //========== DELAYS =============== delayval_t _swOn = swOn[i].now; delayval_t _swPrev = swOn[i].prev; - bool swTog = (mixEnabled != _swOn); + bool swTog = (mixEnabled > _swOn+DELAY_POS_MARGIN || mixEnabled < _swOn-DELAY_POS_MARGIN); if (mode==e_perout_mode_normal && swTog) { if (!swOn[i].delay) _swPrev = _swOn; swOn[i].delay = (mixEnabled > _swOn ? md->delayUp : md->delayDown) * (100/DELAY_STEP); @@ -702,15 +702,20 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms) else if (mixEnabled) continue; } - else if (!mixEnabled) { - if ((md->speedDown || md->speedUp) && md->mltpx!=MLTPX_REP) { - if (mixCondition) { - v = (md->mltpx == MLTPX_ADD ? 0 : RESX); - apply_offset_and_curve = false; - } + else { + if (mode==e_perout_mode_normal) { + swOn[i].now = swOn[i].prev = mixEnabled; } - else if (mixCondition) { - continue; + if (!mixEnabled) { + if ((md->speedDown || md->speedUp) && md->mltpx!=MLTPX_REP) { + if (mixCondition) { + v = (md->mltpx == MLTPX_ADD ? 0 : RESX); + apply_offset_and_curve = false; + } + } + else if (mixCondition) { + continue; + } } } diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 0c1771d48..64810a90a 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -1182,6 +1182,7 @@ void evalFunctions(); #if defined(CPUARM) #define ACTIVE_PHASES_TYPE uint16_t #define DELAY_POS_SHIFT 0 +#define DELAY_POS_MARGIN 16 #define delayval_t int16_t PACK(typedef struct t_SwOn { uint16_t delay; @@ -1193,6 +1194,7 @@ PACK(typedef struct t_SwOn { #else #define ACTIVE_PHASES_TYPE uint8_t #define DELAY_POS_SHIFT 10 +#define DELAY_POS_MARGIN 0 #define delayval_t int8_t PACK(typedef struct t_SwOn { uint16_t delay:10;