diff --git a/header.php b/header.php index 56f970dd..8e99b752 100644 --- a/header.php +++ b/header.php @@ -22,6 +22,7 @@ if(is_numeric($output)) { $celsius = intVal($output)*1e-3; + $kelvin = $celsius + 273.15; $fahrenheit = ($celsius*9./5)+32.0; if(isset($setupVars['TEMPERATUREUNIT'])) @@ -261,13 +262,17 @@ echo "#3366FF"; } echo "\"> Temp: "; - if($temperatureunit != "F") + if($temperatureunit === "F") { - echo round($celsius,1) . "°C"; + echo round($fahrenheit,1) . "°F"; + } + elseif($temperatureunit === "K") + { + echo round($kelvin,1) . "K"; } else { - echo round($fahrenheit,1) . "°F"; + echo round($celsius,1) . "°C"; } echo ""; } diff --git a/php/savesettings.php b/php/savesettings.php index ced3b7a3..4dd357c5 100644 --- a/php/savesettings.php +++ b/php/savesettings.php @@ -222,12 +222,14 @@ function validDomain($domain_name) if($_POST["tempunit"] == "F") { exec('sudo pihole -a -f'); - $success .= "The webUI settings have been updated"; + } + elseif($_POST["tempunit"] == "K") + { + exec('sudo pihole -a -k'); } else { exec('sudo pihole -a -c'); - $success .= "The webUI settings have been updated"; } if(isset($_POST["boxedlayout"])) { @@ -237,6 +239,7 @@ function validDomain($domain_name) { exec('sudo pihole -a layout traditional'); } + $success .= "The webUI settings have been updated"; break; case "reboot": diff --git a/settings.php b/settings.php index 2c58bc49..87bfc815 100644 --- a/settings.php +++ b/settings.php @@ -452,6 +452,7 @@

CPU Temperature Unit

+