Skip to content

Commit

Permalink
Fix features
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Mar 18, 2023
1 parent 23af01b commit f4a222e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
32 changes: 16 additions & 16 deletions src/js/Features.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,36 @@ Features.prototype.generateElements = function (featuresElements) {

const listElements = [];

for (let i = 0; i < self._features.length; i++) {
for (const feature of self._features) {
let feature_tip_html = '';
const rawFeatureName = self._features[i].name;
const featureBit = self._features[i].bit;
const featureName = feature.name;
const featureBit = feature.bit;

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

const newElements = [];

if (self._features[i].mode === 'select') {
if (feature.mode === 'select') {
if (listElements.length === 0) {
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);
listElements.push(newElement);
} else {
let featureName = '';
if (!self._features[i].hideName) {
featureName = `<td><div>${rawFeatureName}</div></td>`;
let newFeatureName = '';
if (!feature.hideName) {
newFeatureName = `<td><div>${featureName}</div></td>`;
}

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

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

featuresElements.each(function () {
if ($(this).hasClass(self._features[i].group)) {
if ($(this).hasClass(feature.group)) {
$(this).append(newElements);
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/js/tabs/motors.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ motors.initialize = async function (callback) {
mixer: FC.MIXER_CONFIG.mixer,
reverseMotorSwitch: FC.MIXER_CONFIG.reverseMotorDir,
escprotocol: FC.PID_ADVANCED_CONFIG.fast_pwm_protocol + 1,
feature3: FC.FEATURE_CONFIG.features.isEnabled('MOTOR_STOP'),
feature9: FC.FEATURE_CONFIG.features.isEnabled('3D'),
feature20: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
feature4: FC.FEATURE_CONFIG.features.isEnabled('MOTOR_STOP'),
feature12: FC.FEATURE_CONFIG.features.isEnabled('3D'),
feature27: FC.FEATURE_CONFIG.features.isEnabled('ESC_SENSOR'),
dshotBidir: FC.MOTOR_CONFIG.use_dshot_telemetry,
motorPoles: FC.MOTOR_CONFIG.motor_poles,
digitalIdlePercent: FC.PID_ADVANCED_CONFIG.digitalIdlePercent,
Expand Down

0 comments on commit f4a222e

Please sign in to comment.