Skip to content

Commit

Permalink
Remove MSP_BOXNAMES from the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
DzikuVx committed May 12, 2024
1 parent 3244df1 commit 5c7b5f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
10 changes: 6 additions & 4 deletions js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion js/msp/MSPCodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 0 additions & 15 deletions js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c7b5f1

Please sign in to comment.