mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 01:35:23 +03:00
Update auxiliary.js
Added checks for modes not in the configuratorBoxOrder array.
This commit is contained in:
parent
7a0487e816
commit
4b14deeebc
1 changed files with 30 additions and 10 deletions
|
@ -33,7 +33,7 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort_modes_for_display() {
|
function sort_modes_for_display() {
|
||||||
// This array defines the order that the modes are displayed in the configurator modes page.
|
// This array defines the order that the modes are displayed in the configurator modes page
|
||||||
configuratorBoxOrder = [
|
configuratorBoxOrder = [
|
||||||
"ARM", // Arming
|
"ARM", // Arming
|
||||||
"ANGLE", "HORIZON", "MANUAL", // Flight modes
|
"ANGLE", "HORIZON", "MANUAL", // Flight modes
|
||||||
|
@ -49,26 +49,46 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Sort the modes
|
// Sort the modes
|
||||||
tmpAUX_CONFIG =[];
|
var tmpAUX_CONFIG = [];
|
||||||
tmpAUX_CONFIG_IDS = [];
|
var tmpAUX_CONFIG_IDS =[];
|
||||||
for (i=0;i<AUX_CONFIG.length;i++) {
|
var found = false;
|
||||||
tmpAUX_CONFIG[i] = AUX_CONFIG[i]; // MSP_BOXNAMES
|
var sortedID = 0;
|
||||||
tmpAUX_CONFIG_IDS[i] = AUX_CONFIG_IDS[i];
|
|
||||||
|
for (i=0; i<AUX_CONFIG.length; i++) {
|
||||||
|
tmpAUX_CONFIG[i] = AUX_CONFIG[i];
|
||||||
|
tmpAUX_CONFIG_IDS[i] = AUX_CONFIG_IDS[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
sortedID = 0;
|
AUX_CONFIG = [];
|
||||||
|
AUX_CONFIG_IDS = [];
|
||||||
|
|
||||||
for (i=0; i<configuratorBoxOrder.length; i++) {
|
for (i=0; i<configuratorBoxOrder.length; i++) {
|
||||||
for(j=0; j<tmpAUX_CONFIG.length; j++) {
|
for(j=0; j<tmpAUX_CONFIG.length; j++) {
|
||||||
if (configuratorBoxOrder[i] === tmpAUX_CONFIG[j]) {
|
if (configuratorBoxOrder[i] === tmpAUX_CONFIG[j]) {
|
||||||
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[j];
|
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[j];
|
||||||
AUX_CONFIG_IDS[sortedID] = tmpAUX_CONFIG_IDS[j];
|
AUX_CONFIG_IDS[sortedID++] = tmpAUX_CONFIG_IDS[j];
|
||||||
sortedID++;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There are modes that are missing from the configuratorBoxOrder array. Add them to the end until they are ordered correctly.
|
||||||
|
if (tmpAUX_CONFIG.length > AUX_CONFIG.length) {
|
||||||
|
for (i=0; i<tmpAUX_CONFIG.length; i++) {
|
||||||
|
found = false;
|
||||||
|
for (j=0; j<AUX_CONFIG.length; j++) {
|
||||||
|
if (tmpAUX_CONFIG[i] === AUX_CONFIG[j]) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[i];
|
||||||
|
AUX_CONFIG_IDS[sortedID++] = tmpAUX_CONFIG_IDS[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue