Subversion Repositories FlightCtrl

Rev

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

Rev 1494 Rev 1495
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
        // Code taken from Arthur
-
 
176
        if(Parameter_UserParam1 < 1)
169
 if(neu > alt) motor = (1*(int)alt + neu) / 2;
177
        { // Original function
-
 
178
                motor = neu - (alt - neu)*1;
-
 
179
        }
-
 
180
        else
-
 
181
        {
-
 
182
                if(Parameter_UserParam1 == 1)  // If userpara1 = 1 then 150% down on the first step followed by upsmoothing.
170
 else   motor = neu - (alt - neu)*1;
183
                {
-
 
184
                        motor = neu - (1*(alt - neu)/2);
-
 
185
                }
-
 
186
                else // If userpara1 > 1 then allow >= 50% of the intended step down to rapidly reach the intended value.
-
 
187
                {
-
 
188
                        motor = neu + ((alt - neu)/Parameter_UserParam1);
-
 
189
                }
-
 
190
        }
171
//if(Poti2 < 20)  return(neu);
191
 }
172
 return(motor);
192
 return(motor);
Line 173... Line 193...
173
}
193
}
174
 
194