Rev 1812 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1812 | Rev 1813 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | /****************************************************************************************************************** |
|
- | 2 | V0.82b-Arthur-P 2010-12-18 |
|
- | 3 | ------------------------------------------------------------------------------------------------------------------ |
|
- | 4 | Version includes only support for external HEF4017 for FC1.x hardware, NOT for Twi2Ppm converters for ESCs. |
|
- | 5 | ||
- | 6 | 2010-12-18 Transferred changes to v.0.82b-Arthur-P. Remarked out variable i in Mittelwert() as this |
|
- | 7 | variable is not used. |
|
- | 8 | 20100917: Transferred changes to v0.80g-Arthur-Px. |
|
- | 9 | 20100804: Arthur P.: Modified to use user parameter 7 to determine downstep for motorsmoothing |
|
- | 10 | with 0 or 1 defaulting to the default -150% first step followed by upsmoothing and |
|
- | 11 | values beyond that resulting in 50% (2), 75% (4), 90% (10), 95% (20), 97.5% (40), 99% (100) |
|
- | 12 | downsteps. |
|
- | 13 | Within timer0.c user paramater 8 is used to activate an external HEF4017 on FC 1.x hardware, |
|
- | 14 | and/or to set the shutter interval timer in steps of 0.1sec (minimum = 1 sec), by using |
|
- | 15 | bit 8 (128) as on/off switch, and bits 7 (0..127) for the timer counter. |
|
- | 16 | ||
- | 17 | ******************************************************************************************************************/ |
|
1 | /*####################################################################################### |
18 | /*####################################################################################### |
2 | Flight Control |
19 | Flight Control |
3 | #######################################################################################*/ |
20 | #######################################################################################*/ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
21 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // + Copyright (c) Holger Buss, Ingo Busker |
22 | // + Copyright (c) Holger Buss, Ingo Busker |
Line 366... | Line 383... | ||
366 | //############################################################################ |
383 | //############################################################################ |
367 | { |
384 | { |
368 | static signed long tmpl,tmpl2,tmpl3,tmpl4; |
385 | static signed long tmpl,tmpl2,tmpl3,tmpl4; |
369 | static signed int oldNick, oldRoll, d2Roll, d2Nick; |
386 | static signed int oldNick, oldRoll, d2Roll, d2Nick; |
370 | signed long winkel_nick, winkel_roll; |
387 | signed long winkel_nick, winkel_roll; |
- | 388 | /*********************************************************************************************************** |
|
- | 389 | Arthur P: Disabbled unsinged char i as this variable is not used. |
|
- | 390 | ***********************************************************************************************************/ |
|
371 | unsigned char i; |
391 | // unsigned char i; |
- | 392 | /*********************************************************************************************************** |
|
- | 393 | Arthur P: End of change. |
|
- | 394 | ***********************************************************************************************************/ |
|
372 | MesswertGier = (signed int) AdNeutralGier - AdWertGier; |
395 | MesswertGier = (signed int) AdNeutralGier - AdWertGier; |
373 | MesswertNick = (signed int) AdWertNickFilter / 8; |
396 | MesswertNick = (signed int) AdWertNickFilter / 8; |
374 | MesswertRoll = (signed int) AdWertRollFilter / 8; |
397 | MesswertRoll = (signed int) AdWertRollFilter / 8; |
375 | RohMesswertNick = MesswertNick; |
398 | RohMesswertNick = MesswertNick; |
376 | RohMesswertRoll = MesswertRoll; |
399 | RohMesswertRoll = MesswertRoll; |
Line 1713... | Line 1736... | ||
1713 | // Gier |
1736 | // Gier |
1714 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1737 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1715 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1738 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1716 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
1739 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
Line -... | Line 1740... | ||
- | 1740 | ||
- | 1741 | /****************************************************************************************************************** |
|
- | 1742 | Arthur P: the original code allowed the motor value to drop to 0 or negative values |
|
- | 1743 | straight off, i.e. could amplify an intended decrease excessively while upregulation |
|
- | 1744 | is dampened. The modification would still allow immediate drop below intended value |
|
- | 1745 | but would dampen this. This would still allow for airbraking of the prop to have effect |
|
- | 1746 | but it might lead to less sudden excessive drops in rpm with only gradual recovery. |
|
- | 1747 | 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and |
|
- | 1748 | possible timing issues with the shutter interval load, removed the shutter interval functions |
|
- | 1749 | and switched to use of userparam6 for the motor smoothing. |
|
- | 1750 | 091114 Inserted modification into 0.76g source code. |
|
- | 1751 | 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function. |
|
- | 1752 | Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0), |
|
- | 1753 | 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==): |
|
- | 1754 | 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100). |
|
- | 1755 | ******************************************************************************************************************/ |
|
1717 | 1756 | ||
- | 1757 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
|
- | 1758 | /****************************************************************************************************************** |
|
- | 1759 | Arthur P: Start of changes in fc.c. Next line is disabled and replaced by modified routine. |
|
1718 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
1760 | ******************************************************************************************************************/ |
- | 1761 | // else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
|
- | 1762 | else |
|
- | 1763 | { |
|
- | 1764 | if(Parameter_UserParam7 < 2) |
|
- | 1765 | { // Original function |
|
- | 1766 | tmp_int = 2 * tmp_int - tmp_motorwert[i]; |
|
- | 1767 | } |
|
- | 1768 | else |
|
- | 1769 | { |
|
- | 1770 | // If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value. |
|
- | 1771 | tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7); |
|
- | 1772 | } |
|
- | 1773 | } |
|
- | 1774 | /****************************************************************************************************************** |
|
- | 1775 | Arthur P: End of changes in fc.c. |
|
Line 1719... | Line 1776... | ||
1719 | else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
1776 | ******************************************************************************************************************/ |
1720 | 1777 | ||
1721 | LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4); |
1778 | LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4); |
1722 | Motor[i].SetPoint = tmp_int / 4; |
1779 | Motor[i].SetPoint = tmp_int / 4; |