Handle extended sensor bits in MSP_STATU_EX

Per betaflight/#3391

In detected sensor field (16-bits), lower 5-bits (bits 0-4) represents
traditional sensors (ACC, BARO, MAG, GPS and SONAR).

Bit 5 is an extension bit, and if present, bit 6 indicates gyro
detection status.
10.3.x-maintenance
jflyper 2017-06-30 15:19:33 +09:00
parent 736c6c293c
commit 2c4a97aee2
1 changed files with 13 additions and 1 deletions

View File

@ -389,7 +389,7 @@ function sensor_status(sensors_detected) {
$('.accicon', e_sensor_status).removeClass('active');
}
if (CONFIG.boardType == 0 || CONFIG.boardType == 2) { // Gyro status is not reported by FC
if ((CONFIG.boardType == 0 || CONFIG.boardType == 2) && have_sensor(sensors_detected, 'gyro')) {
$('.gyro', e_sensor_status).addClass('on');
$('.gyroicon', e_sensor_status).addClass('active');
} else {
@ -443,6 +443,18 @@ function have_sensor(sensors_detected, sensor_code) {
case 'sonar':
return bit_check(sensors_detected, 4);
}
if (bit_check(sensors_detected, 5)) {
switch (sensor_code) {
case 'gyro':
return bit_check(sensors_detected, 6);
}
}
if (sensor_code == 'gyro) {
return true;
}
return false;
}