From a0cfedd5b089fae672eb01e86e6d0d50179111a1 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Fri, 3 Nov 2023 03:40:45 +0100 Subject: [PATCH 1/4] Make idleMinRpm configurable from motor tab (active profile) --- src/js/tabs/motors.js | 7 +++++++ src/tabs/motors.html | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/js/tabs/motors.js b/src/js/tabs/motors.js index ac4a506329..0e34912958 100644 --- a/src/js/tabs/motors.js +++ b/src/js/tabs/motors.js @@ -281,6 +281,7 @@ motors.initialize = async function (callback) { dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry, motorPoles: FC.MOTOR_CONFIG.motor_poles, digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent, + idleMinRpm: FC.ADVANCED_TUNING.idleMinRpm, _3ddeadbandlow: FC.MOTOR_3D_CONFIG.deadband3d_low, _3ddeadbandhigh: FC.MOTOR_3D_CONFIG.deadband3d_high, _3dneutral: FC.MOTOR_3D_CONFIG.neutral, @@ -693,6 +694,8 @@ motors.initialize = async function (callback) { unsyncedPWMSwitchElement.prop('checked', FC.PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).trigger("change"); $('input[name="unsyncedpwmfreq"]').val(FC.PID_ADVANCED_CONFIG.motor_pwm_rate); $('input[name="digitalIdlePercent"]').val(FC.PID_ADVANCED_CONFIG.digitalIdlePercent); + $('input[name="idleMinRpm"]').val(FC.ADVANCED_TUNING.idleMinRpm); + if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) { dshotBidirElement.prop('checked', FC.MOTOR_CONFIG.use_dshot_telemetry).trigger("change"); @@ -771,6 +774,7 @@ motors.initialize = async function (callback) { divUnsyncedPWMFreq.toggle(protocolConfigured && !digitalProtocol); $('div.digitalIdlePercent').toggle(protocolConfigured && digitalProtocol); + $('div.idleMinRpm').toggle(protocolConfigured && digitalProtocol && FC.MOTOR_CONFIG.use_dshot_telemetry); if (FC.ADVANCED_TUNING.idleMinRpm && FC.MOTOR_CONFIG.use_dshot_telemetry) { $('div.digitalIdlePercent').hide(); @@ -1160,10 +1164,13 @@ motors.initialize = async function (callback) { FC.PID_ADVANCED_CONFIG.motor_pwm_rate = parseInt($('input[name="unsyncedpwmfreq"]').val()); FC.PID_ADVANCED_CONFIG.digitalIdlePercent = parseFloat($('input[name="digitalIdlePercent"]').val()); + FC.ADVANCED_TUNING.idleMinRpm = parseInt($('input[name="idleMinRpm"]').val()); + await MSP.promise(MSPCodes.MSP_SET_FEATURE_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FEATURE_CONFIG)); await MSP.promise(MSPCodes.MSP_SET_MIXER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_MIXER_CONFIG)); await MSP.promise(MSPCodes.MSP_SET_MOTOR_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_MOTOR_CONFIG)); await MSP.promise(MSPCodes.MSP_SET_MOTOR_3D_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_MOTOR_3D_CONFIG)); + await MSP.promise(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED)); await MSP.promise(MSPCodes.MSP_SET_ADVANCED_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ADVANCED_CONFIG)); await MSP.promise(MSPCodes.MSP_SET_ARMING_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_ARMING_CONFIG)); diff --git a/src/tabs/motors.html b/src/tabs/motors.html index 9f65fd5b1c..1c469055a7 100644 --- a/src/tabs/motors.html +++ b/src/tabs/motors.html @@ -111,6 +111,15 @@
+
+ +
+