166,9 → 166,29 |
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 |
{ |
// Code taken from Arthur |
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); |
} |
} |
} |
return(motor); |
} |
|