mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-17 05:15:20 +03:00
Support more than 32-bits of modes using MSP_ACTIVEBOXES API
This commit is contained in:
parent
afc8722085
commit
16a23cd39a
4 changed files with 24 additions and 7 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);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,6 @@ TABS.modes.initialize = function (callback) {
|
|||
googleAnalytics.sendAppView('Modes');
|
||||
}
|
||||
|
||||
function get_box_data() {
|
||||
MSP.send_message(MSPCodes.MSP_BOX, false, false, get_box_ids);
|
||||
}
|
||||
|
||||
function get_box_ids() {
|
||||
MSP.send_message(MSPCodes.MSP_BOXIDS, false, false, get_rc_data);
|
||||
}
|
||||
|
@ -27,7 +23,7 @@ TABS.modes.initialize = function (callback) {
|
|||
$('#content').load("./tabs/modes.html", process_html);
|
||||
}
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_box_data);
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_box_ids);
|
||||
|
||||
function process_html() {
|
||||
// generate heads according to RC count
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue