Subversion Repositories FlightCtrl

Rev

Rev 1880 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1880 Rev 1903
Line 1770... Line 1770...
1770
                        else tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
1770
                        else tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
1771
            // Gier
1771
            // Gier
1772
                        if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil;
1772
                        if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil;
1773
                        else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil;
1773
                        else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil;
1774
                        else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
1774
                        else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
1775
 
1775
               
-
 
1776
#ifdef WITH_ORIGINAL_MOTORSMOOTHING     ///  MartinW; set in main.h 
-
 
1777
#warning : "### with  WITH_ORIGINAL_MOTORSMOOTHING ###"
1776
                        if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2;      // MotorSmoothing
1778
                if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2;      // MotorSmoothing
1777
                        else tmp_int = 2 * tmp_int - tmp_motorwert[i];                                                              // MotorSmoothing
1779
                else tmp_int = 2 * tmp_int - tmp_motorwert[i];                                                              // MotorSmoothing
-
 
1780
#else
-
 
1781
#warning : "### without  WITH_ORIGINAL_MOTORSMOOTHING, ajustable ###"   
-
 
1782
// MartinW; variable MS START
-
 
1783
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2;      // MotorSmoothing
-
 
1784
//                      else tmp_int = 2 * tmp_int - tmp_motorwert[i];                                          // MotorSmoothing
-
 
1785
// Arthur P: the original code allowed the motor value to drop to 0 or negative values
-
 
1786
// straight off, i.e. could amplify an intended decrease excessively while upregulation
-
 
1787
// is dampened. The modification would still allow immediate drop below intended value 
-
 
1788
// but would dampen this. This would still allow for airbraking of the prop to have effect
-
 
1789
// but it might lead to less sudden excessive drops in rpm with only gradual recovery.
-
 
1790
// 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and 
-
 
1791
// possible timing issues with the shutter interval load, removed the shutter interval functions
-
 
1792
// and switched to use of userparam6 for the motor smoothing.
-
 
1793
// 091114 Inserted modification into 0.76g source code.
-
 
1794
// 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function.
-
 
1795
// Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0),
-
 
1796
// 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==):
-
 
1797
// 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100).
-
 
1798
                        else
-
 
1799
                        {
-
 
1800
                                if(Parameter_UserParam7 < 2)
-
 
1801
                                { // Original function
-
 
1802
                                        tmp_int = 2 * tmp_int - tmp_motorwert[i];
-
 
1803
                                }
-
 
1804
                                else
-
 
1805
                                {
-
 
1806
                                        // If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value.
-
 
1807
                                        tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7);
-
 
1808
                                }
-
 
1809
                        }
-
 
1810
                       
-
 
1811
// MartinW; variable MS END
-
 
1812
#endif
-
 
1813
               
Line 1778... Line 1814...
1778
 
1814
 
1779
                        LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4);
1815
                        LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4);
1780
                        Motor[i].SetPoint = tmp_int / 4;
1816
                        Motor[i].SetPoint = tmp_int / 4;
1781
                        Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total)
1817
                        Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total)