Fix: hoplimit of dms would always fallback to hops away of the node even when configured hops was higher (#1495)

* fix hops setting in dms

* Fix hops for exchange position

* Final fix
This commit is contained in:
Benjamin Faershtein 2025-11-06 10:10:25 -08:00 committed by GitHub
parent 0f90d8497a
commit ec5dfd5ae3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View file

@ -350,7 +350,7 @@ extension AccessoryManager {
if toUserNum > 0 {
meshPacket.to = UInt32(toUserNum)
let hopsAway = newMessage.toUser?.userNode?.hopsAway ?? 0
if hopsAway > Int32(truncatingIfNeeded: newMessage.toUser?.userNode?.loRaConfig?.hopLimit ?? 0) {
if hopsAway > Int32(truncatingIfNeeded: newMessage.fromUser?.userNode?.loRaConfig?.hopLimit ?? 0) {
meshPacket.hopLimit = UInt32(truncatingIfNeeded: hopsAway)
}
} else {

View file

@ -3,6 +3,7 @@ import SwiftUI
struct ExchangePositionsButton: View {
var node: NodeInfoEntity
var connectedNode: NodeInfoEntity
@EnvironmentObject var accessoryManager: AccessoryManager
@ -10,7 +11,7 @@ struct ExchangePositionsButton: View {
@State private var isPresentingPositionFailedAlert: Bool = false
var body: some View {
let hopsAway = Int32(truncatingIfNeeded: node.hopsAway > node.loRaConfig?.hopLimit ?? 0 ? node.hopsAway : node.loRaConfig?.hopLimit ?? 0)
let hopsAway = Int32(truncatingIfNeeded: node.hopsAway > connectedNode.loRaConfig?.hopLimit ?? 0 ? node.hopsAway : connectedNode.loRaConfig?.hopLimit ?? 0)
Button {
Task {
do {

View file

@ -460,7 +460,8 @@ struct NodeDetail: View {
}
}
ExchangePositionsButton(
node: node
node: node,
connectedNode: connectedNode
)
TraceRouteButton(
node: node