Add sensor / range finder information at Setup tab (#3410)
* Show sonar at setup.js * Changed logic for , seperator * Changed logic for , seperatormaster
parent
c20d527343
commit
56338c2de6
|
@ -313,7 +313,6 @@ const FC = {
|
|||
cno: [],
|
||||
};
|
||||
|
||||
|
||||
this.VOLTAGE_METERS = [];
|
||||
this.VOLTAGE_METER_CONFIGS = [];
|
||||
this.CURRENT_METERS = [];
|
||||
|
@ -538,6 +537,7 @@ const FC = {
|
|||
acc_hardware: 0,
|
||||
baro_hardware: 0,
|
||||
mag_hardware: 0,
|
||||
sonar_hardware: 0,
|
||||
};
|
||||
|
||||
this.RX_CONFIG = {
|
||||
|
@ -767,7 +767,6 @@ const FC = {
|
|||
return name;
|
||||
},
|
||||
|
||||
|
||||
MCU_TYPES: {
|
||||
0: "SIMULATOR",
|
||||
1: "F40X",
|
||||
|
|
|
@ -1170,6 +1170,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FC.SENSOR_CONFIG.acc_hardware = data.readU8();
|
||||
FC.SENSOR_CONFIG.baro_hardware = data.readU8();
|
||||
FC.SENSOR_CONFIG.mag_hardware = data.readU8();
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
|
||||
FC.SENSOR_CONFIG.sonar_hardware = data.readU8();
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_LED_STRIP_CONFIG:
|
||||
|
|
|
@ -326,17 +326,40 @@ setup.initialize = function (callback) {
|
|||
'MPU925X_AK8963',
|
||||
];
|
||||
|
||||
let sonarElements = [
|
||||
'NONE',
|
||||
'HCSR04',
|
||||
'TFMINI',
|
||||
'TF02',
|
||||
];
|
||||
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_CONFIG, false, false, function() {
|
||||
// Sensor info
|
||||
let appendComma = false;
|
||||
sensor_e.text('');
|
||||
if (have_sensor(FC.CONFIG.activeSensors, "acc") && FC.SENSOR_CONFIG.acc_hardware > 1) {
|
||||
sensor_e.append(i18n.getMessage('sensorStatusAccelShort'), ': ', accElements[[FC.SENSOR_CONFIG.acc_hardware]], ', ');
|
||||
sensor_e.append(i18n.getMessage('sensorStatusAccelShort'), ': ', accElements[[FC.SENSOR_CONFIG.acc_hardware]]);
|
||||
appendComma = true;
|
||||
}
|
||||
if (have_sensor(FC.CONFIG.activeSensors, "baro") && FC.SENSOR_CONFIG.baro_hardware > 1) {
|
||||
sensor_e.append(i18n.getMessage('sensorStatusBaroShort'), ': ', baroElements[[FC.SENSOR_CONFIG.baro_hardware]], ', ');
|
||||
if (appendComma) {
|
||||
sensor_e.append(', ');
|
||||
}
|
||||
sensor_e.append(i18n.getMessage('sensorStatusBaroShort'), ': ', baroElements[[FC.SENSOR_CONFIG.baro_hardware]]);
|
||||
appendComma = true;
|
||||
}
|
||||
if (have_sensor(FC.CONFIG.activeSensors, "mag") && FC.SENSOR_CONFIG.mag_hardware > 1) {
|
||||
if (appendComma) {
|
||||
sensor_e.append(', ');
|
||||
}
|
||||
sensor_e.append(i18n.getMessage('sensorStatusMagShort'), ': ', magElements[[FC.SENSOR_CONFIG.mag_hardware]]);
|
||||
appendComma = true;
|
||||
}
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46) && have_sensor(FC.CONFIG.activeSensors, "sonar") && FC.SENSOR_CONFIG.sonar_hardware > 1) {
|
||||
if (appendComma) {
|
||||
sensor_e.append(', ');
|
||||
}
|
||||
sensor_e.append(i18n.getMessage('sensorStatusSonarShort'), ': ', sonarElements[[FC.SENSOR_CONFIG.sonar_hardware]]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue