diff --git a/_locales/en/messages.json b/_locales/en/messages.json index bf2aa8b2c8..34a79d021c 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -802,28 +802,31 @@ "pidTuningPidSettings": { "message": "PID Controller Settings" }, - "pidTuningRcInterpolationHelp": { + "receiverRcInterpolation": { + "message": "RC Interpolation" + }, + "receiverRcInterpolationHelp": { "message": "RC TX/RX systems are not as fast as PID loops. That means that PID loop has gaps in the information stream from RC systems. This option enables interpolation of the RC input during the times when no RC frames are received. The option also offers cleaner P and D behaviour as there are no ramps in control input." }, - "pidTuningRcInterpolationIntervalHelp": { + "receiverRcInterpolationIntervalHelp": { "message": "Interpolation interval for manual RC interpolation mode in milliseconds" }, - "pidTuningRcInterpolation": { + "receiverRcInterpolation": { "message": "RC Interpolation" }, - "pidTuningRcInterpolationOff": { + "receiverRcInterpolationOff": { "message": "Off" }, - "pidTuningRcInterpolationDefault": { + "receiverRcInterpolationDefault": { "message": "Preset" }, - "pidTuningRcInterpolationAuto": { + "receiverRcInterpolationAuto": { "message": "Auto" }, - "pidTuningRcInterpolationManual": { + "receiverRcInterpolationManual": { "message": "Manual" }, - "pidTuningRcInterpolationInterval": { + "receiverRcInterpolationInterval": { "message": "RC Interpolating Interval (ms)" }, "pidTuningPtermSetpoint": { diff --git a/tabs/pid_tuning.css b/tabs/pid_tuning.css index 69a1086750..387d3083ec 100644 --- a/tabs/pid_tuning.css +++ b/tabs/pid_tuning.css @@ -264,25 +264,25 @@ border-right: 0px solid #ccc; } -.tab-pid_tuning .compensation td { +.tab-pid_tuning .pidTuningFeatures td { padding: 5px; } -.tab-pid_tuning .compensation td:first-child { +.tab-pid_tuning .pidTuningFeatures td:first-child { width: 20%; padding-bottom: 6px; padding-top: 5px; } -.tab-pid_tuning .compensation td:last-child { +.tab-pid_tuning .pidTuningFeatures td:last-child { width: 80%; } -.tab-pid_tuning .compensation td { +.tab-pid_tuning .pidTuningFeatures td { width: 20%; } -.tab-pid_tuning .compensation .slider input { +.tab-pid_tuning .pidTuningFeatures .slider input { -webkit-appearance: slider-horizontal } diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index 5621dec30d..b5d635a58a 100755 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -240,45 +240,16 @@ -
+
- +
- - - - - - - -
- - -
- -
-
-
-
- -
-
-
diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index 818a0b93bb..f1e4d7e7a0 100755 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -33,10 +33,6 @@ TABS.pid_tuning.initialize = function (callback) { if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) { return MSP.promise(MSPCodes.MSP_PID_ADVANCED); } - }).then(function() { - if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { - return MSP.promise(MSPCodes.MSP_RX_CONFIG); - } }).then(function() { return MSP.promise(MSPCodes.MSP_RC_TUNING); }).then(function() { @@ -256,17 +252,11 @@ TABS.pid_tuning.initialize = function (callback) { $('.pid_filter input[name="dTermNotchFrequency"]').val(FILTER_CONFIG.dterm_notch_hz); $('.pid_filter input[name="dTermNotchCutoff"]').val(FILTER_CONFIG.dterm_notch_cutoff); - $('select[name="rcInterpolation-select"]').val(RX_CONFIG.rcInterpolation); - - $('input[name="rcInterpolationInterval-number"]').val(RX_CONFIG.rcInterpolationInterval); - $('input[name="ptermSetpoint-number"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100); $('input[name="ptermSetpoint-range"]').val(ADVANCED_TUNING.ptermSetpointWeight / 100); $('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100); $('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100); - - self.updateRcInterpolationParameters(); } else { $('.pid_filter .newFilter').hide(); } @@ -363,9 +353,6 @@ TABS.pid_tuning.initialize = function (callback) { } if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) { - RX_CONFIG.rcInterpolation = parseInt($('select[name="rcInterpolation-select"]').val()); - RX_CONFIG.rcInterpolationInterval = parseInt($('input[name="rcInterpolationInterval-number"]').val()); - ADVANCED_TUNING.ptermSetpointWeight = parseInt($('input[name="ptermSetpoint-number"]').val() * 100); ADVANCED_TUNING.dtermSetpointWeight = parseInt($('input[name="dtermSetpoint-number"]').val() * 100); @@ -454,7 +441,7 @@ TABS.pid_tuning.initialize = function (callback) { } var useLegacyCurve = false; - if (CONFIG.flightControllerIdentifier !== "BTFL" || semver.lt(CONFIG.flightControllerVersion, "2.8.0")) { + if (!semver.gte(CONFIG.flightControllerVersion, "2.8.0")) { useLegacyCurve = true; } @@ -476,8 +463,10 @@ TABS.pid_tuning.initialize = function (callback) { } function process_html() { - if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) { + if (semver.gte(CONFIG.flightControllerVersion, "2.8.0") && !semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { BF_CONFIG.features.generateElements($('.tab-pid_tuning .features')); + } else { + $('.tab-pid_tuning .pidTuningFeatures').hide(); } // translate to user-selected language @@ -604,9 +593,6 @@ TABS.pid_tuning.initialize = function (callback) { } else { $('.tab-pid_tuning .rate_profile').hide(); - $('#pid-tuning .rcInterpolation').hide(); - $('#pid-tuning .rcInterpolationInterval').hide(); - $('#pid-tuning .ptermSetpoint').hide(); $('#pid-tuning .dtermSetpoint').hide(); } @@ -826,12 +812,6 @@ TABS.pid_tuning.initialize = function (callback) { self.updatePidControllerParameters(); }); - if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { - $('select[name="rcInterpolation-select"]').change(function () { - self.updateRcInterpolationParameters(); - }); - } - // update == save. $('a.update').click(function () { form_to_pid_and_rc(); @@ -855,10 +835,6 @@ TABS.pid_tuning.initialize = function (callback) { if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) { return MSP.promise(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED)); } - }).then(function () { - if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { - return MSP.promise(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG)); - } }).then(function () { if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) { return MSP.promise(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG)); @@ -1034,13 +1010,3 @@ TABS.pid_tuning.updatePidControllerParameters = function () { } } } - -TABS.pid_tuning.updateRcInterpolationParameters = function () { - if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { - if ($('select[name="rcInterpolation-select"]').val() === '3') { - $('#pid-tuning .rcInterpolationInterval').show(); - } else { - $('#pid-tuning .rcInterpolationInterval').hide(); - } - } -} diff --git a/tabs/receiver.css b/tabs/receiver.css index 40b62121cd..ffabd69292 100644 --- a/tabs/receiver.css +++ b/tabs/receiver.css @@ -146,7 +146,7 @@ float: right; position: relative; margin: 0px 0px 20px 0; - width: 100% + width: 100%; border-top-left-radius: 5px; border-bottom-left-radius: 5px; background-color: #DEDEDE; @@ -304,6 +304,28 @@ width: calc(100% - 10px); } +.tab-receiver .rcInterpolation td { + padding: 5px; +} + +.tab-receiver .rcInterpolation td:first-child { + width: 20%; + padding-bottom: 6px; + padding-top: 5px; +} + +.tab-receiver .rcInterpolation td:last-child { + width: 80%; +} + +.tab-receiver .rcInterpolation td { + width: 20%; +} + +.tab-receiver .rcInterpolation .slider input { + -webkit-appearance: slider-horizontal +} + .tab-receiver .curves { float: left; margin-right: 10px; diff --git a/tabs/receiver.html b/tabs/receiver.html index fa3d6c881b..af62f6e896 100644 --- a/tabs/receiver.html +++ b/tabs/receiver.html @@ -52,7 +52,43 @@
-
+
+ + + + + + + + + + + + +
+ + +
+ +
+
+
+
+ +
+
+
+
+
diff --git a/tabs/receiver.js b/tabs/receiver.js index e77dfcaf94..b4f088b4ed 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -36,7 +36,7 @@ TABS.receiver.initialize = function (callback) { } function load_rc_configs() { - var next_callback = load_html; + var next_callback = load_rx_config; if (semver.gte(CONFIG.apiVersion, "1.15.0")) { MSP.send_message(MSPCodes.MSP_RC_DEADBAND, false, false, next_callback); } else { @@ -44,6 +44,15 @@ TABS.receiver.initialize = function (callback) { } } + function load_rx_config() { + var next_callback = load_html; + if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { + MSP.send_message(MSPCodes.MSP_RX_CONFIG, false, false, next_callback); + } else { + next_callback(); + } + } + function load_html() { $('#content').load("./tabs/receiver.html", process_html); } @@ -77,6 +86,17 @@ TABS.receiver.initialize = function (callback) { } + if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { + $('select[name="rcInterpolation-select"]').val(RX_CONFIG.rcInterpolation); + $('input[name="rcInterpolationInterval-number"]').val(RX_CONFIG.rcInterpolationInterval); + + $('select[name="rcInterpolation-select"]').change(function () { + self.updateRcInterpolationParameters(); + }).change(); + } else { + $('.tab-receiver div.rcInterpolation').hide(); + } + // generate bars var bar_names = [ chrome.i18n.getMessage('controlAxisRoll'), @@ -231,16 +251,30 @@ TABS.receiver.initialize = function (callback) { // catch rssi aux MISC.rssi_channel = parseInt($('select[name="rssi_channel"]').val()); + if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { + RX_CONFIG.rcInterpolation = parseInt($('select[name="rcInterpolation-select"]').val()); + RX_CONFIG.rcInterpolationInterval = parseInt($('input[name="rcInterpolationInterval-number"]').val()); + } + function save_misc() { MSP.send_message(MSPCodes.MSP_SET_MISC, mspHelper.crunch(MSPCodes.MSP_SET_MISC), false, save_rc_configs); } function save_rc_configs() { - var next_callback = save_to_eeprom; + var next_callback = save_rx_config; if (semver.gte(CONFIG.apiVersion, "1.15.0")) { - MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, next_callback); + MSP.send_message(MSPCodes.MSP_SET_RC_DEADBAND, mspHelper.crunch(MSPCodes.MSP_SET_RC_DEADBAND), false, next_callback); + } else { + next_callback(); + } + } + + function save_rx_config() { + var next_callback = save_to_eeprom; + if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { + MSP.send_message(MSPCodes.MSP_SET_RX_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_RX_CONFIG), false, next_callback); } else { - next_callback(); + next_callback(); } } @@ -447,3 +481,13 @@ TABS.receiver.cleanup = function (callback) { if (callback) callback(); }; + +TABS.receiver.updateRcInterpolationParameters = function () { + if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { + if ($('select[name="rcInterpolation-select"]').val() === '3') { + $('.tab-receiver .rcInterpolationInterval').show(); + } else { + $('.tab-receiver .rcInterpolationInterval').hide(); + } + } +};