firmware icon indicating copy to clipboard operation
firmware copied to clipboard

fix(MQTT): Send first MapReport as soon as possible

Open ndoo opened this issue 1 month ago • 1 comments

  1. fix(MQTT): First MapReport does not get sent

    Throttle::isWithinTimespanMs(last_report_to_map, map_publish_interval_msecs) is used to maintain the map reporting interval, but because last_report_to_map has an initial value of 0, the map report routine does not start until the system millis() time has passed map_publish_interval_msecs.

    Fix this by adding a check that last_report_to_map is not 0.

  2. feat(MQTT): Send MapReporting immediately upon location fix

    Do not update last_report_to_map when Map Report is attempted without a valid location, as this results in waiting up to an hour (or configured Map Report interval).

    That usually happens because most nodes do not keep GPS warm, so GPS usually locks after the first attempt at Map Report.

    This change also results in the log WARNing message getting spammed until a location is obtained, so remove the message for now.

🤝 Attestations

  • [x] I have tested that my proposed changes behave as described.
  • [x] I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • [x] Other: Heltec T114v2
    • [x] Other: Lilygo T3-S3

ndoo avatar Dec 05 '25 17:12 ndoo

After discussion with Ixitxachitl on Discord, it looks like Map Reporting does get sent, but only after the millis() timer has passed the first interval.

I can't think of any good reason not to send the first possible map report instead of letting the clock tick up to the first interval.

So, keeping the code the same, but re-wording the PR and commit to match the actual fix (at least, how I perceive it).

Please help to request re-review.

ndoo avatar Dec 05 '25 17:12 ndoo

Thank you for the feedback i’ll give it a go later today.

On Fri, Dec 19, 2025 at 07:22 Tom Fifield @.***> wrote:

@.**** commented on this pull request.

In src/mqtt/MQTT.cpp https://github.com/meshtastic/firmware/pull/8872#discussion_r2632982097:

     return;
  • if (localPosition.latitude_i == 0 && localPosition.longitude_i == 0) {
  •    last_report_to_map = millis();
    

good idea. there is throttle logic in gps/rtc.cpp if you want to copy that

— Reply to this email directly, view it on GitHub https://github.com/meshtastic/firmware/pull/8872#discussion_r2632982097, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACAFAD3GZ73774W7L3NKO34CMZL7AVCNFSM6AAAAACOFSJWYCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKOJVGYZTMOJZGM . You are receiving this because you authored the thread.Message ID: @.***>

ndoo avatar Dec 19 '25 05:12 ndoo