mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-25 16:31:22 -04:00
feat: Honor radio's option to use Fahrenheit (#658)
This commit is contained in:
@@ -174,8 +174,9 @@ data class NodeInfo(
|
||||
private fun envFormat(f: String, unit: String, env: Float?): String =
|
||||
if (env != null && env != 0f) String.format(f + unit, env) else ""
|
||||
|
||||
val envMetricStr
|
||||
get() = envFormat("%.1f", "°C ", environmentMetrics?.temperature) +
|
||||
fun envMetricStr(isFahrenheit: Boolean = false): String =
|
||||
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", "mΩ ", environmentMetrics?.gasResistance) +
|
||||
|
||||
@@ -205,8 +205,9 @@ class UsersFragment : ScreenFragment("Users"), Logging {
|
||||
|
||||
holder.lastTime.text = formatAgo(n.lastHeard)
|
||||
|
||||
if (n.envMetricStr.isNotEmpty()) {
|
||||
holder.envMetrics.text = n.envMetricStr
|
||||
val envMetrics = n.envMetricStr(model.module.telemetry.environmentDisplayFahrenheit)
|
||||
if (envMetrics.isNotEmpty()) {
|
||||
holder.envMetrics.text = envMetrics
|
||||
holder.envMetrics.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.envMetrics.visibility = View.GONE
|
||||
|
||||
Reference in New Issue
Block a user