Added thermal sensor support in web app.
Ylian Saint-Hilaire committed
Jan 28, 2021 at 01:02 UTC
7279b26d6743917c7260a20e02a12e32196ff327
3 files changed
+35
-4
public/styles/style.css
+12
@@ -3094,3 +3094,15 @@ a {
3094
#p19headers > span.on {
3095
font-weight: bold;
3096
}
3097
+
3098
+.thermalSensor {
3099
+ float: left;
3100
+ padding: 5px;
3101
+ background-color: gold;
3102
+ margin-right: 6px;
3103
+ border-radius: 4px;
3104
+}
3105
+
3106
+.night .thermalSensor {
3107
+ color: #000;
3108
+}
translate/translate.json
+7
-2
@@ -4902,6 +4902,13 @@
4902
"default.handlebars->31->201"
4903
]
4904
},
4905
+ {
4906
+ "en": "Alpine Linux x86 64 Bit (MUSL)",
4907
+ "xloc": [
4908
+ "default-mobile.handlebars->11->39",
4909
+ "default.handlebars->31->46"
4910
+ ]
4911
+ },
4912
{
4913
"en": "Alt",
4914
"fr": "Alt",
@@ -40197,7 +40204,6 @@
40204
"xloc": [
40205
"default-mobile.handlebars->11->219",
40206
"default-mobile.handlebars->11->37",
40200
- "default-mobile.handlebars->11->39",
40207
"default-mobile.handlebars->11->40",
40208
"default-mobile.handlebars->11->41",
40209
"default-mobile.handlebars->11->42",
@@ -40222,7 +40228,6 @@
40228
"default.handlebars->31->2128",
40229
"default.handlebars->31->44",
40230
"default.handlebars->31->452",
40225
- "default.handlebars->31->46",
40231
"default.handlebars->31->47",
40232
"default.handlebars->31->48",
40233
"default.handlebars->31->49",
views/default.handlebars
+16
-2
@@ -878,6 +878,7 @@
878
<div style="margin-bottom:10px;margin-left:16px;height:240px;width:calc(100% - 16px);position:relative">
879
<canvas id=deviceDetailsStats style="position:absolute;top:0;left:0;right:0;bottom:0"></canvas>
880
</div>
881
+ <div id="extraGraphValues" style="display:none;margin-left:30px;margin-bottom:15px"></div>
882
</td>
883
</tr>
884
</table>
@@ -2188,7 +2189,7 @@
2189
if (typeof message.cpu.total == 'number') { cpu = message.cpu.total; }
2190
if (typeof message.memory.percentConsumed == 'number') { memory = message.memory.percentConsumed; }
2191
deviceDetailsStatsData.push([now, cpu, memory]);
2191
- deviceDetailsStatsDraw();
2192
+ deviceDetailsStatsDraw(message);
2193
} else if (message.type == 'console') { p15consoleReceive(nodes[index], message.value, message.source); } // This is a console message.
2194
else if (message.type == 'notify') { // This is a notification message.
2195
var n = getstore('notifications', 0);
@@ -8929,6 +8930,7 @@
8930
{ label: 'Memory', backgroundColor: 'rgba(255, 99, 132, .5)', borderColor: 'rgb(255, 99, 132)', data: [], fill: true }
8931
] },
8932
options: {
8933
+ events: ['click'],
8934
animation: false,
8935
responsive: true,
8936
maintainAspectRatio: false,
@@ -8957,13 +8959,15 @@
8959
if (deviceDetailsStatsTimer != null) { clearInterval(deviceDetailsStatsTimer); deviceDetailsStatsTimer = null; }
8960
deviceDetailsStatsData = [];
8961
deviceDetailsStatsDraw();
8962
+ QV('extraGraphValues', false);
8963
+ QH('extraGraphValues', '');
8964
}
8965
8966
function deviceDetailsStatsTimerFunc() {
8967
if (currentNode != null) { meshserver.send({ action: 'msg', type: 'cpuinfo', nodeid: currentNode._id }); }
8968
}
8969
8966
- function deviceDetailsStatsDraw() {
8970
+ function deviceDetailsStatsDraw(message) {
8971
var now = Date.now() / 1000, oldLimit = (now - 100);
8972
while ((deviceDetailsStatsData.length > 0) && (deviceDetailsStatsData[0][0] < (oldLimit - 5))) { deviceDetailsStatsData.shift(); }
8973
@@ -8977,6 +8981,16 @@
8981
deviceDetailsConfig.data.datasets[0].data = cpu;
8982
deviceDetailsConfig.data.datasets[1].data = memory;
8983
if (window.deviceDetailsStatsChart) { window.deviceDetailsStatsChart.update(); }
8984
+
8985
+ // Display any additional live values
8986
+ if (message != null) {
8987
+ if (Array.isArray(message.thermals) && (message.thermals.length > 0)) {
8988
+ var x = ' ';
8989
+ for (var i in message.thermals) { x += '<div class=thermalSensor>' + parseFloat(message.thermals[i]).toFixed(2) + '°C / ' + parseFloat((message.thermals[i] * 1.8) + 32).toFixed(2) + '°F' + '</div>'; }
8990
+ QV('extraGraphValues', true);
8991
+ QH('extraGraphValues', x);
8992
+ }
8993
+ }
8994
}
8995
8996
var DeviceDetailsHardware = null;