From 2226098fc89a7b0dd7c942de70065e0fd864de01 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 15 Apr 2024 21:35:23 +0200 Subject: [PATCH 01/14] Simplify RC Auto smoothing --- tabs/receiver.html | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tabs/receiver.html b/tabs/receiver.html index fbea3946f..4372788df 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -70,28 +70,13 @@
-
-
- - - -
- -
- - -
- +
- -
From f3224695a848fca761c79a9938df3d8eaa5452ee Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 15 Apr 2024 22:31:34 +0200 Subject: [PATCH 02/14] Add rate and expo sliders --- _locales/en/messages.json | 21 +++++++++++ tabs/pid_tuning.html | 79 ++++++++++++++++++++++++--------------- tabs/pid_tuning.js | 19 ++++++++-- 3 files changed, 85 insertions(+), 34 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index bed40df30..d6533a1d8 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1374,6 +1374,27 @@ "pidTuning_RatesAndExpo": { "message": "Rates & Expo" }, + "pidTuning_Rates_Stabilized": { + "message": "Stabilized Rates" + }, + "pidTuning_Rates_Roll": { + "message": "Roll (°/s)" + }, + "pidTuning_Rates_Pitch": { + "message": "Pitch (°/s)" + }, + "pidTuning_Rates_Yaw": { + "message": "Yaw (°/s)" + }, + "pidTuning_Expo_Stabilized": { + "message": "Stabilized Expo" + }, + "pidTuning_Expo_RollPitch": { + "message": "Roll & Pitch (%)" + }, + "pidTuning_Expo_Yaw": { + "message": "Yaw (%)" + }, "pidTuning_RateDynamics": { "message": "Rate Dynamics" }, diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index fb52eaf25..eea46bafa 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -426,41 +426,60 @@

+ +
+
+ +
+

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+
+
+ +
+

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
-
-
-
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 9a0df1d27..4e080030e 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -15,10 +15,10 @@ TABS.pid_tuning.initialize = function (callback) { var loadChain = [ mspHelper.loadPidData, mspHelper.loadRateDynamics, + mspHelper.loadRateProfileData, mspHelper.loadEzTune, mspHelper.loadMixerConfig, ]; - loadChain.push(mspHelper.loadRateProfileData); loadChainer.setChain(loadChain); loadChainer.setExitPoint(load_html); @@ -83,9 +83,12 @@ TABS.pid_tuning.initialize = function (callback) { }); // catch RC_tuning changes - RC_tuning.roll_rate = parseFloat($('#rate-roll').val()); - RC_tuning.pitch_rate = parseFloat($('#rate-pitch').val()); - RC_tuning.yaw_rate = parseFloat($('#rate-yaw').val()); + RC_tuning.roll_rate = parseFloat($('#rate_roll_rate').val()); + RC_tuning.pitch_rate = parseFloat($('#rate_pitch_rate').val()); + RC_tuning.yaw_rate = parseFloat($('#rate_yaw_rate').val()); + + RC_tuning.RC_EXPO = parseFloat($('#rate_rollpitch_expo').val()) / 100; + RC_tuning.RC_YAW_EXPO = parseFloat($('#rate_yaw_expo').val()) / 100; RC_tuning.dynamic_THR_PID = parseInt($('#tpa').val()); RC_tuning.dynamic_THR_breakpoint = parseInt($('#tpa-breakpoint').val()); @@ -191,6 +194,14 @@ TABS.pid_tuning.initialize = function (callback) { updatePreview(); }); + //Slider rates + GUI.sliderize($('#rate_roll_rate'), RC_tuning.roll_rate, 40, 1000); + GUI.sliderize($('#rate_pitch_rate'), RC_tuning.pitch_rate, 40, 1000); + GUI.sliderize($('#rate_yaw_rate'), RC_tuning.yaw_rate, 40, 1000); + + GUI.sliderize($('#rate_rollpitch_expo'), RC_tuning.RC_EXPO * 100, 0, 100); + GUI.sliderize($('#rate_yaw_expo'), RC_tuning.RC_YAW_EXPO * 100, 0, 100); + updatePreview(); helper.tabs.init($('.tab-pid_tuning')); From b461cbfab6affd1b86a8524b3309f02b67cff6ec Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 18 Apr 2024 19:43:01 +0200 Subject: [PATCH 03/14] Manual rate sliders --- _locales/en/messages.json | 12 +++++++++++ tabs/pid_tuning.html | 43 +++++++++++++++++++++++---------------- tabs/pid_tuning.js | 23 ++++++++++----------- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index d6533a1d8..6562f88fe 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1596,6 +1596,18 @@ "pidTuning_LoadedProfile": { "message": "Loaded Profile: $1" }, + "pidTuning_Manual_Rates": { + "message": "Manual Rates" + }, + "pidTuning_Manual_Roll": { + "message": "Roll (%)" + }, + "pidTuning_Manual_Pitch": { + "message": "Pitch (%)" + }, + "pidTuning_Manual_Yaw": { + "message": "Yaw (%)" + }, "pidTuning_gyro_use_dyn_lpf": { "message": "Dynamic gyro LPF" }, diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index eea46bafa..211591cfb 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -474,6 +474,31 @@

