diff --git a/TODO.adoc b/TODO.adoc
index 9dc0edb..e7555ff 100644
--- a/TODO.adoc
+++ b/TODO.adoc
@@ -273,7 +273,10 @@ already reaches the home MQTT broker (`mqtt_ext`) from ESPHome nodes in `~/espho
settings → "Simulate driving from the map center", `POST/DELETE /api/sim/gnss`): random
trips over our Valhalla (2–8 km each, one after another) at 90 % of the road's limit, a fix
a second into the same `gnss.*` signals / GNSS_LATEST as the node's (ignored meanwhile)
+*** [x] The dashboard's tilt from the terrain's slope while simulating
*** [ ] Replay a library track (GPX/FIT with times) instead, at its own speed
+** [x] Free look while following: moving the map by hand pauses the follow, "Back to the
+ position" or 15 s untouched resumes it
* [ ] While following a planned route: the route ahead highlighted, distance to the next
maneuver from Valhalla's directions
diff --git a/docs/deployment.adoc b/docs/deployment.adoc
index cbc50d2..07ded00 100644
--- a/docs/deployment.adoc
+++ b/docs/deployment.adoc
@@ -328,7 +328,15 @@ while moving ≥ 1.5 m/s and keeps the last one standing still, so
`/api/gnss/position` has `track` and following in 3D turns heading-up.
The simulation (Dashboard settings, `POST`/`DELETE /api/sim/gnss`) drives
random trips over the local Valhalla and stands in for the node's `gnss.*`
-meanwhile — on the car's server only for trying things out.
+meanwhile — on the car's server only for trying things out. While it
+runs, the dashboard takes the altitude from the terrain (no `gnss.alt`
+then) and, when no IMU sends pitch/roll, tilts the car by it: the DEM's slope 15 m ahead/behind and left/right of the course
+(`dem.js`, zoom 12, the terrain's slope rather than the road's).
+
+Following the position (GNSS, Locate) pauses when the map is moved by
+hand — to look around or change the route — while the marker keeps
+moving; "Back to the position" or 15 s without touching the map resumes
+it (`followPosition`, `gnss.js`).
=== Map data (one way)
diff --git a/public/css/style.css b/public/css/style.css
index b45376f..96a9959 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -3446,6 +3446,8 @@ html.night .maplibregl-marker {
.dash-speed { font-size: 12px; color: var(--inst-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.dash-speed span { font-size: 34px; font-weight: 700; color: var(--inst-text); font-variant-numeric: tabular-nums; letter-spacing: 0; }
+.dash-alt { font-size: 11px; color: var(--inst-muted); text-transform: uppercase; letter-spacing: 0.05em; }
+.dash-alt span { font-size: 18px; font-weight: 700; color: var(--inst-text); font-variant-numeric: tabular-nums; letter-spacing: 0; }
/* Navigation on the dashboard: the speed limit sign and what's ahead. */
.dash-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; text-align: left; font-size: 13px; }
@@ -3507,3 +3509,20 @@ html.night .maplibregl-marker {
.dash-banner__then { margin-top: 4px; font-size: 13px; color: var(--inst-muted); display: flex; align-items: center; gap: 4px; }
.dash-banner__then .dash-banner__icon { width: 14px; height: 18px; }
.dash-banner__on { margin-top: 4px; font-size: 12px; color: var(--inst-muted); text-transform: uppercase; letter-spacing: 0.04em; }
+
+/* gnss.js free look: the follow paused while the map is moved by hand */
+.follow-resume {
+ position: absolute;
+ bottom: 24px;
+ left: 50%;
+ transform: translateX(-50%);
+ z-index: 3;
+ padding: 10px 18px;
+ border: none;
+ border-radius: 999px;
+ background: var(--band);
+ color: var(--band-fg, #fff);
+ font-weight: 600;
+ box-shadow: 0 2px 8px rgb(0 0 0 / 0.35);
+ cursor: pointer;
+}
diff --git a/public/js/dashboard.js b/public/js/dashboard.js
index e486a14..0b51fa9 100644
--- a/public/js/dashboard.js
+++ b/public/js/dashboard.js
@@ -1,5 +1,6 @@
import { isLoggedIn } from "/js/auth.js";
import { onRouteChanged, requestReroute, requestGnssFollow } from "/js/panels.js";
+import { elevationAt } from "/js/dem.js";
// The car's dashboard over the map, off the CAN signals (GET /api/can,
// names from data/can.json): one inclinometer — compass ring around a rear
@@ -9,10 +10,15 @@ import { onRouteChanged, requestReroute, requestGnssFollow } from "/js/panels.js
// Heading: driving, the GNSS course (from consecutive fixes); standing
// still, the compass (imu.heading, once the node sends it) — else the
// last course stays, dimmed.
-const SIGNALS = { pitch: "imu.pitch", roll: "imu.roll", heading: "imu.heading", speed: "gnss.speed", lat: "gnss.lat", lon: "gnss.lon", hdop: "gnss.hdop" };
+const SIGNALS = { pitch: "imu.pitch", roll: "imu.roll", heading: "imu.heading", speed: "gnss.speed", alt: "gnss.alt", lat: "gnss.lat", lon: "gnss.lon", hdop: "gnss.hdop" };
const MOVING_MS = 1.5; // m/s: above this the GNSS course counts
const COURSE_MIN_M = 5; // fixes closer than this: too noisy for a course
const POLL_MS = 500;
+// Simulated tilt: the terrain's slope along the course (pitch) and across
+// it (roll), from the DEM 2·TILT_HALF_M apart — the terrain, not the road:
+// a road cut into a hillside is flatter across than this reads.
+const TILT_ZOOM = 12; // ~20–40 m pixels (offline terrain goes to 13)
+const TILT_HALF_M = 15;
const STALE_S = 5; // older signal: shown as missing
const WARN = { roll: 20, pitch: 25 }; // ° — amber past these, red past 1.5×
const STORE_KEY = "maptool.dashboard";
@@ -31,7 +37,7 @@ const REROUTE_EVERY_MS = 15000;
const ROAD_EVERY_MS = 4000; // /api/road at most this often, only while moving
const TRACE_STEP_M = 10; // fixes kept for /api/road at least this far apart
const LANES_AHEAD_M = 1000; // the next maneuver's lanes from this close
-const DEFAULT_WIDGETS = { inclinometer: true, speed: true, navigation: true, banner: true };
+const DEFAULT_WIDGETS = { inclinometer: true, speed: true, altitude: true, navigation: true, banner: true };
const THEN_M = 300; // the maneuver after the next one shown with it when it follows this closely
const DEFAULT_OPACITY = 0.45; // the card's background, the map shows through
@@ -164,6 +170,31 @@ export class DashboardControl {
this._rerouteAt = 0;
}
+ // What the simulation doesn't send, from the terrain at its position: the
+ // altitude, and pitch / roll in degrees (nose up and right side down
+ // positive, as the inclinometer draws them) — unless a node sends them.
+ async _simulateTerrain() {
+ const { lat, lon } = this._values;
+ if (lat == null) return;
+ this._offlineTerrain ??= fetch("/api/terrain-tiles").then((r) => r.json()).then((d) => d.available).catch(() => false);
+ const offline = await this._offlineTerrain;
+ const rad = Math.PI / 180;
+ const at = (bearing) => {
+ const dx = TILT_HALF_M * Math.sin(bearing * rad);
+ const dy = TILT_HALF_M * Math.cos(bearing * rad);
+ return elevationAt(lon + dx / (111320 * Math.cos(lat * rad)), lat + dy / 111320, offline, { zoom: TILT_ZOOM, smooth: true });
+ };
+ if (this._values.alt == null) {
+ this._values.alt = await elevationAt(lon, lat, offline, { zoom: TILT_ZOOM, smooth: true });
+ }
+ if (this._course == null || this._values.pitch != null || this._values.roll != null) return;
+ const [front, back, right, left] = await Promise.all([0, 180, 90, 270].map((b) => at(this._course + b)));
+ if ([front, back, right, left].includes(null)) return;
+ const deg = (rise) => Math.atan(rise / (2 * TILT_HALF_M)) / rad;
+ this._values.pitch = deg(front - back);
+ this._values.roll = deg(left - right);
+ }
+
// The limit and what's ahead: from the route while on it, else the road.
_navigate() {
const { lat, lon, speed } = this._values;
@@ -237,6 +268,7 @@ export class DashboardControl {