diff --git a/js/fc.js b/js/fc.js index adecbef12..9f56d5a31 100644 --- a/js/fc.js +++ b/js/fc.js @@ -950,11 +950,13 @@ var FC = { return this.getServoMixInputNames()[input]; }, getModeId: function (name) { - for (var i = 0; i < this.AUX_CONFIG.length; i++) { - if (this.AUX_CONFIG[i] == name) - return i; + + let mode = FLIGHT_MODES.find( mode => mode.boxName === name ); + if (mode) { + return mode.permanentId; + } else { + return -1; } - return -1; }, isModeBitSet: function (i) { return BitHelper.bit_check(this.CONFIG.mode[Math.trunc(i / 32)], i % 32); diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js index 66d3fd6e8..bcc49eaff 100644 --- a/js/msp/MSPCodes.js +++ b/js/msp/MSPCodes.js @@ -84,7 +84,6 @@ var MSPCodes = { MSP_PID: 112, MSP_ACTIVEBOXES: 113, MSP_MOTOR_PINS: 115, - MSP_BOXNAMES: 116, MSP_PIDNAMES: 117, MSP_WP: 118, MSP_BOXIDS: 119, diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index 4e45369b2..3e0c66067 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -386,21 +386,6 @@ var mspHelper = (function () { case MSPCodes.MSP_MOTOR_PINS: console.log(data); break; - case MSPCodes.MSP_BOXNAMES: - //noinspection JSUndeclaredVariable - FC.AUX_CONFIG = []; // empty the array as new data is coming in - buff = []; - for (let i = 0; i < data.byteLength; i++) { - if (data.getUint8(i) == 0x3B) { // ; (delimeter char) - FC.AUX_CONFIG.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings - - // empty buffer - buff = []; - } else { - buff.push(data.getUint8(i)); - } - } - break; case MSPCodes.MSP_PIDNAMES: //noinspection JSUndeclaredVariable FC.PID_names = []; // empty the array as new data is coming in