+
+

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
@@ -501,24 +526,6 @@

-
-
-
-
-
-
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 4e080030e..f68e224ad 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -51,15 +51,6 @@ TABS.pid_tuning.initialize = function (callback) { } }); - // Fill in data from RC_tuning object - $('#rate-roll').val(RC_tuning.roll_rate); - $('#rate-pitch').val(RC_tuning.pitch_rate); - $('#rate-yaw').val(RC_tuning.yaw_rate); - - $('#rate-manual-roll').val(RC_tuning.manual_roll_rate); - $('#rate-manual-pitch').val(RC_tuning.manual_pitch_rate); - $('#rate-manual-yaw').val(RC_tuning.manual_yaw_rate); - $('#tpa').val(RC_tuning.dynamic_THR_PID); $('#tpa-breakpoint').val(RC_tuning.dynamic_THR_breakpoint); } @@ -93,9 +84,9 @@ TABS.pid_tuning.initialize = function (callback) { RC_tuning.dynamic_THR_PID = parseInt($('#tpa').val()); RC_tuning.dynamic_THR_breakpoint = parseInt($('#tpa-breakpoint').val()); - RC_tuning.manual_roll_rate = $('#rate-manual-roll').val(); - RC_tuning.manual_pitch_rate = $('#rate-manual-pitch').val(); - RC_tuning.manual_yaw_rate = $('#rate-manual-yaw').val(); + RC_tuning.manual_roll_rate = $('#rate_manual_roll').val(); + RC_tuning.manual_pitch_rate = $('#rate_manual_pitch').val(); + RC_tuning.manual_yaw_rate = $('#rate_manual_yaw').val(); // Rate Dynamics RATE_DYNAMICS.sensitivityCenter = parseInt($('#rate_dynamics_center_sensitivity').val()); @@ -178,6 +169,10 @@ TABS.pid_tuning.initialize = function (callback) { $('#ez-tune-switch').hide(); } + if (FC.isMultirotor()) { + $('.not-for-multirotor').hide(); + } + $("#ez_tune_enabled").prop('checked', EZ_TUNE.enabled).trigger('change'); GUI.sliderize($('#ez_tune_filter_hz'), EZ_TUNE.filterHz, 10, 300); @@ -202,6 +197,10 @@ TABS.pid_tuning.initialize = function (callback) { GUI.sliderize($('#rate_rollpitch_expo'), RC_tuning.RC_EXPO * 100, 0, 100); GUI.sliderize($('#rate_yaw_expo'), RC_tuning.RC_YAW_EXPO * 100, 0, 100); + GUI.sliderize($('#rate_manual_roll'), RC_tuning.manual_roll_rate, 0, 100); + GUI.sliderize($('#rate_manual_pitch'), RC_tuning.manual_pitch_rate, 0, 100); + GUI.sliderize($('#rate_manual_yaw'), RC_tuning.manual_yaw_rate, 0, 100); + updatePreview(); helper.tabs.init($('.tab-pid_tuning')); From dc4ccbbf12e47e64721b1090f2ed854346671524 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 18 Apr 2024 19:53:10 +0200 Subject: [PATCH 04/14] Heading hold rate --- _locales/en/messages.json | 6 ++++++ src/css/tabs/pid_tuning.css | 2 +- tabs/pid_tuning.html | 18 +++++++++++------- tabs/pid_tuning.js | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 6562f88fe..7c78db0c1 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1308,6 +1308,12 @@ "portsFunction_SBUS_OUTPUT": { "message": "SBus Output" }, + "pidTuning_Other": { + "message": "Other" + }, + "pidTuning_HeadingHold_Rate": { + "message": "Heading Hold Rate (°/s)" + }, "pidTuning_ShowAllPIDs": { "message": "Show all PIDs" }, diff --git a/src/css/tabs/pid_tuning.css b/src/css/tabs/pid_tuning.css index 37a9aa512..2e52e4eb6 100644 --- a/src/css/tabs/pid_tuning.css +++ b/src/css/tabs/pid_tuning.css @@ -410,7 +410,7 @@ .pid-slider-row span, .pid-switch-row .label { margin-right: 2em; - width: 120px; + width: 150px; line-height: 22px;; } diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 211591cfb..96dcfa453 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -500,6 +500,17 @@

