Added support for rateprofile switching.
Fixed rateprofile switching.10.3.x-maintenance
parent
e97f6685d4
commit
91ccc659d4
|
@ -848,15 +848,24 @@
|
|||
"pidTuningControllerHead": {
|
||||
"message": "PID"
|
||||
},
|
||||
"pidTuningPidsReset": {
|
||||
"message": "Loaded default PID values."
|
||||
"pidTuningResetProfile": {
|
||||
"message": "Reset all profile values"
|
||||
},
|
||||
"pidTuningProfileReset": {
|
||||
"message": "Loaded default profile values."
|
||||
},
|
||||
"pidTuningReceivedProfile": {
|
||||
"message": "Flight controller set Profile: <strong style=\"color: #ffbb00\">$1</strong>"
|
||||
},
|
||||
"pidTuningReceivedRateProfile": {
|
||||
"message": "Flight controller set Rateprofile: <strong style=\"color: #ffbb00\">$1</strong>"
|
||||
},
|
||||
"pidTuningLoadedProfile": {
|
||||
"message": "Loaded Profile: <strong style=\"color: #ffbb00\">$1</strong>"
|
||||
},
|
||||
"pidTuningLoadedRateProfile": {
|
||||
"message": "Loaded Rateprofile: <strong style=\"color: #ffbb00\">$1</strong>"
|
||||
},
|
||||
"pidTuningDataRefreshed": {
|
||||
"message": "PID data <strong>refreshed</strong>"
|
||||
},
|
||||
|
@ -1748,6 +1757,12 @@
|
|||
"pidTuningProfileTip": {
|
||||
"message": "Up to 3 (2 for some controllers) different profiles can be stored on the flight controller. The profiles include all the settings on this tab. Once in the field, simple stick commands (see online instructions) can be used to switch between the profiles."
|
||||
},
|
||||
"pidTuningRateProfile": {
|
||||
"message": "Rateprofile"
|
||||
},
|
||||
"pidTuningRateProfileTip": {
|
||||
"message": "Up to 3 different rateprofiles per profile can be stored on the flight controller. The rateprofiles include the settings for 'RC Rate', 'Rate', 'RC Expo', 'Throttle', and 'TPA'. Switching between rateprofiles is possible in-flight, by setting up a 3 position switch for 'Rate Profile Selection' on the 'Adjustments' tab."
|
||||
},
|
||||
"pidTuningPidTip": {
|
||||
"message": "<b>Derivative from Error</b> provides more direct stick response and is mostly prefered for Racing.<br><br><b>Derivative from Measurement</b> provides smoother stick response what is more usefull for freestyling"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
'use strict;'
|
||||
|
||||
var Features = function (config) {
|
||||
var self = this;
|
||||
|
||||
var features = [
|
||||
{bit: 0, group: 'rxMode', mode: 'group', name: 'RX_PPM'},
|
||||
{bit: 1, group: 'batteryVoltage', name: 'VBAT'},
|
||||
|
@ -43,24 +45,27 @@ var Features = function (config) {
|
|||
);
|
||||
}
|
||||
|
||||
this._features = features;
|
||||
this._featureMask = 0;
|
||||
self._features = features;
|
||||
self._featureMask = 0;
|
||||
}
|
||||
|
||||
Features.prototype.getMask = function () {
|
||||
return this._featureMask;
|
||||
var self = this;
|
||||
|
||||
return self._featureMask;
|
||||
}
|
||||
|
||||
Features.prototype.setMask = function (featureMask) {
|
||||
this._featureMask = featureMask;
|
||||
var self = this;
|
||||
|
||||
self._featureMask = featureMask;
|
||||
}
|
||||
|
||||
Features.prototype.isEnabled = function (featureName) {
|
||||
var features = this._features;
|
||||
var featureMask = this._featureMask;
|
||||
var self = this;
|
||||
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
if (features[i].name === featureName && bit_check(featureMask, features[i].bit)) {
|
||||
for (var i = 0; i < self._features.length; i++) {
|
||||
if (self._features[i].name === featureName && bit_check(self._featureMask, self._features[i].bit)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -68,56 +73,56 @@ Features.prototype.isEnabled = function (featureName) {
|
|||
}
|
||||
|
||||
Features.prototype.generateElements = function (featuresElements) {
|
||||
var features = this._features;
|
||||
var featureMask = this._featureMask;
|
||||
var self = this;
|
||||
|
||||
var radioGroups = [];
|
||||
|
||||
for (var i = 0; i < features.length; i++) {
|
||||
for (var i = 0; i < self._features.length; i++) {
|
||||
var row_e;
|
||||
|
||||
var feature_tip_html = '';
|
||||
if (features[i].haveTip) {
|
||||
feature_tip_html = '<div class="helpicon cf_tip" i18n_title="feature' + features[i].name + 'Tip"></div>';
|
||||
if (self._features[i].haveTip) {
|
||||
feature_tip_html = '<div class="helpicon cf_tip" i18n_title="feature' + self._features[i].name + 'Tip"></div>';
|
||||
}
|
||||
|
||||
if (features[i].mode === 'group') {
|
||||
if (self._features[i].mode === 'group') {
|
||||
row_e = $('<tr><td style="width: 15px;"><input style="width: 13px;" class="feature" id="feature-'
|
||||
+ i
|
||||
+ '" value="'
|
||||
+ features[i].bit
|
||||
+ self._features[i].bit
|
||||
+ '" title="'
|
||||
+ features[i].name
|
||||
+ self._features[i].name
|
||||
+ '" type="radio" name="'
|
||||
+ features[i].group
|
||||
+ self._features[i].group
|
||||
+ '" /></td><td><label for="feature-'
|
||||
+ i
|
||||
+ '">'
|
||||
+ features[i].name
|
||||
+ '</label></td><td><span i18n="feature' + features[i].name + '"></span>'
|
||||
+ self._features[i].name
|
||||
+ '</label></td><td><span i18n="feature' + self._features[i].name + '"></span>'
|
||||
+ feature_tip_html + '</td></tr>');
|
||||
radioGroups.push(features[i].group);
|
||||
radioGroups.push(self._features[i].group);
|
||||
} else {
|
||||
row_e = $('<tr><td><input class="feature toggle" id="feature-'
|
||||
+ i
|
||||
+ '" name="'
|
||||
+ features[i].name
|
||||
+ self._features[i].name
|
||||
+ '" title="'
|
||||
+ features[i].name
|
||||
+ self._features[i].name
|
||||
+ '" type="checkbox"/></td><td><label for="feature-'
|
||||
+ i
|
||||
+ '">'
|
||||
+ features[i].name
|
||||
+ '</label></td><td><span i18n="feature' + features[i].name + '"></span>'
|
||||
+ self._features[i].name
|
||||
+ '</label></td><td><span i18n="feature' + self._features[i].name + '"></span>'
|
||||
+ feature_tip_html + '</td></tr>');
|
||||
|
||||
var feature_e = row_e.find('input.feature');
|
||||
|
||||
feature_e.prop('checked', bit_check(featureMask, features[i].bit));
|
||||
feature_e.data('bit', features[i].bit);
|
||||
feature_e.prop('checked', bit_check(self._featureMask, self._features[i].bit));
|
||||
feature_e.data('bit', self._features[i].bit);
|
||||
}
|
||||
|
||||
featuresElements.each(function () {
|
||||
if ($(this).hasClass(features[i].group)) {
|
||||
if ($(this).hasClass(self._features[i].group)) {
|
||||
$(this).append(row_e);
|
||||
}
|
||||
});
|
||||
|
@ -129,7 +134,7 @@ Features.prototype.generateElements = function (featuresElements) {
|
|||
|
||||
controlElements.each(function() {
|
||||
var bit = parseInt($(this).attr('value'));
|
||||
var state = bit_check(featureMask, bit);
|
||||
var state = bit_check(self._featureMask, bit);
|
||||
|
||||
$(this).prop('checked', state);
|
||||
});
|
||||
|
@ -137,14 +142,16 @@ Features.prototype.generateElements = function (featuresElements) {
|
|||
}
|
||||
|
||||
Features.prototype.updateData = function (featureElement) {
|
||||
var self = this;
|
||||
|
||||
switch (featureElement.attr('type')) {
|
||||
case 'checkbox':
|
||||
var bit = featureElement.data('bit');
|
||||
|
||||
if (featureElement.is(':checked')) {
|
||||
this._featureMask = bit_set(this._featureMask, bit);
|
||||
self._featureMask = bit_set(self._featureMask, bit);
|
||||
} else {
|
||||
this._featureMask = bit_clear(this._featureMask, bit);
|
||||
self._featureMask = bit_clear(self._featureMask, bit);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -152,17 +159,15 @@ Features.prototype.updateData = function (featureElement) {
|
|||
var group = featureElement.attr('name');
|
||||
var controlElements = $('input[name="' + group + '"]');
|
||||
var selectedBit = controlElements.filter(':checked').val();
|
||||
var featureMask = this._featureMask;
|
||||
controlElements.each(function() {
|
||||
var bit = $(this).val();
|
||||
if (selectedBit === bit) {
|
||||
featureMask = bit_set(featureMask, bit);
|
||||
self._featureMask = bit_set(self._featureMask, bit);
|
||||
} else {
|
||||
featureMask = bit_clear(featureMask, bit);
|
||||
self._featureMask = bit_clear(self._featureMask, bit);
|
||||
}
|
||||
|
||||
});
|
||||
this._featureMask = featureMask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
10
js/msp.js
10
js/msp.js
|
@ -283,7 +283,8 @@ var MSP = {
|
|||
CONFIG.activeSensors = data.getUint16(4, 1);
|
||||
CONFIG.mode = data.getUint32(6, 1);
|
||||
CONFIG.profile = data.getUint8(10);
|
||||
$('.tab-pid_tuning select[name="profilechange"]').val(CONFIG.profile);
|
||||
|
||||
TABS.pid_tuning.checkUpdateProfile(false);
|
||||
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
|
@ -299,7 +300,7 @@ var MSP = {
|
|||
CONFIG.numProfiles = data.getUint8(13);
|
||||
CONFIG.rateProfile = data.getUint8(14);
|
||||
|
||||
TABS.pid_tuning.checkUpdateProfile();
|
||||
TABS.pid_tuning.checkUpdateProfile(true);
|
||||
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
|
@ -1271,9 +1272,12 @@ var MSP = {
|
|||
case MSP_codes.MSP_SET_FILTER_CONFIG:
|
||||
console.log('Filter config set');
|
||||
break;
|
||||
case MSP_codes.MSP_SET_PID_ADVANCED:
|
||||
case MSP_codes.MSP_SET_ADVANCED_TUNING:
|
||||
console.log('Advanced tuning parameters set');
|
||||
break;
|
||||
case MSP_codes.MSP_SET_SPECIAL_PARAMETERS:
|
||||
console.log('Special parameters set');
|
||||
break;
|
||||
default:
|
||||
console.log('Unknown code detected: ' + code);
|
||||
} else {
|
||||
|
|
|
@ -274,9 +274,10 @@ function onConnect() {
|
|||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.4.0")) {
|
||||
CONFIG.numProfiles = 2;
|
||||
$('select[name="profilechange"] .profile3').hide();
|
||||
$('.tab-pid_tuning select[name="profile"] .profile3').hide();
|
||||
} else {
|
||||
CONFIG.numProfiles = 3;
|
||||
$('.tab-pid_tuning select[name="rate_profile"]').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -542,6 +542,17 @@
|
|||
}
|
||||
|
||||
|
||||
.tab-pid_tuning .rate_profile {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning .rate_profile select {
|
||||
border: 1px solid silver;
|
||||
margin-left: 5px;
|
||||
width: calc(100% - 10px);
|
||||
}
|
||||
|
||||
|
||||
.tab-pid_tuning .controller {
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -14,13 +14,24 @@
|
|||
<div class="helpicon cf_tip" i18n_title="pidTuningProfileTip" style="margin-top: 5px;"></div>
|
||||
<div class="head" i18n="pidTuningProfile"></div>
|
||||
<div class="bottomarea">
|
||||
<select name="profilechange">
|
||||
<select name="profile">
|
||||
<option value="0" class="profile1">Profile 1</option>
|
||||
<option value="1" class="profile2">Profile 2</option>
|
||||
<option value="2" class="profile3">Profile 3</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rate_profile single-field">
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningRateProfileTip" style="margin-top: 5px;"></div>
|
||||
<div class="head" i18n="pidTuningRateProfile"></div>
|
||||
<div class="bottomarea">
|
||||
<select name="rate_profile">
|
||||
<option value="0">Rateprofile 1</option>
|
||||
<option value="1">Rateprofile 2</option>
|
||||
<option value="2">Rateprofile 3</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controller single-field">
|
||||
<div class="helpicon cf_tip" i18n_title="pidTuningPidControllerTip" style="margin-top: 5px;"></div>
|
||||
<div class="head" i18n="pidTuningControllerHead"></div>
|
||||
|
@ -42,10 +53,10 @@
|
|||
</div>
|
||||
<div class="cf_column right">
|
||||
<div class="default_btn show">
|
||||
<a href="#" id="showAllPids">Show all PIDs</a>
|
||||
<a href="#" id="showAllPids" i18n="pidTuningShowAllPids"></a>
|
||||
</div>
|
||||
<div class="default_btn resetbt">
|
||||
<a href="#" id="resetPIDs">Reset PID Controller</a>
|
||||
<a href="#" id="resetProfile" i18n="pidTuningResetProfile"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
TABS.pid_tuning = {
|
||||
RATE_PROFILE_MASK: 128,
|
||||
showAllPids: false,
|
||||
profileDirty: false,
|
||||
loadingProfile: true
|
||||
updating: true,
|
||||
dirty: false,
|
||||
currentProfile: null,
|
||||
currentRateProfile: null
|
||||
};
|
||||
|
||||
TABS.pid_tuning.initialize = function (callback) {
|
||||
var self = this;
|
||||
|
||||
if (GUI.active_tab != 'pid_tuning') {
|
||||
GUI.active_tab = 'pid_tuning';
|
||||
}
|
||||
|
@ -45,6 +49,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
});
|
||||
|
||||
function pid_and_rc_to_form() {
|
||||
self.setProfile();
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||
self.setRateProfile();
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||
$('input[name="vbatpidcompensation"]').prop('checked', ADVANCED_TUNING.vbatPidCompensation !== 0);
|
||||
}
|
||||
|
@ -441,7 +450,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
var showAllButton = $('#showAllPids');
|
||||
|
||||
function updatePidDisplay() {
|
||||
if (!TABS.pid_tuning.showAllPids) {
|
||||
if (!self.showAllPids) {
|
||||
hideUnusedPids();
|
||||
|
||||
showAllButton.text(chrome.i18n.getMessage("pidTuningShowAllPids"));
|
||||
|
@ -455,34 +464,50 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
updatePidDisplay();
|
||||
|
||||
showAllButton.on('click', function(){
|
||||
TABS.pid_tuning.showAllPids = !TABS.pid_tuning.showAllPids;
|
||||
self.showAllPids = !self.showAllPids;
|
||||
|
||||
updatePidDisplay();
|
||||
});
|
||||
|
||||
$('#resetPIDs').on('click', function(){
|
||||
TABS.pid_tuning.profileLoading = true;
|
||||
$('#resetProfile').on('click', function(){
|
||||
self.updating = true;
|
||||
MSP.promise(MSP_codes.MSP_SET_RESET_CURR_PID).then(function () {
|
||||
TABS.pid_tuning.refresh(function () {
|
||||
TABS.pid_tuning.profileDirty = false;
|
||||
self.refresh(function () {
|
||||
self.updating = false;
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningPidsReset'));
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningProfileReset'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.tab-pid_tuning select[name="profilechange"]').change(function () {
|
||||
var profile = parseInt($(this).val());
|
||||
TABS.pid_tuning.loadingProfile = true;
|
||||
MSP.promise(MSP_codes.MSP_SELECT_SETTING, [profile]).then(function () {
|
||||
TABS.pid_tuning.refresh(function () {
|
||||
TABS.pid_tuning.loadingProfile = false;
|
||||
$('.tab-pid_tuning select[name="profile"]').change(function () {
|
||||
self.currentProfile = parseInt($(this).val());
|
||||
self.updating = true;
|
||||
MSP.promise(MSP_codes.MSP_SELECT_SETTING, [self.currentProfile]).then(function () {
|
||||
self.refresh(function () {
|
||||
self.updating = false;
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [profile + 1]));
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [self.currentProfile + 1]));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||
$('.tab-pid_tuning select[name="rate_profile"]').change(function () {
|
||||
self.currentRateProfile = parseInt($(this).val());
|
||||
self.updating = true;
|
||||
MSP.promise(MSP_codes.MSP_SELECT_SETTING, [self.currentRateProfile + self.RATE_PROFILE_MASK]).then(function () {
|
||||
self.refresh(function () {
|
||||
self.updating = false;
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningLoadedRateProfile', [self.currentRateProfile + 1]));
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$('.tab-pid_tuning .rate_profile').hide();
|
||||
}
|
||||
|
||||
$('.pid_tuning tr').each(function(){
|
||||
for(i = 0; i < PID_names.length; i++) {
|
||||
if($(this).hasClass(PID_names[i])) {
|
||||
|
@ -664,24 +689,24 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}).trigger('input');
|
||||
|
||||
$('a.refresh').click(function () {
|
||||
TABS.pid_tuning.refresh(function () {
|
||||
self.refresh(function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningDataRefreshed'));
|
||||
});
|
||||
});
|
||||
|
||||
$('#pid-tuning').find('input').each(function (k, item) {
|
||||
$(item).change(function () {
|
||||
TABS.pid_tuning.profileDirty = true;
|
||||
self.setDirty(true);
|
||||
})
|
||||
});
|
||||
|
||||
pidController_e.change(function () {
|
||||
TABS.pid_tuning.profileDirty = true;
|
||||
self.setDirty(true);
|
||||
});
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.2")) {
|
||||
$('.delta select').change(function() {
|
||||
TABS.pid_tuning.profileDirty = true;
|
||||
self.setDirty(true);
|
||||
});
|
||||
} else {
|
||||
$('.delta').hide();
|
||||
|
@ -692,6 +717,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$('a.update').click(function () {
|
||||
form_to_pid_and_rc();
|
||||
|
||||
self.updating = true;
|
||||
Promise.resolve(true)
|
||||
.then(function () {
|
||||
var promise;
|
||||
|
@ -723,6 +749,9 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}).then(function () {
|
||||
return MSP.promise(MSP_codes.MSP_EEPROM_WRITE);
|
||||
}).then(function () {
|
||||
self.updating = false;
|
||||
self.setDirty(false);
|
||||
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningEepromSaved'));
|
||||
});
|
||||
});
|
||||
|
@ -731,6 +760,8 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
self.initRatesPreview();
|
||||
self.renderModel();
|
||||
|
||||
self.updating = false;
|
||||
|
||||
// enable RC data pulling for rates preview
|
||||
GUI.interval_add('receiver_pull', self.getRecieverData, true);
|
||||
|
||||
|
@ -739,8 +770,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
|
||||
TABS.pid_tuning.profileLoaded = true;
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
};
|
||||
|
@ -773,18 +802,24 @@ TABS.pid_tuning.renderModel = function () {
|
|||
};
|
||||
|
||||
TABS.pid_tuning.cleanup = function (callback) {
|
||||
if (this.model) {
|
||||
$(window).off('resize', $.proxy(this.model.resize, this.model));
|
||||
var self = this;
|
||||
|
||||
if (self.model) {
|
||||
$(window).off('resize', $.proxy(self.model.resize, self.model));
|
||||
}
|
||||
|
||||
this.keepRendering = false;
|
||||
self.keepRendering = false;
|
||||
|
||||
if (callback) callback();
|
||||
};
|
||||
|
||||
TABS.pid_tuning.refresh = function (callback) {
|
||||
var self = this;
|
||||
|
||||
GUI.tab_switch_cleanup(function () {
|
||||
TABS.pid_tuning.initialize();
|
||||
self.initialize();
|
||||
|
||||
self.setDirty(false);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
|
@ -792,20 +827,66 @@ TABS.pid_tuning.refresh = function (callback) {
|
|||
});
|
||||
}
|
||||
|
||||
TABS.pid_tuning.checkUpdateProfile = function () {
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")
|
||||
&& CONFIG.numProfiles === 2) {
|
||||
$('.tab-pid_tuning select[name="profilechange"] .profile3').hide();
|
||||
}
|
||||
TABS.pid_tuning.setProfile = function () {
|
||||
var self = this;
|
||||
|
||||
if (!TABS.pid_tuning.loadingProfile && !TABS.pid_tuning.profileDirty) {
|
||||
var profileElement = $('.tab-pid_tuning select[name="profilechange"]')
|
||||
if (profileElement.length > 0 && parseInt(profileElement.val()) !== CONFIG.profile) {
|
||||
profileElement.val(CONFIG.profile);
|
||||
self.currentProfile = CONFIG.profile;
|
||||
$('.tab-pid_tuning select[name="profile"]').val(self.currentProfile);
|
||||
}
|
||||
|
||||
TABS.pid_tuning.setRateProfile = function () {
|
||||
var self = this;
|
||||
|
||||
self.currentRateProfile = CONFIG.rateProfile;
|
||||
$('.tab-pid_tuning select[name="rate_profile"]').val(self.currentRateProfile);
|
||||
}
|
||||
|
||||
TABS.pid_tuning.setDirty = function (isDirty) {
|
||||
var self = this;
|
||||
|
||||
self.dirty = isDirty;
|
||||
$('.tab-pid_tuning select[name="profile"]').prop('disabled', isDirty);
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||
$('.tab-pid_tuning select[name="rate_profile"]').prop('disabled', isDirty);
|
||||
}
|
||||
}
|
||||
|
||||
TABS.pid_tuning.checkUpdateProfile = function (updateRateProfile) {
|
||||
var self = this;
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")
|
||||
&& CONFIG.numProfiles === 2) {
|
||||
$('.tab-pid_tuning select[name="profile"] .profile3').hide();
|
||||
}
|
||||
|
||||
if (!self.updating && !self.dirty) {
|
||||
var changedProfile = false;
|
||||
if (self.currentProfile !== CONFIG.profile) {
|
||||
self.setProfile();
|
||||
|
||||
changedProfile = true;
|
||||
}
|
||||
|
||||
var changedRateProfile = false;
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")
|
||||
&& updateRateProfile
|
||||
&& self.currentRateProfile !== CONFIG.rateProfile) {
|
||||
self.setRateProfile();
|
||||
|
||||
changedRateProfile = true;
|
||||
}
|
||||
|
||||
if (changedProfile || changedRateProfile) {
|
||||
self.refresh(function () {
|
||||
if (changedProfile) {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningReceivedProfile', [CONFIG.profile + 1]));
|
||||
}
|
||||
|
||||
if (changedRateProfile) {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningReceivedRateProfile', [CONFIG.rateProfile + 1]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
TABS.pid_tuning.refresh(function () {
|
||||
GUI.log(chrome.i18n.getMessage('pidTuningReceivedProfile', [CONFIG.profile + 1]));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue