Subversion Repositories FlightCtrl

Rev

Rev 2373 | Rev 2381 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2373 Rev 2380
Line 2147... Line 2147...
2147
                        if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil;
2147
                        if(Mixer.Motor[i][3] == 64) tmp_int += GierMischanteil;
2148
                        else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil;
2148
                        else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil;
2149
                        else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
2149
                        else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
Line 2150... Line 2150...
2150
 
2150
 
2151
                        if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2;      // MotorSmoothing
-
 
2152
//                      else tmp_int = 2 * tmp_int - tmp_motorwert[i];                       // original MotorSmoothing
2151
                        if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2;      // MotorSmoothing
2153
            else
2152
            else
-
 
2153
                        {
-
 
2154
                                                        unsigned char smooth;
-
 
2155
                                                        smooth = EE_Parameter.MotorSmooth;
2154
                        {
2156
                                                        if(!smooth && Motor[i].Version & MOTOR_STATE_FAST_MODE) smooth = 2;
2155
                            if(EE_Parameter.MotorSmooth == 0)
2157
                            if(smooth == 0)
2156
                                {
2158
                                {
2157
                                  tmp_int = 2 * tmp_int - tmp_motorwert[i];  // original MotorSmoothing
2159
                                  tmp_int = 2 * tmp_int - tmp_motorwert[i];  // original MotorSmoothing
2158
                                }
2160
                                }
2159
                                                        else  // 1 means tmp_int = tmp_int;
2161
                                                        else  // 1 means tmp_int = tmp_int;
2160
                            if(EE_Parameter.MotorSmooth > 1)
2162
                            if(smooth > 1)
2161
                                {
2163
                                {
2162
                                        // If >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value.
2164
                                        // If >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value.
2163
                                  tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/EE_Parameter.MotorSmooth);
2165
                                  tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int) / smooth);
2164
                                }
2166
                                }
2165
                        }
-
 
2166
 
2167
                        }
2167
                        LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4);
2168
                        LIMIT_MIN_MAX(tmp_int,(int) MIN_GAS * 4,(int) MAX_GAS * 4);
2168
                        Motor[i].SetPoint = tmp_int / 4;
2169
                        Motor[i].SetPoint = tmp_int / 4;
2169
                        Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total)
2170
                        Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total)
2170
            tmp_motorwert[i] = tmp_int;
2171
            tmp_motorwert[i] = tmp_int;