feat(bot): !gps fix -- single-shot GPS location

Turns GPS on (if it wasn't already), waits for a stabilised fix
(isValid() + >=8 satellites, then averages 10s of readings), sends the
position, and restores GPS to whatever state it was in before -- up to
a 90s timeout, after which it reports a partial fix (if it got any
samples) or plain failure.

Replies in two parts since a fix takes seconds-to-minutes, unlike every
other bot command here: an immediate "acquiring fix..." ack (through
the existing synchronous command path), then the actual position as a
separate follow-up message once ready, delivered to whichever
destination (DM/room/channel) the request came from. Only one fix can
be in flight at a time -- a second request while one is pending gets an
immediate "already pending" instead of silently replacing it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-07-24 17:57:05 +02:00
parent 176094d32e
commit 220d46de8e
5 changed files with 162 additions and 8 deletions

View File

@@ -1550,6 +1550,8 @@ MyMesh::MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMe
memset(_bot_dm_log, 0, sizeof(_bot_dm_log));
_bot_reply_count = 0;
_next_auto_advert_ms = 0;
_loc_fix.active = false;
_locfix_requested = false;
clearPendingReqs();
next_ack_idx = 0;
sign_data = NULL;
@@ -3083,6 +3085,8 @@ void MyMesh::loop() {
}
}
tickLocFix();
if (_cli_rescue) {
checkCLIRescueCmd();
} else {