feat: road-route imported GPX stops and widen the TFT camera

- 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>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-26 16:27:51 +01:00
1 parent 694fefd98b
commit b7bf2c2b43
22 files changed
+453 -116

No files matched your search

@@ -28,8 +28,11 @@ import java.util.UUID
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
/** One selected bonded CCU, one outstanding JPEG; no screen capture. */
class NaviLiteTransport(context: Context, private val deviceAddress: String) : TftTransport {
/**
* One selected bonded CCU, one outstanding JPEG; no screen capture. [onRequest] receives
* dashboard-initiated services (for example handlebar zoom) on the I/O thread; keep it short.
*/
class NaviLiteTransport(context: Context, private val deviceAddress: String, private val onRequest: (service: Int, payloadSize: Int) -> Unit = { _, _ -> }) : TftTransport {
private val context = context.applicationContext
private val state = MutableStateFlow(ConnectionState.DISCONNECTED)
override val connectionState: StateFlow<ConnectionState> = state.asStateFlow()
@@ -168,6 +171,11 @@ class NaviLiteTransport(context: Context, private val deviceAddress: String) : T
while (true) {
val packet = NaviLiteCodec.read(input)
if (packet.service == service) return packet
if (packet.service == ZOOM_IN_REQUEST || packet.service == ZOOM_OUT_REQUEST) {
// Upstream documents MAP_ZOOM_LEVEL_UPDATE as the reply; the label is the setup value.
send(token, ZOOM_LEVEL_UPDATE, true, ZOOM_LABEL)
}
if (packet.service !in setOf(66, 80, 82, 83)) onRequest(packet.service, packet.payload.size)
}
}
@@ -180,7 +188,7 @@ class NaviLiteTransport(context: Context, private val deviceAddress: String) : T
Triple(2, false, byteArrayOf(0, 0)), Triple(31, false, byteArrayOf(1, 0)),
Triple(10, false, byteArrayOf(0, 0)), Triple(11, false, byteArrayOf(0, 0)),
Triple(13, false, byteArrayOf(1, 0)), Triple(12, false, byteArrayOf(0, 0)),
Triple(14, true, byteArrayOf(7, 0x19, 6, 0, 0x30, 0x2e, 0x32, 0x20, 0x6d, 0x69)),
Triple(ZOOM_LEVEL_UPDATE, true, ZOOM_LABEL),
Triple(3, true, byteArrayOf()), Triple(17, true, byteArrayOf(0, 0, 0, 0, 3, 0x6d, 0x70, 0x68)),
Triple(13, false, byteArrayOf(1, 0)), Triple(12, false, byteArrayOf(1, 0)),
)
@@ -192,4 +200,12 @@ class NaviLiteTransport(context: Context, private val deviceAddress: String) : T
socket = null
runCatching { closing?.close() }
}
companion object {
/** Pillion docs/PROTOCOL.md: APP_MAP_ZOOM_IN/OUT_REQUEST; direction unverified on hardware. */
const val ZOOM_IN_REQUEST = 51
const val ZOOM_OUT_REQUEST = 52
private const val ZOOM_LEVEL_UPDATE = 14
private val ZOOM_LABEL = byteArrayOf(7, 0x19, 6, 0, 0x30, 0x2e, 0x32, 0x20, 0x6d, 0x69)
}
}