Rev 1354 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1354 | Rev 1362 | ||
---|---|---|---|
Line 152... | Line 152... | ||
152 | signed int tmp_motorwert[MAX_MOTORS]; |
152 | signed int tmp_motorwert[MAX_MOTORS]; |
Line 153... | Line 153... | ||
153 | 153 | ||
154 | int MotorSmoothing(int neu, int alt) |
154 | int MotorSmoothing(int neu, int alt) |
155 | { |
155 | { |
- | 156 | int motor; |
|
- | 157 | ||
- | 158 | if(neu > alt) |
|
156 | int motor; |
159 | { |
- | 160 | motor = (1*(int)alt + neu) / 2; |
|
- | 161 | } |
|
- | 162 | else |
|
- | 163 | ||
- | 164 | // Arthur P: the original code allowed the motor value to drop to 0 or negative values |
|
- | 165 | // straight off, i.e. could amplify an intended decrease excessively while upregulation |
|
- | 166 | // is dampened. The modification would still allow immediate drop below intended value |
|
- | 167 | // but would dampen this. This would still allow for airbraking of the prop to have effect |
|
- | 168 | // but it might lead to less sudden excessive drops in rpm with only gradual recovery. |
|
- | 169 | ||
- | 170 | { |
|
- | 171 | if(Parameter_UserParam1 < 1) |
|
157 | if(neu > alt) motor = (1*(int)alt + neu) / 2; |
172 | { // Original function |
- | 173 | motor = neu - (alt - neu)*1; |
|
- | 174 | } |
|
- | 175 | else |
|
- | 176 | { |
|
- | 177 | if(Parameter_UserParam1 == 1) // If userpara1 = 1 then 150% down on the first step followed by upsmoothing. |
|
- | 178 | { |
|
- | 179 | motor = neu - (1*(alt - neu)/2); |
|
- | 180 | } |
|
- | 181 | else // If userpara1 > 1 then allow >= 50% of the intended step down to rapidly reach the intended value. |
|
- | 182 | { |
|
- | 183 | motor = neu + ((alt - neu)/Parameter_UserParam1); |
|
- | 184 | } |
|
- | 185 | } |
|
158 | else motor = neu - (alt - neu)*1; |
186 | } |
159 | //if(Poti2 < 20) return(neu); |
187 | //if(Poti2 < 20) return(neu); |
160 | return(motor); |
188 | return(motor); |