Skip to content

Commit

Permalink
Generate AUX_CONFIGS from FLIGHT_MODES
Browse files Browse the repository at this point in the history
  • Loading branch information
DzikuVx committed May 11, 2024
1 parent be186d9 commit 72eebe7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 44 deletions.
54 changes: 12 additions & 42 deletions js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const FwApproachCollection = require('./fwApproachCollection')
const { PLATFORM } = require('./model')
const VTX = require('./vtx');
const BitHelper = require('./bitHelper');
const { FLIGHT_MODES } = require('./flightModes');


var FC = {
Expand All @@ -28,7 +29,7 @@ var FC = {
RC_MAP: null,
RC: null,
RC_tuning: null,
AUX_CONFIG: null,
AUX_CONFIG: [],
AUX_CONFIG_IDS: null,
MODE_RANGES: null,
ADJUSTMENT_RANGES: null,
Expand Down Expand Up @@ -199,47 +200,16 @@ var FC = {
manual_yaw_rate: 0,
};

this.AUX_CONFIG = [
"ARM",
"PREARM",
"MULTI FUNCTION",
"ANGLE",
"HORIZON",
"TURN ASSIST",
"HEADING HOLD",
"CAMSTAB",
"HEADFREE",
"HEADADJ",
"FPV ANGLE MIX",
"NAV POSHOLD",
"NAV RTH",
"NAV WP",
"NAV CRUISE",
"NAV COURSE HOLD",
"HOME RESET",
"GCS NAV",
"WP PLANNER",
"MISSION CHANGE",
"MC BRAKING",
"NAV ALTHOLD",
"BEEPER",
"BEEPER MUTE",
"OSD OFF",
"BLACKBOX",
"FAILSAFE",
"CAMERA CONTROL 1",
"CAMERA CONTROL 2",
"CAMERA CONTROL 3",
"USER1",
"USER2",
"USER3",
"USER4",
"OSD ALT 1",
"OSD ALT 2",
"OSD ALT 3",
"MIXER PROFILE 2",
"MIXER TRANSITION"
];
this.generateAuxConfig = function () {
console.log('Generating AUX_CONFIG');

for ( let i = 0; i < FLIGHT_MODES.length; i++ ) {
if (this.AUX_CONFIG_IDS.indexOf(FLIGHT_MODES[i].permanentId) > -1) {
this.AUX_CONFIG.push(FLIGHT_MODES[i].boxName);
}
}
};

this.AUX_CONFIG_IDS = [
0,
51,
Expand Down
2 changes: 1 addition & 1 deletion js/flightModes.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,4 @@ var FLIGHT_MODES = [
}
];

module.exports = FLIGHT_MODES;
module.exports = {FLIGHT_MODES};
9 changes: 8 additions & 1 deletion tabs/auxiliary.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ TABS.auxiliary.initialize = function (callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'auxiliary';

MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_rc_data);
MSP.send_message(MSPCodes.MSP_MODE_RANGES, false, false, get_box_ids);

function get_box_ids() {
MSP.send_message(MSPCodes.MSP_BOXIDS, false, false, function () {
FC.generateAuxConfig();
get_rc_data();
});
}

function get_rc_data() {
if (FC.SERIAL_CONFIG.ports.length == 0) {
Expand Down

0 comments on commit 72eebe7

Please sign in to comment.