Rev 1708 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1708 | Rev 1734 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
51 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
52 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
52 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
53 | // + POSSIBILITY OF SUCH DAMAGE. |
53 | // + POSSIBILITY OF SUCH DAMAGE. |
54 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
54 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line -... | Line 55... | ||
- | 55 | ||
- | 56 | // 20100804: Arthur P.: Modified to use user parameter 7 to determine downstep for motorsmoothing |
|
- | 57 | // with 0 or 1 defaulting to the default -150% first step followed by upsmoothing and |
|
- | 58 | // values beyond that resulting in 50% (2), 75% (4), 90% (10), 95% (20), 97.5% (40), 99% (100) |
|
- | 59 | // downsteps. |
|
- | 60 | // Within timer0.c user paramater 8 is used to activate an external HEF4017 on FC 1.x hardware, |
|
- | 61 | // and/or to set the shutter interval timer in steps of 0.1sec (minimum = 1 sec), by using |
|
- | 62 | // bit 8 (128) as on/off switch, and bits 7 (0..127) for the timer counter. |
|
55 | 63 | ||
56 | #include "main.h" |
64 | #include "main.h" |
57 | #include "mymath.h" |
65 | #include "mymath.h" |
Line 58... | Line 66... | ||
58 | #include "isqrt.h" |
66 | #include "isqrt.h" |
Line 1689... | Line 1697... | ||
1689 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1697 | if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil; |
1690 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1698 | else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil; |
1691 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
1699 | else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
Line 1692... | Line 1700... | ||
1692 | 1700 | ||
1693 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
1701 | if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing |
- | 1702 | // else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
|
- | 1703 | // Arthur P: the original code allowed the motor value to drop to 0 or negative values |
|
- | 1704 | // straight off, i.e. could amplify an intended decrease excessively while upregulation |
|
- | 1705 | // is dampened. The modification would still allow immediate drop below intended value |
|
- | 1706 | // but would dampen this. This would still allow for airbraking of the prop to have effect |
|
- | 1707 | // but it might lead to less sudden excessive drops in rpm with only gradual recovery. |
|
- | 1708 | // 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and |
|
- | 1709 | // possible timing issues with the shutter interval load, removed the shutter interval functions |
|
- | 1710 | // and switched to use of userparam6 for the motor smoothing. |
|
- | 1711 | // 091114 Inserted modification into 0.76g source code. |
|
- | 1712 | // 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function. |
|
- | 1713 | // Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0), |
|
- | 1714 | // 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==): |
|
- | 1715 | // 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100). |
|
- | 1716 | else |
|
- | 1717 | { |
|
- | 1718 | if(Parameter_UserParam7 < 2) |
|
- | 1719 | { // Original function |
|
- | 1720 | tmp_int = 2 * tmp_int - tmp_motorwert[i]; |
|
- | 1721 | } |
|
- | 1722 | else |
|
- | 1723 | { |
|
- | 1724 | // If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value. |
|
- | 1725 | tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7); |
|
- | 1726 | } |
|
Line 1694... | Line 1727... | ||
1694 | else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing |
1727 | } |
1695 | 1728 | ||
1696 | LIMIT_MIN_MAX(tmp_int,MIN_GAS * 4,MAX_GAS * 4); |
1729 | LIMIT_MIN_MAX(tmp_int,MIN_GAS * 4,MAX_GAS * 4); |
1697 | Motor[i].SetPoint = tmp_int / 4; |
1730 | Motor[i].SetPoint = tmp_int / 4; |