1
0
Fork 0
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:
Thorsten Laux 2019-07-28 10:41:03 +02:00
parent e39d5e7000
commit bca9f8a587
4 changed files with 13 additions and 3 deletions

View file

@ -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",
}; };

View file

@ -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;

View file

@ -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
throttle += currentPidProfile->idle_throttle * 0.001f; if (currentPidProfile->idle_hz) {
throttle += currentPidProfile->idle_throttle * 0.001f;
}
#endif #endif
#if defined(USE_THROTTLE_BOOST) #if defined(USE_THROTTLE_BOOST)

View file

@ -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,
); );