+
+

+
+ +
+ +
+
+
+
+
@@ -519,13 +530,6 @@

- - - -
-
- -
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index f68e224ad..9719dfd41 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -167,6 +167,7 @@ TABS.pid_tuning.initialize = function (callback) { if (!FC.isMultirotor()) { $('#ez-tune-switch').hide(); + $('.only-for-multirotor').hide(); } if (FC.isMultirotor()) { From 4f9449748e33be134e1dd040a2c5f6b66715dbf8 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 18 Apr 2024 20:04:42 +0200 Subject: [PATCH 05/14] Angle limits --- _locales/en/messages.json | 12 ++++++++++++ tabs/pid_tuning.html | 41 ++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 7c78db0c1..03275bd5e 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1311,9 +1311,21 @@ "pidTuning_Other": { "message": "Other" }, + "pidTuning_Limits": { + "message": "Limits" + }, "pidTuning_HeadingHold_Rate": { "message": "Heading Hold Rate (°/s)" }, + "pidTuning_Max_Inclination_Angle": { + "message": "Max Inclination Angle" + }, + "pidTuning_Max_Roll": { + "message": "Roll (°/10)" + }, + "pidTuning_Max_Pitch": { + "message": "Pitch (°/10)" + }, "pidTuning_ShowAllPIDs": { "message": "Show all PIDs" }, diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 96dcfa453..635bd9a58 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -508,30 +508,27 @@

- + -
-
-
- - - - - - - - - - - -
-
-
-
-
-
-
+
+ +
+

+
+ +
+ +
+
+
+
+ +
+ +
+
+
From f90c0b9ebcbb9a94f4af94c4b03ea1fecbf2a7b6 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 24 Apr 2024 07:55:24 +0200 Subject: [PATCH 06/14] resolve conflicts --- tabs/pid_tuning.js | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index fb66bcdd9..3303e2780 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -67,22 +67,8 @@ TABS.pid_tuning.initialize = function (callback) { } }); -<<<<<<< HEAD $('#tpa').val(RC_tuning.dynamic_THR_PID); $('#tpa-breakpoint').val(RC_tuning.dynamic_THR_breakpoint); -======= - // Fill in data from FC.RC_tuning object - $('#rate-roll').val(FC.RC_tuning.roll_rate); - $('#rate-pitch').val(FC.RC_tuning.pitch_rate); - $('#rate-yaw').val(FC.RC_tuning.yaw_rate); - - $('#rate-manual-roll').val(FC.RC_tuning.manual_roll_rate); - $('#rate-manual-pitch').val(FC.RC_tuning.manual_pitch_rate); - $('#rate-manual-yaw').val(FC.RC_tuning.manual_yaw_rate); - - $('#tpa').val(FC.RC_tuning.dynamic_THR_PID); - $('#tpa-breakpoint').val(FC.RC_tuning.dynamic_THR_breakpoint); ->>>>>>> master } function form_to_pid_and_rc() { @@ -103,7 +89,6 @@ TABS.pid_tuning.initialize = function (callback) { } }); -<<<<<<< HEAD // catch RC_tuning changes RC_tuning.roll_rate = parseFloat($('#rate_roll_rate').val()); RC_tuning.pitch_rate = parseFloat($('#rate_pitch_rate').val()); @@ -111,25 +96,13 @@ TABS.pid_tuning.initialize = function (callback) { RC_tuning.RC_EXPO = parseFloat($('#rate_rollpitch_expo').val()) / 100; RC_tuning.RC_YAW_EXPO = parseFloat($('#rate_yaw_expo').val()) / 100; -======= - // catch FC.RC_tuning changes - FC.RC_tuning.roll_rate = parseFloat($('#rate-roll').val()); - FC.RC_tuning.pitch_rate = parseFloat($('#rate-pitch').val()); - FC.RC_tuning.yaw_rate = parseFloat($('#rate-yaw').val()); ->>>>>>> master FC.RC_tuning.dynamic_THR_PID = parseInt($('#tpa').val()); FC.RC_tuning.dynamic_THR_breakpoint = parseInt($('#tpa-breakpoint').val()); -<<<<<<< HEAD RC_tuning.manual_roll_rate = $('#rate_manual_roll').val(); RC_tuning.manual_pitch_rate = $('#rate_manual_pitch').val(); RC_tuning.manual_yaw_rate = $('#rate_manual_yaw').val(); -======= - FC.RC_tuning.manual_roll_rate = $('#rate-manual-roll').val(); - FC.RC_tuning.manual_pitch_rate = $('#rate-manual-pitch').val(); - FC.RC_tuning.manual_yaw_rate = $('#rate-manual-yaw').val(); ->>>>>>> master // Rate Dynamics FC.RATE_DYNAMICS.sensitivityCenter = parseInt($('#rate_dynamics_center_sensitivity').val()); From 9c41a8dea318a29b3e1b7b6effd5b357f3ea89de Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sun, 28 Apr 2024 20:31:44 +0200 Subject: [PATCH 07/14] Fix RC_tuning --- tabs/pid_tuning.js | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 3303e2780..742f7d34d 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -9,14 +9,11 @@ const mspHelper = require('./../js/msp/MSPHelper'); const MSPCodes = require('./../js/msp/MSPCodes'); const MSP = require('./../js/msp'); const { GUI, TABS } = require('./../js/gui'); -const features = require('./../js/feature_framework'); const tabs = require('./../js/tabs'); const FC = require('./../js/fc'); const Settings = require('./../js/settings'); const i18n = require('./../js/localization'); const { scaleRangeInt } = require('./../js/helpers'); -const SerialBackend = require('./../js/serial_backend'); -const BitHelper = require('./../js/bitHelper'); TABS.pid_tuning = { @@ -67,8 +64,8 @@ TABS.pid_tuning.initialize = function (callback) { } }); - $('#tpa').val(RC_tuning.dynamic_THR_PID); - $('#tpa-breakpoint').val(RC_tuning.dynamic_THR_breakpoint); + $('#tpa').val(FC.RC_tuning.dynamic_THR_PID); + $('#tpa-breakpoint').val(FC.RC_tuning.dynamic_THR_breakpoint); } function form_to_pid_and_rc() { @@ -90,19 +87,19 @@ TABS.pid_tuning.initialize = function (callback) { }); // catch RC_tuning changes - RC_tuning.roll_rate = parseFloat($('#rate_roll_rate').val()); - RC_tuning.pitch_rate = parseFloat($('#rate_pitch_rate').val()); - RC_tuning.yaw_rate = parseFloat($('#rate_yaw_rate').val()); + FC.RC_tuning.roll_rate = parseFloat($('#rate_roll_rate').val()); + FC.RC_tuning.pitch_rate = parseFloat($('#rate_pitch_rate').val()); + FC.RC_tuning.yaw_rate = parseFloat($('#rate_yaw_rate').val()); - RC_tuning.RC_EXPO = parseFloat($('#rate_rollpitch_expo').val()) / 100; - RC_tuning.RC_YAW_EXPO = parseFloat($('#rate_yaw_expo').val()) / 100; + FC.RC_tuning.RC_EXPO = parseFloat($('#rate_rollpitch_expo').val()) / 100; + FC.RC_tuning.RC_YAW_EXPO = parseFloat($('#rate_yaw_expo').val()) / 100; FC.RC_tuning.dynamic_THR_PID = parseInt($('#tpa').val()); FC.RC_tuning.dynamic_THR_breakpoint = parseInt($('#tpa-breakpoint').val()); - RC_tuning.manual_roll_rate = $('#rate_manual_roll').val(); - RC_tuning.manual_pitch_rate = $('#rate_manual_pitch').val(); - RC_tuning.manual_yaw_rate = $('#rate_manual_yaw').val(); + FC.RC_tuning.manual_roll_rate = $('#rate_manual_roll').val(); + FC.RC_tuning.manual_pitch_rate = $('#rate_manual_pitch').val(); + FC.RC_tuning.manual_yaw_rate = $('#rate_manual_yaw').val(); // Rate Dynamics FC.RATE_DYNAMICS.sensitivityCenter = parseInt($('#rate_dynamics_center_sensitivity').val()); @@ -209,16 +206,16 @@ TABS.pid_tuning.initialize = function (callback) { }); //Slider rates - GUI.sliderize($('#rate_roll_rate'), RC_tuning.roll_rate, 40, 1000); - GUI.sliderize($('#rate_pitch_rate'), RC_tuning.pitch_rate, 40, 1000); - GUI.sliderize($('#rate_yaw_rate'), RC_tuning.yaw_rate, 40, 1000); + GUI.sliderize($('#rate_roll_rate'), FC.RC_tuning.roll_rate, 40, 1000); + GUI.sliderize($('#rate_pitch_rate'), FC.RC_tuning.pitch_rate, 40, 1000); + GUI.sliderize($('#rate_yaw_rate'), FC.RC_tuning.yaw_rate, 40, 1000); - GUI.sliderize($('#rate_rollpitch_expo'), RC_tuning.RC_EXPO * 100, 0, 100); - GUI.sliderize($('#rate_yaw_expo'), RC_tuning.RC_YAW_EXPO * 100, 0, 100); + GUI.sliderize($('#rate_rollpitch_expo'), FC.RC_tuning.RC_EXPO * 100, 0, 100); + GUI.sliderize($('#rate_yaw_expo'), FC.RC_tuning.RC_YAW_EXPO * 100, 0, 100); - GUI.sliderize($('#rate_manual_roll'), RC_tuning.manual_roll_rate, 0, 100); - GUI.sliderize($('#rate_manual_pitch'), RC_tuning.manual_pitch_rate, 0, 100); - GUI.sliderize($('#rate_manual_yaw'), RC_tuning.manual_yaw_rate, 0, 100); + GUI.sliderize($('#rate_manual_roll'), FC.RC_tuning.manual_roll_rate, 0, 100); + GUI.sliderize($('#rate_manual_pitch'), FC.RC_tuning.manual_pitch_rate, 0, 100); + GUI.sliderize($('#rate_manual_yaw'), FC.RC_tuning.manual_yaw_rate, 0, 100); updatePreview(); From 16910dd2d068cd93978c8e25f4b12cc803fbb730 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 29 Apr 2024 20:14:06 +0200 Subject: [PATCH 08/14] Basic expo graph --- src/css/tabs/pid_tuning.css | 11 +++++++++++ tabs/pid_tuning.html | 5 +++++ tabs/pid_tuning.js | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/css/tabs/pid_tuning.css b/src/css/tabs/pid_tuning.css index d241a0a56..264cfb2bc 100644 --- a/src/css/tabs/pid_tuning.css +++ b/src/css/tabs/pid_tuning.css @@ -465,4 +465,15 @@ #pid-sliders { margin-bottom: 1em; +} + +.tab-pid_tuning .expo-chart { + margin: 0 0px 0px 0; + width: 200px; + height: 117px; + border: 1px solid silver; + border-radius: 3px; + background-image: url(./../../../images/paper.jpg); + background-size: 200%; + background-position: center; } \ No newline at end of file diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index bf544661e..64b358079 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -467,6 +467,11 @@

+
+
+ +
+

diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 742f7d34d..8c500f2ad 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -14,9 +14,10 @@ const FC = require('./../js/fc'); const Settings = require('./../js/settings'); const i18n = require('./../js/localization'); const { scaleRangeInt } = require('./../js/helpers'); +const interval = require('./../js/intervals'); TABS.pid_tuning = { - + rateChartHeight: 117 }; TABS.pid_tuning.initialize = function (callback) { @@ -46,6 +47,33 @@ TABS.pid_tuning.initialize = function (callback) { GUI.load(path.join(__dirname, "pid_tuning.html"), Settings.processHtml(process_html)); } + function drawRollPitchYawExpo() { + var pitch_roll_curve = $('.pitch_roll_curve canvas').get(0); + var context = pitch_roll_curve.getContext("2d"); + + var expoAVal = $('.tunings .rate input[name="expo"]'); + var expoA = parseFloat(expoAVal.val()); + + expoA = 0.7; + + if (expoA <= parseFloat(expoAVal.prop('min')) || expoA >= parseFloat(expoAVal.prop('max'))) { + return; + } + + var rateHeight = TABS.pid_tuning.rateChartHeight; + + // draw + context.clearRect(0, 0, 200, rateHeight); + + context.beginPath(); + context.moveTo(0, rateHeight); + context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expoA)), 200, 0); + context.lineWidth = 2; + // context.strokeStyle = '#f4a261'; + context.strokeStyle = '#a00000'; + context.stroke(); + } + function pid_and_rc_to_form() { // Fill in the data from FC.PIDs array @@ -311,6 +339,10 @@ TABS.pid_tuning.initialize = function (callback) { $('.rpy_d').prop('disabled', 'disabled'); } + interval.add("drawRollPitchYawExpo", function () { + drawRollPitchYawExpo(); + }, 100); + GUI.simpleBind(); // UI Hooks From e5d60775e42164d29999d68521cee785a7690746 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 29 Apr 2024 20:26:53 +0200 Subject: [PATCH 09/14] Fix tabs/cli.js and tabs/firmware_flasher.js --- tabs/cli.js | 2 +- tabs/firmware_flasher.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tabs/cli.js b/tabs/cli.js index 292b251fb..d6f9b4ff9 100644 --- a/tabs/cli.js +++ b/tabs/cli.js @@ -14,7 +14,7 @@ const { globalSettings } = require('./../js/globalSettings'); const CliAutoComplete = require('./../js/CliAutoComplete'); const { ConnectionType } = require('./../js/connection/connection'); const jBox = require('./../js/libraries/jBox/jBox.min'); -const mspDeduplicationQueue = require('./msp/mspDeduplicationQueue'); +const mspDeduplicationQueue = require('./../js/msp/mspDeduplicationQueue'); TABS.cli = { lineDelayMs: 50, diff --git a/tabs/firmware_flasher.js b/tabs/firmware_flasher.js index 231d68849..a7b7076ac 100755 --- a/tabs/firmware_flasher.js +++ b/tabs/firmware_flasher.js @@ -22,7 +22,7 @@ const mspQueue = require('./../js/serial_queue'); const mspHelper = require('./../js/msp/MSPHelper'); const STM32 = require('./../js/protocols/stm32'); const STM32DFU = require('./../js/protocols/stm32usbdfu'); -const mspDeduplicationQueue = require('./msp/mspDeduplicationQueue'); +const mspDeduplicationQueue = require('./../js/msp/mspDeduplicationQueue'); TABS.firmware_flasher = {}; TABS.firmware_flasher.initialize = function (callback) { From ac87edaa793dbd7343a893b9e73445b6f8bd00be Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 14 May 2024 15:16:33 +0200 Subject: [PATCH 10/14] Update stabilized expo graph --- tabs/pid_tuning.js | 48 ++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index d48c9707d..7b392fbbf 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -47,31 +47,45 @@ TABS.pid_tuning.initialize = function (callback) { GUI.load(path.join(__dirname, "pid_tuning.html"), Settings.processHtml(process_html)); } - function drawRollPitchYawExpo() { - var pitch_roll_curve = $('.pitch_roll_curve canvas').get(0); - var context = pitch_roll_curve.getContext("2d"); - - var expoAVal = $('.tunings .rate input[name="expo"]'); - var expoA = parseFloat(expoAVal.val()); + function drawExpoCanvas(value, $element, color, width, height, clear) { + let context = $element.getContext("2d"); - expoA = 0.7; - - if (expoA <= parseFloat(expoAVal.prop('min')) || expoA >= parseFloat(expoAVal.prop('max'))) { + if (value < 0 || value > 1) { return; } - var rateHeight = TABS.pid_tuning.rateChartHeight; - - // draw - context.clearRect(0, 0, 200, rateHeight); + if (clear === true) { + context.clearRect(0, 0, width, height); + } context.beginPath(); - context.moveTo(0, rateHeight); - context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expoA)), 200, 0); + context.moveTo(0, height); + context.quadraticCurveTo(110, height - ((height / 2) * (1 - value)), width, 0); context.lineWidth = 2; - // context.strokeStyle = '#f4a261'; - context.strokeStyle = '#a00000'; + context.strokeStyle = color; context.stroke(); + + }; + + function drawRollPitchYawExpo() { + let pitch_roll_curve = $('.pitch_roll_curve canvas').get(0); + + drawExpoCanvas( + parseFloat($('#rate_rollpitch_expo').val()) / 100, + pitch_roll_curve, + '#a00000', + 200, + TABS.pid_tuning.rateChartHeight, + true + ); + drawExpoCanvas( + parseFloat($('#rate_yaw_expo').val()) / 100, + pitch_roll_curve, + '#00a000', + 200, + TABS.pid_tuning.rateChartHeight, + false + ); } function pid_and_rc_to_form() { From bfd91c91f2aa2c2dec67e4f999d4559821ecb668 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 14 May 2024 18:23:50 +0200 Subject: [PATCH 11/14] Draw manual expo chart --- locale/en/messages.json | 3 +++ tabs/pid_tuning.html | 23 +++++++++++++++++++++++ tabs/pid_tuning.js | 25 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/locale/en/messages.json b/locale/en/messages.json index 6a744b9c9..c5e53172e 100644 --- a/locale/en/messages.json +++ b/locale/en/messages.json @@ -1424,6 +1424,9 @@ "pidTuning_Expo_Stabilized": { "message": "Stabilized Expo" }, + "pidTuning_Expo_Manual": { + "message": "Manual Expo" + }, "pidTuning_Expo_RollPitch": { "message": "Roll & Pitch (%)" }, diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 64b358079..9e61b74c5 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -515,6 +515,29 @@

+
+
+
+ +
+
+

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+

diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 7b392fbbf..d4e84b970 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -69,6 +69,7 @@ TABS.pid_tuning.initialize = function (callback) { function drawRollPitchYawExpo() { let pitch_roll_curve = $('.pitch_roll_curve canvas').get(0); + let manual_expo_curve = $('.manual_expo_curve canvas').get(0); drawExpoCanvas( parseFloat($('#rate_rollpitch_expo').val()) / 100, @@ -86,6 +87,24 @@ TABS.pid_tuning.initialize = function (callback) { TABS.pid_tuning.rateChartHeight, false ); + + drawExpoCanvas( + parseFloat($('#manual_rollpitch_expo').val()) / 100, + manual_expo_curve, + '#a00000', + 200, + TABS.pid_tuning.rateChartHeight, + true + ); + + drawExpoCanvas( + parseFloat($('#manual_yaw_expo').val()) / 100, + manual_expo_curve, + '#00a000', + 200, + TABS.pid_tuning.rateChartHeight, + false + ); } function pid_and_rc_to_form() { @@ -143,6 +162,9 @@ TABS.pid_tuning.initialize = function (callback) { FC.RC_tuning.manual_pitch_rate = $('#rate_manual_pitch').val(); FC.RC_tuning.manual_yaw_rate = $('#rate_manual_yaw').val(); + FC.RC_tuning.manual_RC_EXPO = $('#manual_rollpitch_expo').val() / 100; + FC.RC_tuning.manual_RC_YAW_EXPO = $('#manual_yaw_expo').val() / 100; + // Rate Dynamics FC.RATE_DYNAMICS.sensitivityCenter = parseInt($('#rate_dynamics_center_sensitivity').val()); FC.RATE_DYNAMICS.sensitivityEnd = parseInt($('#rate_dynamics_end_sensitivity').val()); @@ -259,6 +281,9 @@ TABS.pid_tuning.initialize = function (callback) { GUI.sliderize($('#rate_manual_pitch'), FC.RC_tuning.manual_pitch_rate, 0, 100); GUI.sliderize($('#rate_manual_yaw'), FC.RC_tuning.manual_yaw_rate, 0, 100); + GUI.sliderize($('#manual_rollpitch_expo'), FC.RC_tuning.manual_RC_EXPO * 100, 0, 100); + GUI.sliderize($('#manual_yaw_expo'), FC.RC_tuning.manual_RC_YAW_EXPO * 100, 0, 100); + updatePreview(); tabs.init($('.tab-pid_tuning')); From 7432ca6872b864c01451c0004e2736f3251ffef8 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 14 May 2024 20:06:46 +0200 Subject: [PATCH 12/14] Expo preview for EzTune --- tabs/pid_tuning.html | 5 +++++ tabs/pid_tuning.js | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 9e61b74c5..9da4d855a 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -185,6 +185,11 @@

+
+
+ +
+
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index d4e84b970..06377f288 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -60,7 +60,7 @@ TABS.pid_tuning.initialize = function (callback) { context.beginPath(); context.moveTo(0, height); - context.quadraticCurveTo(110, height - ((height / 2) * (1 - value)), width, 0); + context.quadraticCurveTo(width / 2, height - ((height / 2) * (1 - value)), width, 0); context.lineWidth = 2; context.strokeStyle = color; context.stroke(); @@ -105,6 +105,19 @@ TABS.pid_tuning.initialize = function (callback) { TABS.pid_tuning.rateChartHeight, false ); + + drawExpoCanvas( + Math.floor(scaleRange($('#ez_tune_expo').val(), 0, 200, 40, 100)) / 100, + $('#ez_tune_expo_curve canvas').get(0), + '#a00000', + 250, + 200, + true + ); + + // console.log('orig', $('#ez_tune_expo').val()); + // console.log('scaled', Math.floor(scaleRange($('#ez_tune_expo').val(), 0, 200, 40, 100)) / 100); + } function pid_and_rc_to_form() { From d522dfd8e402d1fd46372740506c0c145a7cb13e Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 14 May 2024 20:07:09 +0200 Subject: [PATCH 13/14] Expo preview for ez tune --- tabs/pid_tuning.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 06377f288..78efb95eb 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -114,10 +114,6 @@ TABS.pid_tuning.initialize = function (callback) { 200, true ); - - // console.log('orig', $('#ez_tune_expo').val()); - // console.log('scaled', Math.floor(scaleRange($('#ez_tune_expo').val(), 0, 200, 40, 100)) / 100); - } function pid_and_rc_to_form() { From eac50a48657630502135af50d080af933059b384 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Tue, 14 May 2024 20:13:04 +0200 Subject: [PATCH 14/14] Remove expo from the Receiver tab --- tabs/receiver.html | 38 +-------------------------------- tabs/receiver.js | 53 ---------------------------------------------- 2 files changed, 1 insertion(+), 90 deletions(-) diff --git a/tabs/receiver.html b/tabs/receiver.html index 4372788df..5609b6369 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -119,43 +119,7 @@
-
-
-
- - - - -
-
- -
-
-
-
- - - - - - - - - -
- - - - - - - - - -
-
-
-
+
diff --git a/tabs/receiver.js b/tabs/receiver.js index 9b20874f0..9046d5d00 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -47,41 +47,6 @@ TABS.receiver.initialize = function (callback) { Settings.saveInputs(onComplete); } - function drawRollPitchExpo() { - var pitch_roll_curve = $('.pitch_roll_curve canvas').get(0); - var context = pitch_roll_curve.getContext("2d"); - - var expoAVal = $('.tunings .rate input[name="expo"]'); - var expoA = parseFloat(expoAVal.val()); - - var expoMVal = $('.tunings .rate input[name="manual_expo"]'); - var expoM = parseFloat(expoMVal.val()); - - if (expoA <= parseFloat(expoAVal.prop('min')) || expoA >= parseFloat(expoAVal.prop('max')) || - expoM <= parseFloat(expoMVal.prop('min')) || expoM >= parseFloat(expoMVal.prop('max'))) { - return; - } - - var rateHeight = TABS.receiver.rateChartHeight; - - // draw - context.clearRect(0, 0, 200, rateHeight); - - context.beginPath(); - context.moveTo(0, rateHeight); - context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expoA)), 200, 0); - context.lineWidth = 2; - context.strokeStyle = '#37a8db'; - context.stroke(); - - context.beginPath(); - context.moveTo(0, rateHeight); - context.quadraticCurveTo(110, rateHeight - ((rateHeight / 2) * (1 - expoM)), 200, 0); - context.lineWidth = 2; - context.strokeStyle = '#a837db'; - context.stroke(); - } - function process_html() { // translate to user-selected language i18n.localize();; @@ -120,12 +85,6 @@ TABS.receiver.initialize = function (callback) { $('.tunings .throttle input[name="mid"]').val(FC.RC_tuning.throttle_MID.toFixed(2)); $('.tunings .throttle input[name="expo"]').val(FC.RC_tuning.throttle_EXPO.toFixed(2)); - $('.tunings .rate input[name="expo"]').val(FC.RC_tuning.RC_EXPO.toFixed(2)); - $('.tunings .yaw_rate input[name="yaw_expo"]').val(FC.RC_tuning.RC_YAW_EXPO.toFixed(2)); - - $('.tunings .rate input[name="manual_expo"]').val(FC.RC_tuning.manual_RC_EXPO.toFixed(2)); - $('.tunings .yaw_rate input[name="manual_yaw_expo"]').val(FC.RC_tuning.manual_RC_YAW_EXPO.toFixed(2)); - $('.deadband input[name="yaw_deadband"]').val(FC.RC_deadband.yaw_deadband); $('.deadband input[name="deadband"]').val(FC.RC_deadband.deadband); @@ -284,23 +243,11 @@ TABS.receiver.initialize = function (callback) { }, 0); }).trigger('input'); - $('.tunings .rate input').on('input change', function () { - setTimeout(function () { // let global validation trigger and adjust the values first - drawRollPitchExpo(); - }, 0); - }).trigger('input'); - $('a.update').on('click', function () { // catch RC_tuning changes FC.RC_tuning.throttle_MID = parseFloat($('.tunings .throttle input[name="mid"]').val()); FC.RC_tuning.throttle_EXPO = parseFloat($('.tunings .throttle input[name="expo"]').val()); - FC.RC_tuning.RC_EXPO = parseFloat($('.tunings .rate input[name="expo"]').val()); - FC.RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="yaw_expo"]').val()); - - FC.RC_tuning.manual_RC_EXPO = parseFloat($('.tunings .rate input[name="manual_expo"]').val()); - FC.RC_tuning.manual_RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="manual_yaw_expo"]').val()); - FC.RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val()); FC.RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());