mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
i18n profiles and rateprofiles select
This commit is contained in:
parent
1272707067
commit
649281e5f8
3 changed files with 71 additions and 28 deletions
|
@ -1121,6 +1121,13 @@
|
||||||
"portsFunction_RUNCAM_DEVICE_CONTROL": {
|
"portsFunction_RUNCAM_DEVICE_CONTROL": {
|
||||||
"message": "RunCam Device"
|
"message": "RunCam Device"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"pidTuningProfileOption": {
|
||||||
|
"message": "Profile $1"
|
||||||
|
},
|
||||||
|
"pidTuningRateProfileOption": {
|
||||||
|
"message": "Rateprofile $1"
|
||||||
|
},
|
||||||
"pidTuningUpgradeFirmwareToChangePidController": {
|
"pidTuningUpgradeFirmwareToChangePidController": {
|
||||||
"message": "<span class=\"message-negative\">Changing PID controller disabled - you can change it via the CLI.</span> You have firmware with API version <span class=\"message-negative\">$1</span>, but this functionality requires <span class=\"message-positive\">$2</span>."
|
"message": "<span class=\"message-negative\">Changing PID controller disabled - you can change it via the CLI.</span> You have firmware with API version <span class=\"message-negative\">$1</span>, but this functionality requires <span class=\"message-positive\">$2</span>."
|
||||||
},
|
},
|
||||||
|
@ -1249,6 +1256,12 @@
|
||||||
"pidTuningCopyRateProfile": {
|
"pidTuningCopyRateProfile": {
|
||||||
"message": "Copy rateprofile values"
|
"message": "Copy rateprofile values"
|
||||||
},
|
},
|
||||||
|
"dialogCopyProfileText": {
|
||||||
|
"message": "Copy values from current profile to"
|
||||||
|
},
|
||||||
|
"dialogCopyRateProfileText": {
|
||||||
|
"message": "Copy values from current rateprofile to"
|
||||||
|
},
|
||||||
"dialogCopyProfileTitle": {
|
"dialogCopyProfileTitle": {
|
||||||
"message": "Copy Profile Values"
|
"message": "Copy Profile Values"
|
||||||
},
|
},
|
||||||
|
|
|
@ -557,6 +557,56 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$(this).addClass('active');
|
$(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<numberOfProfiles; i++) {
|
||||||
|
profileElements.push(i18n.getMessage("pidTuningProfileOption",[(i + 1)]));
|
||||||
|
}
|
||||||
|
return profileElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadRateProfilesList() {
|
||||||
|
var numberOfRateProfiles = 6;
|
||||||
|
if (semver.lt(CONFIG.apiVersion, "1.37.0")) {
|
||||||
|
numberOfRateProfiles = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rateProfileElements = [];
|
||||||
|
for (var i=0; i<numberOfRateProfiles; i++) {
|
||||||
|
rateProfileElements.push(i18n.getMessage("pidTuningRateProfileOption",[(i + 1)]));
|
||||||
|
}
|
||||||
|
return rateProfileElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This vars are used here for populate the profile (and rate profile) selector AND in the copy profile (and rate profile) window
|
||||||
|
var selectRateProfileValues = loadRateProfilesList();
|
||||||
|
var selectProfileValues = loadProfilesList();
|
||||||
|
|
||||||
|
function populateProfilesSelector(selectProfileValues) {
|
||||||
|
var profileSelect = $('select[name="profile"]');
|
||||||
|
selectProfileValues.forEach(function(value, key) {
|
||||||
|
profileSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
populateProfilesSelector(selectProfileValues);
|
||||||
|
|
||||||
|
function populateRateProfilesSelector(selectRateProfileValues) {
|
||||||
|
var rateProfileSelect = $('select[name="rate_profile"]');
|
||||||
|
selectRateProfileValues.forEach(function(value, key) {
|
||||||
|
rateProfileSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
populateRateProfilesSelector(selectRateProfileValues);
|
||||||
|
|
||||||
var showAllButton = $('#showAllPids');
|
var showAllButton = $('#showAllPids');
|
||||||
|
|
||||||
function updatePidDisplay() {
|
function updatePidDisplay() {
|
||||||
|
@ -872,9 +922,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
var DIALOG_MODE_RATEPROFILE = 1;
|
var DIALOG_MODE_RATEPROFILE = 1;
|
||||||
var dialogCopyProfileMode;
|
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")) {
|
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||||
|
|
||||||
var selectProfile = $('.selectProfile');
|
var selectProfile = $('.selectProfile');
|
||||||
|
@ -1092,16 +1139,6 @@ TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (GUI.active_tab === 'pid_tuning') {
|
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) {
|
if (!self.updating && !self.dirty) {
|
||||||
var changedProfile = false;
|
var changedProfile = false;
|
||||||
|
|
|
@ -10,9 +10,7 @@
|
||||||
<div class="head" i18n="pidTuningProfile"></div>
|
<div class="head" i18n="pidTuningProfile"></div>
|
||||||
<div class="bottomarea">
|
<div class="bottomarea">
|
||||||
<select name="profile">
|
<select name="profile">
|
||||||
<option value="0" class="profile1">Profile 1</option>
|
<!-- list generated here -->
|
||||||
<option value="1" class="profile2">Profile 2</option>
|
|
||||||
<option value="2" class="profile3">Profile 3</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,12 +19,7 @@
|
||||||
<div class="head" i18n="pidTuningRateProfile"></div>
|
<div class="head" i18n="pidTuningRateProfile"></div>
|
||||||
<div class="bottomarea">
|
<div class="bottomarea">
|
||||||
<select name="rate_profile">
|
<select name="rate_profile">
|
||||||
<option value="0" class="RateProfile1">Rateprofile 1</option>
|
<!-- list generated here -->
|
||||||
<option value="1" class="RateProfile2">Rateprofile 2</option>
|
|
||||||
<option value="2" class="RateProfile3">Rateprofile 3</option>
|
|
||||||
<option value="3" class="RateProfile4">Rateprofile 4</option>
|
|
||||||
<option value="4" class="RateProfile5">Rateprofile 5</option>
|
|
||||||
<option value="5" class="RateProfile6">Rateprofile 6</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -147,7 +140,7 @@
|
||||||
<div id="pid_optional" class="gui_box grey topspacer pid_tuning">
|
<div id="pid_optional" class="gui_box grey topspacer pid_tuning">
|
||||||
<table class="pid_titlebar">
|
<table class="pid_titlebar">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="name" i18n="pidTuningName"></th>
|
<th class="name"></th>
|
||||||
<th class="proportional" i18n="pidTuningProportional"></th>
|
<th class="proportional" i18n="pidTuningProportional"></th>
|
||||||
<th class="integral" i18n="pidTuningIntegral"></th>
|
<th class="integral" i18n="pidTuningIntegral"></th>
|
||||||
<th class="derivative" i18n="pidTuningDerivative"></th>
|
<th class="derivative" i18n="pidTuningDerivative"></th>
|
||||||
|
@ -231,7 +224,7 @@
|
||||||
</table>
|
</table>
|
||||||
<table class="pid_titlebar">
|
<table class="pid_titlebar">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="third" i18n="pidTuningName"></th>
|
<th class="third"></th>
|
||||||
<th class="third" i18n="pidTuningStrength" style="width: 33%;"></th>
|
<th class="third" i18n="pidTuningStrength" style="width: 33%;"></th>
|
||||||
<th class="third" i18n="pidTuningTransition" style="width: 33%;"></th>
|
<th class="third" i18n="pidTuningTransition" style="width: 33%;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -592,9 +585,9 @@
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<span i18n="pidTuningDtermLowpassFrequency"></span>
|
<span i18n="pidTuningDTermLowpassFrequency"></span>
|
||||||
</label>
|
</label>
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningDtermLowpassFrequencyHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningDTermLowpassFrequencyHelp"></div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -673,13 +666,13 @@
|
||||||
|
|
||||||
<div class="contentProfile" style="margin-top:20px;">
|
<div class="contentProfile" style="margin-top:20px;">
|
||||||
<div>
|
<div>
|
||||||
Copy values from current profile to <select class="selectProfile"></select>
|
<span i18n="dialogCopyProfileText"></span> <select class="selectProfile"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="contentRateProfile" style="margin-top:20px;">
|
<div class="contentRateProfile" style="margin-top:20px;">
|
||||||
<div>
|
<div>
|
||||||
Copy values from current rateprofile to <select class="selectRateProfile"></select>
|
<span i18n="dialogCopyRateProfileText"></span> <select class="selectRateProfile"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue