From 1ec73a96ff3c0bc15ce8b5e63b2041a989995c0e Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Thu, 21 Apr 2022 21:40:28 +0100 Subject: [PATCH 1/8] Moved font select/upload box Moved the font select/upload box down. This allows the OSD preview window to still be visible in most cases. --- tabs/osd.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tabs/osd.js b/tabs/osd.js index 1f2d181d..a2af5eb8 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -2820,6 +2820,8 @@ TABS.osd.initialize = function (callback) { OSD.GUI.jbox = new jBox('Modal', { width: 708, height: 240, + position: {y:'bottom'}, + offset: {y:-50}, closeButton: 'title', animation: false, attach: $('#fontmanager'), From 13204c29c245db1875cf8c609d59e8d1c3fe48dc Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Sat, 7 May 2022 20:25:36 +0200 Subject: [PATCH 2/8] Update defaults --- js/defaults_dialog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/defaults_dialog.js b/js/defaults_dialog.js index 13c3e9b4..174dcc29 100644 --- a/js/defaults_dialog.js +++ b/js/defaults_dialog.js @@ -105,7 +105,7 @@ helper.defaultsDialog = (function () { }, { key: "d_boost_min", - value: 0.5 + value: 0.8 }, { key: "d_boost_max", @@ -195,6 +195,10 @@ helper.defaultsDialog = (function () { { key: "applied_defaults", value: 2 + }, + { + key: "failsafe_procedure", + value: "DROP" } ] }, From c2ad26d4d43cd0cd73a5496a3f163d53a3c24d93 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 9 May 2022 20:11:28 +0200 Subject: [PATCH 3/8] Basic Slider PIDs --- _locales/en/messages.json | 9 ++++ gulpfile.js | 6 ++- main.css | 2 +- package-lock.json | 5 ++ package.json | 3 +- src/css/tabs/pid_tuning.css | 45 ++++++++++++++++++ tabs/pid_tuning.html | 95 +++++++++++++++++++++++++++++++++++-- tabs/pid_tuning.js | 55 +++++++++++++++++++++ 8 files changed, 212 insertions(+), 8 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 42299e07..2fa71e54 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -4262,5 +4262,14 @@ }, "BLACKBOX_FEATURE_MOTORS": { "message": "Motors output" + }, + "axisRoll": { + "message": "Roll" + }, + "axisPitch": { + "message": "Pitch" + }, + "axisYaw": { + "message": "Yaw" } } diff --git a/gulpfile.js b/gulpfile.js index 661b95d6..4619bb7e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -52,7 +52,8 @@ sources.css = [ './js/libraries/jbox/jBox.css', './node_modules/openlayers/dist/ol.css', './src/css/logic.css', - './src/css/defaults_dialog.css' + './src/css/defaults_dialog.css', + './node_modules/nouislider/dist/nouislider.min.css', ]; sources.js = [ @@ -133,7 +134,8 @@ sources.js = [ './js/waypointCollection.js', './js/waypoint.js', './node_modules/openlayers/dist/ol.js', - './js/libraries/plotly-latest.min.js' + './js/libraries/plotly-latest.min.js', + './node_modules/nouislider/dist/nouislider.min.js', ]; sources.receiverCss = [ diff --git a/main.css b/main.css index 33f54e7d..1c13dbf8 100644 --- a/main.css +++ b/main.css @@ -2274,5 +2274,5 @@ ol li { } .controlProfileHighlightActive { - background-color: #d5ebfe; + background-color: #d5ebfe !important ; } diff --git a/package-lock.json b/package-lock.json index 89853366..935cc5ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4272,6 +4272,11 @@ "remove-trailing-separator": "^1.0.1" } }, + "nouislider": { + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/nouislider/-/nouislider-15.6.0.tgz", + "integrity": "sha512-YJg+A6RQXTuFqhEwd42FeRaEGMGgDSSNnpIyVtT8XJrNl4VBEUkPI6Yj91bT3JjJIvNYi4VdppWeCV+z2gOnnw==" + }, "now-and-later": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz", diff --git a/package.json b/package.json index ad08f73c..5cb20eb1 100755 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "plotly": "^1.0.6", "temp": "^0.8.3", "three": "0.139.0", - "xml2js": "^0.4.19" + "xml2js": "^0.4.19", + "nouislider": "15.6.0" }, "devDependencies": { "nw-builder": "^3.5.7", diff --git a/src/css/tabs/pid_tuning.css b/src/css/tabs/pid_tuning.css index 2b00ad87..7433995f 100644 --- a/src/css/tabs/pid_tuning.css +++ b/src/css/tabs/pid_tuning.css @@ -395,3 +395,48 @@ .settings-table tbody { /* background: #D6D6D6 linear-gradient(-45deg, rgba(255, 255, 255, .2) 10%, transparent 10%, transparent 20%, rgba(255, 255, 255, .2) 20%, rgba(255, 255, 255, .2) 30%, transparent 30%, transparent 40%, rgba(255, 255, 255, .2) 40%, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent 60%, rgba(255, 255, 255, .2) 60%, rgba(255, 255, 255, .2) 70%, transparent 70%, transparent 80%, rgba(255, 255, 255, .2) 80%, rgba(255, 255, 255, .2) 90%, transparent 90%, transparent 100%, rgba(255, 255, 255, .2) 100%, transparent); */ } + +.pid-slider-row { + display: flex; + padding: 4px; +} + +.pid-slider-row span { + margin-right: 2em; + width: 150px; +} + +.pid-slider-row input[type="number"] { + font-family: 'open_sansregular', 'Segoe UI', Tahoma, sans-serif; + background-color: #fff; + border: 1px solid #ccc; + font-size: 0.95em; + border-radius: 3px; + padding: 0.3em; + margin-right: 2em; +} + +.pid-slider-row input[type="range"] { + display: block; + flex-grow: 100; +} + +.pid-sliders-axis h3 { + padding: 4px; +} + +.pid-sliders-axis[data-axis="roll"] { + background-color: #afe4fe; +} + +.pid-sliders-axis[data-axis="pitch"] { + background-color: #C4B5FF; +} + +.pid-sliders-axis[data-axis="yaw"] { + background-color: #E6B6F0; +} + +#pid-sliders { + margin-bottom: 1em; +} \ No newline at end of file diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 352ea50a..15cf31e8 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -22,6 +22,93 @@
+ +
+
+

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

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

+
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+
+
@@ -34,12 +121,12 @@
- + - + @@ -47,7 +134,7 @@ - + @@ -55,7 +142,7 @@ - + diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 0309cc6f..ae2986be 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -66,9 +66,14 @@ TABS.pid_tuning.initialize = function (callback) { function form_to_pid_and_rc() { $('[data-pid-bank-position]').each(function () { + var $this = $(this), bankPosition = $this.data('pid-bank-position'); + if ($this.hasClass('is-hidden')) { + return; + } + if (PIDs[bankPosition]) { $this.find('input').each(function (index) { PIDs[bankPosition][index] = parseFloat($(this).val()); @@ -157,6 +162,56 @@ TABS.pid_tuning.initialize = function (callback) { pid_and_rc_to_form(); + function scaleRangeInt(x, srcMin, srcMax, destMin, destMax) { + let a = (destMax - destMin) * (x - srcMin); + let b = srcMax - srcMin; + return Math.round((a / b) + destMin); + } + + $(".pid-slider-row [name='value-slider']").on('input', function () { + let val = $(this).val(); + + if (val <= 800) { + val = scaleRangeInt(val, 0, 800, 0, 110); + } else { + val = scaleRangeInt(val, 801, 1000, 111, 255); + } + + $(this).parent().find('input[name="value-input"]').val(val); + PIDs[$(this).parent().data('axis')][$(this).parent().data('bank')] = val; + }); + + $(".pid-slider-row [name='value-input']").on('change', function () { + let val = $(this).val(); + let newVal; + + if (val <= 110) { + newVal = scaleRangeInt(val, 0, 110, 0, 800); + } else { + newVal = scaleRangeInt(val, 111, 255, 801, 1000); + } + + $(this).parent().find('input[name="value-slider"]').val(newVal); + PIDs[$(this).parent().data('axis')][$(this).parent().data('bank')] = $(this).val(); + }); + + let axis = 0; + $('#pid-sliders').find('.pid-sliders-axis').each(function () { + + let $this = $(this); + let bank = 0; + + $this.find('.pid-slider-row').each(function () { + let $this = $(this); + $this.data('axis', axis); + $this.data('bank', bank); + $this.find('input[name="value-input"]').val(PIDs[axis][bank]).trigger('change'); + bank++; + }); + + axis++; + }); + let $magHoldYawRate = $("#magHoldYawRate"); $magHoldYawRate.val(INAV_PID_CONFIG.magHoldRateLimit); From eec23b6386c659d6bc896669ce96b97806da6ac7 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 9 May 2022 20:41:58 +0200 Subject: [PATCH 4/8] Show other PID controllers conditionally --- _locales/en/messages.json | 3 +++ src/css/tabs/pid_tuning.css | 8 +++++++- tabs/pid_tuning.html | 7 ++++++- tabs/pid_tuning.js | 24 ++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 2fa71e54..b0f09232 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -4271,5 +4271,8 @@ }, "axisYaw": { "message": "Yaw" + }, + "showAdvancedPIDs": { + "message": "Show advanced PID controllers" } } diff --git a/src/css/tabs/pid_tuning.css b/src/css/tabs/pid_tuning.css index 7433995f..fb744c92 100644 --- a/src/css/tabs/pid_tuning.css +++ b/src/css/tabs/pid_tuning.css @@ -403,7 +403,8 @@ .pid-slider-row span { margin-right: 2em; - width: 150px; + width: 120px; + line-height: 22px;; } .pid-slider-row input[type="number"] { @@ -421,6 +422,11 @@ flex-grow: 100; } +.pid-sliders-axis { + padding: 0.5em; + margin-bottom: 1em; +} + .pid-sliders-axis h3 { padding: 4px; } diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 15cf31e8..7bbdb916 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -109,7 +109,12 @@ -
+
+ + +
+ +
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index ae2986be..23ef2908 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -162,6 +162,30 @@ TABS.pid_tuning.initialize = function (callback) { pid_and_rc_to_form(); + let $theOtherPids = $('#the-other-pids'); + let $showAdvancedPids = $('#show-advanced-pids'); + + chrome.storage.local.get('showOtherPids', function (result) { + if (result.showOtherPids) { + $theOtherPids.removeClass("is-hidden"); + $showAdvancedPids.prop('checked', true); + } else { + $theOtherPids.addClass("is-hidden"); + $showAdvancedPids.prop('checked', false); + } + $showAdvancedPids.change(); + }); + + $showAdvancedPids.on('change', function() { + if ($showAdvancedPids.is(':checked')) { + $theOtherPids.removeClass("is-hidden"); + chrome.storage.local.set({ showOtherPids: true }); + } else { + $theOtherPids.addClass("is-hidden"); + chrome.storage.local.set({ showOtherPids: false }); + } + }); + function scaleRangeInt(x, srcMin, srcMax, destMin, destMax) { let a = (destMax - destMin) * (x - srcMin); let b = srcMax - srcMin; From 7556c5264142ab41cb12f84b2944743235219c24 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 9 May 2022 21:16:28 +0200 Subject: [PATCH 5/8] Dynamic scaling --- tabs/pid_tuning.html | 24 ++++++++++++------------ tabs/pid_tuning.js | 10 ++++++---- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 7bbdb916..bafa0bd7 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -29,25 +29,25 @@
- +
- +
- +
- +
@@ -57,25 +57,25 @@
- +
- +
- +
- +
@@ -85,25 +85,25 @@
- +
- +
- +
- +
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 23ef2908..cec0ba4f 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -194,11 +194,12 @@ TABS.pid_tuning.initialize = function (callback) { $(".pid-slider-row [name='value-slider']").on('input', function () { let val = $(this).val(); + let normalMax = parseInt($(this).data('normal-max')); if (val <= 800) { - val = scaleRangeInt(val, 0, 800, 0, 110); + val = scaleRangeInt(val, 0, 800, 0, normalMax); } else { - val = scaleRangeInt(val, 801, 1000, 111, 255); + val = scaleRangeInt(val, 801, 1000, normalMax + 1, 255); } $(this).parent().find('input[name="value-input"]').val(val); @@ -208,11 +209,12 @@ TABS.pid_tuning.initialize = function (callback) { $(".pid-slider-row [name='value-input']").on('change', function () { let val = $(this).val(); let newVal; + let normalMax = parseInt($(this).parent().find('input[name="value-slider"]').data('normal-max')); if (val <= 110) { - newVal = scaleRangeInt(val, 0, 110, 0, 800); + newVal = scaleRangeInt(val, 0, normalMax, 0, 800); } else { - newVal = scaleRangeInt(val, 111, 255, 801, 1000); + newVal = scaleRangeInt(val, normalMax + 1, 255, 801, 1000); } $(this).parent().find('input[name="value-slider"]').val(newVal); From f697bc2132c1ea312352f4dbdb8e70e781bc60cf Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 9 May 2022 21:17:48 +0200 Subject: [PATCH 6/8] Drop nouislider --- gulpfile.js | 2 -- package.json | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4619bb7e..992ca971 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -53,7 +53,6 @@ sources.css = [ './node_modules/openlayers/dist/ol.css', './src/css/logic.css', './src/css/defaults_dialog.css', - './node_modules/nouislider/dist/nouislider.min.css', ]; sources.js = [ @@ -135,7 +134,6 @@ sources.js = [ './js/waypoint.js', './node_modules/openlayers/dist/ol.js', './js/libraries/plotly-latest.min.js', - './node_modules/nouislider/dist/nouislider.min.js', ]; sources.receiverCss = [ diff --git a/package.json b/package.json index 5cb20eb1..ad08f73c 100755 --- a/package.json +++ b/package.json @@ -41,8 +41,7 @@ "plotly": "^1.0.6", "temp": "^0.8.3", "three": "0.139.0", - "xml2js": "^0.4.19", - "nouislider": "15.6.0" + "xml2js": "^0.4.19" }, "devDependencies": { "nw-builder": "^3.5.7", From 600aac2d3217606a099396228a41181faee108e0 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 9 May 2022 21:35:46 +0200 Subject: [PATCH 7/8] Simplifications --- js/helpers.js | 6 ++++++ tabs/pid_tuning.html | 24 ++++++++++++------------ tabs/pid_tuning.js | 14 -------------- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/js/helpers.js b/js/helpers.js index 25ff1bae..d45a2263 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -57,4 +57,10 @@ function generateFilename(prefix, suffix) { + zeroPad(date.getSeconds(), 2); return filename + '.' + suffix; +} + +function scaleRangeInt(x, srcMin, srcMax, destMin, destMax) { + let a = (destMax - destMin) * (x - srcMin); + let b = srcMax - srcMin; + return Math.round((a / b) + destMin); } \ No newline at end of file diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index bafa0bd7..cedfe2e3 100644 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -26,25 +26,25 @@

-
+
-
+
-
+
-
+
@@ -54,25 +54,25 @@

-
+
-
+
-
+
-
+
@@ -82,25 +82,25 @@

-
+
-
+
-
+
-
+
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index cec0ba4f..486090eb 100644 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -186,12 +186,6 @@ TABS.pid_tuning.initialize = function (callback) { } }); - function scaleRangeInt(x, srcMin, srcMax, destMin, destMax) { - let a = (destMax - destMin) * (x - srcMin); - let b = srcMax - srcMin; - return Math.round((a / b) + destMin); - } - $(".pid-slider-row [name='value-slider']").on('input', function () { let val = $(this).val(); let normalMax = parseInt($(this).data('normal-max')); @@ -238,14 +232,6 @@ TABS.pid_tuning.initialize = function (callback) { axis++; }); - let $magHoldYawRate = $("#magHoldYawRate"); - - $magHoldYawRate.val(INAV_PID_CONFIG.magHoldRateLimit); - - $magHoldYawRate.change(function () { - INAV_PID_CONFIG.magHoldRateLimit = parseInt($magHoldYawRate.val(), 10); - }); - if (!FC.isRpyFfComponentUsed()) { $('.rpy_ff').prop('disabled', 'disabled'); } From 88c0bbc8ab837a8089bcf678c2897db888af17f7 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Tue, 10 May 2022 10:22:38 +0100 Subject: [PATCH 8/8] Increase LC to 64 --- js/logicConditionsCollection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/logicConditionsCollection.js b/js/logicConditionsCollection.js index 7d7bb762..84ccc8ce 100644 --- a/js/logicConditionsCollection.js +++ b/js/logicConditionsCollection.js @@ -6,7 +6,7 @@ let LogicConditionsCollection = function () { data = [], $container; - let max_logicConditions = 32; + let max_logicConditions = 64; self.getMaxLogicConditionCount = function () { return max_logicConditions;