mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 17:25:14 +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_ANALOG: 110,
|
||||||
MSP_RC_TUNING: 111,
|
MSP_RC_TUNING: 111,
|
||||||
MSP_PID: 112,
|
MSP_PID: 112,
|
||||||
MSP_BOX: 113,
|
MSP_ACTIVEBOXES: 113,
|
||||||
MSP_MISC: 114,
|
MSP_MISC: 114,
|
||||||
MSP_MOTOR_PINS: 115,
|
MSP_MOTOR_PINS: 115,
|
||||||
MSP_BOXNAMES: 116,
|
MSP_BOXNAMES: 116,
|
||||||
|
|
|
@ -95,7 +95,12 @@ var mspHelper = (function (gui) {
|
||||||
CONFIG.cycleTime = data.getUint16(0, true);
|
CONFIG.cycleTime = data.getUint16(0, true);
|
||||||
CONFIG.i2cError = data.getUint16(2, true);
|
CONFIG.i2cError = data.getUint16(2, true);
|
||||||
CONFIG.activeSensors = data.getUint16(4, 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.profile = data.getUint8(10);
|
||||||
CONFIG.cpuload = data.getUint16(11, true);
|
CONFIG.cpuload = data.getUint16(11, true);
|
||||||
|
|
||||||
|
@ -110,6 +115,21 @@ var mspHelper = (function (gui) {
|
||||||
gui.updateProfileChange();
|
gui.updateProfileChange();
|
||||||
break;
|
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:
|
case MSPCodes.MSP_SENSOR_STATUS:
|
||||||
SENSOR_STATUS.isHardwareHealthy = data.getUint8(0);
|
SENSOR_STATUS.isHardwareHealthy = data.getUint8(0);
|
||||||
SENSOR_STATUS.gyroHwStatus = data.getUint8(1);
|
SENSOR_STATUS.gyroHwStatus = data.getUint8(1);
|
||||||
|
|
|
@ -118,6 +118,7 @@ helper.periodicStatusUpdater = (function () {
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0")) {
|
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false);
|
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false);
|
||||||
|
MSP.send_message(MSPCodes.MSP_ACTIVEBOXES, false, false);
|
||||||
} else {
|
} else {
|
||||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false);
|
MSP.send_message(MSPCodes.MSP_STATUS, false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ TABS.modes.initialize = function (callback) {
|
||||||
googleAnalytics.sendAppView('Modes');
|
googleAnalytics.sendAppView('Modes');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_box_data() {
|
function get_active_box_data() {
|
||||||
MSP.send_message(MSPCodes.MSP_BOX, false, false, get_box_ids);
|
MSP.send_message(MSPCodes.MSP_ACTIVEBOXES, false, false, get_box_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_box_ids() {
|
function get_box_ids() {
|
||||||
|
@ -27,7 +27,7 @@ TABS.modes.initialize = function (callback) {
|
||||||
$('#content').load("./tabs/modes.html", process_html);
|
$('#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() {
|
function process_html() {
|
||||||
// generate heads according to RC count
|
// generate heads according to RC count
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue