- Route points, waypoints and sparse tracks are joined along roads with multi-location Valhalla requests (chunks of 20, merged legs); failures offer a retry instead of straight lines. - TFT camera: lower zoom, 45 degree pitch and rider lower in the frame; rider zoom offset from Settings and NaviLite zoom requests 51/52. - Online map failures fall back to an installed offline pack for 30 s. - Production-facing copy cleanup and docs; version 0.14.8 (25). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 KiB
TFT rendering and navigation data
This document distinguishes visual demo data from real GPS data. Output for the Yamaha is an original 480 × 240 image rendered directly; the phone preview should show the same JPEG bytes before they are sent.
Phase 2: synthetic demo
Start the demo with Start animated demo. It supports TFT layout iteration and transport tests. Position, motion, road segment, route, maneuver, and distances are invented by the app. The UI says DEMO · carretera y maniobras ficticias; the TFT says DEMO · RUTA FICTICIA and ETA … · DEMO. These values do not come from the phone, OSM, route calculation, or motorcycle. Demo values are not riding directions.
Drawing uses a logical 480 × 240 Canvas, prioritizing the maneuver, route shape, and position marker. RenderScheduler keeps only the latest state and avoids repaints for small changes: initial thresholds are 2 m position, 3° bearing, 0.5 m/s speed, and 10 m for visible distance changes. Initial maximum redraw rates are 1 FPS stopped, 5 FPS moving, and 10 FPS turning. These limit redraws; NaviLite keepalive sending is a separate configurable cadence (0.5/1/2 s) that waits for ACK and never queues frames. An ACK delay must not build a frame queue or block the demo.
In this phase the renderer draws an illustrative road directly on Canvas; it does not project tiles or a map. The camera policy used by the later map renderer is described under TFT camera and zoom.
Check by starting the simulated demo and watching the preview for at least one minute. Position/bearing should change, frames should remain 480 × 240, and DEMO should remain visible. Stopping the demo should halt its animation and update source. This check does not test GPS or real navigation.
Phase 3: GPS position
The real source uses Android LocationManager with GPS_PROVIDER from the navigation service. On Start real GPS (no map/route), Android requests precise location (ACCESS_FINE_LOCATION) if it is not already granted. The foreground service uses type location, or location|connectedDevice when TFT Bluetooth is also active. The app does not request permanent/background location: the service starts from the visible Activity. Revisit this policy if the start flow changes.
Platform references: location permissions, foreground service types, and restrictions on starting a service from the background.
When switching from demo to GPS, the image stops identifying itself as demo. A local grid moves with real position, and the marker rotates to the real bearing if Android provides one; speed and accuracy also come from the fix. This is a schematic visual aid without cartography, not a scaled map or route. Fixes older than 15 seconds are discarded. If GPS is lost, the TFT shows SIN SEÑAL, --, and Esperando una posición GPS reciente. Do not replace missing measurements with invented values. Do not persist exact coordinates in logs.
The GPS phase has no map, destination search, calculated route, or real turn-by-turn instructions. A decorative line that follows position is not a navigable route. Do not use this screen as riding guidance.
To check it, grant precise location and test while parked in an open area; validate loss/recovery states without sharing coordinates in screenshots or logs. Stop navigation · keep TFT must cancel GPS listening without ending an existing TFT session; Disconnect TFT also ends Bluetooth. This phase has not yet had runtime visual verification; review the exported Canvas image and physical test separately. Emulator location simulation can aid development but does not replace testing on the Xiaomi.
Phase 4: MapLibre in a 480 × 240 frame
The app includes MapLibre Native OpenGL and MapSnapshotter to request a GPU snapshot at 480 × 240 from the service; it then draws its own marker/state, attribution, and text and encodes the NaviLite JPEG. It does not use an Activity MapView or capture StreetCross. The default style is a reduced dark vector JSON in NavFrame assets, using OpenFreeMap tile/vector sources and glyphs. An HTTPS URL setting can replace the remote style; attribution is configured alongside the URL. The MapLibre layer is reused and cancelled on stop/mode change. Snapshots are serial and limited to about 1 Hz moving and 0.5 Hz at rest to avoid a queue; Bluetooth send/ACK cadence is independent. According to the MapSnapshotter API, the object is used on the UI thread, draws off-thread, calls back on the caller thread, and cancel() must be called from its creation thread. The implementation defers continuation resumption until the callback's internal reset finishes.
Start demo map (simulated position) places synthetic position on real cartography and displays MAPA · POSICIÓN SIMULADA, without invented turn/route instructions. Start GPS map (no route) uses granted GPS permission and centers on real fixes, displaying MAPA GPS · SIN RUTA. Earlier GPS-only and demo-only modes remain separate. This phase draws position on a map; it does not search destinations, calculate routes, geocode, or provide navigation instructions.
Remote styles request resources for the visible map area. This reveals the viewed area and network metadata to the configured source even though NavFrame does not store GPS history or log coordinates. OpenFreeMap states that it does not retain IPs in routine logs but may use a CDN and temporarily log IPs during incidents; see its privacy policy and terms. At the time this phase was implemented, offline use required an authorized source and later implementation; it did not download regions or promise offline coverage. Regional package downloads are now documented in OFFLINE.md and GLOBAL_OFFLINE.md. Do not substitute raster tiles from tile.openstreetmap.org; its separate rules prohibit preloading/offline use.
The footer retains OpenFreeMap · © OpenMapTiles · © OpenStreetMap contributors, including error/GPS-loss frames. For custom styles, check all attribution in MapLibre metadata and add provider-required credits; the configuration stores attribution with the URL. Credits must remain legible in the 480 × 240 footer and the phone license screen must link to terms. The SDK is BSD-2-Clause; NavFrame's TFT style does not copy Dark. See MapLibre research and Licensing.
A connection/style error should show MAPA NO DISPONIBLE and remove speed/bearing figures that are no longer current; do not replace the real map with an illustrative road or fabricate a position. Snapshots are asynchronous: create, start, and cancel MapSnapshotter on Main; its callback runs on the caller thread, and restarting must wait for the SDK reset. Old/cancelled callbacks must not publish frames after STOP or a mode change.
Phase limits
Phase 4 added map and position; phase 5 added an explicit route plan. Neither screen is suitable for riding guidance. Robolectric can check composition/overlay but does not run JNI/OpenGL or tiles on a device. Runtime Android and physical map/route tests on the TFT are required. Demo routes must never be confused with real routes. Later phases are in the product brief.
Phase 5: coordinate route plan without guidance
The screen offers origin DEMO Oviedo · simulated or GPS real · last position, destination latitude/longitude, and HTTPS /route endpoint. There is no geocoder. A GPS origin is accepted only when the provider is enabled and the fix is younger than 15 seconds. Calculation is user initiated and uses Valhalla costing=motorcycle (beta profile); the result identifies origin, distance, estimated duration, and maneuver count. Response geometry is retained to draw a line; it is not progress tracking or turn-by-turn navigation.
The polyline is shown as PREVIEW or PLAN … no guidance. The marker continues to show current GPS or demo position; movement does not mean NavFrame performs map matching, detects route adherence, measures turn distance, or dynamically calculates ETA. Switching ordinary sources clears the route/overlay; showing a plan explicitly selects the source appropriate to its origin. Stop route · keep GPS/TFT removes the plan and overlay without stopping GPS/map or transport by itself.
Coordinates are sent to the chosen endpoint only on explicit route calculation. The endpoint receives origin/destination and connection metadata; request body and coordinates are not written to local logs. The implementation limits requests to one per second and does not retry automatically. The public Valhalla/FOSSGIS server is for development/fair use, with no SLA. See ROUTING.md and Licensing; review terms and data retention before changing endpoint.
This phase has no turn-by-turn, active progress, live turns, off-route detection, rerouting, voice, geocoding, or motorcycle road-safety verification. Do not ride using the line or route data. A successful synthetic service request does not validate user GPS origin, MapLibre rendering on the phone, or a route sent to the TFT. Those physical tests remain pending.
Phase 6: guidance on an active route
Start guidance for calculated route activates the GPS tracker or DEMO simulation over route geometry. The HUD shows icon, distance to maneuver, remaining distance, and approximate ETA. NO GPS, OFF ROUTE, and RECALCULATING hide stale estimates. Arrival requires distinct position observations. The service retains continuous transport and stop controls.
Native composition is checked using guidance.png on a test base. This does not certify MapLibre GPU or physical navigation. See testing and thresholds and limitations.
TFT camera and zoom
TftCameraPolicy places the rider at 78% of the frame height with a 45° pitch, so most of the 480 × 240 image shows the road ahead. Zoom depends on speed and on the next turn: 15.5 below 30 km/h or within 200 m of a turn, 15 up to 70 km/h, and 14.5 above. Earlier versions used zoom 15–17.5 with the rider at 60% and no pitch, which showed only a few hundred metres ahead.
The rider can shift the automatic zoom in 0.5 steps between −2 and +2 from ☰ → Ajustes → Zoom del mapa en la pantalla de la moto, or with the motorcycle's zoom controls when the TFT sends NaviLite zoom requests (see NAVILITE.md). The offset is saved and the next frame is redrawn immediately. Pitch and handlebar zoom still need validation on the motorcycle.
Online map fallback
A MapLibre snapshot fails as a whole if any tile, glyph or style resource fails, which happens with patchy mobile coverage. When the online map fails, NavFrame records MAP_ONLINE_FAILED, renders from an installed offline pack or region covering the position if there is one, and retries the online source after 30 seconds. Without an installed pack for the area, the TFT shows MAPA NO DISPONIBLE as before. Installing the bundled Asturias pack (or a regional pack) keeps the TFT map available when coverage drops.