mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 01:05:15 +03:00
Centralised feature handler in BF_CONFIG. Switched all access to features to use the handler.
This commit is contained in:
parent
7e7361dafd
commit
9594cbded5
12 changed files with 104 additions and 116 deletions
|
@ -538,7 +538,13 @@
|
||||||
"message": "Configure via the Race Transponder tab after enabling."
|
"message": "Configure via the Race Transponder tab after enabling."
|
||||||
},
|
},
|
||||||
"featureAIRMODE": {
|
"featureAIRMODE": {
|
||||||
"message": "Airmode always enabled!"
|
"message": "Permanently enable Airmode"
|
||||||
|
},
|
||||||
|
"featureSUPEREXPO_RATES": {
|
||||||
|
"message": "Super Expo Rates"
|
||||||
|
},
|
||||||
|
"featureOSD": {
|
||||||
|
"message": "On Screen Display"
|
||||||
},
|
},
|
||||||
"configurationFeatureEnabled": {
|
"configurationFeatureEnabled": {
|
||||||
"message": "Enabled"
|
"message": "Enabled"
|
||||||
|
@ -1610,12 +1616,6 @@
|
||||||
"pidTuningYaw": {
|
"pidTuningYaw": {
|
||||||
"message": "Yaw (Hz)"
|
"message": "Yaw (Hz)"
|
||||||
},
|
},
|
||||||
"pidTuningSuperExpo": {
|
|
||||||
"message": "Enable SuperExpo Rates"
|
|
||||||
},
|
|
||||||
"pidTuningRatesSuperExpoHelp": {
|
|
||||||
"message": "This setting controls the feature 'SUPEREXPO_RATES'"
|
|
||||||
},
|
|
||||||
"pidTuningVbatPidCompensation": {
|
"pidTuningVbatPidCompensation": {
|
||||||
"message": "Vbat PID Compensation"
|
"message": "Vbat PID Compensation"
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,7 +35,7 @@ var Features = function (config) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.gte(config.flightControllerVersion, "2.8.0")) {
|
if (config.flightControllerVersion !== '' && semver.gte(config.flightControllerVersion, "2.8.0")) {
|
||||||
features.push(
|
features.push(
|
||||||
{bit: 22, group: 'other', name: 'AIRMODE'},
|
{bit: 22, group: 'other', name: 'AIRMODE'},
|
||||||
{bit: 23, group: 'pidTuning', name: 'SUPEREXPO_RATES'},
|
{bit: 23, group: 'pidTuning', name: 'SUPEREXPO_RATES'},
|
||||||
|
@ -44,20 +44,34 @@ var Features = function (config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._features = features;
|
this._features = features;
|
||||||
|
this._featureMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Features.prototype.isFeatureEnabled = function (featureSet, featureName) {
|
Features.prototype.getMask = function () {
|
||||||
|
return this._featureMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
Features.prototype.setMask = function (featureMask) {
|
||||||
|
this._featureMask = featureMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
Features.prototype.isEnabled = function (featureName) {
|
||||||
var features = this._features;
|
var features = this._features;
|
||||||
|
var featureMask = this._featureMask;
|
||||||
|
|
||||||
for (var i = 0; i < features.length; i++) {
|
for (var i = 0; i < features.length; i++) {
|
||||||
if (features[i].name === featureName && bit_check(featureSet, features[i].bit)) {
|
if (features[i].name === featureName && bit_check(featureMask, features[i].bit)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Features.prototype.generateElements = function (featuresElements, radioGroups) {
|
Features.prototype.generateElements = function (featuresElements) {
|
||||||
var features = this._features;
|
var features = this._features;
|
||||||
|
var featureMask = this._featureMask;
|
||||||
|
var radioGroups = [];
|
||||||
|
|
||||||
for (var i = 0; i < features.length; i++) {
|
for (var i = 0; i < features.length; i++) {
|
||||||
var row_e;
|
var row_e;
|
||||||
|
|
||||||
|
@ -83,7 +97,7 @@ Features.prototype.generateElements = function (featuresElements, radioGroups) {
|
||||||
+ feature_tip_html + '</td></tr>');
|
+ feature_tip_html + '</td></tr>');
|
||||||
radioGroups.push(features[i].group);
|
radioGroups.push(features[i].group);
|
||||||
} else {
|
} else {
|
||||||
row_e = $('<tr><td><input class="feature toggle"'
|
row_e = $('<tr><td><input class="feature toggle" id="feature-'
|
||||||
+ i
|
+ i
|
||||||
+ '" name="'
|
+ '" name="'
|
||||||
+ features[i].name
|
+ features[i].name
|
||||||
|
@ -98,7 +112,7 @@ Features.prototype.generateElements = function (featuresElements, radioGroups) {
|
||||||
|
|
||||||
var feature_e = row_e.find('input.feature');
|
var feature_e = row_e.find('input.feature');
|
||||||
|
|
||||||
feature_e.prop('checked', bit_check(BF_CONFIG.features, features[i].bit));
|
feature_e.prop('checked', bit_check(featureMask, features[i].bit));
|
||||||
feature_e.data('bit', features[i].bit);
|
feature_e.data('bit', features[i].bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,17 +122,29 @@ Features.prototype.generateElements = function (featuresElements, radioGroups) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < radioGroups.length; i++) {
|
||||||
|
var group = radioGroups[i];
|
||||||
|
var controlElements = $('input[name="' + group + '"].feature');
|
||||||
|
|
||||||
|
controlElements.each(function() {
|
||||||
|
var bit = parseInt($(this).attr('value'));
|
||||||
|
var state = bit_check(featureMask, bit);
|
||||||
|
|
||||||
|
$(this).prop('checked', state);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Features.prototype.updateData = function (featureSet, featureElement) {
|
Features.prototype.updateData = function (featureElement) {
|
||||||
switch (featureElement.attr('type')) {
|
switch (featureElement.attr('type')) {
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
var bit = featureElement.data('bit');
|
var bit = featureElement.data('bit');
|
||||||
|
|
||||||
if (featureElement.is(':checked')) {
|
if (featureElement.is(':checked')) {
|
||||||
featureSet = bit_set(featureSet, bit);
|
this._featureMask = bit_set(this._featureMask, bit);
|
||||||
} else {
|
} else {
|
||||||
featureSet = bit_clear(featureSet, bit);
|
this._featureMask = bit_clear(this._featureMask, bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -130,15 +156,13 @@ Features.prototype.updateData = function (featureSet, featureElement) {
|
||||||
controlElements.each(function() {
|
controlElements.each(function() {
|
||||||
var bit = $(this).val();
|
var bit = $(this).val();
|
||||||
if (selectedBit === bit) {
|
if (selectedBit === bit) {
|
||||||
featureSet = bit_set(BF_CONFIG.featureSet, bit);
|
this._featureMask = bit_set(BF_CONFIG.this._featureMask, bit);
|
||||||
} else {
|
} else {
|
||||||
featureSet = bit_clear(featureSet, bit);
|
this._featureMask = bit_clear(this._featureMask, bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return featureSet;
|
|
||||||
}
|
}
|
||||||
|
|
2
js/fc.js
2
js/fc.js
|
@ -67,7 +67,7 @@ var FC = {
|
||||||
|
|
||||||
BF_CONFIG = {
|
BF_CONFIG = {
|
||||||
mixerConfiguration: 0,
|
mixerConfiguration: 0,
|
||||||
features: 0,
|
features: new Features(CONFIG),
|
||||||
serialrx_type: 0,
|
serialrx_type: 0,
|
||||||
board_align_roll: 0,
|
board_align_roll: 0,
|
||||||
board_align_pitch: 0,
|
board_align_pitch: 0,
|
||||||
|
|
26
js/msp.js
26
js/msp.js
|
@ -700,7 +700,7 @@ var MSP = {
|
||||||
break;
|
break;
|
||||||
case MSP_codes.MSP_BF_CONFIG:
|
case MSP_codes.MSP_BF_CONFIG:
|
||||||
BF_CONFIG.mixerConfiguration = data.getUint8(0);
|
BF_CONFIG.mixerConfiguration = data.getUint8(0);
|
||||||
BF_CONFIG.features = data.getUint32(1, 1);
|
BF_CONFIG.features.setMask(data.getUint32(1, 1));
|
||||||
BF_CONFIG.serialrx_type = data.getUint8(5);
|
BF_CONFIG.serialrx_type = data.getUint8(5);
|
||||||
BF_CONFIG.board_align_roll = data.getInt16(6, 1); // -180 - 360
|
BF_CONFIG.board_align_roll = data.getInt16(6, 1); // -180 - 360
|
||||||
BF_CONFIG.board_align_pitch = data.getInt16(8, 1); // -180 - 360
|
BF_CONFIG.board_align_pitch = data.getInt16(8, 1); // -180 - 360
|
||||||
|
@ -708,9 +708,7 @@ var MSP = {
|
||||||
BF_CONFIG.currentscale = data.getInt16(12, 1);
|
BF_CONFIG.currentscale = data.getInt16(12, 1);
|
||||||
BF_CONFIG.currentoffset = data.getUint16(14, 1);
|
BF_CONFIG.currentoffset = data.getUint16(14, 1);
|
||||||
|
|
||||||
if (this.features) {
|
updateTabList(BF_CONFIG.features);
|
||||||
updateTabList(BF_CONFIG.features, this.features);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MSP_codes.MSP_SET_BF_CONFIG:
|
case MSP_codes.MSP_SET_BF_CONFIG:
|
||||||
|
@ -730,11 +728,6 @@ var MSP = {
|
||||||
CONFIG.mspProtocolVersion = data.getUint8(offset++);
|
CONFIG.mspProtocolVersion = data.getUint8(offset++);
|
||||||
CONFIG.apiVersion = data.getUint8(offset++) + '.' + data.getUint8(offset++) + '.0';
|
CONFIG.apiVersion = data.getUint8(offset++) + '.' + data.getUint8(offset++) + '.0';
|
||||||
|
|
||||||
if ((!this.features || CONFIG.apiVersion !== apiVersion)
|
|
||||||
&& CONFIG.flightControllerVersion !== '') {
|
|
||||||
this.features = new Features(CONFIG);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP_codes.MSP_FC_VARIANT:
|
case MSP_codes.MSP_FC_VARIANT:
|
||||||
|
@ -752,12 +745,6 @@ var MSP = {
|
||||||
|
|
||||||
CONFIG.flightControllerVersion = data.getUint8(offset++) + '.' + data.getUint8(offset++) + '.' + data.getUint8(offset++);
|
CONFIG.flightControllerVersion = data.getUint8(offset++) + '.' + data.getUint8(offset++) + '.' + data.getUint8(offset++);
|
||||||
|
|
||||||
if ((!this.features
|
|
||||||
|| CONFIG.flightControllerVersion !== flightControllerVersion)
|
|
||||||
&& CONFIG.apiVersion !== '') {
|
|
||||||
this.features = new Features(CONFIG);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSP_codes.MSP_BUILD_INFO:
|
case MSP_codes.MSP_BUILD_INFO:
|
||||||
|
@ -1380,11 +1367,12 @@ MSP.crunch = function (code) {
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case MSP_codes.MSP_SET_BF_CONFIG:
|
case MSP_codes.MSP_SET_BF_CONFIG:
|
||||||
|
var featureMask = BF_CONFIG.features.getMask();
|
||||||
buffer.push(BF_CONFIG.mixerConfiguration);
|
buffer.push(BF_CONFIG.mixerConfiguration);
|
||||||
buffer.push(specificByte(BF_CONFIG.features, 0));
|
buffer.push(specificByte(featureMask, 0));
|
||||||
buffer.push(specificByte(BF_CONFIG.features, 1));
|
buffer.push(specificByte(featureMask, 1));
|
||||||
buffer.push(specificByte(BF_CONFIG.features, 2));
|
buffer.push(specificByte(featureMask, 2));
|
||||||
buffer.push(specificByte(BF_CONFIG.features, 3));
|
buffer.push(specificByte(featureMask, 3));
|
||||||
buffer.push(BF_CONFIG.serialrx_type);
|
buffer.push(BF_CONFIG.serialrx_type);
|
||||||
buffer.push(specificByte(BF_CONFIG.board_align_roll, 0));
|
buffer.push(specificByte(BF_CONFIG.board_align_roll, 0));
|
||||||
buffer.push(specificByte(BF_CONFIG.board_align_roll, 1));
|
buffer.push(specificByte(BF_CONFIG.board_align_roll, 1));
|
||||||
|
|
|
@ -265,6 +265,8 @@ function onConnect() {
|
||||||
$('#tabs ul.mode-connected-cli').show();
|
$('#tabs ul.mode-connected-cli').show();
|
||||||
|
|
||||||
if (CONFIG.flightControllerVersion !== '') {
|
if (CONFIG.flightControllerVersion !== '') {
|
||||||
|
BF_CONFIG.features = new Features(CONFIG);
|
||||||
|
|
||||||
$('#tabs ul.mode-connected').show();
|
$('#tabs ul.mode-connected').show();
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
|
|
12
main.js
12
main.js
|
@ -399,32 +399,32 @@ function updateActivatedTab() {
|
||||||
$('a', activeTab).trigger('click');
|
$('a', activeTab).trigger('click');
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTabList(featureSet, features) {
|
function updateTabList(features) {
|
||||||
if (features.isFeatureEnabled(featureSet, 'GPS')) {
|
if (features.isEnabled('GPS')) {
|
||||||
$('#tabs ul.mode-connected li.tab_gps').show();
|
$('#tabs ul.mode-connected li.tab_gps').show();
|
||||||
} else {
|
} else {
|
||||||
$('#tabs ul.mode-connected li.tab_gps').hide();
|
$('#tabs ul.mode-connected li.tab_gps').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.isFeatureEnabled(featureSet, 'LED_STRIP')) {
|
if (features.isEnabled('LED_STRIP')) {
|
||||||
$('#tabs ul.mode-connected li.tab_led_strip').show();
|
$('#tabs ul.mode-connected li.tab_led_strip').show();
|
||||||
} else {
|
} else {
|
||||||
$('#tabs ul.mode-connected li.tab_led_strip').hide();
|
$('#tabs ul.mode-connected li.tab_led_strip').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.isFeatureEnabled(featureSet, 'BLACKBOX')) {
|
if (features.isEnabled('BLACKBOX')) {
|
||||||
$('#tabs ul.mode-connected li.tab_onboard_logging').show();
|
$('#tabs ul.mode-connected li.tab_onboard_logging').show();
|
||||||
} else {
|
} else {
|
||||||
$('#tabs ul.mode-connected li.tab_onboard_logging').hide();
|
$('#tabs ul.mode-connected li.tab_onboard_logging').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.isFeatureEnabled(featureSet, 'TRANSPONDER')) {
|
if (features.isEnabled('TRANSPONDER')) {
|
||||||
$('#tabs ul.mode-connected li.tab_transponder').show();
|
$('#tabs ul.mode-connected li.tab_transponder').show();
|
||||||
} else {
|
} else {
|
||||||
$('#tabs ul.mode-connected li.tab_transponder').hide();
|
$('#tabs ul.mode-connected li.tab_transponder').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (features.isFeatureEnabled(featureSet, 'OSD')) {
|
if (features.isEnabled('OSD')) {
|
||||||
$('#tabs ul.mode-connected li.tab_osd').show();
|
$('#tabs ul.mode-connected li.tab_osd').show();
|
||||||
} else {
|
} else {
|
||||||
$('#tabs ul.mode-connected li.tab_osd').hide();
|
$('#tabs ul.mode-connected li.tab_osd').hide();
|
||||||
|
|
|
@ -129,30 +129,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
// select current mixer configuration
|
// select current mixer configuration
|
||||||
mixer_list_e.val(BF_CONFIG.mixerConfiguration).change();
|
mixer_list_e.val(BF_CONFIG.mixerConfiguration).change();
|
||||||
|
|
||||||
var features = new Features(CONFIG);
|
|
||||||
|
|
||||||
var radioGroups = [];
|
var radioGroups = [];
|
||||||
var features_e = $('.features');
|
var features_e = $('.features');
|
||||||
|
|
||||||
features.generateElements(features_e, radioGroups);
|
BF_CONFIG.features.generateElements(features_e);
|
||||||
|
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
for (var i = 0; i < radioGroups.length; i++) {
|
|
||||||
var group = radioGroups[i];
|
|
||||||
var controls_e = $('input[name="' + group + '"].feature');
|
|
||||||
|
|
||||||
|
|
||||||
controls_e.each(function() {
|
|
||||||
var bit = parseInt($(this).attr('value'));
|
|
||||||
var state = bit_check(BF_CONFIG.features, bit);
|
|
||||||
|
|
||||||
$(this).prop('checked', state);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var alignments = [
|
var alignments = [
|
||||||
'CW 0°',
|
'CW 0°',
|
||||||
'CW 90°',
|
'CW 90°',
|
||||||
|
@ -413,7 +397,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input[name="autodisarmdelay"]').val(ARMING_CONFIG.auto_disarm_delay);
|
$('input[name="autodisarmdelay"]').val(ARMING_CONFIG.auto_disarm_delay);
|
||||||
$('input[name="disarmkillswitch"]').prop('checked', ARMING_CONFIG.disarm_kill_switch);
|
$('input[name="disarmkillswitch"]').prop('checked', ARMING_CONFIG.disarm_kill_switch);
|
||||||
$('div.disarm').show();
|
$('div.disarm').show();
|
||||||
if (features.isFeatureEnabled(BF_CONFIG.features, 'MOTOR_STOP')) {
|
if (BF_CONFIG.features.isEnabled('MOTOR_STOP')) {
|
||||||
$('div.disarmdelay').show();
|
$('div.disarmdelay').show();
|
||||||
} else {
|
} else {
|
||||||
$('div.disarmdelay').hide();
|
$('div.disarmdelay').hide();
|
||||||
|
@ -457,11 +441,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input.feature', features_e).change(function () {
|
$('input.feature', features_e).change(function () {
|
||||||
var element = $(this);
|
var element = $(this);
|
||||||
|
|
||||||
BF_CONFIG.features = features.updateData(BF_CONFIG.features, element);
|
BF_CONFIG.features.updateData(element);
|
||||||
updateTabList(BF_CONFIG.features, features);
|
updateTabList(BF_CONFIG.features);
|
||||||
|
|
||||||
if (element.attr('name') === 'MOTOR_STOP') {
|
if (element.attr('name') === 'MOTOR_STOP') {
|
||||||
if (features.isFeatureEnabled(BF_CONFIG.features, 'MOTOR_STOP')) {
|
if (BF_CONFIG.features.isEnabled('MOTOR_STOP')) {
|
||||||
$('div.disarmdelay').show();
|
$('div.disarmdelay').show();
|
||||||
} else {
|
} else {
|
||||||
$('div.disarmdelay').hide();
|
$('div.disarmdelay').hide();
|
||||||
|
|
|
@ -176,7 +176,7 @@ TABS.motors.initialize = function (callback) {
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
self.feature3DEnabled = bit_check(BF_CONFIG.features, 12);
|
self.feature3DEnabled = BF_CONFIG.features.isEnabled('3D');
|
||||||
|
|
||||||
if (self.feature3DEnabled && !self.feature3DSupported) {
|
if (self.feature3DEnabled && !self.feature3DSupported) {
|
||||||
self.allowTestMode = false;
|
self.allowTestMode = false;
|
||||||
|
|
|
@ -94,7 +94,7 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
* The best we can do on those targets is check the BLACKBOX feature bit to identify support for Blackbox instead.
|
* The best we can do on those targets is check the BLACKBOX feature bit to identify support for Blackbox instead.
|
||||||
*/
|
*/
|
||||||
if (BLACKBOX.supported || DATAFLASH.supported
|
if (BLACKBOX.supported || DATAFLASH.supported
|
||||||
|| semver.gte(CONFIG.flightControllerVersion, "1.5.0") && semver.lte(CONFIG.flightControllerVersion, "1.10.0") && bit_check(BF_CONFIG.features, 19)) {
|
|| semver.gte(CONFIG.flightControllerVersion, "1.5.0") && semver.lte(CONFIG.flightControllerVersion, "1.10.0") && BF_CONFIG.features.isEnabled('BLACKBOX')) {
|
||||||
blackboxSupport = 'yes';
|
blackboxSupport = 'yes';
|
||||||
} else if (semver.gte(CONFIG.flightControllerVersion, "1.5.0") && semver.lte(CONFIG.flightControllerVersion, "1.10.0")) {
|
} else if (semver.gte(CONFIG.flightControllerVersion, "1.5.0") && semver.lte(CONFIG.flightControllerVersion, "1.10.0")) {
|
||||||
blackboxSupport = 'maybe';
|
blackboxSupport = 'maybe';
|
||||||
|
|
|
@ -41,6 +41,27 @@
|
||||||
<form name="pid-tuning" id="pid-tuning">
|
<form name="pid-tuning" id="pid-tuning">
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
<div class="cf_column twothird">
|
<div class="cf_column twothird">
|
||||||
|
<div class="gui_box grey">
|
||||||
|
<table class="new_rates">
|
||||||
|
<tbody class="features pidTuning">
|
||||||
|
<!-- table generated here -->
|
||||||
|
</tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="vbatpidcompensation" class="toggle" />
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<label for="vbatpidcompensation">
|
||||||
|
<span i18n="pidTuningVbatPidCompensation"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" i18n_title="pidTuningVbatPidCompensationHelp"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<div class="gui_box grey">
|
<div class="gui_box grey">
|
||||||
<table class="pid_titlebar">
|
<table class="pid_titlebar">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -62,30 +83,6 @@
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="new_rates">
|
|
||||||
<td colspan=3>
|
|
||||||
<div class="checkbox super_expo_checkbox" style="margin-top: 10px;">
|
|
||||||
<div style="float: left; margin-right: 5px; margin-left: 3px; margin-bottom: 5px;">
|
|
||||||
<input type="checkbox" name="show_superexpo_rates" class="toggle" />
|
|
||||||
</div>
|
|
||||||
<label for="showSuperExpoRates">
|
|
||||||
<span i18n="pidTuningSuperExpo"></span>
|
|
||||||
</label>
|
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningRatesSuperExpoHelp"></div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td colspan=4>
|
|
||||||
<div class="checkbox vbat_compensation_checkbox" style="margin-top: 10px;">
|
|
||||||
<div style="float: left; margin-right: 5px; margin-left: 3px; margin-bottom: 5px;">
|
|
||||||
<input type="checkbox" name="vbatpidcompensation" class="toggle" />
|
|
||||||
</div>
|
|
||||||
<label for="vbatpidcompensation">
|
|
||||||
<span i18n="pidTuningVbatPidCompensation"></span>
|
|
||||||
</label>
|
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningVbatPidCompensationHelp"></div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="ROLL">
|
<tr class="ROLL">
|
||||||
<!-- 0 -->
|
<!-- 0 -->
|
||||||
<td bgcolor="#FF8080"></td>
|
<td bgcolor="#FF8080"></td>
|
||||||
|
|
|
@ -4,8 +4,6 @@ TABS.pid_tuning = {
|
||||||
controllerChanged: false
|
controllerChanged: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var SUPEREXPO_FEATURE_BIT = 23;
|
|
||||||
|
|
||||||
TABS.pid_tuning.initialize = function (callback) {
|
TABS.pid_tuning.initialize = function (callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (GUI.active_tab != 'pid_tuning') {
|
if (GUI.active_tab != 'pid_tuning') {
|
||||||
|
@ -42,13 +40,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function pid_and_rc_to_form() {
|
function pid_and_rc_to_form() {
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
//This will need to be reworked to remove BF_CONFIG reference eventually
|
|
||||||
$('.pid_tuning input[name="show_superexpo_rates"]').prop(
|
|
||||||
'checked', bit_check(BF_CONFIG.features, SUPEREXPO_FEATURE_BIT));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
|
|
||||||
$('input[name="vbatpidcompensation"]').prop('checked', ADVANCED_TUNING.vbatPidCompensation !== 0);
|
$('input[name="vbatpidcompensation"]').prop('checked', ADVANCED_TUNING.vbatPidCompensation !== 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,12 +212,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
|
|
||||||
function form_to_pid_and_rc() {
|
function form_to_pid_and_rc() {
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
|
||||||
//This will need to be reworked to remove BF_CONFIG reference eventually
|
BF_CONFIG.features.updateData($('.pid_tuning input[name="SUPEREXPO_RATES"]'));
|
||||||
if ($('.pid_tuning input[name="show_superexpo_rates"]').is(':checked')) {
|
|
||||||
BF_CONFIG.features = bit_set(BF_CONFIG.features, SUPEREXPO_FEATURE_BIT);
|
|
||||||
} else {
|
|
||||||
BF_CONFIG.features = bit_clear(BF_CONFIG.features, SUPEREXPO_FEATURE_BIT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
|
@ -335,7 +322,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('#pid_mag').show();
|
$('#pid_mag').show();
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
}
|
}
|
||||||
if (bit_check(BF_CONFIG.features, 7)) { //This will need to be reworked to remove BF_CONFIG reference eventually
|
if (BF_CONFIG.features.isEnabled('GPS')) {
|
||||||
$('#pid_gps').show();
|
$('#pid_gps').show();
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
}
|
}
|
||||||
|
@ -410,6 +397,12 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_html() {
|
function process_html() {
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "2.8.0")) {
|
||||||
|
var features_e = $('.features');
|
||||||
|
|
||||||
|
BF_CONFIG.features.generateElements(features_e);
|
||||||
|
}
|
||||||
|
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
localize();
|
localize();
|
||||||
|
|
||||||
|
@ -422,7 +415,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
rc_rate_yaw: SPECIAL_PARAMETERS.RC_RATE_YAW,
|
rc_rate_yaw: SPECIAL_PARAMETERS.RC_RATE_YAW,
|
||||||
rc_expo: RC_tuning.RC_EXPO,
|
rc_expo: RC_tuning.RC_EXPO,
|
||||||
rc_yaw_expo: RC_tuning.RC_YAW_EXPO,
|
rc_yaw_expo: RC_tuning.RC_YAW_EXPO,
|
||||||
superexpo: bit_check(BF_CONFIG.features, SUPEREXPO_FEATURE_BIT)
|
superexpo: BF_CONFIG.features.isEnabled('SUPEREXPO_RATES')
|
||||||
};
|
};
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier !== "BTFL" || semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (CONFIG.flightControllerIdentifier !== "BTFL" || semver.lt(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
|
@ -559,13 +552,13 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
self.currentRates.pitch_rate = targetValue;
|
self.currentRates.pitch_rate = targetValue;
|
||||||
|
|
||||||
updateNeeded = true;
|
updateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetElement.attr('name') === 'show_superexpo_rates') {
|
if (targetElement.attr('name') === 'SUPEREXPO_RATES') {
|
||||||
self.currentRates.superexpo = targetElement.is(':checked');
|
self.currentRates.superexpo = targetElement.is(':checked');
|
||||||
|
|
||||||
updateNeeded = true;
|
updateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateNeeded) {
|
if (updateNeeded) {
|
||||||
var curveHeight = rcCurveElement.height;
|
var curveHeight = rcCurveElement.height;
|
||||||
|
@ -598,7 +591,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
// curves
|
// curves
|
||||||
$('.pid_tuning').on('input change', updateRates);
|
$('.pid_tuning').on('input change', updateRates);
|
||||||
$('.super_expo_checkbox').on('input change', updateRates).trigger('input');
|
$('input.feature').on('input change', updateRates).trigger('input');
|
||||||
|
|
||||||
$('.throttle input').on('input change', function () {
|
$('.throttle input').on('input change', function () {
|
||||||
setTimeout(function () { // let global validation trigger and adjust the values first
|
setTimeout(function () { // let global validation trigger and adjust the values first
|
||||||
|
|
|
@ -273,7 +273,7 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only show the MSP control sticks if the MSP Rx feature is enabled
|
// Only show the MSP control sticks if the MSP Rx feature is enabled
|
||||||
$(".sticks_btn").toggle(bit_check(BF_CONFIG.features, 14 /* RX_MSP */));
|
$(".sticks_btn").toggle(BF_CONFIG.features.isEnabled('RX_MSP'));
|
||||||
|
|
||||||
$('select[name="rx_refresh_rate"]').change(function () {
|
$('select[name="rx_refresh_rate"]').change(function () {
|
||||||
var plot_update_rate = parseInt($(this).val(), 10);
|
var plot_update_rate = parseInt($(this).val(), 10);
|
||||||
|
@ -405,7 +405,7 @@ TABS.receiver.initModelPreview = function () {
|
||||||
|
|
||||||
this.useSuperExpo = false;
|
this.useSuperExpo = false;
|
||||||
if (CONFIG.flightControllerIdentifier === 'BTFL' && semver.gte(CONFIG.flightControllerVersion, '2.8.0')) {
|
if (CONFIG.flightControllerIdentifier === 'BTFL' && semver.gte(CONFIG.flightControllerVersion, '2.8.0')) {
|
||||||
this.useSuperExpo = bit_check(BF_CONFIG.features, SUPEREXPO_FEATURE_BIT);
|
this.useSuperExpo = BF_CONFIG.features.isEnabled('SUPEREXPO_RATES');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.rateCurve = new RateCurve(CONFIG.flightControllerIdentifier !== 'BTFL' || semver.lt(CONFIG.flightControllerVersion, '2.8.0'));
|
this.rateCurve = new RateCurve(CONFIG.flightControllerIdentifier !== 'BTFL' || semver.lt(CONFIG.flightControllerVersion, '2.8.0'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue