Show CPU core temp on Setup tab (#3403)

* add temp

* add cpu temperature
master
HThuren 2023-04-06 22:22:13 +02:00 committed by GitHub
parent 397aba07aa
commit e15cb55e24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 1 deletions

View File

@ -901,6 +901,9 @@
"initialSetupBatteryAValue": {
"message": "$1 A"
},
"initialSetupCpuTemp": {
"message": "CPU Temperature:"
},
"initialSetupRSSI": {
"message": "RSSI:"
},

View File

@ -16,6 +16,7 @@ const INITIAL_CONFIG = {
cycleTime: 0,
i2cError: 0,
cpuload: 0,
cpuTemp: 0,
activeSensors: 0,
mode: 0,
profile: 0,
@ -43,6 +44,7 @@ const INITIAL_CONFIG = {
signature: [],
mcuTypeId: 255,
configurationState: 0,
configStateFlag: 0,
sampleRateHz: 0,
configurationProblems: 0,
hardwareName: '',

View File

@ -213,6 +213,14 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.CONFIG.armingDisableCount = data.readU8(); // Flag count
FC.CONFIG.armingDisableFlags = data.readU32();
// Read config state flags - bits to indicate the state of the configuration, reboot required, etc.
FC.CONFIG.configStateFlag = data.readU8();
// Read CPU temp, from API version 1.46
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
FC.CONFIG.cpuTemp = data.readU16();
}
sensor_status(FC.CONFIG.activeSensors, FC.GPS_DATA.fix);
break;

View File

@ -9,7 +9,7 @@ import FC from '../fc';
import MSP from '../msp';
import Model from '../model';
import MSPCodes from '../msp/MSPCodes';
import CONFIGURATOR, { API_VERSION_1_42, API_VERSION_1_43 } from '../data_storage';
import CONFIGURATOR, { API_VERSION_1_42, API_VERSION_1_43, API_VERSION_1_46 } from '../data_storage';
import { gui_log } from '../gui_log';
const setup = {
@ -190,6 +190,7 @@ setup.initialize = function (callback) {
bat_mah_drawn_e = $('.bat-mah-drawn'),
bat_mah_drawing_e = $('.bat-mah-drawing'),
rssi_e = $('.rssi'),
cputemp_e = $('.cpu-temp'),
arming_disable_flags_e = $('.arming-disable-flags'),
gpsFix_e = $('.gpsFix'),
gpsSats_e = $('.gpsSats'),
@ -400,6 +401,9 @@ setup.initialize = function (callback) {
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)]));
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_46)) {
cputemp_e.html(`${FC.CONFIG.cpuTemp.toFixed(0)} ℃`);
}
});
}

View File

@ -167,6 +167,10 @@
<td i18n="initialSetupRSSI"></td>
<td class="rssi">0 %</td>
</tr>
<tr>
<td id="cpu-temp" i18n="initialSetupCpuTemp"></td>
<td class="cpu-temp">0 &#8451;</td>
</tr>
<tr>
<td id="sensor-hw" i18n="initialSetupSensorHardware"></td>
<td class="sensor-hw"></td>