Skip to content

armgit / moss

Public Imported from GitHub
0

MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.

Python

cockpit: a Simple view for a phone or a tablet (the word for now, the battery, one camera, STOP in reach, the stack, one line of log); the whole page is Advanced; ?view= or the width picks, the device remembers; the camera not shown is not streamed; page bench 100

metrox9353d053192c
diff --git a/benches/bench_moss_cockpit_page_cold.py b/benches/bench_moss_cockpit_page_cold.py
index 2e33b6d..695e8d9 100644
--- a/benches/bench_moss_cockpit_page_cold.py
+++ b/benches/bench_moss_cockpit_page_cold.py
@@ -931,6 +931,100 @@ console.log(JSON.stringify({ n: rows.length, kinds: rows.map(function (r) { retu
and not F.get("unknown") and F.get("newest") == evs[-1].get("text") and F.get("wordKnown") is True,
json.dumps({"kinds": sorted(k for k in kinds if k), "page": F})[:400] + r.stderr[:200])
+# ---------------------------------------------------------------------------
+print("F. the Simple view")
+need_s = ["b-view", "simple", "s-word", "s-detail", "s-batt", "s-volt", "s-pct", "s-cam", "b-s-cam", "b-s-stop",
+ "b-s-launch", "b-s-stack-stop", "s-log"]
+check("index.html has the Simple view's elements: #b-view in the header, #simple with the word, the battery, the "
+ "camera frame, STOP, the stack buttons and the log line", all(i in E for i in need_s),
+ ", ".join(i for i in need_s if i not in E))
+sm, mn = E.get("simple", {}), E.get("b-map", {})
+check("#simple sits in #app before <main> and is hidden until the script picks a view: without the script the page "
+ "is Advanced", bool(sm and mn) and sm["pos"] < mn["pos"] and "hidden" in sm.get("attrs", {})
+ and "app" in sm.get("in", []) and "col-right" not in sm.get("in", []),
+ json.dumps({"simple": sm.get("pos"), "b-map": mn.get("pos"), "attrs": sm.get("attrs")}))
+check("#b-view is in the header and says 'Simple' on the Advanced page",
+ re.search(r'<header>[\s\S]*?<button class="btn link" id="b-view"[^>]*>Simple</button>[\s\S]*?</header>', html) is not None)
+check("in Simple the page hides the modules and the floating STOP; its own STOP is sticky at the bottom (always in reach)",
+ "body.simple main { display: none; }" in html and "body.simple #stop-fab { display: none; }" in html
+ and "position: sticky" in rule(".s-stop") and "bottom: 12px" in rule(".s-stop"), rule(".s-stop"))
+check("the word's colours are the page's tokens: .attn = --ui-attention, .accent = mint, .dim = --ui-dim; the word is uppercase",
+ "color: var(--ui-attention)" in rule(".s-word.attn") and "color: var(--moss-mint)" in rule(".s-word.accent")
+ and "color: var(--ui-dim)" in rule(".s-word.dim") and "text-transform: uppercase" in rule(".s-word"))
+check("app.js: STOP in Simple is the same soft stop and its answer shows on all three STOP buttons; Launch map and Stop "
+ "stack are the same stack commands; the view button and the camera switch are wired",
+ '$("b-s-stop").addEventListener("click", softStop);' in js and '["b-stop", "stop-fab", "b-s-stop"]' in js
+ and '$("b-s-launch").addEventListener("click", function () { stackCmd("map"' in js
+ and '$("b-s-stack-stop").addEventListener("click", function () { stackCmd("stop"' in js
+ and '$("b-view").addEventListener("click"' in js and '$("b-s-cam").addEventListener("click"' in js)
+check("app.js: the camera not shown in Simple is not streamed (camWanted in camConnect and camWatch); the view is picked "
+ "at load from ?view=, the device's memory and the width",
+ js.count("!camWanted(n)") >= 2
+ and re.search(r'applyView\(viewFor\(.*"view".*storedView\(\), window\.innerWidth\)\);', js) is not None)
+if node is None:
+ print(" -- skipped, no node here: viewFor, simpleView and simpleLogView on known input")
+else:
+ sdefs = {n: js_def(n) for n in ("SIMPLE_MAX_W", "VIEW_KEY", "SAY_SIMPLE_MS", "BATTERY_LOW_V", "LIVE_S", "dur",
+ "viewFor", "simpleView", "simpleLogView")}
+ check("the Simple view's functions and constants are found in app.js", all(sdefs.values()),
+ ", ".join(n for n, d in sdefs.items() if not d))
+ sjs = "\n".join(sdefs.values()) + r"""
+var base = function (o) { var b = { battery_v: 11.9, battery_pct: 70, mode: 1, age_s: 0.2, firmware_age_s: 0.1, ina_ok: true, stall_count: 0 };
+ Object.keys(o || {}).forEach(function (k) { b[k] = o[k]; }); return b; };
+var up = function (b, nav) { return { stack: { running: true, blueprint: "moss-nav" }, base: b, nav: nav || {} }; };
+var out = {
+ views: [viewFor("simple", null, 1440), viewFor("advanced", "simple", 390), viewFor(null, "advanced", 390),
+ viewFor(null, "simple", 1440), viewFor(null, null, 390), viewFor(null, null, 699), viewFor(null, null, 700),
+ viewFor("junk", "junk", 1440)],
+ offline: simpleView(up(base()), false, false, false),
+ busy: simpleView(up(base()), true, true, false),
+ noStack: simpleView({ stack: { running: false } }, true, false, false),
+ noBase: simpleView({ stack: { running: true }, base: null }, true, false, false),
+ stale: simpleView(up(base({ age_s: 4 })), true, false, false),
+ low: simpleView(up(base({ battery_v: 10.5 })), true, false, false),
+ stalled: simpleView(up(base()), true, false, true),
+ exploring: simpleView(up(base({ mode: 2 }), { exploring: true }), true, false, false),
+ driving: simpleView(up(base({ mode: 2 })), true, false, false),
+ ready: simpleView(up(base({ mode: 1 })), true, false, false),
+ disarmed: simpleView(up(base({ mode: 0 })), true, false, false),
+ lowBeatsStall: simpleView(up(base({ battery_v: 10.0 })), true, false, true).word,
+ logs: [simpleLogView(null, null, 0), simpleLogView(null, { text: "12:00:01 base up", warn: false }, 0),
+ simpleLogView({ text: "Sent.", bad: false, at: 0 }, { text: "x", warn: false }, 7999),
+ simpleLogView({ text: "Sent.", bad: false, at: 0 }, { text: "x", warn: false }, 8000),
+ simpleLogView({ text: "Refused.", bad: true, at: 0 }, { text: "x", warn: false }, 999999),
+ simpleLogView(null, { text: "stall", warn: true }, 0)]
+};
+console.log(JSON.stringify(out));
+"""
+ r = subprocess.run([node, "-e", sjs], capture_output=True, text=True, timeout=30)
+ try:
+ SJ = json.loads(r.stdout)
+ except ValueError:
+ SJ = {}
+ print(" node said:", r.stderr.strip()[:400])
+ check("viewFor: ?view= wins over the memory, the memory over the width, a first visit under 700 px is Simple, "
+ "junk is Advanced",
+ SJ.get("views") == ["simple", "advanced", "advanced", "simple", "simple", "simple", "advanced", "advanced"],
+ json.dumps(SJ.get("views")))
+ W = {k: ((SJ.get(k) or {}).get("word"), (SJ.get(k) or {}).get("cls")) for k in
+ ("offline", "busy", "noStack", "noBase", "stale", "low", "stalled", "exploring", "driving", "ready", "disarmed")}
+ want = {"offline": ("OFFLINE", "attn"), "busy": ("LAUNCHING", ""), "noStack": ("NO STACK", "dim"),
+ "noBase": ("NO TELEMETRY", "dim"), "stale": ("NO TELEMETRY", "attn"), "low": ("BATTERY LOW", "attn"),
+ "stalled": ("STALLED", "attn"), "exploring": ("EXPLORING", "accent"), "driving": ("DRIVING", "accent"),
+ "ready": ("READY", ""), "disarmed": ("DISARMED", "dim")}
+ check("simpleView: one word per state, the worst first: OFFLINE attn, LAUNCHING, NO STACK dim, NO TELEMETRY (dim before "
+ "the base spoke, attn when stale 4 s), BATTERY LOW attn, STALLED attn, EXPLORING / DRIVING accent, READY, "
+ "DISARMED dim", W == want, json.dumps({k: v for k, v in W.items() if want.get(k) != v}))
+ check("simpleView: a low battery outranks a stall; the stale detail says the age ('Nothing from the base for 4 s.')",
+ SJ.get("lowBeatsStall") == "BATTERY LOW" and (SJ.get("stale") or {}).get("detail") == "Nothing from the base for 4 s.",
+ json.dumps([SJ.get("lowBeatsStall"), (SJ.get("stale") or {}).get("detail")]))
+ L = SJ.get("logs") or []
+ check("the Simple status line: nothing -> 'No stack, no log.' dim; the newest log line dim (attn when it warns); a press's "
+ "answer holds it 8 s (mint), an error until the next action (attn)",
+ L == [{"text": "No stack, no log.", "cls": "dim"}, {"text": "12:00:01 base up", "cls": "dim"},
+ {"text": "Sent.", "cls": "ok"}, {"text": "x", "cls": "dim"}, {"text": "Refused.", "cls": "attn"},
+ {"text": "stall", "cls": "attn"}], json.dumps(L))
+
_TMPDIR.cleanup()
print(f"{OK} OK, {KO} KO")
print("TEST PASSED" if KO == 0 else "TEST FAILED")
diff --git a/docs/cockpit.md b/docs/cockpit.md
index cbc393d..87c78bb 100644
--- a/docs/cockpit.md
+++ b/docs/cockpit.md
@@ -484,6 +484,18 @@ over the run.
`tools/moss_cockpit.py --demo` serves synthetic data for working on the page
without a robot.
+### Simple and Advanced
+
+The page has two views. **Advanced** is the whole cockpit described above. **Simple** is one
+column for a phone or a tablet: the word for now (OFFLINE, NO STACK, LAUNCHING, NO TELEMETRY,
+BATTERY LOW, STALLED, EXPLORING, DRIVING, READY, DISARMED; the worst first) with a line that
+says what it means for the hand on the pad, the battery, one camera (a button switches nose and
+wrist; the one not shown is not streamed), a STOP that stays in reach at the bottom of the
+screen, Launch map and Stop stack, and one line of log (the page's last answer while it is
+fresh, then the newest log line). `?view=simple` or `?view=advanced` picks a view and the
+browser remembers it; without either, a first visit narrower than 700 px opens Simple. The
+button at the top right switches at any time.
+
## What it decides
The map shows what the rover sees; the "What it decides." panel says what it
diff --git a/tools/moss_cockpit/app.js b/tools/moss_cockpit/app.js
index 416fa06..526d3f7 100644
--- a/tools/moss_cockpit/app.js
+++ b/tools/moss_cockpit/app.js
@@ -59,6 +59,7 @@ var S = {
pendingGoal: null, camPaused: false, camOk: false, camAt: 0, camLost: null, pfAll: false,
stateAt: 0, stallLatch: { count: null, until: 0 },
decisions: null, decHtml: null, decKeys: null,
+ ui: "advanced", simpleCam: "nose", say: null, lastLog: null, // the Simple view: which view, its camera, its status line
noteTs: undefined // the launcher note last seen (undefined: no state yet)
};
@@ -136,6 +137,7 @@ function say(text, bad) {
var el = $("say");
el.textContent = text;
el.className = bad ? "err" : "ok";
+ S.say = { text: text, bad: !!bad, at: Date.now() }; renderSimpleLog();
clearTimeout(sayTimer);
// a success line fades after a while; an error stays until the next action
if (!bad) sayTimer = setTimeout(function () { if (el.textContent === text) el.textContent = ""; }, 8000);
@@ -417,6 +419,7 @@ function renderControls() {
else if (st.running) title = "Stack up. Nothing moves by itself.";
else title = "Nothing moves by itself.";
setText("ctl-title", title);
+ renderSimple();
}
function epElapsed(ep) {
@@ -487,7 +490,7 @@ function camSilent(n) {
function camConnect(n) {
var c = CAMS[n], st = camState[n], img = $(c.img);
- if (S.camPaused || document.hidden) { img.removeAttribute("src"); st.ok = false; return; }
+ if (S.camPaused || document.hidden || !camWanted(n)) { img.removeAttribute("src"); st.ok = false; return; }
if (!img.getAttribute("src")) { st.at = Date.now(); img.src = c.src + "&t=" + Date.now(); }
}
function camConnectAll() { Object.keys(CAMS).forEach(camConnect); }
@@ -504,7 +507,7 @@ function camRestart(n, why) {
function camWatch(n) {
var st = camState[n];
- if (S.camPaused || document.hidden || !S.online || st.timer) return;
+ if (S.camPaused || document.hidden || !S.online || st.timer || !camWanted(n)) return;
if (!$(CAMS[n].img).getAttribute("src")) { camConnect(n); return; }
var silent = camSilent(n) && !isDemo();
if (Date.now() - st.at < CAM_GRACE_MS) { st.wasSilent = silent; return; }
@@ -1010,6 +1013,7 @@ function watchLaunch() {
var ul = $("launch-tail"), html = "";
lines.slice(-5).forEach(function (l) { html += "<li>" + esc(l) + "</li>"; });
ul.innerHTML = html;
+ if (lines.length) { S.lastLog = { text: String(lines[lines.length - 1]), warn: false }; renderSimpleLog(); }
if (d && d.running) { setTimeout(step, POLL.launch); return; }
launchWatching = false;
var was = S.launchAction;
@@ -1061,7 +1065,7 @@ $("b-ep").addEventListener("click", function () {
var stopTimer = null;
function stopShow(label, bad) { // #say may be scrolled away: the button that was pressed tells too
- ["b-stop", "stop-fab"].forEach(function (id) { var b = $(id); b.textContent = label; b.classList.toggle("fail", !!bad); });
+ ["b-stop", "stop-fab", "b-s-stop"].forEach(function (id) { var b = $(id); b.textContent = label; b.classList.toggle("fail", !!bad); });
clearTimeout(stopTimer);
stopTimer = setTimeout(function () { stopShow("STOP", false); }, bad ? 8000 : 2500);
}
@@ -1078,6 +1082,107 @@ function softStop() {
$("b-stop").addEventListener("click", softStop);
$("stop-fab").addEventListener("click", softStop);
+// ---------------------------------------------------------------- Simple view
+
+// Two views of one page. Advanced is everything above: the modules, the map, the feed. Simple is
+// the column for a phone or a tablet (#simple in index.html): the word for now and the battery,
+// one camera, STOP, the stack, one line of log. ?view=simple or ?view=advanced picks a view and
+// the device remembers it; otherwise the remembered choice; otherwise a first visit narrower than
+// SIMPLE_MAX_W opens Simple. The cameras' elements move into #simple and back, so the streams and
+// their watch are the same code; the camera not shown is not streamed (camWanted).
+var SIMPLE_MAX_W = 700;
+var VIEW_KEY = "moss.cockpit.view";
+var SAY_SIMPLE_MS = 8000; // a press's answer holds the Simple status line this long; an error until the next action
+var BATTERY_LOW_V = 10.8; // the base module's own line
+
+function viewFor(query, stored, width) {
+ if (query === "simple" || query === "advanced") return query;
+ if (stored === "simple" || stored === "advanced") return stored;
+ return typeof width === "number" && width < SIMPLE_MAX_W ? "simple" : "advanced";
+}
+
+function storedView() { try { return localStorage.getItem(VIEW_KEY); } catch (e) { return null; } }
+
+function camWanted(n) { return S.ui !== "simple" || S.simpleCam === n; }
+
+// The word for now in Simple, from the state: {word, cls, detail}. One word, the worst thing first,
+// and a line that says what it means for the hand on the pad.
+function simpleView(state, online, busy, stalled) {
+ var st = (state && state.stack) || { running: false };
+ if (!online) return { word: "OFFLINE", cls: "attn",
+ detail: "The cockpit does not answer. The pad still drives; the firmware stops the tracks 300 ms after its last command." };
+ if (busy) return { word: "LAUNCHING", cls: "", detail: "The stack is starting; its last line is below." };
+ if (!st.running) return { word: "NO STACK", cls: "dim", detail: "Launch map: the lidar map and the pad." };
+ var b = state.base;
+ if (!b) return { word: "NO TELEMETRY", cls: "dim", detail: "Stack up; the base has not spoken yet." };
+ var age = (typeof b.age_s === "number" ? b.age_s : 0) + (typeof b.firmware_age_s === "number" ? b.firmware_age_s : 0);
+ if (age > LIVE_S) return { word: "NO TELEMETRY", cls: "attn", detail: "Nothing from the base for " + dur(age) + "." };
+ if (typeof b.battery_v === "number" && b.battery_v < BATTERY_LOW_V) return { word: "BATTERY LOW", cls: "attn", detail: "Land it." };
+ if (stalled) return { word: "STALLED", cls: "attn",
+ detail: "A commanded track did not move and the base stopped it. Centre the sticks, then drive again." };
+ if (state.nav && state.nav.exploring) return { word: "EXPLORING", cls: "accent", detail: "On its own. A stick or STOP takes over." };
+ if (b.mode === 2) return { word: "DRIVING", cls: "accent", detail: "The pad drives." };
+ if (b.mode === 1) return { word: "READY", cls: "", detail: "Armed. Centred sticks, tracks stopped." };
+ return { word: "DISARMED", cls: "dim", detail: "Stack up, base disarmed." };
+}
+
+function renderSimple() {
+ if (S.ui !== "simple") return;
+ var v = simpleView(S.state, S.online, S.launchBusy, !$("b-stall").hidden);
+ setText("s-word", v.word);
+ $("s-word").className = ("s-word " + v.cls).trim();
+ setText("s-detail", v.detail);
+ var b = S.state && S.state.base, low = !!(b && typeof b.battery_v === "number" && b.battery_v < BATTERY_LOW_V);
+ setText("s-volt", b ? num(b.battery_v, 2) : "--");
+ setText("s-pct", b && typeof b.battery_pct === "number" ? Math.round(b.battery_pct) + " %"
+ : (b && b.ina_ok === false ? "battery sensor not seen" : ""));
+ $("s-batt").classList.toggle("attn", low);
+ var st = stack(), on = S.online, busy = S.launchBusy;
+ $("b-s-launch").disabled = !on || st.running || busy;
+ $("b-s-stack-stop").disabled = !on || (!st.running && !busy);
+ renderSimpleLog();
+}
+
+// The Simple status line: what the page just said (a press's answer) while it is fresh, else the
+// newest log line (the launcher's while a stack starts): {text, cls}.
+function simpleLogView(said, last, nowMs) {
+ if (said && (said.bad || nowMs - said.at < SAY_SIMPLE_MS)) return { text: said.text, cls: said.bad ? "attn" : "ok" };
+ if (last) return { text: last.text, cls: last.warn ? "attn" : "dim" };
+ return { text: "No stack, no log.", cls: "dim" };
+}
+
+function renderSimpleLog() {
+ var v = simpleLogView(S.say, S.lastLog, Date.now());
+ setText("s-log", v.text);
+ $("s-log").className = "s-log num " + v.cls;
+}
+
+function applyView(v) {
+ S.ui = v;
+ var simple = v === "simple";
+ document.body.classList.toggle("simple", simple);
+ $("simple").hidden = !simple;
+ $("b-view").textContent = simple ? "Advanced" : "Simple";
+ $("b-view").setAttribute("aria-pressed", simple ? "true" : "false");
+ var home = simple ? $("s-cam") : $("cams");
+ ["nose", "wrist"].forEach(function (n) {
+ var el = $("cam-" + n);
+ if (el.parentNode !== home) home.insertBefore(el, simple ? $("b-s-cam") : null);
+ el.hidden = simple && n !== S.simpleCam;
+ });
+ $("b-s-cam").textContent = S.simpleCam === "nose" ? "WRIST" : "NOSE";
+ try { localStorage.setItem(VIEW_KEY, v); } catch (e) {}
+ camConnectAll(); renderCamera();
+ if (!simple) { S.fitted = false; resize(); fitView(); }
+ renderSimple();
+}
+
+$("b-view").addEventListener("click", function () { applyView(S.ui === "simple" ? "advanced" : "simple"); });
+$("b-s-cam").addEventListener("click", function () { S.simpleCam = S.simpleCam === "nose" ? "wrist" : "nose"; applyView("simple"); });
+$("b-s-stop").addEventListener("click", softStop);
+$("b-s-launch").addEventListener("click", function () { stackCmd("map", "Launching the mapping stack."); });
+$("b-s-stack-stop").addEventListener("click", function () { stackCmd("stop", "Stopping the stack."); });
+
// ---------------------------------------------------------------- flight check
function loadPreflight() {
@@ -1156,6 +1261,11 @@ function pollLog() {
});
if (!html) html = '<li><span class="t"></span><span class="e dim">' + (stack().running ? "Log is empty." : "No stack, no log.") + "</span></li>";
if (el.innerHTML !== html) el.innerHTML = html;
+ var last = lines.length ? lines[lines.length - 1] : null;
+ S.lastLog = last ? { text: fmtTs(last.ts) + " " + last.event,
+ warn: /warn|error|crit/.test(String(last.level || "").toLowerCase()) }
+ : { text: stack().running ? "Log is empty." : "No stack, no log.", warn: false };
+ renderSimpleLog();
}, function () {});
}
@@ -1295,6 +1405,7 @@ function renderDecisions() {
if ("ResizeObserver" in window) new ResizeObserver(function () { resize(); if (!S.fitted) fitView(); }).observe(wrap);
window.addEventListener("resize", resize);
+applyView(viewFor(window.URLSearchParams ? new URLSearchParams(location.search).get("view") : null, storedView(), window.innerWidth));
resize();
camConnectAll();
renderCamera();
diff --git a/tools/moss_cockpit/index.html b/tools/moss_cockpit/index.html
index db92b91..01303b5 100644
--- a/tools/moss_cockpit/index.html
+++ b/tools/moss_cockpit/index.html
@@ -268,6 +268,46 @@
body.offline [data-live] { opacity: .45; transition: opacity var(--moss-fade-out) var(--moss-ease); }
.stale { opacity: .5; }
+ /* ---- Simple view: the page for a phone or a tablet (?view=simple, or a narrow first visit); the
+ whole page is Advanced. One column: the word for now and the battery, one camera, STOP, the
+ stack, one line of log. The cameras' elements move in here, so their streams are the same. ---- */
+ body.simple #app { display: block; height: auto; padding: 0 16px; }
+ body.simple header { padding: 18px 0 10px; gap: 14px; min-height: 0; flex-wrap: wrap; }
+ body.simple .lockup .mark { width: 26px; }
+ body.simple .lockup .wm { height: 24.5px; }
+ body.simple .lockup { gap: 10px; }
+ body.simple #run-name { white-space: normal; overflow-wrap: anywhere; }
+ body.simple .runline .row { flex-wrap: wrap; row-gap: 4px; } /* the run name wraps and the chip stays on screen */
+ body.simple #idle-note { white-space: normal; }
+ body.simple main { display: none; }
+ body.simple #stop-fab { display: none; } /* the Simple STOP is in the column, sticky at the bottom */
+ #b-view { margin-left: auto; align-self: flex-start; flex: none; }
+ #simple { display: flex; flex-direction: column; gap: 14px; max-width: 720px; margin: 0 auto; padding-bottom: 28px; }
+ .s-status { position: relative; border-top: 1px solid var(--moss-hairline); padding-top: 12px; }
+ .s-status::before { content: ""; position: absolute; left: 0; top: -1px; width: var(--moss-accent-len);
+ height: var(--moss-accent-w); background: var(--moss-mint); }
+ .s-word { font-size: clamp(36px, 11vw, 60px); font-weight: var(--moss-w-display); line-height: 1; letter-spacing: .03em;
+ text-transform: uppercase; overflow-wrap: anywhere; margin-top: 6px; }
+ .s-word.attn { color: var(--ui-attention); }
+ .s-word.accent { color: var(--moss-mint); }
+ .s-word.dim { color: var(--ui-dim); }
+ .s-detail { font-size: var(--ui-fs-body); margin-top: 8px; overflow-wrap: anywhere; }
+ .s-batt { display: flex; align-items: baseline; gap: 12px; }
+ .s-batt .s-volt { font-size: 48px; font-weight: 600; line-height: 1; letter-spacing: -.01em; }
+ .s-batt .unit { font-size: 20px; font-weight: 500; margin-left: -8px; }
+ .s-batt .s-pct { font-size: 20px; }
+ .s-batt.attn .s-volt, .s-batt.attn .unit { color: var(--ui-attention); }
+ /* 36 vh: the word, the battery, the camera and STOP fit one phone screen without a scroll */
+ #s-cam { position: relative; height: 36vh; min-height: 200px; background: rgba(8, 15, 26, .35); overflow: hidden; }
+ #s-cam .cam { position: absolute; inset: 0; height: 100%; }
+ #b-s-cam { position: absolute; right: 10px; top: 8px; z-index: 3; background: rgba(61, 87, 106, .7);
+ backdrop-filter: blur(2px); } /* top right: the sticky STOP never covers it */
+ .s-stop { position: sticky; bottom: 12px; z-index: 5; font-size: 34px; padding: 22px 0 21px;
+ box-shadow: 0 6px 24px rgba(8, 15, 26, .5); }
+ .s-row .btn { padding: 14px 13px; font-size: 16px; }
+ .s-log { font-size: 13px; overflow-wrap: anywhere; min-height: 1.4em; }
+ .s-log.ok { color: var(--moss-mint); }
+
/* ---- phone and narrow windows: one column, map first ---- */
@media (max-width: 1099px) {
#app { display: block; height: auto; padding: 0 16px; }
@@ -318,8 +358,32 @@
<button id="idle-note" class="num dim" type="button" data-live hidden
title="Keep the stack up: the idle count starts again"></button>
</div>
+ <button class="btn link" id="b-view" type="button" aria-pressed="false"
+ title="Simple: the page for a phone or a tablet. Advanced: the whole cockpit.">Simple</button>
</header>
+ <!-- the Simple view: one column for a phone or a tablet; the script fills it and moves the cameras in -->
+ <section id="simple" hidden aria-label="Simple view">
+ <div class="s-status" data-live>
+ <p class="kicker">NOW</p>
+ <p id="s-word" class="s-word dim" role="status" aria-live="polite">--</p>
+ <p id="s-detail" class="s-detail dim">Waiting for the cockpit.</p>
+ </div>
+ <div class="s-batt num" id="s-batt" data-live>
+ <span id="s-volt" class="s-volt">--</span><span class="unit">V</span>
+ <span id="s-pct" class="s-pct dim"></span>
+ </div>
+ <div id="s-cam" data-live>
+ <button class="btn" id="b-s-cam" type="button" title="Switch between the nose and the wrist camera">WRIST</button>
+ </div>
+ <button class="stop s-stop" id="b-s-stop" type="button">STOP</button>
+ <div class="btnrow s-row">
+ <button class="btn primary" id="b-s-launch" type="button">Launch map</button>
+ <button class="btn" id="b-s-stack-stop" type="button">Stop stack</button>
+ </div>
+ <p id="s-log" class="s-log num dim">No stack, no log.</p>
+ </section>
+
<main>
<!-- column 1: flight check, base, system -->
<div class="col" id="col-left">