From fd27a814b711e2df929ae6cef982812ae14cfaaa Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 30 Jul 2022 07:36:21 -0500 Subject: [PATCH] Don't send me to null island, please (#1576) * Don't send me to null island, please * Typo Co-authored-by: Sacha Weatherstone --- src/modules/PositionModule.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 899d309b37..bb42d756bc 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -133,22 +133,22 @@ int32_t PositionModule::runOnce() // Only send packets if the channel is less than 40% utilized. if (airTime->channelUtilizationPercent() < 40) { + if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) { + lastGpsSend = now; - lastGpsSend = now; + lastGpsLatitude = node->position.latitude_i; + lastGpsLongitude = node->position.longitude_i; - lastGpsLatitude = node->position.latitude_i; - lastGpsLongitude = node->position.longitude_i; + // If we changed channels, ask everyone else for their latest info + bool requestReplies = currentGeneration != radioGeneration; + currentGeneration = radioGeneration; - // If we changed channels, ask everyone else for their latest info - bool requestReplies = currentGeneration != radioGeneration; - currentGeneration = radioGeneration; - - DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies); - - sendOurPosition(NODENUM_BROADCAST, requestReplies); + DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies); + sendOurPosition(NODENUM_BROADCAST, requestReplies); + } } else { - DEBUG_MSG("Channel utilization is >50 percent. Skipping this opportunity to send.\n"); + DEBUG_MSG("Channel utilization is >40 percent. Skipping this opportunity to send.\n"); } } else if (!config.position.position_broadcast_smart_disabled) {