166,9 → 166,39 |
int MotorSmoothing(int neu, int alt) |
{ |
int motor; |
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
else motor = neu - (alt - neu)*1; |
//if(Poti2 < 20) return(neu); |
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. |
// 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and |
// possible timing issues with the shutter interval load, removed the shutter interval functions |
// and switched to use of userparam6 for the motor smoothing. |
// 091114 Inserted modification into 0.76g source code. |
|
if(Parameter_UserParam6 < 1) |
{ // Original function |
motor = neu - (alt - neu)*1; |
} |
else |
{ |
if(Parameter_UserParam6 == 1) // If userpara1 = 1 then 150% down on the first step followed by upsmoothing. |
{ |
motor = neu - (1*(alt - neu)/2); |
} |
else // If userpara5 > 1 then allow >= 50% of the intended step down to rapidly reach the intended value. |
{ |
motor = neu + ((alt - neu)/Parameter_UserParam6); |
} |
} |
} |
|
return(motor); |
} |
|