Update system.php

- Adding the CPU temp from a copy of CPU load.
- The CPU temp cannot go to 100°C, so i multiply the temp to 1.2. This way the progress bar is full when CPU temp is 83°C or more.
- The LAN Chipset supports up to 70°C, so i set the red progress bar to that threshold 
   (source: https://www.raspberrypi.org/documentation/faqs/)
This commit is contained in:
Weylin-fr 2020-01-20 16:30:44 +01:00 committed by GitHub
parent 6fc73851aa
commit 9819c6a3e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,16 @@ if ($cpuload > 90) {
$cpuload_status = "success"; $cpuload_status = "success";
} }
// cpu temp
$cputemp = $system->systemTemperature();
if ($cputemp > 70) {
$cputemp_status = "danger";
} elseif ($cputemp > 50) {
$cputemp_status = "warning";
} else {
$cputemp_status = "success";
}
?> ?>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
@ -63,12 +73,20 @@ if ($cpuload > 90) {
</div> </div>
</div> </div>
<div class="mb-1"><?php echo _("CPU Load"); ?></div> <div class="mb-1"><?php echo _("CPU Load"); ?></div>
<div class="progress mb-4" style="height: 20px;"> <div class="progress mb-2" style="height: 20px;">
<div class="progress-bar bg-<?php echo htmlspecialchars($cpuload_status, ENT_QUOTES); ?>" <div class="progress-bar bg-<?php echo htmlspecialchars($cpuload_status, ENT_QUOTES); ?>"
role="progressbar" aria-valuenow="<?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>" aria-valuemin="0" aria-valuemax="100" role="progressbar" aria-valuenow="<?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>" aria-valuemin="0" aria-valuemax="100"
style="width: <?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%"><?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>% style="width: <?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%"><?php echo htmlspecialchars($cpuload, ENT_QUOTES); ?>%
</div> </div>
</div> </div>
</div>
<div class="mb-1"><?php echo _("CPU Temp"); ?></div>
<div class="progress mb-4" style="height: 20px;">
<div class="progress-bar bg-<?php echo htmlspecialchars($cputemp_status, ENT_QUOTES); ?>"
role="progressbar" aria-valuenow="<?php echo htmlspecialchars($cputemp, ENT_QUOTES); ?>" aria-valuemin="0" aria-valuemax="100"
style="width: <?php echo htmlspecialchars(($cputemp*1.2), ENT_QUOTES); ?>%"><?php echo htmlspecialchars($cputemp, ENT_QUOTES); ?>°C
</div>
</div>
<form action="?page=system_info" method="POST"> <form action="?page=system_info" method="POST">
<?php echo CSRFTokenFieldTag() ?> <?php echo CSRFTokenFieldTag() ?>