1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +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:
Konstantin Sharlaimov 2017-10-10 21:52:02 +10:00 committed by GitHub
commit 00b0dcda9a
4 changed files with 26 additions and 5 deletions

View file

@ -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,

View file

@ -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);

View file

@ -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);
}

View file

@ -11,8 +11,8 @@ 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_active_box_data() {
MSP.send_message(MSPCodes.MSP_ACTIVEBOXES, false, false, get_box_ids);
}
function get_box_ids() {
@ -27,7 +27,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_active_box_data);
function process_html() {
// generate heads according to RC count