Offline hiking trails drawn only from zoom 10 (a whole country's lanes rebuilt per zoom froze the zoomed-out map); TODO: server in the car (RPi CM5) — builds on brick, offline login, HTTPS, Pi kiosk display, home ⇄ car sync with conflict handling, hardware buttons over CAN
CI / check (push) Successful in 19s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-23 15:56:20 +01:00
1 parent 2470099877
commit fdd77986c1
2 files changed
+52 -5

No files matched your search

+47 -4
View File
@@ -161,10 +161,10 @@ already reaches the home MQTT broker (`mqtt_ext`) from ESPHome nodes in `~/espho
=== 3D navigation mode === 3D navigation mode
* [ ] A "follow" mode like a car navigation: camera locked to the GNSS position, rotated to the * [x] A "follow" mode like a car navigation: camera locked to the GNSS position, rotated to the
heading, pitched ~60°, smooth easing; the rotation lock released while it's on. The pieces heading, pitched ~60°, smooth easing — the tracker's "Navigate" (see the Tablet-friendly
exist: pitch toggle, raster-dem terrain (MapLibre can also do real 3D relief from it), section); follows the MQTT tracker, not the browser's own GNSS control yet
Liberty's `building-3d` extrusions ** [ ] Real 3D relief from the raster-dem terrain and Liberty's `building-3d` extrusions while navigating
* [ ] While following a planned route: the route ahead highlighted, distance to the next * [ ] While following a planned route: the route ahead highlighted, distance to the next
maneuver from Valhalla's directions maneuver from Valhalla's directions
@@ -174,6 +174,49 @@ already reaches the home MQTT broker (`mqtt_ext`) from ESPHome nodes in `~/espho
* [ ] Victron/Home Assistant via MQTT or WebSocket — battery SoC, tank levels, temperatures * [ ] Victron/Home Assistant via MQTT or WebSocket — battery SoC, tank levels, temperatures
* [ ] Plot GPS track with historical battery/speed data * [ ] Plot GPS track with historical battery/speed data
== Server in the car (RPi CM5, 8 GB)
The tablet talks to a server far away today, so without internet nothing loads. Moving the
server into the car (on the car's Wi-Fi, next to the MQTT broker) makes everything that's
already offline work on the road. The Pi only serves; heavy builds stay on brick.
* [ ] Run the existing docker-compose stack on the CM5 (arm64: our image handles it, check
that the Valhalla and kiwix-serve images have arm64 builds); data on NVMe, not the SD card
* [ ] Build on brick, ship to the Pi: `offline.pmtiles`, `terrain.pmtiles`, Valhalla
`tiles.tar`, `places/*.sqlite`, `hiking_trails/*.geojson`, the ZIM — an rsync (only when
refreshed, which is rare) instead of the Pi's own build buttons; hide/disable those there
* [ ] Login without internet: Gitea OAuth can't run offline — let the car's LAN through
without login (e.g. `TRUSTED_NETWORKS` CIDR list), or a local fallback account
* [ ] HTTPS on the LAN (the secure session cookie, the PWA and the service worker need it):
the same hostname resolved to the Pi by the car router's DNS, Let's Encrypt cert via DNS-01
* [ ] A touch display on the Pi itself (USB touchscreen, Chromium in kiosk mode on
`http://localhost`) as the car display — solves a lot at once: localhost is a secure
context (no certificate needed for the PWA/service worker) and can skip login, it doesn't
depend on the car's Wi-Fi, buttons plug straight into the Pi (a USB/BLE keypad is just a
keyboard to Chromium, a CAN keypad via SocketCAN on the Pi). The tablet/phone stay optional
* [ ] Sync home ⇄ car — two servers, each fully usable on its own:
** Bulk data (pmtiles, Valhalla tiles, places, hiking trails, ZIM) only on the home network
(the car joining the home Wi-Fi as the trigger), never over LTE
** User data (library: folders/items/notes, tracker settings, logged trail) whenever both
ends are reachable, LTE included — small, incremental
** Builds on the library's existing pieces (docs/library-design.adoc): `rev` change counter,
`GET /api/library/changes?since=<rev>`, tombstones, `item_history` for the losing version.
Missing for two servers: per-peer high-water marks (my rev on your side and vice versa),
ids that never collide (UUIDs, already for items), and a base version per item so a real
conflict (both sides changed since the last sync) is told apart from a plain update
** Conflicts: per item, newer `updated_at` wins (clocks: the Pi needs NTP/GNSS time), the
other version into `item_history` and flagged in the UI so it can be restored; a delete vs.
an edit keeps the edit
** Logged tracker positions: append-only, merged by timestamp, no conflicts
* [ ] Hardware buttons: keyboard shortcuts in the page (zoom, Navigate, night mode, …) — the
cheap way with any BLE/USB keypad that sends plain keys
* [ ] … and the full way: a CANopen keypad (Blink Marine style) on the CAN bus wired straight
to the Pi (SocketCAN `can0`) → the small CAN → MQTT bridge on the host (see "Later in the
van" above; NMT start, key bitmap from `0x180+node`, LEDs via `0x200+node`) → maptool → the
browser over Server-Sent Events; the page's state (navigating, night) back the same way to
light the keypad's LEDs. Server needs to know which browser is "the car display" (a
per-device switch — or simply the Pi's own kiosk display)
== Admin / ops tooling == Admin / ops tooling
* [ ] Offline build log readability — a failed pmtiles/terrain build currently surfaces as one * [ ] Offline build log readability — a failed pmtiles/terrain build currently surfaces as one
+5 -1
View File
@@ -62,6 +62,9 @@ const OPACITY = 0.85;
// 3D terrain (sinks under raised ground, warns on the console) — a known // 3D terrain (sinks under raised ground, warns on the console) — a known
// limitation of the library, not worth working around for an overlay. // limitation of the library, not worth working around for an overlay.
const LANES_LAYER_ID = "hiking-trails-lanes"; const LANES_LAYER_ID = "hiking-trails-lanes";
// Zoomed out further, a whole country's lanes took seconds per frame/zoom
// build and froze the map — and a trail line at that scale tells nothing.
const LANES_MIN_ZOOM = 10;
const LANE_SIZES = () => ({ spacing: 3.5, width: 3, casingWidth: 0.5 }); const LANE_SIZES = () => ({ spacing: 3.5, width: 3, casingWidth: 0.5 });
function offlineUrl(code) { function offlineUrl(code) {
return `/tiles/hiking_trails/${code}.geojson`; return `/tiles/hiking_trails/${code}.geojson`;
@@ -332,6 +335,7 @@ export class HikingTrailsControl {
// Below labels (same firstSymbolLayerId spot contour.js/radar.js use), // Below labels (same firstSymbolLayerId spot contour.js/radar.js use),
// so place names/POI icons stay readable on top of the trail lines. // so place names/POI icons stay readable on top of the trail lines.
this._map.addLayer(this._lanes, firstSymbolLayerId(this._map)); this._map.addLayer(this._lanes, firstSymbolLayerId(this._map));
this._map.setLayerZoomRange(LANES_LAYER_ID, LANES_MIN_ZOOM, 24);
} }
_handleClick(event) { _handleClick(event) {
@@ -345,7 +349,7 @@ export class HikingTrailsControl {
// miss just closes an already-open panel rather than showing a "not // miss just closes an already-open panel rather than showing a "not
// found" message, same as clicking empty space anywhere else on the map. // found" message, same as clicking empty space anywhere else on the map.
_handleOfflineClick(event) { _handleOfflineClick(event) {
const hit = this._lanes?.queryLane(event.point, 8); const hit = this._map.getZoom() >= LANES_MIN_ZOOM && this._lanes?.queryLane(event.point, 8);
const info = hit && this._routeInfo.get(String(hit.route)); const info = hit && this._routeInfo.get(String(hit.route));
if (!info) { if (!info) {
this._hidePanel(); this._hidePanel();