From 649281e5f8b75e8d3f455d6adb697f368eae5496 Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Fri, 2 Feb 2018 14:23:11 +0100 Subject: [PATCH] i18n profiles and rateprofiles select --- locales/en/messages.json | 13 ++++++++ src/js/tabs/pid_tuning.js | 63 +++++++++++++++++++++++++++++++-------- src/tabs/pid_tuning.html | 23 +++++--------- 3 files changed, 71 insertions(+), 28 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 6727416d..a5dcbfbf 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -1121,6 +1121,13 @@ "portsFunction_RUNCAM_DEVICE_CONTROL": { "message": "RunCam Device" }, + + "pidTuningProfileOption": { + "message": "Profile $1" + }, + "pidTuningRateProfileOption": { + "message": "Rateprofile $1" + }, "pidTuningUpgradeFirmwareToChangePidController": { "message": "Changing PID controller disabled - you can change it via the CLI. You have firmware with API version $1, but this functionality requires $2." }, @@ -1249,6 +1256,12 @@ "pidTuningCopyRateProfile": { "message": "Copy rateprofile values" }, + "dialogCopyProfileText": { + "message": "Copy values from current profile to" + }, + "dialogCopyRateProfileText": { + "message": "Copy values from current rateprofile to" + }, "dialogCopyProfileTitle": { "message": "Copy Profile Values" }, diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 58062a9d..1b81ac4a 100755 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -557,6 +557,56 @@ TABS.pid_tuning.initialize = function (callback) { $(this).addClass('active'); }); + + function loadProfilesList() { + var numberOfProfiles = 3; + if (semver.gte(CONFIG.apiVersion, "1.20.0") + && CONFIG.numProfiles === 2) { + numberOfProfiles = 2; + } + + var profileElements = []; + for (var i=0; i' + value + ''); + }); + } + + populateProfilesSelector(selectProfileValues); + + function populateRateProfilesSelector(selectRateProfileValues) { + var rateProfileSelect = $('select[name="rate_profile"]'); + selectRateProfileValues.forEach(function(value, key) { + rateProfileSelect.append(''); + }); + } + + populateRateProfilesSelector(selectRateProfileValues); + var showAllButton = $('#showAllPids'); function updatePidDisplay() { @@ -872,9 +922,6 @@ TABS.pid_tuning.initialize = function (callback) { var DIALOG_MODE_RATEPROFILE = 1; var dialogCopyProfileMode; - var selectProfileValues = { "0": "Profile 1", "1": "Profile 2", "2": "Profile 3" }; - var selectRateProfileValues = { "0": "Rateprofile 1", "1": "Rateprofile 2", "2": "Rateprofile 3" }; - if (semver.gte(CONFIG.apiVersion, "1.36.0")) { var selectProfile = $('.selectProfile'); @@ -1092,16 +1139,6 @@ TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) { var self = this; if (GUI.active_tab === 'pid_tuning') { - if (semver.gte(CONFIG.apiVersion, "1.20.0") - && CONFIG.numProfiles === 2) { - $('.tab-pid_tuning select[name="profile"] .profile3').hide(); - } - - if (semver.lt(CONFIG.apiVersion, "1.37.0")) { - $('.tab-pid_tuning select[name="rate_profile"] .RateProfile4').hide(); - $('.tab-pid_tuning select[name="rate_profile"] .RateProfile5').hide(); - $('.tab-pid_tuning select[name="rate_profile"] .RateProfile6').hide(); - } if (!self.updating && !self.dirty) { var changedProfile = false; diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index df6ed8bd..f3edbfa4 100755 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -10,9 +10,7 @@
@@ -21,12 +19,7 @@
@@ -147,7 +140,7 @@
- + @@ -231,7 +224,7 @@
- + @@ -592,9 +585,9 @@ @@ -673,13 +666,13 @@
- Copy values from current profile to +
- Copy values from current rateprofile to +
-
+