From 47bf242ba708c01aaa791c7f5e267d81000f8677 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 18 Sep 2022 10:47:46 +0100 Subject: [PATCH] Updated for PR 8401 Modes tab: - Added USER 3 & USER 4 to modes ordering Programming Tab: - Added USER 3 & USER 4 to Flight Modes operand - Added Course Hold to the Flight Modes operand. It was in firmware, but missing from Configurator - Changed select operand values to order alphabetically. Looks much nicer than the random order. --- js/fc.js | 5 ++++- js/gui.js | 22 +++++++++++++++++++--- tabs/auxiliary.js | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/js/fc.js b/js/fc.js index 7500f5410..096ccc692 100644 --- a/js/fc.js +++ b/js/fc.js @@ -1240,7 +1240,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: { diff --git a/js/gui.js b/js/gui.js index 301abf71a..6849c9727 100644 --- a/js/gui.js +++ b/js/gui.js @@ -279,11 +279,27 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata $t.append(''); } } else if (operandMetadata.type == "dictionary") { - for (let k in operandMetadata.values) { - if (operandMetadata.values.hasOwnProperty(k)) { - $t.append(''); + 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(''); + }); } $t.val(value); diff --git a/tabs/auxiliary.js b/tabs/auxiliary.js index f33f20d23..7e497d00b 100644 --- a/tabs/auxiliary.js +++ b/tabs/auxiliary.js @@ -38,7 +38,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", "BLACKBOX", "FAILSAFE", "KILLSWITCH", "TELEMETRY", "MSP RC OVERRIDE", "USER1", "USER2"]; + modeSections["Misc Modes"] = ["BEEPER", "LEDS OFF", "LIGHTS", "HOME RESET", "WP PLANNER", "BLACKBOX", "FAILSAFE", "KILLSWITCH", "TELEMETRY", "MSP RC OVERRIDE", "USER1", "USER2", "USER3", "USER4"]; function sort_modes_for_display() { // Sort the modes