mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-07-03 14:06:34 +02:00
Restore voltage precision to 2 places (#889)
This commit is contained in:
@@ -24,7 +24,7 @@ fun BatteryInfo(
|
||||
batteryLevel: Int?,
|
||||
voltage: Float?
|
||||
) {
|
||||
val infoString = "%d%% %.1fV".format(batteryLevel, voltage)
|
||||
val infoString = "%d%% %.2fV".format(batteryLevel, voltage)
|
||||
val (image, level) = when (batteryLevel) {
|
||||
in 0 .. 4 -> R.drawable.ic_battery_alert to " $infoString"
|
||||
in 5 .. 14 -> R.drawable.ic_battery_outline to infoString
|
||||
@@ -32,7 +32,7 @@ fun BatteryInfo(
|
||||
in 35..79 -> R.drawable.ic_battery_medium to infoString
|
||||
in 80..100 -> R.drawable.ic_battery_high to infoString
|
||||
101 -> R.drawable.ic_power_plug_24 to "%.1fV".format(voltage)
|
||||
else -> R.drawable.ic_battery_unknown to (voltage?.let { "%.1fV".format(it) } ?: "")
|
||||
else -> R.drawable.ic_battery_unknown to (voltage?.let { "%.2fV".format(it) } ?: "")
|
||||
}
|
||||
|
||||
Row(
|
||||
|
||||
Reference in New Issue
Block a user