From b424492bde5de8036f603aeade391e3f6eef76b9 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Mon, 11 Mar 2024 19:38:34 +0100 Subject: [PATCH] Don't spam logs if no position with map reporting --- src/mqtt/MQTT.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 2de35971ad..760aa7210a 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -552,14 +552,14 @@ void MQTT::perhapsReportToMap() if (!moduleConfig.mqtt.map_reporting_enabled || !(moduleConfig.mqtt.proxy_to_client_enabled || isConnectedDirectly())) return; - if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { - LOG_WARN("MQTT Map reporting is enabled, but precision is 0 or no position available.\n"); - return; - } - if (millis() - last_report_to_map < map_publish_interval_secs * 1000) { return; } else { + if (map_position_precision == 0 || (localPosition.latitude_i == 0 && localPosition.longitude_i == 0)) { + LOG_WARN("MQTT Map reporting is enabled, but precision is 0 or no position available.\n"); + return; + } + // Allocate ServiceEnvelope and fill it meshtastic_ServiceEnvelope *se = mqttPool.allocZeroed(); se->channel_id = (char *)channels.getGlobalId(channels.getPrimaryIndex()); // Use primary channel as the channel_id