diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 8fd39b8e8..17ef0c448 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -429,7 +429,7 @@ const clivalue_t valueTable[] = { { "yaw_control_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.yaw_control_direction, -1, 1 }, - { "pid_at_min_throttle", VAR_UINT8 | MASTER_VALUE, &masterConfig.mixerConfig.pid_at_min_throttle, 0, 1 }, + { "pid_at_min_throttle", VAR_UINT8 | MASTER_VALUE, &masterConfig.mixerConfig.pid_at_min_throttle, 0, 5 }, { "yaw_motor_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_motor_direction, -1, 1 }, { "yaw_jump_prevention_limit", VAR_UINT16 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_jump_prevention_limit, YAW_JUMP_PREVENTION_LIMIT_LOW, YAW_JUMP_PREVENTION_LIMIT_HIGH }, #ifdef USE_SERVOS diff --git a/src/main/mw.c b/src/main/mw.c index 15e8f3723..5026dfd85 100644 --- a/src/main/mw.c +++ b/src/main/mw.c @@ -539,6 +539,7 @@ void executePeriodicTasks(bool skipBaroUpdate) void processRx(void) { static bool armedBeeperOn = false; + static uint32_t pidResetErrorGyroTimeout = 0; calculateRxChannelsAndUpdateFailsafe(currentTime); @@ -563,7 +564,19 @@ void processRx(void) if (throttleStatus == THROTTLE_LOW) { pidResetErrorAngle(); - pidResetErrorGyro(); + /* + * Additional code to prevent Iterm reset below min_check. pid_at_min_throttle higher than 1 will + * activate the feature. Experimental yet. Minimum configuration is 2 sec and maxx is 5seconds. + */ + if (masterConfig.mixerConfig.pid_at_min_throttle > 1) { + if (pidResetErrorGyroTimeout < millis()) { + pidResetErrorGyro(); + } else { + pidResetErrorGyroTimeout = millis() + (masterConfig.mixerConfig.pid_at_min_throttle * 1000); + } + } else { + pidResetErrorGyro(); + } } // When armed and motors aren't spinning, do beeps and then disarm