mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-21 15:25:22 +03:00
Merge pull request #353 from mikeller/remove_pid_controller_selection
Removed PID controller selection for firmware >= 3.1.0.
This commit is contained in:
commit
dc14455e81
1 changed files with 73 additions and 65 deletions
|
@ -339,7 +339,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
RC_tuning.rcYawRate = parseFloat($('.pid_tuning input[name="rc_rate_yaw"]').val());
|
RC_tuning.rcYawRate = parseFloat($('.pid_tuning input[name="rc_rate_yaw"]').val());
|
||||||
|
|
||||||
RC_tuning.throttle_MID = parseFloat($('.throttle input[name="mid"]').val());
|
RC_tuning.throttle_MID = parseFloat($('.throttle input[name="mid"]').val());
|
||||||
RC_tuning.throttle_EXPO = parseFloat($('.throttle input[name="expo"]').val())
|
RC_tuning.throttle_EXPO = parseFloat($('.throttle input[name="expo"]').val());
|
||||||
|
|
||||||
RC_tuning.dynamic_THR_PID = parseFloat($('.tpa input[name="tpa"]').val());
|
RC_tuning.dynamic_THR_PID = parseFloat($('.tpa input[name="tpa"]').val());
|
||||||
RC_tuning.dynamic_THR_breakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
|
RC_tuning.dynamic_THR_breakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
|
||||||
|
@ -612,45 +612,52 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
|
|
||||||
var pidController_e = $('select[name="controller"]');
|
var pidController_e = $('select[name="controller"]');
|
||||||
|
|
||||||
var pidControllerList;
|
if (semver.lt(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
var pidControllerList;
|
||||||
|
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.14.0")) {
|
|
||||||
pidControllerList = [
|
if (semver.lt(CONFIG.apiVersion, "1.14.0")) {
|
||||||
{ name: "MultiWii (Old)"},
|
pidControllerList = [
|
||||||
{ name: "MultiWii (rewrite)"},
|
{name: "MultiWii (Old)"},
|
||||||
{ name: "LuxFloat"},
|
{name: "MultiWii (rewrite)"},
|
||||||
{ name: "MultiWii (2.3 - latest)"},
|
{name: "LuxFloat"},
|
||||||
{ name: "MultiWii (2.3 - hybrid)"},
|
{name: "MultiWii (2.3 - latest)"},
|
||||||
{ name: "Harakiri"}
|
{name: "MultiWii (2.3 - hybrid)"},
|
||||||
]
|
{name: "Harakiri"}
|
||||||
} else if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
]
|
||||||
pidControllerList = [
|
} else if (semver.lt(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
{ name: "Legacy"},
|
pidControllerList = [
|
||||||
{ name: "Betaflight"},
|
{name: ""},
|
||||||
]
|
{name: "Integer"},
|
||||||
|
{name: "Float"}
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
pidControllerList = [
|
||||||
|
{name: "Legacy"},
|
||||||
|
{name: "Betaflight"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < pidControllerList.length; i++) {
|
||||||
|
pidController_e.append('<option value="' + (i) + '">' + pidControllerList[i].name + '</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion)) {
|
||||||
|
pidController_e.val(PID.controller);
|
||||||
|
|
||||||
|
self.updatePidControllerParameters();
|
||||||
|
} else {
|
||||||
|
GUI.log(chrome.i18n.getMessage('pidTuningUpgradeFirmwareToChangePidController', [CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion]));
|
||||||
|
|
||||||
|
pidController_e.empty();
|
||||||
|
pidController_e.append('<option value="">Unknown</option>');
|
||||||
|
|
||||||
|
pidController_e.prop('disabled', true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pidControllerList = [
|
$('.tab-pid_tuning div.controller').hide();
|
||||||
{ name: ""},
|
|
||||||
{ name: "Integer"},
|
|
||||||
{ name: "Float"},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < pidControllerList.length; i++) {
|
self.updatePidControllerParameters();
|
||||||
pidController_e.append('<option value="' + (i) + '">' + pidControllerList[i].name + '</option>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion)) {
|
|
||||||
pidController_e.val(PID.controller);
|
|
||||||
|
|
||||||
self.updatePidControllerParameters();
|
|
||||||
} else {
|
|
||||||
GUI.log(chrome.i18n.getMessage('pidTuningUpgradeFirmwareToChangePidController', [CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion]));
|
|
||||||
|
|
||||||
pidController_e.empty();
|
|
||||||
pidController_e.append('<option value="">Unknown</option>');
|
|
||||||
|
|
||||||
pidController_e.prop('disabled', true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.7.0")) {
|
if (semver.lt(CONFIG.apiVersion, "1.7.0")) {
|
||||||
|
@ -743,7 +750,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
updateNeeded = false;
|
updateNeeded = false;
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
}
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
// curves
|
// curves
|
||||||
|
@ -814,11 +821,13 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pidController_e.change(function () {
|
if (semver.lt(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
self.setDirty(true);
|
pidController_e.change(function () {
|
||||||
|
self.setDirty(true);
|
||||||
|
|
||||||
self.updatePidControllerParameters();
|
self.updatePidControllerParameters();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// update == save.
|
// update == save.
|
||||||
$('a.update').click(function () {
|
$('a.update').click(function () {
|
||||||
|
@ -828,7 +837,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
Promise.resolve(true)
|
Promise.resolve(true)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
var promise;
|
var promise;
|
||||||
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion)) {
|
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion) && semver.lt(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
PID.controller = pidController_e.val();
|
PID.controller = pidController_e.val();
|
||||||
promise = MSP.promise(MSPCodes.MSP_SET_PID_CONTROLLER, mspHelper.crunch(MSPCodes.MSP_SET_PID_CONTROLLER));
|
promise = MSP.promise(MSPCodes.MSP_SET_PID_CONTROLLER, mspHelper.crunch(MSPCodes.MSP_SET_PID_CONTROLLER));
|
||||||
}
|
}
|
||||||
|
@ -939,21 +948,21 @@ TABS.pid_tuning.refresh = function (callback) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.setProfile = function () {
|
TABS.pid_tuning.setProfile = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.currentProfile = CONFIG.profile;
|
self.currentProfile = CONFIG.profile;
|
||||||
$('.tab-pid_tuning select[name="profile"]').val(self.currentProfile);
|
$('.tab-pid_tuning select[name="profile"]').val(self.currentProfile);
|
||||||
}
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.setRateProfile = function () {
|
TABS.pid_tuning.setRateProfile = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.currentRateProfile = CONFIG.rateProfile;
|
self.currentRateProfile = CONFIG.rateProfile;
|
||||||
$('.tab-pid_tuning select[name="rate_profile"]').val(self.currentRateProfile);
|
$('.tab-pid_tuning select[name="rate_profile"]').val(self.currentRateProfile);
|
||||||
}
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.setDirty = function (isDirty) {
|
TABS.pid_tuning.setDirty = function (isDirty) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -963,7 +972,7 @@ TABS.pid_tuning.setDirty = function (isDirty) {
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
$('.tab-pid_tuning select[name="rate_profile"]').prop('disabled', isDirty);
|
$('.tab-pid_tuning select[name="rate_profile"]').prop('disabled', isDirty);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
|
TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -1004,7 +1013,7 @@ TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.checkRC = function() {
|
TABS.pid_tuning.checkRC = function() {
|
||||||
// Function monitors for change in the primary axes rc received data and returns true if a change is detected.
|
// Function monitors for change in the primary axes rc received data and returns true if a change is detected.
|
||||||
|
@ -1023,24 +1032,22 @@ TABS.pid_tuning.checkRC = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.updatePidControllerParameters = function () {
|
TABS.pid_tuning.updatePidControllerParameters = function () {
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0") && semver.lt(CONFIG.flightControllerVersion, "3.1.0") && $('.tab-pid_tuning select[name="controller"]').val() === '0') {
|
||||||
if ($('.tab-pid_tuning select[name="controller"]').val() === '0') {
|
$('.pid_tuning .YAW_JUMP_PREVENTION').show();
|
||||||
$('.pid_tuning .YAW_JUMP_PREVENTION').show();
|
|
||||||
|
|
||||||
$('#pid-tuning .delta').show();
|
$('#pid-tuning .delta').show();
|
||||||
|
|
||||||
$('#pid-tuning .ptermSetpoint').hide();
|
$('#pid-tuning .ptermSetpoint').hide();
|
||||||
$('#pid-tuning .dtermSetpoint').hide();
|
$('#pid-tuning .dtermSetpoint').hide();
|
||||||
} else {
|
} else {
|
||||||
$('.pid_tuning .YAW_JUMP_PREVENTION').hide();
|
$('.pid_tuning .YAW_JUMP_PREVENTION').hide();
|
||||||
|
|
||||||
$('#pid-tuning .ptermSetpoint').show();
|
$('#pid-tuning .ptermSetpoint').show();
|
||||||
$('#pid-tuning .dtermSetpoint').show();
|
$('#pid-tuning .dtermSetpoint').show();
|
||||||
|
|
||||||
$('#pid-tuning .delta').hide();
|
$('#pid-tuning .delta').hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.updateRatesLabels = function() {
|
TABS.pid_tuning.updateRatesLabels = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -1051,7 +1058,8 @@ TABS.pid_tuning.updateRatesLabels = function() {
|
||||||
context.fillStyle = color || '#000000' ;
|
context.fillStyle = color || '#000000' ;
|
||||||
context.textAlign = align || 'center';
|
context.textAlign = align || 'center';
|
||||||
context.fillText(axisLabel, x, y);
|
context.fillText(axisLabel, x, y);
|
||||||
}
|
};
|
||||||
|
|
||||||
var drawBalloonLabel = function(context, axisLabel, x, y, align, colors, dirty) {
|
var drawBalloonLabel = function(context, axisLabel, x, y, align, colors, dirty) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1138,7 +1146,7 @@ TABS.pid_tuning.updateRatesLabels = function() {
|
||||||
// and add the label
|
// and add the label
|
||||||
drawAxisLabel(context, axisLabel, x + (width/2), y + (height + fontSize)/2 - 4, 'center', colors.text);
|
drawAxisLabel(context, axisLabel, x + (width/2), y + (height + fontSize)/2 - 4, 'center', colors.text);
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
const BALLOON_COLORS = {
|
const BALLOON_COLORS = {
|
||||||
roll : {color: 'rgba(255,128,128,0.4)', border: 'rgba(255,128,128,0.6)', text: '#000000'},
|
roll : {color: 'rgba(255,128,128,0.4)', border: 'rgba(255,128,128,0.6)', text: '#000000'},
|
||||||
|
@ -1190,10 +1198,10 @@ TABS.pid_tuning.updateRatesLabels = function() {
|
||||||
currentValues = [];
|
currentValues = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
stickContext.lineWidth = 1 * lineScale;
|
stickContext.lineWidth = lineScale;
|
||||||
|
|
||||||
// use a custom scale so that the text does not appear stretched
|
// use a custom scale so that the text does not appear stretched
|
||||||
stickContext.scale(textScale,1);
|
stickContext.scale(textScale, 1);
|
||||||
|
|
||||||
// add the maximum range label
|
// add the maximum range label
|
||||||
drawAxisLabel(stickContext, maxAngularVel.toFixed(0) + ' deg/s', ((curveWidth / 2) - 10) / textScale, parseInt(stickContext.font)*1.2, 'right');
|
drawAxisLabel(stickContext, maxAngularVel.toFixed(0) + ' deg/s', ((curveWidth / 2) - 10) / textScale, parseInt(stickContext.font)*1.2, 'right');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue