Switches in drive mode, after the Design canvas' GridSwitches: Menu → Switches (only when /api/outputs answers), 3×3 tiles per page with the output's name, On / Off / Flashing / level, the key and mode driving it and its LED colour line, a group per module, All off, More ▸, a tap toggles. The status pill above the car (pypilot's note in SidePanel): ● REC while the trip is recorded, estimated / no fix, hidden when all is well
This commit is contained in:
1 parent
82a728e024
commit
88fa2d27a3
5 files changed
+162
-5
No files matched your search
@@ -7,7 +7,7 @@ import { watchDashboard, maneuverSvg, laneSvg, distance, VOICE_KEY } from "/js/d
|
||||
import { SPEED_LIMITS, COUNTRY_NAMES, isHeavy, motorwayPayment } from "/js/speed_limits.js";
|
||||
import { currentVehicle, onVehicle } from "/js/panels.js";
|
||||
import { formatSunInfo } from "/js/sun.js";
|
||||
import { pointsMenu, layersMenu, terrainMenu, levelMenu, recordingMenu, todayMenu, elevationHtml, cellButton, bindKey, emptyRow as empty, escapeHtml } from "/js/drive_menus.js";
|
||||
import { pointsMenu, layersMenu, terrainMenu, levelMenu, recordingMenu, todayMenu, switchesMenu, elevationHtml, cellButton, bindKey, emptyRow as empty, escapeHtml } from "/js/drive_menus.js";
|
||||
|
||||
// Driving mode: the grid of docs/design.adoc ("Layout: a grid, not floating
|
||||
// panels"; the Design canvas' Grid) — the page becomes cells, the map one
|
||||
@@ -109,6 +109,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
menuPanel.innerHTML = `<div class="drive-panel__head">Menu</div>
|
||||
<button type="button" class="drive-panel__close" aria-label="Close">✕</button>
|
||||
<button type="button" class="drive-menu__row" data-action="today">Today ▸ <small>the stops left, tonight, the weather, the day's notes</small></button>
|
||||
<button type="button" class="drive-menu__row" data-action="switches" hidden>Switches ▸ <small>the relays and lights, what drives them</small></button>
|
||||
<button type="button" class="drive-menu__row" data-action="overview">The whole route <small>the follow pauses</small></button>
|
||||
<button type="button" class="drive-menu__row" data-action="terrain-auto"></button>
|
||||
<button type="button" class="drive-menu__row" data-action="voice"></button>
|
||||
@@ -150,6 +151,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
renderProfile();
|
||||
menuPanel.querySelector('[data-action="overview"]').addEventListener("click", overview);
|
||||
menuPanel.querySelector('[data-action="today"]').addEventListener("click", () => open(today.el));
|
||||
menuPanel.querySelector('[data-action="switches"]').addEventListener("click", () => open(switches.el));
|
||||
menuPanel.querySelector('[data-action="leave"]').addEventListener("click", () => set(false));
|
||||
const crosshair = document.createElement("div");
|
||||
crosshair.className = "drive-crosshair";
|
||||
@@ -260,7 +262,9 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
endTrip: () => endTrip(),
|
||||
});
|
||||
const today = todayMenu(menuCtx);
|
||||
const menus = [points, layers, terrain, level, recording, today];
|
||||
const switches = switchesMenu(menuCtx);
|
||||
switches.available().then((yes) => { menuPanel.querySelector('[data-action="switches"]').hidden = !yes; });
|
||||
const menus = [points, layers, terrain, level, recording, today, switches];
|
||||
let offRoad = false;
|
||||
let tiltSince = null;
|
||||
let pavedM = 0;
|
||||
@@ -356,6 +360,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
logButton.classList.toggle("drive-trip__log--on", !!log?.active);
|
||||
logState.textContent = log?.active ? `● ${log.folder.replace(/^Trips\//, "")} · ${(log.distance_m / 1000).toFixed(1)} km` : "Not recording";
|
||||
logState.classList.toggle("drive-trip__log-text--on", !!log?.active);
|
||||
document.documentElement.classList.toggle("trip-rec", !!log?.active);
|
||||
};
|
||||
const endTrip = async () => {
|
||||
if (!log?.active || !window.confirm(`End the trip "${log.folder}"? Its track stays in the library.`)) return;
|
||||
@@ -381,7 +386,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
logState.textContent = "Log in to record";
|
||||
}
|
||||
map.getContainer().append(crosshair);
|
||||
app.append(tripPanel, menuPanel, points.el, layers.el, terrain.el, level.el, recording.el, today.el);
|
||||
app.append(tripPanel, menuPanel, points.el, layers.el, terrain.el, level.el, recording.el, today.el, switches.el);
|
||||
|
||||
// --- the grid's cells ---------------------------------------------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user