mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-10-09 12:01:29 -04:00
Account for negative metric values in telemetry (#532)
This commit is contained in:
1 parent
88fabab750
commit
dcc03be484
1 file changed
+2
-2
@@ -158,7 +158,7 @@ data class NodeInfo(
|
||||
val batteryStr get() = if (batteryLevel in 1..100) String.format("%d%%", batteryLevel) else ""
|
||||
|
||||
private fun envFormat(f: String, unit: String, env: Float?): String =
|
||||
if (env != null && env > 0f) String.format(f + unit, env) else ""
|
||||
if (env != null && env != 0f) String.format(f + unit, env) else ""
|
||||
|
||||
val envMetricStr
|
||||
get() = envFormat("%.1f", "°C ", environmentMetrics?.temperature) +
|
||||
@@ -211,4 +211,4 @@ data class NodeInfo(
|
||||
else -> "%.1f km".format(dist / 1000.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user