Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show CPU core temp on Setup tab #3403

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@
"initialSetupBatteryAValue": {
"message": "$1 A"
},
"initialSetupCpuTemp": {
"message": "CPU Temperature:"
},
"initialSetupRSSI": {
"message": "RSSI:"
},
Expand Down
2 changes: 2 additions & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const INITIAL_CONFIG = {
cycleTime: 0,
i2cError: 0,
cpuload: 0,
cpuTemp: 0,
activeSensors: 0,
mode: 0,
profile: 0,
Expand Down Expand Up @@ -43,6 +44,7 @@ const INITIAL_CONFIG = {
signature: [],
mcuTypeId: 255,
configurationState: 0,
configStateFlag: 0,
sampleRateHz: 0,
configurationProblems: 0,
hardwareName: '',
Expand Down
8 changes: 8 additions & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
HThuren marked this conversation as resolved.
Show resolved Hide resolved

// 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;

Expand Down
6 changes: 5 additions & 1 deletion src/js/tabs/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -394,6 +395,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)} ℃`);
}
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/tabs/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,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>
Expand Down