Skip to content

Front-panel status strip for the browser page#228

Merged
LinuxJedi merged 3 commits into
mainfrom
feature/web-status-bar
Jul 19, 2026
Merged

Front-panel status strip for the browser page#228
LinuxJedi merged 3 commits into
mainfrom
feature/web-status-bar

Conversation

@LinuxJedi

Copy link
Copy Markdown
Owner

Summary

The browser build had no drive or power feedback. This adds a status strip below the canvas on the /try page with the same front-panel readouts as the desktop status bar:

  • PWR and FDD LEDs (HDD/CD LEDs appear only on machines fitted with those drives), using the desktop bar's exact LED palette.
  • Three-digit floppy track counter, latching the last track like the desktop bar so it does not flicker back to --- between accesses.
  • Inserted disk name per connected drive (DF0: name.adf), with ellipsis + hover tooltip for long names.

No controls -- the page already has insert/eject/volume -- and the strip only appears once a machine boots.

How

  • WebEmu gains flat scalar getters wrapping the core's existing Bus::front_panel_status() snapshot: power_led(), fdd_led(), fdd_track(), hdd_led(), cd_led(), drive_connected(n), disk_name(n). Option returns map to undefined in JS (no drive selected / hardware absent / drive empty).
  • try.js builds the strip lazily like the fullscreen UI. LEDs and the track counter poll every animation frame with change guards (steady frames do no DOM writes); disk names refresh at the 1 Hz stat tick and immediately on insert, eject and boot.
  • Optional page-shell hook: a #ledbar element hosts the strip and the page owns its layout; without one the strip inserts itself after the canvas shell, so the hosted page works with no markup change.
  • Docs: new getters in the WebEmu embedding API section, #ledbar in the page-shell hooks list, and a mention in the hosted-page section of docs/guide/browser.md.

Also fixes a pre-existing rustfmt drift in the web crate and adds a cargo fmt --check step for it to the wasm CI job -- the crate is a standalone workspace, so the root Formatting step never reached it.

Testing

  • cargo check --target wasm32-unknown-unknown --locked and cargo clippy clean; cargo fmt --check now clean on the web crate.
  • Rebuilt pkg/ with wasm-bindgen 0.2.126 and confirmed the generated .d.ts signatures (fdd_track(): number | undefined, disk_name(drive: number): string | undefined, ...).
  • Drove the unchanged production try/index.html locally in Chrome: booted AROS with a ?df0= disk queued and watched PWR light red, the FDD LED go amber during the disk load and off after, the track counter step --- -> 000 -> 001 and hold, the disk name appear at boot, and Eject clear it synchronously. HDD/CD rows stay hidden on the A500, no console errors, and the #ledbar host path renders into a page-provided element without creating the fallback strip.

The web crate is a standalone workspace, so the root Formatting CI step
never reaches it and one statement had drifted from rustfmt's output.
Reformat it and add a cargo fmt --check step to the wasm job so the
crate stays covered.
The browser build had no drive or power feedback at all. Expose the
desktop status bar's front-panel snapshot on WebEmu as flat getters --
power_led, fdd_led, fdd_track, hdd_led, cd_led, drive_connected and
disk_name -- and have try.js render a status strip below the canvas:
PWR/FDD LEDs (HDD/CD only on machines fitted with those drives), the
three-digit floppy track counter, and the inserted disk name per
connected drive, using the desktop bar's LED palette.

LEDs and the track counter poll every animation frame with change
guards, so steady frames do no DOM writes; the track value latches like
the desktop counter so it does not flicker between accesses. Disk names
refresh at the 1 Hz stat tick and immediately on insert, eject and
boot. A page shell can opt into hosting the strip with a #ledbar
element; without one it inserts itself after the canvas shell, so the
hosted page needs no markup change.
Copilot AI review requested due to automatic review settings July 19, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a front-panel style status strip to the browser /try page, bringing the web demo closer to the desktop frontend by exposing and rendering core “front panel” state (LEDs, floppy track, and inserted disk labels) once a machine is running.

Changes:

  • Extend WebEmu’s wasm API with front-panel status getters (power/FDD/HDD/CD LEDs, selected floppy track, drive connectivity, and disk names).
  • Build and update a DOM status strip in try.js (per-frame LED/track updates; 1 Hz + event-driven disk label refresh; optional #ledbar host element).
  • Update browser docs and tighten CI by adding cargo fmt --check for the standalone web workspace.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
docs/guide/browser.md Documents the new status strip behavior, new embedding API getters, and the optional #ledbar hook.
crates/copperline-web/www/try.js Implements the front-panel status strip UI and hooks it into boot/tick/insert/eject flows.
crates/copperline-web/src/lib.rs Adds wasm-exposed WebEmu getters wrapping the core front_panel_status() snapshot and floppy metadata.
.github/workflows/ci.yml Ensures rustfmt is available and enforces formatting for the web crate workspace in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/copperline-web/www/try.js
The status strip latched the floppy track across live disk inserts and
machine resets, so the counter could keep showing a track from before
the swap. The desktop bar clears its latch in insert_disk_image and
reset_emulator; mirror that so the counter drops back to --- until the
drive is next selected. Raised by review on PR 228.
@LinuxJedi
LinuxJedi merged commit 9ee84c7 into main Jul 19, 2026
11 checks passed
@LinuxJedi
LinuxJedi deleted the feature/web-status-bar branch July 19, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants