Firmware info on setup tab (#3369)

* More messages

* caps API

* More buiold info

* buildinfo

* buildinfo test

* Added build options

* Added build options

* Change of label

* chang loop

* Add buildkey and sensors

* Show config and log based on buildkey
master
HThuren 2023-03-16 14:39:05 +01:00 committed by GitHub
parent 9705c1e040
commit 36628523db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 219 additions and 52 deletions

View File

@ -865,7 +865,7 @@
"message": "Magnetometer"
},
"initialSetupInfoHead": {
"message": "Info"
"message": "System info"
},
"initialSetupBattery": {
"message": "Battery voltage:"
@ -888,6 +888,9 @@
"initialSetupRSSI": {
"message": "RSSI:"
},
"initialSetupSensorHardware": {
"message": "Sensors:"
},
"initialSetupRSSIValue": {
"message": "$1 %"
},
@ -1014,6 +1017,30 @@
"initialSetupInstrumentsHead": {
"message": "Instruments"
},
"initialSetupInfoAPIversion": {
"message": "MSP API:"
},
"initialSetupInfoBuild": {
"message": "Firmware info"
},
"initialSetupInfoBuildDate": {
"message": "Build date:"
},
"initialSetupInfoBuildInfo": {
"message": "Build info:"
},
"initialSetupInfoBuildInfoConfig": {
"message": "Build config"
},
"initialSetupInfoBuildInfoLog": {
"message": "Build log"
},
"initialSetupInfoBuildOptions": {
"message": "Build Options:"
},
"initialSetupInfoBuildOptionsEmpty": {
"message": "Local Build - no Defines"
},
"initialSetupButtonSave": {
"message": "Save"
},

View File

@ -1731,6 +1731,13 @@ dialog {
color: #fff;
font-size: 10px;
}
.buildKeyInfoClass {
background-color: #ffcc3f;
padding: 2px 5px;
border-radius: 3px;
color: #272727;
font-size: 10px;
}
.cf_tooltiptext {
display: none;
}

View File

@ -197,7 +197,14 @@ setup.initialize = function (callback) {
gpsLon_e = $('.gpsLon'),
roll_e = $('dd.roll'),
pitch_e = $('dd.pitch'),
heading_e = $('dd.heading');
heading_e = $('dd.heading'),
// Sensor info
sensor_e = $('.sensor-hw'),
// Firmware info
msp_api_e = $('.api-version'),
build_date_e = $('.build-date'),
build_info_e = $('.build-info'),
build_opt_e = $('.build-options');
// DISARM FLAGS
// We add all the arming/disarming flags available, and show/hide them if needed.
@ -265,7 +272,99 @@ setup.initialize = function (callback) {
}
};
const showSensorInfo = function() {
let accElements = [
'DEFAULT',
'NONE',
'ADXL345',
'MPU6050',
'MMA8452',
'BMA280',
'LSM303DLHC',
'MPU6000',
'MPU6500',
'MPU9250',
'ICM20601',
'ICM20602',
'ICM20608G',
'ICM20649',
'ICM20689',
'ICM42605',
'ICM42688P',
'BMI160',
'BMI270',
'LSM6DSO',
'VIRTUAL',
];
let baroElements = [
'DEFAULT',
'NONE',
'BMP085',
'MS5611',
'BMP280',
'LPS',
'QMP6988',
'BMP388',
'DPS310',
'2SMPB_02B',
'VIRTUAL',
];
let magElements = [
'DEFAULT',
'NONE',
'HMC5883',
'AK8975',
'AK8963',
'QMC5883',
'LIS3MDL',
'MPU925X_AK8963',
];
MSP.send_message(MSPCodes.MSP_SENSOR_CONFIG, false, false, function() {
// Sensor info
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]], ', ');
}
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(have_sensor(FC.CONFIG.activeSensors, "mag") && FC.SENSOR_CONFIG.mag_hardware > 1) {
sensor_e.append(i18n.getMessage('sensorStatusMagShort'), ': ', magElements[[FC.SENSOR_CONFIG.mag_hardware]]);
}
});
};
const showFirmwareInfo = function() {
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false, function() {
// Firmware info
msp_api_e.text([FC.CONFIG.apiVersion]);
build_date_e.text([FC.CONFIG.buildInfo]);
if(FC.CONFIG.buildInfo.length > 0) {
const buildRoot = `https://build.betaflight.com/api/builds/${FC.CONFIG.buildKey}`;
const buildConfig = `<span class="buildKeyInfoClass" title="${i18n.getMessage('initialSetupInfoBuildInfoConfig')}: ${FC.CONFIG.buildKey}">
<a href="${buildRoot}/json" target="_blank">${i18n.getMessage('initialSetupInfoBuildInfoConfig')}</a></span>`;
const buildLog = `<span class="buildKeyInfoClass" title="${i18n.getMessage('initialSetupInfoBuildInfoLog')}: ${FC.CONFIG.buildKey}">
<a href="${buildRoot}/log" target="_blank">${i18n.getMessage('initialSetupInfoBuildInfoLog')}</a></span>`;
build_info_e.html(`${buildConfig} &nbsp ${buildLog}`);
}
if(FC.CONFIG.buildOptions.length > 0) {
build_opt_e.text = "";
for (const buildOption of FC.CONFIG.buildOptions) {
build_opt_e.append(buildOption, ' ');
}
} else {
build_opt_e.text(i18n.getMessage('initialSetupInfoBuildOptionsEmpty'));
}
});
};
prepareDisarmFlags();
showSensorInfo();
showFirmwareInfo();
function get_slow_data() {
@ -279,13 +378,7 @@ setup.initialize = function (callback) {
});
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
bat_voltage_e.text(i18n.getMessage('initialSetupBatteryValue', [FC.ANALOG.voltage]));
bat_mah_drawn_e.text(i18n.getMessage('initialSetupBatteryMahValue', [FC.ANALOG.mAhdrawn]));
bat_mah_drawing_e.text(i18n.getMessage('initialSetupBatteryAValue', [FC.ANALOG.amperage.toFixed(2)]));
rssi_e.text(i18n.getMessage('initialSetupRSSIValue', [((FC.ANALOG.rssi / 1023) * 100).toFixed(0)]));
});
// GPS info
if (have_sensor(FC.CONFIG.activeSensors, 'gps')) {
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
gpsFix_e.html((FC.GPS_DATA.fix) ? i18n.getMessage('gpsFixTrue') : i18n.getMessage('gpsFixFalse'));
@ -294,6 +387,14 @@ setup.initialize = function (callback) {
gpsLon_e.text(`${(FC.GPS_DATA.lon / 10000000).toFixed(4)} deg`);
});
}
// System info
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
bat_voltage_e.text(i18n.getMessage('initialSetupBatteryValue', [FC.ANALOG.voltage]));
bat_mah_drawn_e.text(i18n.getMessage('initialSetupBatteryMahValue', [FC.ANALOG.mAhdrawn]));
bat_mah_drawing_e.text(i18n.getMessage('initialSetupBatteryAValue', [FC.ANALOG.amperage.toFixed(2)]));
rssi_e.text(i18n.getMessage('initialSetupRSSIValue', [((FC.ANALOG.rssi / 1023) * 100).toFixed(0)]));
});
}
function get_fast_data() {

View File

@ -88,35 +88,26 @@
</div>
</div>
<div class="grid-col col3">
<div class="gui_box grey">
<div class="gui_box grey instrumentsbox" align="center">
<div class="gui_box_titlebar" align="left">
<div class="spacer_box_title" i18n="initialSetupInstrumentsHead"></div>
</div>
<span id="attitude"></span> <span id="heading"></span>
</div>
<div class="gui_box grey backupRestore">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="initialSetupInfoHead"></div>
<div class="spacer_box_title" i18n="initialSetupBackupRestoreHeader"></div>
</div>
<div class="spacer_box">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
<tbody>
<tr>
<td id="arming-disable-flag" i18n="initialSetupArmingDisableFlags" class="cf_tip"></td>
<td class="arming-disable-flags"></td>
</tr>
<tr>
<td i18n="initialSetupBattery"></td>
<td class="bat-voltage">0 V</td>
</tr>
<tr>
<td i18n="initialSetupDrawn"></td>
<td class="bat-mah-drawn">0 mAh</td>
</tr>
<tr>
<td i18n="initialSetupDrawing"></td>
<td class="bat-mah-drawing">0.00 A</td>
</tr>
<tr class="noboarder">
<td i18n="initialSetupRSSI"></td>
<td class="rssi">0 %</td>
</tr>
</tbody>
</table>
<div class="default_btn">
<a class="backup" href="#" i18n="initialSetupButtonBackup"></a>
</div>
<div class="default_btn">
<a class="restore" href="#" i18n="initialSetupButtonRestore"></a>
</div>
<div class="cell_setup">
<span i18n="initialSetupBackupRestoreText"></span>
</div>
</div>
</div>
<div class="gui_box grey">
@ -146,26 +137,67 @@
</table>
</div>
</div>
<div class="gui_box grey instrumentsbox" align="center">
<div class="gui_box_titlebar" align="left">
<div class="spacer_box_title" i18n="initialSetupInstrumentsHead"></div>
</div>
<span id="attitude"></span> <span id="heading"></span>
</div>
<div class="gui_box grey backupRestore">
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="initialSetupBackupRestoreHeader"></div>
<div class="spacer_box_title" i18n="initialSetupInfoHead"></div>
</div>
<div class="spacer_box">
<div class="default_btn">
<a class="backup" href="#" i18n="initialSetupButtonBackup"></a>
</div>
<div class="default_btn">
<a class="restore" href="#" i18n="initialSetupButtonRestore"></a>
</div>
<div class="cell_setup">
<span i18n="initialSetupBackupRestoreText"></span>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
<tbody>
<tr>
<td id="arming-disable-flag" i18n="initialSetupArmingDisableFlags" class="cf_tip"></td>
<td class="arming-disable-flags"></td>
</tr>
<tr>
<td i18n="initialSetupBattery"></td>
<td class="bat-voltage">0 V</td>
</tr>
<tr>
<td i18n="initialSetupDrawn"></td>
<td class="bat-mah-drawn">0 mAh</td>
</tr>
<tr>
<td i18n="initialSetupDrawing"></td>
<td class="bat-mah-drawing">0.00 A</td>
</tr>
<tr class="noboarder">
<td i18n="initialSetupRSSI"></td>
<td class="rssi">0 %</td>
</tr>
<tr>
<td id="sensor-hw" i18n="initialSetupSensorHardware"></td>
<td class="sensor-hw"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="gui_box grey">
<div class="gui_box_titlebar">
<div class="spacer_box_title" i18n="initialSetupInfoBuild"></div>
</div>
<div class="spacer_box">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cf_table">
<tbody>
<tr>
<td id="api-version" i18n="initialSetupInfoAPIversion"></td>
<td class="api-version"></td>
</tr>
<tr>
<td id="build-date" i18n="initialSetupInfoBuildDate"></td>
<td class="build-date"></td>
</tr>
</tr>
<tr>
<td id="build-info" i18n="initialSetupInfoBuildInfo"></td>
<td class="build-info"></td>
</tr>
<tr>
<td id="build-options" i18n="initialSetupInfoBuildOptions"></td>
<td class="build-options"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>