Rev 1408 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1408 | Rev 1409 | ||
---|---|---|---|
Line 161... | Line 161... | ||
161 | unsigned char LoadHandler = 0; |
161 | unsigned char LoadHandler = 0; |
162 | #define LIMIT_MIN(value, min) {if(value < min) value = min;} |
162 | #define LIMIT_MIN(value, min) {if(value < min) value = min;} |
163 | #define LIMIT_MAX(value, max) {if(value > max) value = max;} |
163 | #define LIMIT_MAX(value, max) {if(value > max) value = max;} |
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) //orginal |
167 | { |
167 | { |
168 | int motor; |
168 | int motor; |
169 | if(neu > alt) motor = (1*(int)alt + neu) / 2; |
169 | if(neu > alt) motor = (1*(int)alt + neu) / 2; |
170 | else motor = neu - (alt - neu)*1; |
170 | else motor = neu - (alt - neu)*1; |
171 | //if(Poti2 < 20) return(neu); |
171 | //if(Poti2 < 20) return(neu); |
172 | return(motor); |
172 | return(motor); |
Line -... | Line 173... | ||
- | 173 | } |
|
- | 174 | ||
- | 175 | ||
- | 176 | ||
- | 177 | ||
- | 178 | ||
- | 179 | ||
- | 180 | int MotorSmoothing2(int neu, int alt) // MartinW, nur bei ansteigenden Werten |
|
- | 181 | { |
|
- | 182 | int motor; |
|
- | 183 | if(neu > alt) motor = (1*(int)alt + neu) / 2; |
|
- | 184 | else motor = neu; |
|
- | 185 | return(motor); |
|
- | 186 | } |
|
- | 187 | ||
- | 188 | int MotorSmoothing3(int neu, int alt) // MartinW, absteigende Werte können variiert werden |
|
- | 189 | { |
|
- | 190 | int motor; |
|
- | 191 | if(Parameter_UserParam2 < 39) Parameter_UserParam2= 40; //von 50% bis ... |
|
- | 192 | ||
- | 193 | if(neu > alt) motor = (1*(int)alt + neu) / 2; |
|
- | 194 | else motor = neu + ((alt - neu)*1 / (Parameter_UserParam2/20)); |
|
- | 195 | return(motor); |
|
- | 196 | } |
|
- | 197 | ||
- | 198 | int MotorSmoothing4(int neu, int alt) // MartinW, an und absteigendes Filter 50%/50% |
|
- | 199 | { |
|
- | 200 | int motor; |
|
- | 201 | if(Parameter_UserParam2 < 39) Parameter_UserParam2= 40; |
|
- | 202 | ||
- | 203 | if(neu > alt) motor = (1*(int)alt + neu) / 2; |
|
- | 204 | else motor = neu + ((alt - neu)*1 / 2); |
|
- | 205 | return(motor); |
|
- | 206 | } |
|
- | 207 | ||
- | 208 | ||
- | 209 | ||
- | 210 | ||
- | 211 | ||
173 | } |
212 | |
174 | 213 | ||
175 | void Piep(unsigned char Anzahl, unsigned int dauer) |
214 | void Piep(unsigned char Anzahl, unsigned int dauer) |
176 | { |
215 | { |
177 | if(MotorenEin) return; //auf keinen Fall im Flug! |
216 | if(MotorenEin) return; //auf keinen Fall im Flug! |
Line 1587... | Line 1626... | ||
1587 | { |
1626 | { |
1588 | tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L; |
1627 | tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L; |
1589 | tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L; |
1628 | tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L; |
1590 | tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L; |
1629 | tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L; |
1591 | tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
1630 | tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
- | 1631 | ||
- | 1632 | ||
- | 1633 | ||
- | 1634 | ||
- | 1635 | ||
- | 1636 | if(Parameter_UserParam1 < 51) // MartinW, orginales MotorSmoothing |
|
- | 1637 | { |
|
1592 | tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter |
1638 | tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter |
- | 1639 | ||
- | 1640 | } |
|
- | 1641 | ||
- | 1642 | if(Parameter_UserParam1 < 101 && Parameter_UserParam1 > 50) // MartinW, nur bei ansteigenden Werten |
|
- | 1643 | { |
|
- | 1644 | tmp_motorwert[i] = MotorSmoothing2(tmp_int,tmp_motorwert[i]); // Filter |
|
- | 1645 | ||
- | 1646 | } |
|
- | 1647 | ||
- | 1648 | if(Parameter_UserParam1 < 201 && Parameter_UserParam1 > 100) // MartinW, mit ansteigendem und absteigendem Filter up50%/down50% |
|
- | 1649 | { |
|
- | 1650 | tmp_motorwert[i] = MotorSmoothing4(tmp_int,tmp_motorwert[i]); // Filter |
|
- | 1651 | ||
- | 1652 | } |
|
- | 1653 | ||
- | 1654 | if(Parameter_UserParam1 > 200) // MartinW, Variabel, mit Parameter_UserParam2 |
|
- | 1655 | { |
|
- | 1656 | tmp_motorwert[i] = MotorSmoothing3(tmp_int,tmp_motorwert[i]); // Filter |
|
- | 1657 | ||
- | 1658 | } |
|
- | 1659 | ||
- | 1660 | ||
- | 1661 | ||
- | 1662 | ||
- | 1663 | ||
- | 1664 | ||
- | 1665 | ||
1593 | tmp_int = tmp_motorwert[i] / STICK_GAIN; |
1666 | tmp_int = tmp_motorwert[i] / STICK_GAIN; |
1594 | CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS); |
1667 | CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS); |
1595 | Motor[i] = tmp_int; |
1668 | Motor[i] = tmp_int; |
1596 | } |
1669 | } |
1597 | else Motor[i] = 0; |
1670 | else Motor[i] = 0; |