This commit is contained in:
bsongis
2014-06-12 10:34:57 +02:00
parent 06064b6da2
commit 2cd66cbc65
2 changed files with 16 additions and 9 deletions
+14 -9
View File
@@ -688,7 +688,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
//========== DELAYS =============== //========== DELAYS ===============
delayval_t _swOn = swOn[i].now; delayval_t _swOn = swOn[i].now;
delayval_t _swPrev = swOn[i].prev; 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 (mode==e_perout_mode_normal && swTog) {
if (!swOn[i].delay) _swPrev = _swOn; if (!swOn[i].delay) _swPrev = _swOn;
swOn[i].delay = (mixEnabled > _swOn ? md->delayUp : md->delayDown) * (100/DELAY_STEP); 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) else if (mixEnabled)
continue; continue;
} }
else if (!mixEnabled) { else {
if ((md->speedDown || md->speedUp) && md->mltpx!=MLTPX_REP) { if (mode==e_perout_mode_normal) {
if (mixCondition) { swOn[i].now = swOn[i].prev = mixEnabled;
v = (md->mltpx == MLTPX_ADD ? 0 : RESX);
apply_offset_and_curve = false;
}
} }
else if (mixCondition) { if (!mixEnabled) {
continue; 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;
}
} }
} }
+2
View File
@@ -1182,6 +1182,7 @@ void evalFunctions();
#if defined(CPUARM) #if defined(CPUARM)
#define ACTIVE_PHASES_TYPE uint16_t #define ACTIVE_PHASES_TYPE uint16_t
#define DELAY_POS_SHIFT 0 #define DELAY_POS_SHIFT 0
#define DELAY_POS_MARGIN 16
#define delayval_t int16_t #define delayval_t int16_t
PACK(typedef struct t_SwOn { PACK(typedef struct t_SwOn {
uint16_t delay; uint16_t delay;
@@ -1193,6 +1194,7 @@ PACK(typedef struct t_SwOn {
#else #else
#define ACTIVE_PHASES_TYPE uint8_t #define ACTIVE_PHASES_TYPE uint8_t
#define DELAY_POS_SHIFT 10 #define DELAY_POS_SHIFT 10
#define DELAY_POS_MARGIN 0
#define delayval_t int8_t #define delayval_t int8_t
PACK(typedef struct t_SwOn { PACK(typedef struct t_SwOn {
uint16_t delay:10; uint16_t delay:10;