Skip to content

Commit

Permalink
Merge pull request #1621 from iNavFlight/MrD_Changes-for-PR-8401
Browse files Browse the repository at this point in the history
Updates for PR #8401
  • Loading branch information
MrD-RC committed Nov 15, 2022
2 parents 8a54665 + 91da0f6 commit e7ed9ce
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
5 changes: 4 additions & 1 deletion js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,10 @@ var FC = {
7: "Horizon",
8: "Air",
9: "USER 1",
10: "USER 2"
10: "USER 2",
11: "Course Hold",
12: "USER 3",
13: "USER 4",
}
},
4: {
Expand Down
22 changes: 19 additions & 3 deletions js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,27 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata
$t.append('<option value="' + i + '">' + i + '</option>');
}
} else if (operandMetadata.type == "dictionary") {
for (let k in operandMetadata.values) {
if (operandMetadata.values.hasOwnProperty(k)) {
$t.append('<option value="' + k + '">' + operandMetadata.values[k] + '</option>');
let operandValues = [];

for (let j in operandMetadata.values) {
if (operandMetadata.values.hasOwnProperty(j)) {
operandValues[parseInt(j,10)] = {
id: parseInt(j, 10),
name: operandMetadata.values[j],
};
}
}

operandValues.sort((a, b) => {
let ovAN = a.name.toLowerCase(),
ovBN = b.name.toLowerCase();

return (ovAN < ovBN) ? -1 : 1;
});

operandValues.forEach( val => {
$t.append('<option value="' + val.id + '">' + val.name + '</option>');
});
}

$t.val(value);
Expand Down
2 changes: 1 addition & 1 deletion tabs/auxiliary.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TABS.auxiliary.initialize = function (callback) {
modeSections["Multi-rotor"] = ["FPV ANGLE MIX", "TURTLE", "MC BRAKING", "HEADFREE", "HEADADJ"];
modeSections["OSD Modes"] = ["OSD OFF", "OSD ALT 1", "OSD ALT 2", "OSD ALT 3"];
modeSections["FPV Camera Modes"] = ["CAMSTAB", "CAMERA CONTROL 1", "CAMERA CONTROL 2", "CAMERA CONTROL 3"];
modeSections["Misc Modes"] = ["BEEPER", "LEDS OFF", "LIGHTS", "HOME RESET", "WP PLANNER", "MISSION CHANGE", "BLACKBOX", "FAILSAFE", "KILLSWITCH", "TELEMETRY", "MSP RC OVERRIDE", "USER1", "USER2"];
modeSections["Misc Modes"] = ["BEEPER", "LEDS OFF", "LIGHTS", "HOME RESET", "WP PLANNER", "MISSION CHANGE", "BLACKBOX", "FAILSAFE", "KILLSWITCH", "TELEMETRY", "MSP RC OVERRIDE", "USER1", "USER2", "USER3", "USER4"];

function sort_modes_for_display() {
// Sort the modes
Expand Down

0 comments on commit e7ed9ce

Please sign in to comment.