Subversion Repositories FlightCtrl

Rev

Rev 1502 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1502 Rev 1504
Line 164... Line 164...
164
#define LIMIT_MIN_MAX(value, min, max) {if(value < min) value = min; else if(value > max) value = max;}
164
#define LIMIT_MIN_MAX(value, min, max) {if(value < min) value = min; else if(value > max) value = max;}
Line 165... Line 165...
165
 
165
 
166
int MotorSmoothing(int neu, int alt)
166
int MotorSmoothing(int neu, int alt)
167
{
167
{
-
 
168
 int motor;
-
 
169
 if(neu > alt)
168
 int motor;
170
 {
-
 
171
        motor = (1*(int)alt + neu) / 2;
-
 
172
 }
-
 
173
 else
-
 
174
 {
-
 
175
// Arthur P: the original code allowed the motor value to drop to 0 or negative values
-
 
176
// straight off, i.e. could amplify an intended decrease excessively while upregulation
-
 
177
// is dampened. The modification would still allow immediate drop below intended value 
-
 
178
// but would dampen this. This would still allow for airbraking of the prop to have effect
-
 
179
// but it might lead to less sudden excessive drops in rpm with only gradual recovery.
-
 
180
// 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and 
-
 
181
// possible timing issues with the shutter interval load, removed the shutter interval functions
-
 
182
// and switched to use of userparam6 for the motor smoothing.
-
 
183
// 091114 Inserted modification into 0.76g source code.
-
 
184
 
-
 
185
        if(Parameter_UserParam6 < 1)
169
 if(neu > alt) motor = (1*(int)alt + neu) / 2;
186
        { // Original function
-
 
187
                motor = neu - (alt - neu)*1;
-
 
188
        }
-
 
189
        else
-
 
190
        {
-
 
191
                if(Parameter_UserParam6 == 1)  // If userpara1 = 1 then 150% down on the first step followed by upsmoothing.
170
 else   motor = neu - (alt - neu)*1;
192
                {
-
 
193
                        motor = neu - (1*(alt - neu)/2);
-
 
194
                }
-
 
195
                else // If userpara5 > 1 then allow >= 50% of the intended step down to rapidly reach the intended value.
-
 
196
                {
-
 
197
                        motor = neu + ((alt - neu)/Parameter_UserParam6);
-
 
198
                }
-
 
199
        }
-
 
200
 }
171
//if(Poti2 < 20)  return(neu);
201
 
172
 return(motor);
202
 return(motor);
Line 173... Line 203...
173
}
203
}
174
 
204