kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
refactor: update `signalMetrics` filter for 0 hop packets
rodzic
bb345e7437
commit
fa24dd43b8
|
@ -37,6 +37,9 @@ class MetricsViewModel @Inject constructor(
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
private val destNum = MutableStateFlow(0)
|
private val destNum = MutableStateFlow(0)
|
||||||
|
|
||||||
|
private fun MeshPacket.hasValidSignal(): Boolean =
|
||||||
|
rxTime > 0 && (rxSnr != 0f && rxRssi != 0) && (hopStart > 0 && hopStart - hopLimit == 0)
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
val state = destNum.flatMapLatest { destNum ->
|
val state = destNum.flatMapLatest { destNum ->
|
||||||
combine(
|
combine(
|
||||||
|
@ -49,7 +52,7 @@ class MetricsViewModel @Inject constructor(
|
||||||
environmentMetrics = telemetry.filter {
|
environmentMetrics = telemetry.filter {
|
||||||
it.hasEnvironmentMetrics() && it.environmentMetrics.relativeHumidity >= 0f
|
it.hasEnvironmentMetrics() && it.environmentMetrics.relativeHumidity >= 0f
|
||||||
},
|
},
|
||||||
signalMetrics = meshPackets.filter { it.rxTime > 0 },
|
signalMetrics = meshPackets.filter { it.hasValidSignal() },
|
||||||
environmentDisplayFahrenheit = config.telemetry.environmentDisplayFahrenheit,
|
environmentDisplayFahrenheit = config.telemetry.environmentDisplayFahrenheit,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue