mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 21:05:28 +03:00
Add support for MSP_SENSOR_STATUS if firmware version is gte 1.5
This commit is contained in:
parent
c631b33fda
commit
2946004ccf
16 changed files with 153 additions and 63 deletions
28
js/msp.js
28
js/msp.js
|
@ -80,6 +80,7 @@ var MSP_codes = {
|
|||
MSP_SENSOR_ALIGNMENT: 126,
|
||||
MSP_LED_STRIP_MODECOLOR:127,
|
||||
MSP_STATUS_EX: 150,
|
||||
MSP_SENSOR_STATUS: 151,
|
||||
|
||||
MSP_SET_RAW_RC: 200,
|
||||
MSP_SET_RAW_GPS: 201,
|
||||
|
@ -269,6 +270,7 @@ var MSP = {
|
|||
CONFIG.msp_version = data.getUint8(2);
|
||||
CONFIG.capability = data.getUint32(3, 1);
|
||||
break;
|
||||
|
||||
case MSP_codes.MSP_STATUS:
|
||||
CONFIG.cycleTime = data.getUint16(0, 1);
|
||||
CONFIG.i2cError = data.getUint16(2, 1);
|
||||
|
@ -277,10 +279,15 @@ var MSP = {
|
|||
CONFIG.profile = data.getUint8(10);
|
||||
$('select[name="profilechange"]').val(CONFIG.profile);
|
||||
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
// Only update sensors via MSP_STATUS if earlier than 1.5
|
||||
if (semver.lt(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
}
|
||||
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||
break;
|
||||
|
||||
case MSP_codes.MSP_STATUS_EX:
|
||||
CONFIG.cycleTime = data.getUint16(0, 1);
|
||||
CONFIG.i2cError = data.getUint16(2, 1);
|
||||
|
@ -289,12 +296,29 @@ var MSP = {
|
|||
CONFIG.profile = data.getUint8(10);
|
||||
CONFIG.cpuload = data.getUint16(11, 1);
|
||||
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
// Only update sensors via MSP_STATUS if earlier than 1.5
|
||||
if (semver.lt(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
}
|
||||
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||
$('span.cpu-load').text(chrome.i18n.getMessage('statusbar_cpu_load', [CONFIG.cpuload]));
|
||||
break;
|
||||
|
||||
case MSP_codes.MSP_SENSOR_STATUS:
|
||||
SENSOR_STATUS.isHardwareHealthy = data.getUint8(0);
|
||||
SENSOR_STATUS.gyroHwStatus = data.getUint8(1);
|
||||
SENSOR_STATUS.accHwStatus = data.getUint8(2);
|
||||
SENSOR_STATUS.magHwStatus = data.getUint8(3);
|
||||
SENSOR_STATUS.baroHwStatus = data.getUint8(4);
|
||||
SENSOR_STATUS.gpsHwStatus = data.getUint8(5);
|
||||
SENSOR_STATUS.rangeHwStatus = data.getUint8(6);
|
||||
SENSOR_STATUS.speedHwStatus = data.getUint8(7);
|
||||
SENSOR_STATUS.flowHwStatus = data.getUint8(8);
|
||||
sensor_status_ex(SENSOR_STATUS);
|
||||
break;
|
||||
|
||||
case MSP_codes.MSP_RAW_IMU:
|
||||
// 512 for mpu6050, 256 for mma
|
||||
// currently we are unable to differentiate between the sensor types, so we are goign with 512
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue