mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 19:40:22 +03:00
Use MSP_STATUS_EX to display CPU load in status bar, from INAV 1.2.0
This commit is contained in:
parent
a2d8647b19
commit
c40f0cf2e6
4 changed files with 36 additions and 7 deletions
|
@ -213,7 +213,10 @@
|
||||||
"statusbar_cycle_time": {
|
"statusbar_cycle_time": {
|
||||||
"message": "Cycle Time:"
|
"message": "Cycle Time:"
|
||||||
},
|
},
|
||||||
|
"statusbar_cpu_load": {
|
||||||
|
"message": "CPU Load: $1%"
|
||||||
|
},
|
||||||
|
|
||||||
"dfu_connect_message": {
|
"dfu_connect_message": {
|
||||||
"message": "Please use the Firmware Flasher to access DFU devices"
|
"message": "Please use the Firmware Flasher to access DFU devices"
|
||||||
},
|
},
|
||||||
|
|
15
js/msp.js
15
js/msp.js
|
@ -66,6 +66,7 @@ var MSP_codes = {
|
||||||
MSP_3D: 124,
|
MSP_3D: 124,
|
||||||
MSP_RC_DEADBAND: 125,
|
MSP_RC_DEADBAND: 125,
|
||||||
MSP_SENSOR_ALIGNMENT: 126,
|
MSP_SENSOR_ALIGNMENT: 126,
|
||||||
|
MSP_STATUS_EX: 150,
|
||||||
|
|
||||||
MSP_SET_RAW_RC: 200,
|
MSP_SET_RAW_RC: 200,
|
||||||
MSP_SET_RAW_GPS: 201,
|
MSP_SET_RAW_GPS: 201,
|
||||||
|
@ -263,6 +264,20 @@ var MSP = {
|
||||||
$('span.i2c-error').text(CONFIG.i2cError);
|
$('span.i2c-error').text(CONFIG.i2cError);
|
||||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||||
break;
|
break;
|
||||||
|
case MSP_codes.MSP_STATUS_EX:
|
||||||
|
CONFIG.cycleTime = data.getUint16(0, 1);
|
||||||
|
CONFIG.i2cError = data.getUint16(2, 1);
|
||||||
|
CONFIG.activeSensors = data.getUint16(4, 1);
|
||||||
|
CONFIG.mode = data.getUint32(6, 1);
|
||||||
|
CONFIG.profile = data.getUint8(10);
|
||||||
|
CONFIG.cpuload = data.getUint16(11, 1);
|
||||||
|
|
||||||
|
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_RAW_IMU:
|
case MSP_codes.MSP_RAW_IMU:
|
||||||
// 512 for mpu6050, 256 for mma
|
// 512 for mpu6050, 256 for mma
|
||||||
// currently we are unable to differentiate between the sensor types, so we are goign with 512
|
// currently we are unable to differentiate between the sensor types, so we are goign with 512
|
||||||
|
|
|
@ -73,6 +73,8 @@ $(document).ready(function () {
|
||||||
// Reset various UI elements
|
// Reset various UI elements
|
||||||
$('span.i2c-error').text(0);
|
$('span.i2c-error').text(0);
|
||||||
$('span.cycle-time').text(0);
|
$('span.cycle-time').text(0);
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0"))
|
||||||
|
$('span.cpu-load').text('');
|
||||||
|
|
||||||
// unlock port select & baud
|
// unlock port select & baud
|
||||||
$('div#port-picker #port').prop('disabled', false);
|
$('div#port-picker #port').prop('disabled', false);
|
||||||
|
@ -260,8 +262,12 @@ function onConnect() {
|
||||||
$('#tabs ul.mode-disconnected').hide();
|
$('#tabs ul.mode-disconnected').hide();
|
||||||
$('#tabs ul.mode-connected').show();
|
$('#tabs ul.mode-connected').show();
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0")) {
|
||||||
|
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
|
||||||
|
} else {
|
||||||
|
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false);
|
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false);
|
||||||
|
|
||||||
var sensor_state = $('#sensor-status');
|
var sensor_state = $('#sensor-status');
|
||||||
|
@ -351,7 +357,7 @@ function sensor_status(sensors_detected) {
|
||||||
|
|
||||||
if (have_sensor(sensors_detected, 'mag')) {
|
if (have_sensor(sensors_detected, 'mag')) {
|
||||||
$('.mag', e_sensor_status).addClass('on');
|
$('.mag', e_sensor_status).addClass('on');
|
||||||
$('.magicon', e_sensor_status).addClass('active');
|
$('.magicon', e_sensor_status).addClass('active');
|
||||||
} else {
|
} else {
|
||||||
$('.mag', e_sensor_status).removeClass('on');
|
$('.mag', e_sensor_status).removeClass('on');
|
||||||
$('.magicon', e_sensor_status).removeClass('active');
|
$('.magicon', e_sensor_status).removeClass('active');
|
||||||
|
@ -359,7 +365,7 @@ function sensor_status(sensors_detected) {
|
||||||
|
|
||||||
if (have_sensor(sensors_detected, 'gps')) {
|
if (have_sensor(sensors_detected, 'gps')) {
|
||||||
$('.gps', e_sensor_status).addClass('on');
|
$('.gps', e_sensor_status).addClass('on');
|
||||||
$('.gpsicon', e_sensor_status).addClass('active');
|
$('.gpsicon', e_sensor_status).addClass('active');
|
||||||
} else {
|
} else {
|
||||||
$('.gps', e_sensor_status).removeClass('on');
|
$('.gps', e_sensor_status).removeClass('on');
|
||||||
$('.gpsicon', e_sensor_status).removeClass('active');
|
$('.gpsicon', e_sensor_status).removeClass('active');
|
||||||
|
@ -443,7 +449,10 @@ function update_live_status() {
|
||||||
|
|
||||||
if (GUI.active_tab != 'cli') {
|
if (GUI.active_tab != 'cli') {
|
||||||
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false);
|
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false);
|
||||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0"))
|
||||||
|
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
|
||||||
|
else
|
||||||
|
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
||||||
MSP.send_message(MSP_codes.MSP_ANALOG, false, false);
|
MSP.send_message(MSP_codes.MSP_ANALOG, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +518,6 @@ function update_live_status() {
|
||||||
startLiveDataRefreshTimer();
|
startLiveDataRefreshTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function specificByte(num, pos) {
|
function specificByte(num, pos) {
|
||||||
return 0x000000FF & (num >> (8 * pos));
|
return 0x000000FF & (num >> (8 * pos));
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,9 @@
|
||||||
<div>
|
<div>
|
||||||
<span i18n="statusbar_cycle_time"></span> <span class="cycle-time">0</span>
|
<span i18n="statusbar_cycle_time"></span> <span class="cycle-time">0</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="cpu-load"> </span>
|
||||||
|
</div>
|
||||||
<div class="version">
|
<div class="version">
|
||||||
<!-- configuration version generated here -->
|
<!-- configuration version generated here -->
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue