From 319bd852bf58af311bc26d25278edd31d0a5c7df Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Wed, 17 Nov 2021 02:03:06 +0100 Subject: [PATCH] RFC Dynamic Idle --- locales/en/messages.json | 6 ++++++ src/js/tabs/motors.js | 11 +++++++++++ src/js/tabs/pid_tuning.js | 8 +++++++- src/tabs/motors.html | 4 ++-- src/tabs/pid_tuning.html | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 6be38867..f41f3e09 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1281,6 +1281,9 @@ "configurationDigitalIdlePercent": { "message": "Motor Idle Throttle Value [percent]" }, + "configurationDigitalIdlePercentDisabled": { + "message": "Motor Idle Throttle Value % is disabled because Dynamic Idle is enabled with value at {{dynamicIdle}}rpm in PID tuning tab" + }, "configurationDigitalIdlePercentHelp": { "message": "The 'DShot idle' value is the percent of maximum throttle that is sent to the ESCs when the throttle at minimum stick position and the craft is armed. Increase it to gain more idle speed and avoid desyncs. Too high and the craft feels floaty." }, @@ -4017,6 +4020,9 @@ "pidTuningIdleMinRpmHelp": { "message": "Dynamic Idle improves control at low rpm and reduces risk of motor desyncs. It corrects problems caused by airflow speeding up or slowing down the props, improving PID authority, stability, motor braking and responsiveness. The Dynamic Idle rpm should be set to be about 20% below the rpm of your Dshot Idle value (see the $t(tabMotorTesting.message) tab). Usually there is no need to change your DShot idle value from defaults. For longer inverted hang time, DShot idle value and Minimum rpm should be lowered together.

Visit this wiki entry for more info." }, + "pidTuningIdleMinRpmDisabled": { + "message": "Dynamic Idle is disabled as Dshot Telemetry is disabled" + }, "pidTuningAcroTrainerAngleLimit": { "message": "Acro Trainer Angle Limit" }, diff --git a/src/js/tabs/motors.js b/src/js/tabs/motors.js index 3e0dfeb4..2f9bba5e 100644 --- a/src/js/tabs/motors.js +++ b/src/js/tabs/motors.js @@ -61,6 +61,7 @@ TABS.motors.initialize = function (callback) { } MSP.promise(MSPCodes.MSP_STATUS) + .then(() => MSP.promise(MSPCodes.MSP_PID_ADVANCED)) .then(() => MSP.promise(MSPCodes.MSP_FEATURE_CONFIG)) .then(() => MSP.promise(MSPCodes.MSP_MIXER_CONFIG)) .then(() => FC.MOTOR_CONFIG.use_dshot_telemetry || FC.MOTOR_CONFIG.use_esc_sensor ? MSP.promise(MSPCodes.MSP_MOTOR_TELEMETRY) : true) @@ -735,6 +736,16 @@ TABS.motors.initialize = function (callback) { divUnsyncedPWMFreq.toggle(protocolConfigured && !digitalProtocol); $('div.digitalIdlePercent').toggle(protocolConfigured && digitalProtocol); + + $('input[name="digitalIdlePercent"]').prop('disabled', protocolConfigured && digitalProtocol && FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry); + + if (FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry) { + const dynamicIdle = FC.ADVANCED_TUNING.idleMinRpm * 100; + $('span.digitalIdlePercentDisabled').text(i18n.getMessage('configurationDigitalIdlePercentDisabled', { dynamicIdle })); + } else { + $('span.digitalIdlePercentDisabled').text(i18n.getMessage('configurationDigitalIdlePercent')); + } + $('.escSensor').toggle(protocolConfigured && digitalProtocol); $('div.checkboxDshotBidir').toggle(protocolConfigured && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42) && digitalProtocol); diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 89ae49eb..c62147bc 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -456,7 +456,13 @@ TABS.pid_tuning.initialize = function (callback) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) { $('.pid_tuning input[name="motorLimit"]').val(FC.ADVANCED_TUNING.motorOutputLimit); $('.pid_tuning input[name="cellCount"]').val(FC.ADVANCED_TUNING.autoProfileCellCount); - $('input[name="idleMinRpm-number"]').val(FC.ADVANCED_TUNING.idleMinRpm); + $('input[name="idleMinRpm-number"]').val(FC.ADVANCED_TUNING.idleMinRpm).prop('disabled', !FC.MOTOR_CONFIG.use_dshot_telemetry); + + if (FC.MOTOR_CONFIG.use_dshot_telemetry) { + $('span.pidTuningIdleMinRpmDisabled').text(i18n.getMessage('pidTuningIdleMinRpm')); + } else { + $('span.pidTuningIdleMinRpmDisabled').text(i18n.getMessage('pidTuningIdleMinRpmDisabled')); + } } else { $('.motorOutputLimit').hide(); $('.idleMinRpm').hide(); diff --git a/src/tabs/motors.html b/src/tabs/motors.html index 72946afd..6a3e1bdf 100644 --- a/src/tabs/motors.html +++ b/src/tabs/motors.html @@ -105,9 +105,9 @@
- + +
-