mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-06 12:16:11 +00:00
polish(nav): tidy parseLatLon precision + ping-menu edge cases
- geo::parseLatLon now rounds lat/lon in double (matching the Add-by-coords form) instead of through a float cast that lost ~1 m near 1e8. - NearbyScreen: preserve the ping menu's selected row across a rebuild instead of snapping back to "Send" when a result line arrives. - NearbyScreen: guard the ping-menu input path so a vanished contact (selectedStoredPubKey == false) closes the popup rather than acting on an uninitialised pub-key buffer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -94,8 +94,8 @@ static inline bool parseLatLon(const char* text, int32_t& lat_1e6, int32_t& lon_
|
||||
if (end2 == q) continue;
|
||||
if (la < -90.0 || la > 90.0 || lo < -180.0 || lo > 180.0) continue;
|
||||
|
||||
lat_1e6 = (int32_t)lroundf((float)(la * 1e6));
|
||||
lon_1e6 = (int32_t)lroundf((float)(lo * 1e6));
|
||||
lat_1e6 = (int32_t)(la * 1e6 + (la < 0 ? -0.5 : 0.5)); // round in double — float loses ~1m at 1e8
|
||||
lon_1e6 = (int32_t)(lo * 1e6 + (lo < 0 ? -0.5 : 0.5));
|
||||
if (label && label_n > 0 && tag) { // label only from a tagged share
|
||||
const char* s = end2;
|
||||
while (*s == ' ') s++;
|
||||
|
||||
Reference in New Issue
Block a user