check-health: handle formatting by picking from string

The mathematical way is more elegant, but just picking the char from
string is shorter. 😜
This commit is contained in:
Christian Hesse 2020-11-19 20:24:09 +01:00
parent 7adfd1b670
commit 88f9948c72

View file

@ -19,10 +19,7 @@
:local FormatVoltage do={
:local Voltage [ :tonum $1 ];
:if ($Voltage < 10) do={
:return ("0." . $Voltage . "V");
}
:return (($Voltage / 10) . "." . ($Voltage % ($Voltage / 10 * 10)) . "V");
:return (($Voltage / 10) . "." . [ :pick $Voltage ([ :len $Voltage ] - 1) ] . "V");
}
:local CheckHealthCurrent [ / system health get ];