mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 01:05:12 +03:00
Merge pull request #277 from iNavFlight/de_support_more_than_32_boxmodes
Support more than 32-bits of modes using MSP_ACTIVEBOXES API
This commit is contained in:
commit
00b0dcda9a
4 changed files with 26 additions and 5 deletions
|
@ -82,7 +82,7 @@ var MSPCodes = {
|
|||
MSP_ANALOG: 110,
|
||||
MSP_RC_TUNING: 111,
|
||||
MSP_PID: 112,
|
||||
MSP_BOX: 113,
|
||||
MSP_ACTIVEBOXES: 113,
|
||||
MSP_MISC: 114,
|
||||
MSP_MOTOR_PINS: 115,
|
||||
MSP_BOXNAMES: 116,
|
||||
|
|
|
@ -95,7 +95,12 @@ var mspHelper = (function (gui) {
|
|||
CONFIG.cycleTime = data.getUint16(0, true);
|
||||
CONFIG.i2cError = data.getUint16(2, true);
|
||||
CONFIG.activeSensors = data.getUint16(4, true);
|
||||
CONFIG.mode = data.getUint32(6, true);
|
||||
|
||||
/* For 1.7.4+ MSP_ACTIVEBOXES should be used to determine active modes */
|
||||
if (semver.lt(CONFIG.flightControllerVersion, "1.7.4")) {
|
||||
CONFIG.mode = data.getUint32(6, true);
|
||||
}
|
||||
|
||||
CONFIG.profile = data.getUint8(10);
|
||||
CONFIG.cpuload = data.getUint16(11, true);
|
||||
|
||||
|
@ -110,6 +115,21 @@ var mspHelper = (function (gui) {
|
|||
gui.updateProfileChange();
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_ACTIVEBOXES:
|
||||
var words = dataHandler.message_length_expected / 4;
|
||||
|
||||
CONFIG.mode = 0;
|
||||
if (words == 1) {
|
||||
CONFIG.mode = data.getUint32(0, true);
|
||||
}
|
||||
else if (words == 2) {
|
||||
CONFIG.mode = data.getUint32(0, true) | (data.getUint32(4, true) << 32);
|
||||
}
|
||||
else {
|
||||
console.log('MSP_ACTIVEBOXES doesn\'t support more than 53 bits at the moment');
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_SENSOR_STATUS:
|
||||
SENSOR_STATUS.isHardwareHealthy = data.getUint8(0);
|
||||
SENSOR_STATUS.gyroHwStatus = data.getUint8(1);
|
||||
|
|
|
@ -118,6 +118,7 @@ helper.periodicStatusUpdater = (function () {
|
|||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false);
|
||||
MSP.send_message(MSPCodes.MSP_ACTIVEBOXES, false, false);
|
||||
} else {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue