154,8 → 154,36 |
int MotorSmoothing(int neu, int alt) |
{ |
int motor; |
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
else motor = neu - (alt - neu)*1; |
|
if(neu > alt) |
{ |
motor = (1*(int)alt + neu) / 2; |
} |
else |
|
// Arthur P: the original code allowed the motor value to drop to 0 or negative values |
// straight off, i.e. could amplify an intended decrease excessively while upregulation |
// is dampened. The modification would still allow immediate drop below intended value |
// but would dampen this. This would still allow for airbraking of the prop to have effect |
// but it might lead to less sudden excessive drops in rpm with only gradual recovery. |
|
{ |
if(Parameter_UserParam1 < 1) |
{ // Original function |
motor = neu - (alt - neu)*1; |
} |
else |
{ |
if(Parameter_UserParam1 == 1) // If userpara1 = 1 then 150% down on the first step followed by upsmoothing. |
{ |
motor = neu - (1*(alt - neu)/2); |
} |
else // If userpara1 > 1 then allow >= 50% of the intended step down to rapidly reach the intended value. |
{ |
motor = neu + ((alt - neu)/Parameter_UserParam1); |
} |
} |
} |
//if(Poti2 < 20) return(neu); |
return(motor); |
} |