163,7 → 163,7 |
#define LIMIT_MAX(value, max) {if(value > max) value = max;} |
#define LIMIT_MIN_MAX(value, min, max) {if(value < min) value = min; else if(value > max) value = max;} |
|
int MotorSmoothing(int neu, int alt) |
int MotorSmoothing(int neu, int alt) //orginal |
{ |
int motor; |
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
172,6 → 172,45 |
return(motor); |
} |
|
|
|
|
|
|
int MotorSmoothing2(int neu, int alt) // MartinW, nur bei ansteigenden Werten |
{ |
int motor; |
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
else motor = neu; |
return(motor); |
} |
|
int MotorSmoothing3(int neu, int alt) // MartinW, absteigende Werte können variiert werden |
{ |
int motor; |
if(Parameter_UserParam2 < 39) Parameter_UserParam2= 40; //von 50% bis ... |
|
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
else motor = neu + ((alt - neu)*1 / (Parameter_UserParam2/20)); |
return(motor); |
} |
|
int MotorSmoothing4(int neu, int alt) // MartinW, an und absteigendes Filter 50%/50% |
{ |
int motor; |
if(Parameter_UserParam2 < 39) Parameter_UserParam2= 40; |
|
if(neu > alt) motor = (1*(int)alt + neu) / 2; |
else motor = neu + ((alt - neu)*1 / 2); |
return(motor); |
} |
|
|
|
|
|
|
|
void Piep(unsigned char Anzahl, unsigned int dauer) |
{ |
if(MotorenEin) return; //auf keinen Fall im Flug! |
1589,7 → 1628,41 |
tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L; |
tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L; |
tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter |
|
|
|
|
|
if(Parameter_UserParam1 < 51) // MartinW, orginales MotorSmoothing |
{ |
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter |
|
} |
|
if(Parameter_UserParam1 < 101 && Parameter_UserParam1 > 50) // MartinW, nur bei ansteigenden Werten |
{ |
tmp_motorwert[i] = MotorSmoothing2(tmp_int,tmp_motorwert[i]); // Filter |
|
} |
|
if(Parameter_UserParam1 < 201 && Parameter_UserParam1 > 100) // MartinW, mit ansteigendem und absteigendem Filter up50%/down50% |
{ |
tmp_motorwert[i] = MotorSmoothing4(tmp_int,tmp_motorwert[i]); // Filter |
|
} |
|
if(Parameter_UserParam1 > 200) // MartinW, Variabel, mit Parameter_UserParam2 |
{ |
tmp_motorwert[i] = MotorSmoothing3(tmp_int,tmp_motorwert[i]); // Filter |
|
} |
|
|
|
|
|
|
|
tmp_int = tmp_motorwert[i] / STICK_GAIN; |
CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS); |
Motor[i] = tmp_int; |