Add min/max observed CPU temps.

#728.
rxwx
cyoung 2019-01-31 11:45:21 -05:00
rodzic 7026f1975a
commit 39bb2e3415
3 zmienionych plików z 14 dodań i 2 usunięć

Wyświetl plik

@ -1148,6 +1148,8 @@ type status struct {
Uptime int64
UptimeClock time.Time
CPUTemp float32
CPUTempMin float32
CPUTempMax float32
NetworkDataMessagesSent uint64
NetworkDataMessagesSentNonqueueable uint64
NetworkDataBytesSent uint64
@ -1350,7 +1352,7 @@ func printStats() {
runtime.ReadMemStats(&memstats)
log.Printf("stats [started: %s]\n", humanize.RelTime(time.Time{}, stratuxClock.Time, "ago", "from now"))
log.Printf(" - Disk bytes used = %s (%.1f %%), Disk bytes free = %s (%.1f %%)\n", humanize.Bytes(usage.Used()), 100*usage.Usage(), humanize.Bytes(usage.Free()), 100*(1-usage.Usage()))
log.Printf(" - CPUTemp=%.02f deg C, MemStats.Alloc=%s, MemStats.Sys=%s, totalNetworkMessagesSent=%s\n", globalStatus.CPUTemp, humanize.Bytes(uint64(memstats.Alloc)), humanize.Bytes(uint64(memstats.Sys)), humanize.Comma(int64(totalNetworkMessagesSent)))
log.Printf(" - CPUTemp=%.02f [%.02f - %.02f] deg C, MemStats.Alloc=%s, MemStats.Sys=%s, totalNetworkMessagesSent=%s\n", globalStatus.CPUTemp, globalStatus.CPUTempMin, globalStatus.CPUTempMax, humanize.Bytes(uint64(memstats.Alloc)), humanize.Bytes(uint64(memstats.Sys)), humanize.Comma(int64(totalNetworkMessagesSent)))
log.Printf(" - UAT/min %s/%s [maxSS=%.02f%%], ES/min %s/%s, Total traffic targets tracked=%s", humanize.Comma(int64(globalStatus.UAT_messages_last_minute)), humanize.Comma(int64(globalStatus.UAT_messages_max)), float64(maxSignalStrength)/10.0, humanize.Comma(int64(globalStatus.ES_messages_last_minute)), humanize.Comma(int64(globalStatus.ES_messages_max)), humanize.Comma(int64(len(seenTraffic))))
log.Printf(" - Network data messages sent: %d total, %d nonqueueable. Network data bytes sent: %d total, %d nonqueueable.\n", globalStatus.NetworkDataMessagesSent, globalStatus.NetworkDataMessagesSentNonqueueable, globalStatus.NetworkDataBytesSent, globalStatus.NetworkDataBytesSentNonqueueable)
if globalSettings.GPS_Enabled {
@ -1649,8 +1651,16 @@ func main() {
go printStats()
// Monitor RPi CPU temp.
globalStatus.CPUTempMin = invalidCpuTemp
globalStatus.CPUTempMax = invalidCpuTemp
go cpuTempMonitor(func(cpuTemp float32) {
globalStatus.CPUTemp = cpuTemp
if isCPUTempValid(cpuTemp) && ((cpuTemp < globalStatus.CPUTempMin) || !isCPUTempValid(globalStatus.CPUTempMin)) {
globalStatus.CPUTempMin = cpuTemp
}
if isCPUTempValid(cpuTemp) && ((cpuTemp > globalStatus.CPUTempMax) || !isCPUTempValid(globalStatus.CPUTempMax)) {
globalStatus.CPUTempMax = cpuTemp
}
})
// Start reading from serial UAT radio.

Wyświetl plik

@ -130,6 +130,8 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval) {
if (boardtemp != undefined) {
/* boardtemp is celcius to tenths */
$scope.CPUTemp = String(boardtemp.toFixed(1) + '°C / ' + ((boardtemp * 9 / 5) + 32.0).toFixed(1) + '°F');
$scope.CPUTempMin = String(status.CPUTempMin.toFixed(1)) + '°C';
$scope.CPUTempMax = String(status.CPUTempMax.toFixed(1)) + '°C';
} else {
// $('#CPUTemp').text('unavailable');
}

Wyświetl plik

@ -107,7 +107,7 @@
</div>
<div class="col-sm-4 label_adj">
<span class="col-xs-5"><strong>CPU Temp:</strong></span>
<span class="col-xs-7">{{CPUTemp}}</span>
<span class="col-xs-7">{{CPUTemp}} <div ng-show="DeveloperMode == true">[{{CPUTempMin}} - {{CPUTempMax}}]</div></span>
</div>
<div class="col-sm-4 label_adj">
<span class="col-xs-5"><strong>Free Storage:</strong></span>