mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Fields for PID and rate profile names. (#3150)
* Fields for PID and rate profile names. * Minor styling changes.
This commit is contained in:
parent
e8ef9418e1
commit
bc6307adf7
4 changed files with 52 additions and 3 deletions
|
@ -1608,6 +1608,18 @@
|
|||
"pidTuningSubTabFilter": {
|
||||
"message": "Filter Settings"
|
||||
},
|
||||
"pidProfileName": {
|
||||
"message": "PID profile name"
|
||||
},
|
||||
"pidProfileNameHelp": {
|
||||
"message": "PID profile name which can describe what conditions this profile was tuned to: lighter/heavier battery, action camera/no action camera, higher elevation, etc."
|
||||
},
|
||||
"rateProfileName": {
|
||||
"message": "Rate profile name"
|
||||
},
|
||||
"rateProfileNameHelp": {
|
||||
"message": "Rate profile name which can describe what type of flying this profile is for: cine, race, freestyle, etc."
|
||||
},
|
||||
"pidTuningShowAllPids": {
|
||||
"message": "Show all PIDs"
|
||||
},
|
||||
|
|
|
@ -2033,10 +2033,10 @@ MspHelper.prototype.crunch = function(code, modifierCode = undefined) {
|
|||
self.setText(buffer, modifierCode, FC.CONFIG.pidProfileNames[FC.CONFIG.profile], 8);
|
||||
break;
|
||||
case MSPCodes.RATE_PROFILE_NAME:
|
||||
self.setText(buffer, modifierCode, FC.CONFIG.pidProfileNames[FC.CONFIG.rateProfile], 8);
|
||||
self.setText(buffer, modifierCode, FC.CONFIG.rateProfileNames[FC.CONFIG.rateProfile], 8);
|
||||
break;
|
||||
default:
|
||||
console.log('Unsupport text type');
|
||||
console.log('Unsupported text type');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -48,6 +48,10 @@ pid_tuning.initialize = function (callback) {
|
|||
.then(() => MSP.promise(MSPCodes.MSP_FILTER_CONFIG))
|
||||
.then(() => MSP.promise(MSPCodes.MSP_RC_DEADBAND))
|
||||
.then(() => MSP.promise(MSPCodes.MSP_MOTOR_CONFIG))
|
||||
.then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_GET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.PID_PROFILE_NAME)) : true)
|
||||
.then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_GET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.RATE_PROFILE_NAME)) : true)
|
||||
.then(() => {
|
||||
let promise;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||
|
@ -68,6 +72,14 @@ pid_tuning.initialize = function (callback) {
|
|||
self.setProfile();
|
||||
self.setRateProfile();
|
||||
|
||||
// Profile names
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.45.0")) {
|
||||
$('input[name="pidProfileName"]').val(FC.CONFIG.pidProfileNames[FC.CONFIG.profile]);
|
||||
$('input[name="rateProfileName"]').val(FC.CONFIG.rateProfileNames[FC.CONFIG.rateProfile]);
|
||||
} else {
|
||||
$('.profile_name').hide();
|
||||
}
|
||||
|
||||
// Fill in the data from PIDs array for each pid name
|
||||
FC.PID_NAMES.forEach(function(elementPid, indexPid) {
|
||||
|
||||
|
@ -1000,6 +1012,12 @@ pid_tuning.initialize = function (callback) {
|
|||
// Fill in the data from PIDs array
|
||||
// Catch all the changes and stuff the inside PIDs array
|
||||
|
||||
// Profile names
|
||||
if (semver.gte(FC.CONFIG.apiVersion, "1.45.0")) {
|
||||
FC.CONFIG.pidProfileNames[FC.CONFIG.profile] = $('input[name="pidProfileName"]').val().trim();
|
||||
FC.CONFIG.rateProfileNames[FC.CONFIG.rateProfile] = $('input[name="rateProfileName"]').val().trim();
|
||||
}
|
||||
|
||||
// For each pid name
|
||||
FC.PID_NAMES.forEach(function(elementPid, indexPid) {
|
||||
|
||||
|
@ -2188,6 +2206,10 @@ pid_tuning.initialize = function (callback) {
|
|||
|
||||
MSP.promise(MSPCodes.MSP_SET_PID, mspHelper.crunch(MSPCodes.MSP_SET_PID))
|
||||
.then(() => MSP.promise(MSPCodes.MSP_SET_PID_ADVANCED, mspHelper.crunch(MSPCodes.MSP_SET_PID_ADVANCED)))
|
||||
.then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_SET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_SET_TEXT, MSPCodes.PID_PROFILE_NAME)) : true)
|
||||
.then(() => semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? MSP.promise(MSPCodes.MSP2_SET_TEXT,
|
||||
mspHelper.crunch(MSPCodes.MSP2_SET_TEXT, MSPCodes.RATE_PROFILE_NAME)) : true)
|
||||
.then(() => {
|
||||
self.updatePIDColors();
|
||||
return MSP.promise(MSPCodes.MSP_SET_FILTER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_FILTER_CONFIG));
|
||||
|
|
|
@ -63,6 +63,14 @@
|
|||
<div class="subtab-pid">
|
||||
<div class="clear-both"></div>
|
||||
<div class="cf_column">
|
||||
<div class="profile_name">
|
||||
<div class="number">
|
||||
<label> <input type="text" name="pidProfileName" maxlength="8" style="width:100px;"/> <span
|
||||
i18n="pidProfileName"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="pidProfileNameHelp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="note dMinDisabledNote">
|
||||
<p i18n="pidTuningDMinDisabledNote"></p>
|
||||
</div>
|
||||
|
@ -919,7 +927,14 @@
|
|||
<div class="subtab-rates" style="display: none;">
|
||||
<div class="clear-both"></div>
|
||||
<div class="cf_column">
|
||||
|
||||
<div class="profile_name">
|
||||
<div class="number">
|
||||
<label> <input type="text" name="rateProfileName" maxlength="8" style="width:100px;"/> <span
|
||||
i18n="rateProfileName"></span>
|
||||
</label>
|
||||
<div class="helpicon cf_tip" i18n_title="rateProfileNameHelp"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gui_box rates_type pid_tuning">
|
||||
<table class="cf">
|
||||
<thead>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue