diff --git a/toaster-oven/.vscode/extensions.json b/.vscode/extensions.json similarity index 100% rename from toaster-oven/.vscode/extensions.json rename to .vscode/extensions.json diff --git a/ToasterOS/RemoteControl.h b/ToasterOS/RemoteControl.h index 1e0055e..03ae4ff 100644 --- a/ToasterOS/RemoteControl.h +++ b/ToasterOS/RemoteControl.h @@ -22,6 +22,9 @@ class RemoteControl { CRGB OutputLEDData[OutputNumLEDs]; public: + // The combo pressed this loop, like "DC", for custom features. Empty if no combo was finished this loop + char JustPressedCombo[3] = ""; + RemoteControl(ExpressionManager* expressionState, FaceRender* faceRenderer, BoopStateHandler* boopState) { ExpressionState = expressionState; FaceRenderer = faceRenderer; @@ -53,6 +56,8 @@ class RemoteControl { // Update state void Update() { + JustPressedCombo[0] = 0; + int buttonsPressed = 0; if (digitalRead(ProtoConfig.PinRemoteButtonA)) buttonsPressed += BUTTON_A; if (digitalRead(ProtoConfig.PinRemoteButtonB)) buttonsPressed += BUTTON_B; @@ -221,6 +226,10 @@ class RemoteControl { // Wait for 2 button presses if (NumPressedButtons < 2) return; + // Record the combo, for custom features + JustPressedCombo[0] = ButtonToLetter(PressedButtons[0]); + JustPressedCombo[1] = ButtonToLetter(PressedButtons[1]); + // Run the action for this combo, if there is one (RemoteControlActions in Protogen_Faces.h) const RemoteControlActionConfig* action = FindAction(PressedButtons[0], PressedButtons[1]); if (action != NULL) RunAction(action); diff --git a/toaster-oven/AGENTS.md b/toaster-oven/AGENTS.md index ff94882..12b0c1f 100644 --- a/toaster-oven/AGENTS.md +++ b/toaster-oven/AGENTS.md @@ -31,7 +31,7 @@ There's no test framework or linter. Prettier handles formatting only (`.prettie ``` src/ main.ts, App.vue App shell (nav +
). App.vue warns before leaving with undownloaded changes - router/index.ts / and /configure/{panels,expressions,features} + router/index.ts /, /configure/{panels,expressions,features}, /guides and /guides/
/ assets/ main.css Theme tokens + small component classes (.btn, .form-input, .kbd, .display-title) Protogen_Faces.h COPY of ../ToasterOS/Protogen_Faces.h, plus OWO, Binary and UWU, parsed at build time for the preset expressions @@ -52,6 +52,14 @@ src/ read-config.ts Config.h -> state. A list of readers per setting, newest format first read-faces.ts Protogen_Faces.h -> expressions. Adds back missing required expressions import-files.ts Detects each file's type, applies it in place, builds the import summary + guides/ +
/*.md The guides, a folder per section (toaster-os/, later building/ ...). + A --- header with title, description, order and optional group, then Markdown + images/ Pictures for the guides, linked as images/name.png + sections.ts GUIDE_SECTIONS: each section's title, description, coming-soon topics and unnumbered groups + guides.ts Loads the guides (import.meta.glob) and their pictures + markdown.ts Small Markdown renderer. Code blocks are highlighted with highlight.js (only the languages it registers). See its header for what it supports + embeds.ts Parts of the site a guide can show with a `::name args` line, e.g. ::panel-layout 14-one faces/ faces.ts Parses the presets from assets/Protogen_Faces.h. mirror(), expressionToPanels() parse-faces.ts Regex parser for `struct FaceExpression Face_X = {...}` blocks and their animations @@ -59,10 +67,13 @@ src/ required-expressions.ts Expressions the firmware references by name (see below) components/ VisorDisplay.vue SVG visor that draws panels as LED dots. Used on Home (hero), the panel map and the preview + PanelLayoutMap.vue The panel layout map for some connections: C1 #3 labels and wiring. Panels page and guides expressions/ ExpressionCanvas (paint LEDs), ExpressionThumbnail, expression-layout.ts form/ SettingsCard, FormField, ToggleSwitch DownloadConfigButton.vue One button per file (kind="config" | "expressions") views/ + GuidesView.vue The guides by section and group, with each section's "coming soon" topics + GuideView.vue One guide, with "On this page" and previous/next links HomeView.vue Hero visor (blinks; click to boop, using the boop expressions like the firmware) ConfigureView.vue Heading, both download buttons, tabs, sticky "changed" reminder configure/ PanelLayoutView, ExpressionsView, FeaturesView @@ -104,6 +115,25 @@ src/ To check a generator, render the defaults and diff the output against the firmware file. Expect the panel layout to differ unless you pick the `14-two` preset first. `vite`'s `createServer` + `ssrLoadModule` can load the TS modules from a Node script. +## Guides + +The Guides section (`/guides`) is Markdown in `src/guides/
/`. Sections are listed in `GUIDE_SECTIONS` in `sections.ts`, with a title, a description and the topics still to come (shown as "coming soon"). `toaster-os/` covers this software; `building/` (head, body and armour) has no guides yet. The owner's plan for both is `../guides-overview.md`. + +To add a guide, add a `.md` file to its section's folder. Its path is its address: `toaster-os/side-lights.md` is `/guides/toaster-os/side-lights`. Each file starts with a header: + +``` +--- +title: Side lights +description: One sentence, shown on the guides list. +order: 3 +group: Enabling features +--- +``` + +`order` sets its place in the section. `group` is optional: guides with the same group are listed under that heading, where the first of them comes in the order. Each list of guides (a group, or a run of guides without one) is numbered from 1, unless the group is in its section's `unnumberedGroups`. Previous/Next links stay within the section. + +`markdown.ts` renders a small subset of Markdown, listed at the top of that file, including callouts (`> [!NOTE]`, `> [!TIP]`, `> [!WARNING]`). HTML in a guide is shown as text. Links to other pages start with `/` (e.g. `/guides/toaster-os/debugging#check-the-panels`); heading ids are the heading text in lowercase with dashes. Pictures are shared by all sections, in `src/guides/images/`, linked as `images/name.png`; keep them small, as they're bundled with the site. `power-splitting.svg` (the Power section of Setting up) is drawn by `scripts/power-splitting.py`: change the script and run it with `python scripts/power-splitting.py`, rather than editing the SVG. Add new guides to `public/sitemap.xml`. A line like `::panel-layout 14-one` shows a live part of the site (here the panel layout map for a preset) in place of a picture; `embeds.ts` lists what's available, and `GuideView.vue` mounts them. Styles are `.guide-content` in `main.css`. `> [!NOTE]` callouts starting with **To do:** mark parts the owner still needs to write. Toaster OS runs on an Arduino Nano Every or an ESP32, so guides say "microcontroller" (lowercase, except at the start of a sentence or heading), not "Arduino". Name a board only for something specific to it, such as the Nano Every's 6 KB of memory, or for the Arduino IDE. Pin numbers are examples, as people can use any free pins on their microcontroller: say "for example, pin 9" or label a table column "Example pin". + ## State and downloads - All state is in memory. **Nothing persists across a refresh yet.** Saving is planned as "projects" (multiple saved configurations to switch between). Keep state serialisable: plain objects, number bitmaps, and numeric ids on expressions. diff --git a/toaster-oven/README.md b/toaster-oven/README.md index 0b9494d..0527cdc 100644 --- a/toaster-oven/README.md +++ b/toaster-oven/README.md @@ -52,7 +52,7 @@ In either the project root or the toaster-oven directory, create `.vscode/launch "version": "0.2.0", "configurations": [ { - "cwd": "${workspaceFolder}/toaster-oven", + "cwd": "${workspaceFolder}/toaster-oven", // This will need to change if you're running it from the sub-folder "name": "Launch via NPM", "request": "launch", "runtimeArgs": ["start"], diff --git a/toaster-oven/package-lock.json b/toaster-oven/package-lock.json index 25005c7..854ea9f 100644 --- a/toaster-oven/package-lock.json +++ b/toaster-oven/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@fontsource-variable/atkinson-hyperlegible-next": "^5.3.0", "@fontsource-variable/doto": "^5.3.0", + "highlight.js": "^11.12.0", "vue": "^3.5.42", "vue-router": "^5.3.1" }, @@ -2147,6 +2148,15 @@ "dev": true, "license": "BlueOak-1.0.0" }, + "node_modules/highlight.js": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.12.0.tgz", + "integrity": "sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/hookable": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", diff --git a/toaster-oven/package.json b/toaster-oven/package.json index ea9c64a..f44e3c3 100644 --- a/toaster-oven/package.json +++ b/toaster-oven/package.json @@ -15,6 +15,7 @@ "dependencies": { "@fontsource-variable/atkinson-hyperlegible-next": "^5.3.0", "@fontsource-variable/doto": "^5.3.0", + "highlight.js": "^11.12.0", "vue": "^3.5.42", "vue-router": "^5.3.1" }, diff --git a/toaster-oven/public/sitemap.xml b/toaster-oven/public/sitemap.xml index 6ffcae4..fc7b20a 100644 --- a/toaster-oven/public/sitemap.xml +++ b/toaster-oven/public/sitemap.xml @@ -4,4 +4,12 @@ https://toaster.badgercode.co.uk/configure/panels https://toaster.badgercode.co.uk/configure/expressions https://toaster.badgercode.co.uk/configure/features + https://toaster.badgercode.co.uk/guides + https://toaster.badgercode.co.uk/guides/toaster-os/setting-up + https://toaster.badgercode.co.uk/guides/toaster-os/debugging + https://toaster.badgercode.co.uk/guides/toaster-os/managing-expressions + https://toaster.badgercode.co.uk/guides/toaster-os/side-lights + https://toaster.badgercode.co.uk/guides/toaster-os/boop-sensor + https://toaster.badgercode.co.uk/guides/toaster-os/remote-control + https://toaster.badgercode.co.uk/guides/toaster-os/adding-custom-features diff --git a/toaster-oven/scripts/power-splitting.py b/toaster-oven/scripts/power-splitting.py new file mode 100644 index 0000000..296c9eb --- /dev/null +++ b/toaster-oven/scripts/power-splitting.py @@ -0,0 +1,103 @@ +"""Draws src/guides/images/power-splitting.svg, the power-splitting diagram in the +Toaster OS "Setting up" guide (Power section). + +Run it from anywhere with `python scripts/power-splitting.py`. It needs only Python 3. +Change the parts list or the layout numbers below, then run it again. +""" +from pathlib import Path + +OUTPUT = Path(__file__).resolve().parent.parent / 'src' / 'guides' / 'images' / 'power-splitting.svg' + +W, H = 1000, 620 +BG = '#120e1a'; SURFACE = '#1c1726'; BORDER = '#3f3a4d'; TEXT = '#f1f2f6'; MUTED = '#9a93aa' +RED = '#e5484d'; BLACK = '#111014'; CASING = '#7b748d'; ACCENT = '#3d8bff' +FONT = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif" +out = [] +def add(s): out.append(s) +def text(x, y, s, size=15, fill=TEXT, weight=400, anchor='start'): + add(f'{s}') +def box(x, y, w, h, r=10, fill=SURFACE, stroke=BORDER, sw=2): + add(f'') +def wire(d, colour): + if colour == BLACK: # Ground: black, with a light casing so it shows on the dark background + add(f'') + add(f'') + else: + add(f'') +def curve(x1, y1, x2, y2): + mx = (x1 + x2) / 2 + return f'M {x1} {y1} C {mx} {y1}, {mx} {y2}, {x2} {y2}' + +add(f'') +add(f'') + +# --- Power bank ------------------------------------------------------------- +pbx, pby = 40, 230 +box(pbx, pby, 130, 170, r=18) +add(f'') +add(f'') +for i in range(3): + add(f'') +text(pbx + 65, pby + 150, 'Power bank', 15, TEXT, 600, 'middle') +# USB port + plug +add(f'') + +# --- USB cable to the cut end ------------------------------------------------ +cable_y = pby + 85 +add(f'') +add(f'') +text(235, cable_y - 26, 'USB cable', 15, TEXT, 600, 'middle') +text(235, cable_y + 40, 'End cut off, or a', 13, MUTED, 400, 'middle') +text(235, cable_y + 58, 'cable with bare wires', 13, MUTED, 400, 'middle') + +# Exposed wires from the cut end to the splitter +split_x = 420 +v_in_y, g_in_y = 150, 430 +wire(curve(300, cable_y - 6, split_x + 8, v_in_y - 38), RED) +wire(curve(300, cable_y + 6, split_x + 8, g_in_y - 38), BLACK) +text(352, 205, '5V (red)', 15, RED, 700, 'end') +text(385, 412, 'Ground (black)', 15, TEXT, 700, 'end') + +# --- Splitter: two lever-connector blocks ---------------------------------- +def splitter(y, label, colour): + box(split_x, y - 60, 70, 150, r=8, fill='#e8e6ee', stroke='#bdb7ca') + for i in range(5): # Five slots: one in, four out (like a WAGO 221-415) + ly = y - 48 + i * 28 + add(f'') + add(f'') + text(split_x + 35, y - 72, label, 14, TEXT, 700, 'middle') + text(split_x + 78, y - 33, 'in', 12, MUTED, 600) +splitter(v_in_y, '5V splitter', '#f3a5a7') +splitter(g_in_y, 'Ground splitter', '#5a546b') +text(split_x + 35, 560, 'Splitters, e.g. WAGO lever', 13, MUTED, 400, 'middle') +text(split_x + 35, 578, 'connectors or JST Y cables', 13, MUTED, 400, 'middle') + +# --- Parts ------------------------------------------------------------------ +parts = [ + ('Microcontroller', '5V and GND pins'), + ('LED panels', 'VCC and GND of the first panel'), + ('Side LED strips', '5V and GND of the strips'), + ('Fan', 'Red and black wires'), +] +px, pw, ph, gap = 680, 280, 80, 36 +top = (H - (len(parts) * ph + (len(parts) - 1) * gap)) / 2 +for i, (name, pins) in enumerate(parts): + y = top + i * (ph + gap) + box(px, y, pw, ph) + text(px + 22, y + 34, name, 16, TEXT, 600) + text(px + 22, y + 56, pins, 13, MUTED) + vy, gy = y + 24, y + 56 + # Two terminals on the left edge + add(f'') + add(f'') + # Outputs from each splitter, spread over the blocks' slots + out_v = v_in_y - 10 + i * 28 + out_g = g_in_y - 10 + i * 28 + wire(curve(split_x + 70, out_v, px, vy), RED) + wire(curve(split_x + 70, out_g, px, gy), BLACK) + +text(px + pw / 2, top - 18, 'Every part gets its own 5V and ground', 13, MUTED, 400, 'middle') +text(px + pw / 2, top + 4 * ph + 3 * gap + 30, 'Add more outputs for other parts', 13, MUTED, 400, 'middle') +add('') +OUTPUT.write_text('\n'.join(out) + '\n', encoding='utf-8') +print(f'Wrote {OUTPUT}') diff --git a/toaster-oven/src/App.vue b/toaster-oven/src/App.vue index e8a4af5..623d022 100644 --- a/toaster-oven/src/App.vue +++ b/toaster-oven/src/App.vue @@ -2,6 +2,7 @@ import { onBeforeUnmount, onMounted } from 'vue' import { RouterView } from 'vue-router' import NavBar from '@/components/NavBar.vue' +import SiteFooter from '@/components/SiteFooter.vue' import { hasUndownloadedChanges } from '@/state/config-download' // Config isn't saved anywhere yet, so warn before a refresh/close loses changes @@ -19,5 +20,6 @@ onBeforeUnmount(() => window.removeEventListener('beforeunload', warnAboutUndown
+ diff --git a/toaster-oven/src/assets/main.css b/toaster-oven/src/assets/main.css index cda1fe0..2414787 100644 --- a/toaster-oven/src/assets/main.css +++ b/toaster-oven/src/assets/main.css @@ -111,3 +111,194 @@ @apply size-8 p-0 text-slate-400 hover:bg-red-950 hover:text-red-400; } } + +/* Guides: Markdown rendered by src/guides/markdown.ts */ +@layer components { + .guide-content { + @apply max-w-prose leading-relaxed text-slate-300; + } + + .guide-content > * + * { + @apply mt-4; + } + + .guide-content h2 { + @apply mt-20 scroll-mt-20 border-b border-border pb-2 text-2xl font-bold text-white; + } + + .guide-content h3 { + @apply mt-16 scroll-mt-20 text-lg font-semibold text-white; + } + + .guide-content h4 { + @apply mt-12 scroll-mt-20 font-semibold text-slate-200; + } + + /* + The link button after each heading, which copies a link to it. It shows on hover with a mouse, + and all the time on touch screens, which can't hover + */ + .guide-content .heading-link { + @apply ml-1.5 inline-flex size-7 items-center justify-center rounded-md align-middle text-slate-500 no-underline opacity-0 transition-opacity hover:bg-surface hover:text-accent focus-visible:opacity-100; + } + + .guide-content .heading-link svg { + @apply size-4; + } + + .guide-content :is(h1, h2, h3, h4):hover .heading-link { + @apply opacity-100; + } + + @media (hover: none) { + .guide-content .heading-link { + @apply opacity-100; + } + } + + /* A heading straight after another heading, e.g. a ### just under a ##, needs less space */ + .guide-content :is(h2, h3, h4) + :is(h2, h3, h4) { + @apply mt-6; + } + + .guide-content a { + @apply text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent; + } + + .guide-content strong { + @apply font-semibold text-white; + } + + .guide-content ul { + @apply list-disc space-y-1.5 pl-6; + } + + .guide-content ol { + @apply list-decimal space-y-1.5 pl-6; + } + + .guide-content li > ul, + .guide-content li > ol { + @apply mt-1.5; + } + + .guide-content code { + @apply rounded bg-surface px-1.5 py-0.5 text-[0.9em] text-slate-100; + } + + .guide-content pre { + @apply overflow-x-auto rounded-lg border border-border bg-visor-glass p-4 text-sm leading-normal; + } + + .guide-content pre code { + @apply bg-transparent p-0 text-slate-200; + } + + /* Code highlighting (highlight.js classes), in the site's colours. Gold is kept for warnings */ + .guide-content .hljs-comment { + @apply text-slate-400; + } + + .guide-content .hljs-keyword, + .guide-content .hljs-meta { + @apply text-accent-hover; + } + + .guide-content .hljs-type, + .guide-content .hljs-built_in, + .guide-content .hljs-title.class_ { + color: #9fd4ff; + } + + .guide-content .hljs-title.function_ { + @apply text-white; + } + + .guide-content .hljs-string, + .guide-content .hljs-meta .hljs-string { + color: #eaa8d9; + } + + .guide-content .hljs-number, + .guide-content .hljs-literal { + color: #c6b4ff; + } + + .guide-content .hljs-variable { + @apply text-slate-100; + } + + /* A part of the site placed in a guide, e.g. the panel layout map */ + .guide-content .guide-embed { + @apply my-6; + } + + .guide-content .guide-embed-problem { + @apply rounded-lg border border-gold-400/50 bg-gold-950 px-4 py-3 text-sm text-gold-300; + } + + .guide-content img { + @apply rounded-lg border border-border; + } + + .guide-content blockquote { + @apply border-l-2 border-border pl-4 text-slate-400; + } + + .guide-content hr { + @apply my-8 border-border; + } + + .guide-content .table-wrap { + @apply overflow-x-auto; + } + + .guide-content table { + @apply w-full border-collapse text-sm; + } + + .guide-content th { + @apply border-b border-border px-3 py-2 text-left font-semibold text-white; + } + + .guide-content td { + @apply border-b border-border/60 px-3 py-2 align-top; + } + + .guide-content .callout { + @apply rounded-lg border px-4 py-3; + } + + .guide-content .callout > * + * { + @apply mt-2; + } + + .guide-content .callout-title { + @apply text-sm font-semibold; + } + + .guide-content .callout-note { + @apply border-accent/40 bg-accent-muted/60; + } + + .guide-content .callout-note .callout-title { + @apply text-accent; + } + + .guide-content .callout-tip { + @apply border-border bg-surface; + } + + .guide-content .callout-tip .callout-title { + @apply text-slate-200; + } + + /* Gold: needs attention, like the rest of the site */ + .guide-content .callout-warning { + @apply border-gold-400/50 bg-gold-950; + } + + .guide-content .callout-warning .callout-title { + @apply text-gold-300; + } +} diff --git a/toaster-oven/src/components/NavBar.vue b/toaster-oven/src/components/NavBar.vue index 911f5d6..ab43544 100644 --- a/toaster-oven/src/components/NavBar.vue +++ b/toaster-oven/src/components/NavBar.vue @@ -6,6 +6,7 @@ import { hasUndownloadedChanges } from '@/state/config-download' const links = [ { to: '/', label: 'Home', exact: true, showChanges: false }, { to: '/configure', label: 'Configure', exact: false, showChanges: true }, + { to: '/guides', label: 'Guides', exact: false, showChanges: false }, ] diff --git a/toaster-oven/src/components/PanelLayoutMap.vue b/toaster-oven/src/components/PanelLayoutMap.vue new file mode 100644 index 0000000..02cd1e7 --- /dev/null +++ b/toaster-oven/src/components/PanelLayoutMap.vue @@ -0,0 +1,105 @@ + + + diff --git a/toaster-oven/src/components/SiteFooter.vue b/toaster-oven/src/components/SiteFooter.vue new file mode 100644 index 0000000..aee1fa9 --- /dev/null +++ b/toaster-oven/src/components/SiteFooter.vue @@ -0,0 +1,32 @@ + + + diff --git a/toaster-oven/src/components/form/SettingsCard.vue b/toaster-oven/src/components/form/SettingsCard.vue index 66705f7..8d4412a 100644 --- a/toaster-oven/src/components/form/SettingsCard.vue +++ b/toaster-oven/src/components/form/SettingsCard.vue @@ -1,5 +1,6 @@ + + diff --git a/toaster-oven/src/views/GuidesView.vue b/toaster-oven/src/views/GuidesView.vue new file mode 100644 index 0000000..c405a2e --- /dev/null +++ b/toaster-oven/src/views/GuidesView.vue @@ -0,0 +1,75 @@ + + + diff --git a/toaster-oven/src/views/HomeView.vue b/toaster-oven/src/views/HomeView.vue index 517ffe7..93a219a 100644 --- a/toaster-oven/src/views/HomeView.vue +++ b/toaster-oven/src/views/HomeView.vue @@ -96,17 +96,17 @@ onBeforeUnmount(() => {

Protosoft Toaster OS

-

- Beeeeeep!
- Use the Toaster Oven to prepare your protogen :3 -

-

Manage configuration and expressions for your MAX7219 Protogen fursuit head!

+

Beeeeeep!

+

It's time to make some protogens :3

Configure your protogen + + Help guides + {
+ +
+

What is Toaster OS?

+

+ Toaster OS is software for protogens using MAX7219 8x8 LED panels, on an Arduino Nano Every + or ESP32 microcontroller. It draws the face, switches between expressions, and runs extras + like side lights, a boop sensor and a remote control. +

+

+ Toaster Oven, this website, lets you lay out your panels, draw your expressions and choose + your features. Then you download the files and upload them to your microcontroller. The + guides take you + through it, from wiring to your first upload. +

+
+ -
+

Features

Features are configurable and can be disabled if you lack the hardware. diff --git a/toaster-oven/src/views/configure/FeaturesView.vue b/toaster-oven/src/views/configure/FeaturesView.vue index 583d99b..384d477 100644 --- a/toaster-oven/src/views/configure/FeaturesView.vue +++ b/toaster-oven/src/views/configure/FeaturesView.vue @@ -123,6 +123,7 @@ const remoteButtons = [ // Visor map: lights each assigned panel with its part of the default expression const defaultFace = computed(() => expressionToPanels(getDefaultExpression())) -const mapPanelIds = computed(() => { - const usesSideNose = - usageCounts.value.has(PanelType.LEFT_NOSE) || usageCounts.value.has(PanelType.RIGHT_NOSE) - const showSingleNose = usageCounts.value.has(PanelType.SINGLE_NOSE) || !usesSideNose - return PANEL_TYPES.map((p) => p.id).filter((id) => id !== PanelType.SINGLE_NOSE || showSingleNose) -}) - -const mapBitmaps = computed(() => - Object.fromEntries( - Object.entries(defaultFace.value).filter(([id]) => usageCounts.value.has(Number(id))), - ), -) - -const mapMarkers = computed(() => { - const positions = new Map() - face.connections.forEach((connection, ci) => - connection.panels.forEach((panel, pi) => { - if (panel.panelType === EMPTY_PANEL) return - positions.set(panel.panelType, [ - ...(positions.get(panel.panelType) ?? []), - { connection: ci + 1, position: pi + 1 }, - ]) - }), - ) - - const describe = (p: { connection: number; position: number }) => - `C${p.connection} #${p.position}` - - const markers: Record = {} - for (const type of PANEL_TYPES) { - const uses = positions.get(type.id) ?? [] - const name = panelTypeName(type.id) - if (uses.length === 0) { - markers[type.id] = { state: 'unused', title: `${name}: not in use` } - } else if (uses.length === 1) { - markers[type.id] = { - state: 'used', - label: describe(uses[0]!), - title: `${name}: connection ${uses[0]!.connection}, panel ${uses[0]!.position}`, - } - } else { - markers[type.id] = { - state: 'attention', - label: `Used ${uses.length}×`, - title: `${name}: used more than once (${uses.map(describe).join(', ')})`, - } - } - } - return markers -}) - -// Wiring on the map: each connection's panels in order, starting from the Arduino -const mapChains = computed(() => - face.connections - .map((connection, ci) => ({ - label: `Connection ${ci + 1}`, - title: `Connection ${ci + 1} from the Arduino: DIN pin ${connection.pinDataIn}, CS pin ${connection.pinCS}, CLK pin ${connection.pinCLK}`, - panelIds: connection.panels.map((p) => p.panelType).filter((t) => t !== EMPTY_PANEL), - })) - .filter((chain) => chain.panelIds.length > 0), -) - // Presets const presets = computed(() => FACE_LAYOUT_PRESETS.map((preset) => { @@ -201,12 +139,7 @@ function movePanel(connection: FaceLEDConnection, index: number, offset: number) description="Every face panel and whether it's been assigned to a connection. Unused panels are simply not rendered." >

- +

@@ -286,7 +219,8 @@ function movePanel(connection: FaceLEDConnection, index: number, offset: number)

- List panels in the order they're wired, starting with the one connected to the Arduino. + List panels in the order they're wired, starting with the one connected to the + microcontroller.