Fix truncation of environmental metrics when using Celsius (#667)

This commit is contained in:
Jonathan Bennett 2023-07-27 03:45:04 -05:00 committed by GitHub
parent 242dc76081
commit 75eebb989e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,8 +175,8 @@ data class NodeInfo(
if (env != null && env != 0f) String.format(f + unit, env) else ""
fun envMetricStr(isFahrenheit: Boolean = false): String =
if (!isFahrenheit) envFormat("%.1f", "°C ", environmentMetrics?.temperature)
else envFormat("%.1f", "°F ", environmentMetrics?.temperature?.times(1.8f)?.plus(32)) +
(if (!isFahrenheit) envFormat("%.1f", "°C ", environmentMetrics?.temperature)
else envFormat("%.1f", "°F ", environmentMetrics?.temperature?.times(1.8f)?.plus(32))) +
envFormat("%.0f", "%% ", environmentMetrics?.relativeHumidity) +
envFormat("%.1f", "hPa ", environmentMetrics?.barometricPressure) +
envFormat("%.0f", "", environmentMetrics?.gasResistance) +