Rev 1793 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1793 | Rev 1799 | ||
---|---|---|---|
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 | //MartinW; added vars |
|
- | 61 | unsigned char loop1, loop2, loop3; |
|
- | 62 | unsigned char settingdest = 5; |
|
- | 63 | int keynumber=-7; |
|
- | 64 | ||
- | 65 | unsigned short CurrentOffset = 0;/// |
|
- | 66 | ||
- | 67 | unsigned char pos1, pos2, pos3, pos4=0; |
|
- | 68 | unsigned char Motors0,Motors1,Motors2,Motors3,Motors4,Motors5,Motors6,Motors7; |
|
- | 69 | unsigned char Motors0max,Motors1max,Motors2max,Motors3max,Motors4max,Motors5max,Motors6max,Motors7max; |
|
- | 70 | unsigned short MotorsTmax; |
|
- | 71 | unsigned char updatemotors=5; |
|
- | 72 | //MartinW; added vars |
|
58 | #include "isqrt.h" |
73 | |
59 | 74 | ||
60 | unsigned char h,m,s; |
75 | unsigned char h,m,s; |
61 | unsigned int BaroExpandActive = 0; |
76 | unsigned int BaroExpandActive = 0; |
62 | int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll; |
77 | int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll; |
Line 183... | Line 198... | ||
183 | DebugOut.Analog[11] = ErsatzKompass / GIER_GRAD_FAKTOR; |
198 | DebugOut.Analog[11] = ErsatzKompass / GIER_GRAD_FAKTOR; |
184 | DebugOut.Analog[12] = Motor[0].SetPoint; |
199 | DebugOut.Analog[12] = Motor[0].SetPoint; |
185 | DebugOut.Analog[13] = Motor[1].SetPoint; |
200 | DebugOut.Analog[13] = Motor[1].SetPoint; |
186 | DebugOut.Analog[14] = Motor[2].SetPoint; |
201 | DebugOut.Analog[14] = Motor[2].SetPoint; |
187 | DebugOut.Analog[15] = Motor[3].SetPoint; |
202 | DebugOut.Analog[15] = Motor[3].SetPoint; |
- | 203 | ||
- | 204 | //MartinW added Debug ouputs |
|
- | 205 | DebugOut.Analog[16] = Motor[4].SetPoint; |
|
- | 206 | DebugOut.Analog[17] = Motor[5].SetPoint; |
|
- | 207 | DebugOut.Analog[24] = Motor[6].SetPoint; |
|
- | 208 | DebugOut.Analog[25] = Motor[7].SetPoint; |
|
- | 209 | DebugOut.Analog[26] = Motor[8].SetPoint; |
|
- | 210 | DebugOut.Analog[27] = Motor[9].SetPoint; |
|
- | 211 | //MartinW added Debug ouputs |
|
- | 212 | ||
188 | DebugOut.Analog[20] = ServoNickValue; |
213 | DebugOut.Analog[20] = ServoNickValue; |
189 | DebugOut.Analog[22] = Capacity.ActualCurrent; |
214 | DebugOut.Analog[22] = Capacity.ActualCurrent; |
190 | DebugOut.Analog[23] = Capacity.UsedCapacity; |
215 | DebugOut.Analog[23] = Capacity.UsedCapacity; |
191 | // DebugOut.Analog[22] = FromNaviCtrl_Value.GpsZ; |
216 | // DebugOut.Analog[22] = FromNaviCtrl_Value.GpsZ; |
192 | // DebugOut.Analog[29] = FromNaviCtrl_Value.SerialDataOkay; |
217 | // DebugOut.Analog[29] = FromNaviCtrl_Value.SerialDataOkay; |
Line 1713... | Line 1738... | ||
1713 | // Gier |
1738 | // Gier |
1714 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1739 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1715 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1740 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1716 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
1741 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
Line -... | Line 1742... | ||
- | 1742 | ||
- | 1743 | ||
1717 | 1744 | /* //MartinW original Motorsmoothing |
|
1718 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
1745 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
- | 1746 | else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
|
- | 1747 | */ |
|
- | 1748 | ||
- | 1749 | ||
- | 1750 | ||
- | 1751 | // MartinW; variable MS START |
|
- | 1752 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
|
- | 1753 | // else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
|
- | 1754 | // Arthur P: the original code allowed the motor value to drop to 0 or negative values |
|
- | 1755 | // straight off, i.e. could amplify an intended decrease excessively while upregulation |
|
- | 1756 | // is dampened. The modification would still allow immediate drop below intended value |
|
- | 1757 | // but would dampen this. This would still allow for airbraking of the prop to have effect |
|
- | 1758 | // but it might lead to less sudden excessive drops in rpm with only gradual recovery. |
|
- | 1759 | // 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and |
|
- | 1760 | // possible timing issues with the shutter interval load, removed the shutter interval functions |
|
- | 1761 | // and switched to use of userparam6 for the motor smoothing. |
|
- | 1762 | // 091114 Inserted modification into 0.76g source code. |
|
- | 1763 | // 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function. |
|
- | 1764 | // Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0), |
|
- | 1765 | // 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==): |
|
- | 1766 | // 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100). |
|
- | 1767 | else |
|
- | 1768 | { |
|
- | 1769 | if(Parameter_UserParam7 < 2) |
|
- | 1770 | { // Original function |
|
- | 1771 | tmp_int = 2 * tmp_int - tmp_motorwert[i]; |
|
- | 1772 | } |
|
- | 1773 | else |
|
- | 1774 | { |
|
- | 1775 | // If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value. |
|
- | 1776 | tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7); |
|
- | 1777 | } |
|
- | 1778 | } |
|
- | 1779 | ||
- | 1780 | ||
- | 1781 | ||
- | 1782 | // MartinW; variable MS END |
|
Line 1719... | Line 1783... | ||
1719 | else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
1783 | |
1720 | 1784 | ||
1721 | LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4); |
1785 | LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4); |
1722 | Motor[i].SetPoint = tmp_int / 4; |
1786 | Motor[i].SetPoint = tmp_int / 4; |