Skip to content

[codex] Add map telemetry and LXMF fixes#20

Draft
brothercorvo wants to merge 13 commits intotorlando-tech:mainfrom
brothercorvo:codex/guard-missing-packed-message
Draft

[codex] Add map telemetry and LXMF fixes#20
brothercorvo wants to merge 13 commits intotorlando-tech:mainfrom
brothercorvo:codex/guard-missing-packed-message

Conversation

@brothercorvo
Copy link
Copy Markdown

@brothercorvo brothercorvo commented Apr 1, 2026

This should fix #16

What changed

  • add offline map display work and Sideband-compatible telemetry location sharing
  • add on-demand tile downloading with SD card caching
  • include follow-up fixes for tile download TLS usage, map rendering, telemetry encoding, and telemetry RX handling
  • fix GPS time sync behavior, TCP reply routing, propagation state refresh, chat propagation indicators, and sent-message status handling
  • update deps/microReticulum to the companion branch from [codex] Harden packed message handling microReticulum#2
  • include the branch's current asset and log additions that are part of the local diff

Why

This branch packages the current local work into a single upstream review unit. The changes center on map and telemetry functionality, plus the LXMF and transport fixes needed to make those flows reliable on device.

Impact

Users get offline map and telemetry capabilities, improved message state handling, and multiple runtime fixes across GPS, TCP reply routing, propagation feedback, and packed-message handling.

Validation

Notes

  • This is a very large draft PR: origin/main..HEAD is currently 12 commits and about 55k changed files, largely due to tile and log artifacts already present on the branch.
  • The parent repo submodule bump depends on the companion microReticulum change being available upstream.

torlando-tech and others added 13 commits March 4, 2026 21:05
…aring

- LVGL PNG decoder (lodepng) + SD card filesystem driver for loading OSM tiles
- MapScreen with 2x2 tile grid, GPS marker, peer location markers, pan/zoom
- 5th nav button (GPS icon) on conversation list for map access
- TelemetryCodec: Sideband/Columba-compatible LXMF telemetry encode/decode
- TelemetryManager: per-peer sharing sessions with duration/expiry, SPIFFS persistence
- ChatScreen location share button with duration picker (15min/1hr/4hr/indefinite)
- UIManager integration: telemetry send/receive via LXMF fields, map marker updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TileDownloader fetches OSM raster tiles over HTTPS when not found
on SD card, saves them for permanent offline cache. MapScreen calls
ensure_tile() before each LVGL load — tiles download once, then
load from SD on subsequent views.

Default tile server: tile.openstreetmap.org (configurable via
set_tile_url). Proper User-Agent set per OSM usage policy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Route mbedtls allocations to PSRAM via mbedtls_platform_set_calloc_free()
  to fix TLS handshake failure (-32512 SSL alloc) with only ~36KB internal heap
- Use WiFiClientSecure with setInsecure() for HTTPS tile downloads from OSM
- Move tile downloads to background FreeRTOS task to avoid blocking UI thread
- Add incremental tile loading (one PNG decode per update cycle) to prevent
  LVGL mutex timeout from decoding 4 tiles synchronously
- Enable LVGL image cache (LV_IMG_CACHE_DEF_SIZE=8) so decoded PNGs stay
  in PSRAM and don't re-decode on every redraw
- Add touch drag panning for map navigation via LV_EVENT_PRESSING

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three bugs prevented Pyxis telemetry from appearing on Columba's map:

1. Bytes({0x02}) called Bytes(size_t capacity=2) instead of creating a
   1-byte buffer containing 0x02. Both field keys were empty, so the
   second fields_set() overwrote the first — FIELD_TELEMETRY was missing
   from the wire payload. Fixed with Bytes(&key, 1).

2. FIELD_COLUMBA_META was encoded as msgpack but Columba expects JSON
   (json.loads after .decode('utf-8')). Changed to manual JSON string.

3. expires was sent as Unix seconds but Columba compares against
   System.currentTimeMillis() (milliseconds). Locations were immediately
   deleted as expired. Now sends expires_ms = end_time * 1000.

Also: set OPPORTUNISTIC delivery method on telemetry/cease messages,
add pyxis_log() diagnostics for telemetry pipeline, and manage tile
download task lifecycle (start on show, stop on hide).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three issues caused wildly incorrect device time:

1. mktime() was called before setting TZ=UTC, corrupting the time
   struct. The second mktime() then operated on mutated values.
   Fix: set TZ=UTC0 before the single mktime() call.

2. GPS cold start takes minutes but boot only waited 15s. If GPS
   missed the window, time was never set. Fix: retry in main loop
   once GPS reports a valid fix.

3. GPS timezone used a raw longitude offset with no DST rules, so
   EDT was shown as EST (off by 1 hour). Fix: use proper POSIX TZ
   strings with DST rules for US timezones.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…arkers

- Fix Bytes({key_int}) bug in LXMessage::unpack_from_bytes() that caused
  incoming field keys to be empty, making fields_get() always miss
- Telemetry-only messages (fields present, no body) now skip chat bubble,
  notification sound, and message store entirely
- Implement position_peer_markers() with proper lat/lon to screen coords
- Add display name resolution for map markers via recall_app_data()
- Store peer locations for repositioning on pan/zoom

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Clear peer markers when locations list is empty (e.g. after cease signal)
instead of returning early, which left stale markers on the map. Add debug
logging around COLUMBA_META field handling to trace cease signal flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Message acknowledgment reports success but LoRa messages do not arrive

2 participants