mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 11:59:58 +03:00
better idle defaults and don't set idle_throttle if not enabled
This commit is contained in:
parent
e39d5e7000
commit
bca9f8a587
4 changed files with 13 additions and 3 deletions
|
@ -92,4 +92,5 @@ const char * const debugModeNames[DEBUG_COUNT] = {
|
||||||
"CRSF_LINK_STATISTICS_DOWN",
|
"CRSF_LINK_STATISTICS_DOWN",
|
||||||
"BARO",
|
"BARO",
|
||||||
"GPS_RESCUE_THROTTLE_PID",
|
"GPS_RESCUE_THROTTLE_PID",
|
||||||
|
"DYN_IDLE",
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,6 +108,7 @@ typedef enum {
|
||||||
DEBUG_CRSF_LINK_STATISTICS_DOWN,
|
DEBUG_CRSF_LINK_STATISTICS_DOWN,
|
||||||
DEBUG_BARO,
|
DEBUG_BARO,
|
||||||
DEBUG_GPS_RESCUE_THROTTLE_PID,
|
DEBUG_GPS_RESCUE_THROTTLE_PID,
|
||||||
|
DEBUG_DYN_IDLE,
|
||||||
DEBUG_COUNT
|
DEBUG_COUNT
|
||||||
} debugType_e;
|
} debugType_e;
|
||||||
|
|
||||||
|
|
|
@ -585,6 +585,12 @@ static void calculateThrottleAndCurrentMotorEndpoints(timeUs_t currentTimeUs)
|
||||||
const float pidSum = constrainf(currentPidProfile->idle_p * 0.0001f * error, -currentPidProfile->idle_pid_limit, currentPidProfile->idle_pid_limit);
|
const float pidSum = constrainf(currentPidProfile->idle_p * 0.0001f * error, -currentPidProfile->idle_pid_limit, currentPidProfile->idle_pid_limit);
|
||||||
motorRangeMinIncrease = constrainf(motorRangeMinIncrease + pidSum * dT, 0.0f, maxIncrease);
|
motorRangeMinIncrease = constrainf(motorRangeMinIncrease + pidSum * dT, 0.0f, maxIncrease);
|
||||||
oldMinRpm = minRpm;
|
oldMinRpm = minRpm;
|
||||||
|
|
||||||
|
DEBUG_SET(DEBUG_DYN_IDLE, 0, motorRangeMinIncrease * 1000);
|
||||||
|
DEBUG_SET(DEBUG_DYN_IDLE, 1, targetRpmChangeRate);
|
||||||
|
DEBUG_SET(DEBUG_DYN_IDLE, 2, error);
|
||||||
|
DEBUG_SET(DEBUG_DYN_IDLE, 3, minRpm);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -849,7 +855,9 @@ FAST_CODE_NOINLINE void mixTable(timeUs_t currentTimeUs, uint8_t vbatPidCompensa
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_DYN_IDLE
|
#ifdef USE_DYN_IDLE
|
||||||
|
if (currentPidProfile->idle_hz) {
|
||||||
throttle += currentPidProfile->idle_throttle * 0.001f;
|
throttle += currentPidProfile->idle_throttle * 0.001f;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_THROTTLE_BOOST)
|
#if defined(USE_THROTTLE_BOOST)
|
||||||
|
|
|
@ -207,9 +207,9 @@ void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
.transient_throttle_limit = 15,
|
.transient_throttle_limit = 15,
|
||||||
.profileName = { 0 },
|
.profileName = { 0 },
|
||||||
.idle_hz = 0,
|
.idle_hz = 0,
|
||||||
.idle_adjustment_speed = 200,
|
.idle_adjustment_speed = 50,
|
||||||
.idle_throttle = 60,
|
.idle_throttle = 60,
|
||||||
.idle_p = 40,
|
.idle_p = 50,
|
||||||
.idle_pid_limit = 200,
|
.idle_pid_limit = 200,
|
||||||
.idle_max_increase = 150,
|
.idle_max_increase = 150,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue