diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 74ac1670f..af3870fb8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -1119,8 +1119,10 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp) info->via_mqtt = mp.via_mqtt; // Store if we received this packet via MQTT // If hopStart was set and there wasn't someone messing with the limit in the middle, add hopsAway - if (mp.hop_start != 0 && mp.hop_limit <= mp.hop_start) + if (mp.hop_start != 0 && mp.hop_limit <= mp.hop_start) { + info->has_hops_away = true; info->hops_away = mp.hop_start - mp.hop_limit; + } } } diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 30af9d7b0..742bdbf34 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -194,7 +194,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) auto us = nodeDB->readNextMeshNode(readIndex); if (us) { nodeInfoForPhone = TypeConversions::ConvertToNodeInfo(us); - nodeInfoForPhone.hops_away = 0; + nodeInfoForPhone.has_hops_away = false; nodeInfoForPhone.is_favorite = true; fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag; fromRadioScratch.node_info = nodeInfoForPhone; diff --git a/src/mesh/TypeConversions.cpp b/src/mesh/TypeConversions.cpp index 6a90ac703..550f87021 100644 --- a/src/mesh/TypeConversions.cpp +++ b/src/mesh/TypeConversions.cpp @@ -11,9 +11,13 @@ meshtastic_NodeInfo TypeConversions::ConvertToNodeInfo(const meshtastic_NodeInfo info.last_heard = lite->last_heard; info.channel = lite->channel; info.via_mqtt = lite->via_mqtt; - info.hops_away = lite->hops_away; info.is_favorite = lite->is_favorite; + if (lite->has_hops_away) { + info.has_hops_away = true; + info.hops_away = lite->hops_away; + } + if (lite->has_position) { info.has_position = true; if (lite->position.latitude_i != 0)