Skip to content

Commit a3d7537

Browse files
committed
Fix features
1 parent 23af01b commit a3d7537

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/js/Features.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -109,36 +109,36 @@ Features.prototype.generateElements = function (featuresElements) {
109109

110110
const listElements = [];
111111

112-
for (let i = 0; i < self._features.length; i++) {
112+
for (const feature of self._features) {
113113
let feature_tip_html = '';
114-
const rawFeatureName = self._features[i].name;
115-
const featureBit = self._features[i].bit;
114+
const rawFeatureName = feature.name;
115+
const featureBit = feature.bit;
116116

117-
if (self._features[i].haveTip) {
117+
if (feature.haveTip) {
118118
feature_tip_html = `<div class="helpicon cf_tip" i18n_title="feature${rawFeatureName}Tip"></div>`;
119119
}
120120

121121
const newElements = [];
122122

123-
if (self._features[i].mode === 'select') {
123+
if (feature.mode === 'select') {
124124
if (listElements.length === 0) {
125125
newElements.push($('<option class="feature" value="-1" i18n="featureNone" />'));
126126
}
127-
const newElement = $(`<option class="feature" id="feature${featureBit - 1}" name="${rawFeatureName}" value="${featureBit}" i18n="feature${rawFeatureName}" />`);
127+
const newElement = $(`<option class="feature" id="feature${featureBit}" name="${rawFeatureName}" value="${featureBit}" i18n="feature${rawFeatureName}" />`);
128128

129129
newElements.push(newElement);
130130
listElements.push(newElement);
131131
} else {
132132
let featureName = '';
133-
if (!self._features[i].hideName) {
133+
if (!feature.hideName) {
134134
featureName = `<td><div>${rawFeatureName}</div></td>`;
135135
}
136136

137-
let element = `<tr><td><input class="feature toggle" id="feature${featureBit - 1}"`;
138-
element += `name="${self._features[i].name}" title="${self._features[i].name}"`;
137+
let element = `<tr><td><input class="feature toggle" id="feature${featureBit}"`;
138+
element += `name="${feature.name}" title="${rawFeatureName}"`;
139139
element += `type="checkbox"/></td><td><div>${featureName}</div>`;
140-
element += `<span class="xs" i18n="feature${self._features[i].name}"></span></td>`;
141-
element += `<td><span class="sm-min" i18n="feature${self._features[i].name}"></span>`;
140+
element += `<span class="xs" i18n="feature${rawFeatureName}"></span></td>`;
141+
element += `<td><span class="sm-min" i18n="feature${rawFeatureName}"></span>`;
142142
element += `${feature_tip_html}</td></tr>`;
143143

144144
const newElement = $(element);
@@ -152,7 +152,7 @@ Features.prototype.generateElements = function (featuresElements) {
152152
}
153153

154154
featuresElements.each(function () {
155-
if ($(this).hasClass(self._features[i].group)) {
155+
if ($(this).hasClass(feature.group)) {
156156
$(this).append(newElements);
157157
}
158158
});

src/js/tabs/motors.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ motors.initialize = async function (callback) {
269269
mixer: FC.MIXER_CONFIG.mixer,
270270
reverseMotorSwitch: FC.MIXER_CONFIG.reverseMotorDir,
271271
escprotocol: FC.PID_ADVANCED_CONFIG.fast_pwm_protocol + 1,
272-
feature3: FC.FEATURE_CONFIG.features.isEnabled('MOTOR_STOP'),
273-
feature9: FC.FEATURE_CONFIG.features.isEnabled('3D'),
274-
feature20: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
272+
feature4: FC.FEATURE_CONFIG.features.isEnabled('MOTOR_STOP'),
273+
feature12: FC.FEATURE_CONFIG.features.isEnabled('3D'),
274+
feature27: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
275275
dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry,
276276
motorPoles: FC.MOTOR_CONFIG.motor_poles,
277277
digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent,

0 commit comments

Comments
 (0)