From 9f8c13ff393f02f13cef051e707c13c4ff502f73 Mon Sep 17 00:00:00 2001 From: Asizon <43983086+Asizon@users.noreply.github.com> Date: Fri, 28 Feb 2020 10:05:16 +0100 Subject: [PATCH] Adding Motor Output Limit and cellcount Fix cell count min Move tootltip`icons Cosmetic changes --- locales/en/messages.json | 15 +++++++++++++++ src/js/fc.js | 2 ++ src/js/msp/MSPHelper.js | 10 ++++++++++ src/js/tabs/pid_tuning.js | 9 +++++++++ src/tabs/pid_tuning.html | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+) diff --git a/locales/en/messages.json b/locales/en/messages.json index 1e23186b049..b57be99cfbe 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -3278,6 +3278,21 @@ "pidTuningLevelHelp": { "message": "The values below change the behaviour of the ANGLE and HORIZON flight modes. Different PID controllers handle the values differently. Please check the documentation." }, + "pidTuningMotorOutputLimit": { + "message": "Motor Output Limit" + }, + "pidTuningMotorLimit": { + "message": "Attenuation %" + }, + "pidTuningMotorLimitHelp": { + "message": "Attenuates motor commands by the set percentage. Reduces ESC current and motor heat when using higher cell count batteries, e.g. for similar performance from a 6S battery on a 4S build, try 66%; for a 4S battery on a 3S build, try 75%." + }, + "pidTuningCellCount": { + "message": "Cell Count" + }, + "pidTuningCellCountHelp": { + "message": "Automatically activates the first profile that has a cell count equal to the connected battery." + }, "pidTuningNonProfileFilterSettings": { "message": "Profile independent Filter Settings" }, diff --git a/src/js/fc.js b/src/js/fc.js index 9ce9afdddc9..f10a3f3813d 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -458,6 +458,8 @@ var FC = { dMinAdvance: 0, useIntegratedYaw: 0, integratedYawRelax: 0, + motorOutputLimit: 0, + autoProfileCellCount: 0, }; ADVANCED_TUNING_ACTIVE = { ...ADVANCED_TUNING }; diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index bb01c302eae..e998e6aaa06 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -1142,6 +1142,11 @@ MspHelper.prototype.process_data = function(dataHandler) { if(semver.gte(CONFIG.apiVersion, "1.42.0")) { ADVANCED_TUNING.itermRelaxCutoff = data.readU8(); + + if(semver.gte(CONFIG.apiVersion, "1.43.0")) { + ADVANCED_TUNING.motorOutputLimit = data.readU8(); + ADVANCED_TUNING.autoProfileCellCount = data.readU8(); + } } } } @@ -2071,6 +2076,11 @@ MspHelper.prototype.crunch = function(code) { if(semver.gte(CONFIG.apiVersion, "1.42.0")) { buffer.push8(ADVANCED_TUNING.itermRelaxCutoff); + + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + buffer.push8(ADVANCED_TUNING.motorOutputLimit) + .push8(ADVANCED_TUNING.autoProfileCellCount); + } } } } diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 1134f02cf62..eb5453189e4 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -390,6 +390,13 @@ TABS.pid_tuning.initialize = function (callback) { $('.rpmFilter').hide(); } + if (semver.gte(CONFIG.apiVersion, "1.43.0")) { + $('.pid_tuning input[name="motorLimit"]').val(ADVANCED_TUNING.motorOutputLimit); + $('.pid_tuning input[name="cellCount"]').val(ADVANCED_TUNING.autoProfileCellCount); + } else { + $('.motorOutputLimit').hide(); + } + $('input[id="useIntegratedYaw"]').change(function() { var checked = $(this).is(':checked'); $('#pidTuningIntegratedYawCaution').toggle(checked); @@ -767,6 +774,8 @@ TABS.pid_tuning.initialize = function (callback) { if (semver.gte(CONFIG.apiVersion, "1.43.0")) { FILTER_CONFIG.dyn_notch_max_hz = parseInt($('.pid_filter input[name="dynamicNotchMaxHz"]').val()); + ADVANCED_TUNING.motorOutputLimit = parseInt($('.pid_tuning input[name="motorLimit"]').val()); + ADVANCED_TUNING.autoProfileCellCount = parseInt($('.pid_tuning input[name="cellCount"]').val()); } } diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index 5d48a0dda0d..f3d6312b3b5 100644 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -361,6 +361,41 @@ +
+ + + + +
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + +
+