Rev 1742 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1742 | Rev 1749 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | 55 | ||
56 | #include "main.h" |
56 | #include "main.h" |
57 | #include "mymath.h" |
57 | #include "mymath.h" |
Line -... | Line 58... | ||
- | 58 | #include "isqrt.h" |
|
- | 59 | ||
- | 60 | #ifdef NODISPLAY // main.h |
|
- | 61 | ||
- | 62 | ||
- | 63 | ||
- | 64 | #endif |
|
- | 65 | unsigned char loop1, loop2, loop3, loop4; |
|
- | 66 | int keynumber=-7; |
|
- | 67 | ||
- | 68 | ||
- | 69 | unsigned char pos1, pos2, pos3, pos4=0; |
|
58 | #include "isqrt.h" |
70 | unsigned char Motors0,Motors1,Motors2,Motors3,Motors4,Motors5,Motors6,Motors7; |
59 | 71 | unsigned char updatemotors=5; |
|
60 | unsigned char h,m,s; |
72 | unsigned char h,m,s; |
61 | unsigned int BaroExpandActive = 0; |
73 | unsigned int BaroExpandActive = 0; |
62 | int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll; |
74 | int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll; |
Line 1698... | Line 1710... | ||
1698 | // Gier |
1710 | // Gier |
1699 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1711 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1700 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1712 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1701 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
1713 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
Line 1702... | Line -... | ||
1702 | - | ||
1703 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
- | |
Line -... | Line 1714... | ||
- | 1714 | ||
- | 1715 | ||
- | 1716 | ||
- | 1717 | ||
- | 1718 | ||
- | 1719 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
|
- | 1720 | // else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
|
- | 1721 | // Arthur P: the original code allowed the motor value to drop to 0 or negative values |
|
- | 1722 | // straight off, i.e. could amplify an intended decrease excessively while upregulation |
|
- | 1723 | // is dampened. The modification would still allow immediate drop below intended value |
|
- | 1724 | // but would dampen this. This would still allow for airbraking of the prop to have effect |
|
- | 1725 | // but it might lead to less sudden excessive drops in rpm with only gradual recovery. |
|
- | 1726 | // 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and |
|
- | 1727 | // possible timing issues with the shutter interval load, removed the shutter interval functions |
|
- | 1728 | // and switched to use of userparam6 for the motor smoothing. |
|
- | 1729 | // 091114 Inserted modification into 0.76g source code. |
|
- | 1730 | // 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function. |
|
- | 1731 | // Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0), |
|
- | 1732 | // 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==): |
|
- | 1733 | // 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100). |
|
- | 1734 | else |
|
- | 1735 | { |
|
- | 1736 | if(Parameter_UserParam7 < 2) |
|
- | 1737 | { // Original function |
|
- | 1738 | tmp_int = 2 * tmp_int - tmp_motorwert[i]; |
|
- | 1739 | } |
|
- | 1740 | else |
|
- | 1741 | { |
|
- | 1742 | // If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value. |
|
- | 1743 | tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7); |
|
- | 1744 | } |
|
- | 1745 | } |
|
- | 1746 | ||
1704 | else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
1747 | |
1705 | 1748 | ||
1706 | LIMIT_MIN_MAX(tmp_int,MIN_GAS * 4,MAX_GAS * 4); |
1749 | LIMIT_MIN_MAX(tmp_int,MIN_GAS * 4,MAX_GAS * 4); |
1707 | Motor[i].SetPoint = tmp_int / 4; |
1750 | Motor[i].SetPoint = tmp_int / 4; |
1708 | Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total) |
1751 | Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total) |