Front-panel status strip for the browser page#228
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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#ledbarhost element). - Update browser docs and tighten CI by adding
cargo fmt --checkfor 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
---between accesses.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
WebEmugains flat scalar getters wrapping the core's existingBus::front_panel_status()snapshot:power_led(),fdd_led(),fdd_track(),hdd_led(),cd_led(),drive_connected(n),disk_name(n). Option returns map toundefinedin JS (no drive selected / hardware absent / drive empty).try.jsbuilds 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.#ledbarelement 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.WebEmuembedding API section,#ledbarin the page-shell hooks list, and a mention in the hosted-page section ofdocs/guide/browser.md.Also fixes a pre-existing rustfmt drift in the web crate and adds a
cargo fmt --checkstep 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 --lockedandcargo clippyclean;cargo fmt --checknow clean on the web crate.pkg/with wasm-bindgen 0.2.126 and confirmed the generated.d.tssignatures (fdd_track(): number | undefined,disk_name(drive: number): string | undefined, ...).try/index.htmllocally 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->001and 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#ledbarhost path renders into a page-provided element without creating the fallback strip.