mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Decouple NodeMapScreen from MetricsViewModel (#3323)
Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
8b4397a825
commit
ff95bc5311
7 changed files with 87 additions and 47 deletions
|
|
@ -62,6 +62,7 @@ import org.meshtastic.core.model.DataPacket
|
|||
import org.meshtastic.core.model.DeviceHardware
|
||||
import org.meshtastic.core.navigation.NodesRoutes
|
||||
import org.meshtastic.core.prefs.map.MapPrefs
|
||||
import org.meshtastic.core.proto.toPosition
|
||||
import org.meshtastic.core.service.ServiceAction
|
||||
import org.meshtastic.core.service.ServiceRepository
|
||||
import org.meshtastic.core.strings.R
|
||||
|
|
@ -190,12 +191,6 @@ enum class TimeFrame(val seconds: Long, @StringRes val strRes: Int) {
|
|||
private fun MeshPacket.hasValidSignal(): Boolean =
|
||||
rxTime > 0 && (rxSnr != 0f && rxRssi != 0) && (hopStart > 0 && hopStart - hopLimit == 0)
|
||||
|
||||
private fun MeshPacket.toPosition(): Position? = if (!decoded.wantResponse) {
|
||||
runCatching { Position.parseFrom(decoded.payload) }.getOrNull()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
@HiltViewModel
|
||||
class MetricsViewModel
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue