diff --git a/app/src/main/java/com/geeksville/mesh/database/entity/NodeEntity.kt b/app/src/main/java/com/geeksville/mesh/database/entity/NodeEntity.kt index c80cea7a..10d99b88 100644 --- a/app/src/main/java/com/geeksville/mesh/database/entity/NodeEntity.kt +++ b/app/src/main/java/com/geeksville/mesh/database/entity/NodeEntity.kt @@ -135,13 +135,21 @@ data class NodeEntity( ).joinToString(" ") } + private fun TelemetryProtos.PowerMetrics.getDisplayString(): String = listOfNotNull( + "%.2fV".format(ch2Voltage).takeIf { hasCh2Voltage() }, + "%.1fmA".format(ch2Current).takeIf { hasCh2Current() }, + "%.2fV".format(ch3Voltage).takeIf { hasCh3Voltage() }, + "%.1fmA".format(ch3Current).takeIf { hasCh3Current() }, + ).joinToString(" ") + private fun PaxcountProtos.Paxcount.getDisplayString() = "PAX: ${ble + wifi} (B:$ble/W:$wifi)".takeIf { ble != 0 && wifi != 0 } fun getTelemetryString(isFahrenheit: Boolean = false): String { return listOfNotNull( paxcounter.getDisplayString(), - environmentMetrics.getDisplayString(isFahrenheit) + environmentMetrics.getDisplayString(isFahrenheit), + powerMetrics.getDisplayString(), ).joinToString(" ") }