mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 00:05:28 +03:00
disable level trim when any stick is deflected
This commit is contained in:
parent
119682826a
commit
966c73d4f8
1 changed files with 8 additions and 3 deletions
|
@ -1327,11 +1327,16 @@ void updateFixedWingLevelTrim(timeUs_t currentTimeUs)
|
|||
*/
|
||||
pidControllerFlags_e flags = PID_LIMIT_INTEGRATOR;
|
||||
|
||||
//Iterm should freeze when pitch stick is deflected
|
||||
//Iterm should freeze when sticks are deflected
|
||||
bool areSticksDeflected = false;
|
||||
for (int stick = ROLL; stick <= YAW; stick++) {
|
||||
areSticksDeflected = areSticksDeflected ||
|
||||
rxGetChannelValue(stick) > (PWM_RANGE_MIDDLE + pidProfile()->fixedWingLevelTrimDeadband) ||
|
||||
rxGetChannelValue(stick) < (PWM_RANGE_MIDDLE - pidProfile()->fixedWingLevelTrimDeadband);
|
||||
}
|
||||
if (
|
||||
!IS_RC_MODE_ACTIVE(BOXAUTOLEVEL) ||
|
||||
rxGetChannelValue(PITCH) > (PWM_RANGE_MIDDLE + pidProfile()->fixedWingLevelTrimDeadband) ||
|
||||
rxGetChannelValue(PITCH) < (PWM_RANGE_MIDDLE - pidProfile()->fixedWingLevelTrimDeadband) ||
|
||||
areSticksDeflected ||
|
||||
(!FLIGHT_MODE(ANGLE_MODE) && !FLIGHT_MODE(HORIZON_MODE)) ||
|
||||
navigationIsControllingAltitude()
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue