FIX: feature ESC_SENSOR (#3382)

Fix features
master
Mark Haslinghuis 2023-03-25 00:24:52 +01:00 committed by GitHub
parent f56ea60d2d
commit e7b057ef98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 19 deletions

View File

@ -109,36 +109,36 @@ Features.prototype.generateElements = function (featuresElements) {
const listElements = []; const listElements = [];
for (let i = 0; i < self._features.length; i++) { for (const feature of self._features) {
let feature_tip_html = ''; let feature_tip_html = '';
const rawFeatureName = self._features[i].name; const featureName = feature.name;
const featureBit = self._features[i].bit; const featureBit = feature.bit;
if (self._features[i].haveTip) { if (feature.haveTip) {
feature_tip_html = `<div class="helpicon cf_tip" i18n_title="feature${rawFeatureName}Tip"></div>`; feature_tip_html = `<div class="helpicon cf_tip" i18n_title="feature${featureName}Tip"></div>`;
} }
const newElements = []; const newElements = [];
if (self._features[i].mode === 'select') { if (feature.mode === 'select') {
if (listElements.length === 0) { if (listElements.length === 0) {
newElements.push($('<option class="feature" value="-1" i18n="featureNone" />')); newElements.push($('<option class="feature" value="-1" i18n="featureNone" />'));
} }
const newElement = $(`<option class="feature" id="feature${featureBit - 1}" name="${rawFeatureName}" value="${featureBit}" i18n="feature${rawFeatureName}" />`); const newElement = $(`<option class="feature" id="feature${featureBit}" name="${featureName}" value="${featureBit}" i18n="feature${featureName}" />`);
newElements.push(newElement); newElements.push(newElement);
listElements.push(newElement); listElements.push(newElement);
} else { } else {
let featureName = ''; let newFeatureName = '';
if (!self._features[i].hideName) { if (!feature.hideName) {
featureName = `<td><div>${rawFeatureName}</div></td>`; newFeatureName = `<td><div>${featureName}</div></td>`;
} }
let element = `<tr><td><input class="feature toggle" id="feature${featureBit - 1}"`; let element = `<tr><td><input class="feature toggle" id="feature${featureBit}"`;
element += `name="${self._features[i].name}" title="${self._features[i].name}"`; element += `name="${featureName}" title="${featureName}"`;
element += `type="checkbox"/></td><td><div>${featureName}</div>`; element += `type="checkbox"/></td><td><div>${newFeatureName}</div>`;
element += `<span class="xs" i18n="feature${self._features[i].name}"></span></td>`; element += `<span class="xs" i18n="feature${featureName}"></span></td>`;
element += `<td><span class="sm-min" i18n="feature${self._features[i].name}"></span>`; element += `<td><span class="sm-min" i18n="feature${featureName}"></span>`;
element += `${feature_tip_html}</td></tr>`; element += `${feature_tip_html}</td></tr>`;
const newElement = $(element); const newElement = $(element);
@ -152,7 +152,7 @@ Features.prototype.generateElements = function (featuresElements) {
} }
featuresElements.each(function () { featuresElements.each(function () {
if ($(this).hasClass(self._features[i].group)) { if ($(this).hasClass(feature.group)) {
$(this).append(newElements); $(this).append(newElements);
} }
}); });

View File

@ -269,9 +269,9 @@ motors.initialize = async function (callback) {
mixer: FC.MIXER_CONFIG.mixer, mixer: FC.MIXER_CONFIG.mixer,
reverseMotorSwitch: FC.MIXER_CONFIG.reverseMotorDir, reverseMotorSwitch: FC.MIXER_CONFIG.reverseMotorDir,
escprotocol: FC.PID_ADVANCED_CONFIG.fast_pwm_protocol + 1, escprotocol: FC.PID_ADVANCED_CONFIG.fast_pwm_protocol + 1,
feature3: FC.FEATURE_CONFIG.features.isEnabled('MOTOR_STOP'), feature4: FC.FEATURE_CONFIG.features.isEnabled('MOTOR_STOP'),
feature9: FC.FEATURE_CONFIG.features.isEnabled('3D'), feature12: FC.FEATURE_CONFIG.features.isEnabled('3D'),
feature20: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'), feature27: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry, dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry,
motorPoles: FC.MOTOR_CONFIG.motor_poles, motorPoles: FC.MOTOR_CONFIG.motor_poles,
digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent, digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent,