diff --git a/_locales/en/messages.json b/_locales/en/messages.json index cdee6ebb..d5497b89 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -5549,5 +5549,8 @@ }, "ezTuneRatePreviewExpo" : { "message": "Expo" + }, + "ezTuneEnabledTips": { + "message": "" } } \ No newline at end of file diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 8c634214..cea0470c 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -1584,7 +1584,7 @@ var mspHelper = (function (gui) { break; case MSPCodes.MSP2_INAV_EZ_TUNE_SET: - console.log('Rate dynamics saved'); + console.log('EzTune settings saved'); break; default: @@ -2235,6 +2235,9 @@ var mspHelper = (function (gui) { buffer.push(EZ_TUNE.aggressiveness); buffer.push(EZ_TUNE.rate); buffer.push(EZ_TUNE.expo); + console.log(buffer); + break; + default: return false; diff --git a/src/css/tabs/pid_tuning.css b/src/css/tabs/pid_tuning.css index b4bf1c28..37a9aa51 100644 --- a/src/css/tabs/pid_tuning.css +++ b/src/css/tabs/pid_tuning.css @@ -401,18 +401,21 @@ /* 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 { +.pid-slider-row, +.pid-switch-row { display: flex; padding: 4px; } -.pid-slider-row span { +.pid-slider-row span, +.pid-switch-row .label { margin-right: 2em; width: 120px; line-height: 22px;; } -.pid-slider-row input[type="number"] { +.pid-slider-row input[type="number"], +.pid-switch-row input[type="number"] { font-family: 'open_sansregular', 'Segoe UI', Tahoma, sans-serif; background-color: #fff; border: 1px solid #ccc; @@ -422,7 +425,9 @@ margin-right: 2em; } -.pid-slider-row input[type="range"] { +.pid-slider-row input[type="range"], +.pid-switch-row input[type="range"] + { display: block; flex-grow: 100; } diff --git a/tabs/ez_tune.html b/tabs/ez_tune.html index 73c53b67..252401a3 100644 --- a/tabs/ez_tune.html +++ b/tabs/ez_tune.html @@ -1,92 +1,103 @@
-
+
-
-
-
- -
- -
-
-
-
- -
-
-
- - -
- +
+
+
+ +
+ +
-
-
- -
- -
-
-
- -
-
- -
- +
+
+
+ +
+ +
-
-
- -
- +
+
+
+ + +
+ +
+
-
-
- -
-
- -
- + +
+
+ +
+ +
+
-
-
- -
- -
-
-
- -
- + +
+
+ +
+ +
+
-
-
- -
-
- -
- + +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
-
-
diff --git a/tabs/ez_tune.js b/tabs/ez_tune.js index b0ce6b4f..8128deb5 100644 --- a/tabs/ez_tune.js +++ b/tabs/ez_tune.js @@ -7,9 +7,9 @@ TABS.ez_tune = { TABS.ez_tune.initialize = function (callback) { - var loadChainer = new MSPChainerClass(); + let loadChainer = new MSPChainerClass(); - var loadChain = [ + let loadChain = [ mspHelper.loadEzTune, ]; @@ -22,6 +22,29 @@ TABS.ez_tune.initialize = function (callback) { loadChainer.setExitPoint(load_html); loadChainer.execute(); + var saveChainer = new MSPChainerClass(); + + var saveChain = [ + mspHelper.saveEzTune, + mspHelper.saveToEeprom + ]; + + saveChainer.setChain(saveChain); + saveChainer.setExitPoint(reboot); + + function reboot() { + //noinspection JSUnresolvedVariable + GUI.log(chrome.i18n.getMessage('configurationEepromSaved')); + GUI.tab_switch_cleanup(function () { + MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize); + }); + } + + function reinitialize() { + GUI.log(chrome.i18n.getMessage('deviceRebooting')); + GUI.handleReconnect($('.tab_ez_tune a')); + } + if (GUI.active_tab != 'ez_tune') { GUI.active_tab = 'ez_tune'; googleAnalytics.sendAppView('Ez Tune'); @@ -84,6 +107,8 @@ TABS.ez_tune.initialize = function (callback) { helper.tabs.init($('.tab-ez_tune')); helper.features.updateUI($('.tab-ez_tune'), FEATURES); + $("#ez_tune_enabled").prop('checked', EZ_TUNE.enabled); + GUI.sliderize($('#ez_tune_filter_hz'), EZ_TUNE.filterHz, 10, 300); GUI.sliderize($('#ez_tune_axis_ratio'), EZ_TUNE.axisRatio, 25, 175); GUI.sliderize($('#ez_tune_response'), EZ_TUNE.response, 0, 200); @@ -104,6 +129,27 @@ TABS.ez_tune.initialize = function (callback) { GUI.simpleBind(); GUI.content_ready(callback); + + $('a.update').on('click', function () { + + if ($("#ez_tune_enabled").is(":checked")) { + EZ_TUNE.enabled = 1; + } else { + EZ_TUNE.enabled = 0; + } + + EZ_TUNE.filterHz = $('#ez_tune_filter_hz').val(); + EZ_TUNE.axisRatio = $('#ez_tune_axis_ratio').val(); + EZ_TUNE.response = $('#ez_tune_response').val(); + EZ_TUNE.damping = $('#ez_tune_damping').val(); + EZ_TUNE.stability = $('#ez_tune_stability').val(); + EZ_TUNE.aggressiveness = $('#ez_tune_aggressiveness').val(); + EZ_TUNE.rate = $('#ez_tune_rate').val(); + EZ_TUNE.expo = $('#ez_tune_expo').val(); + + saveChainer.execute(); + }); + } };