Rework the temp info in the status panel (#2054)

* Explicit set templimit if no tempsensor output was found

Signed-off-by: Christian König <ckoenig@posteo.de>

* Only show Temp info if tempsensor data is available

Signed-off-by: Christian König <ckoenig@posteo.de>

* Move block to the right place

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
yubiuser
2022-01-08 06:39:52 +01:00
committed by GitHub
parent 7bb82d0cff
commit 33755f1775

View File

@@ -66,6 +66,8 @@
// Nothing can be colder than -273.15 degree Celsius (= 0 Kelvin)
// This is the minimum temperature possible (AKA absolute zero)
$celsius = -273.16;
// Set templimit to null if no tempsensor was found
$temperaturelimit = null;
}
// Get load
@@ -375,18 +377,16 @@ if($auth) {
?>
<br/>
<?php
$tempcolor = "text-vivid-blue";
if ($celsius > $temperaturelimit) {
$tempcolor = "text-red";
}
echo '<span id="temperature"><i class="fa fa-w fa-fire '.$tempcolor.'" style="width: 1em !important"></i> ';
if ($celsius >= -273.15) {
if ($celsius >= -273.15) {
// Only show temp info if any data is available -->
$tempcolor = "text-vivid-blue";
if (isset($temperaturelimit) && $celsius > $temperaturelimit) {
$tempcolor = "text-red";
}
echo '<span id="temperature"><i class="fa fa-w fa-fire '.$tempcolor.'" style="width: 1em !important"></i> ';
echo 'Temp:&nbsp;<span id="rawtemp" hidden>' .$celsius. '</span>';
} else {
echo "No temp sensor found";
}
echo '<span id="tempdisplay"></span></span>';
echo '<span id="tempdisplay"></span></span>';
}
?>
</div>
</div>