Skip to content

Run a Mona OS 4.0 simulator on the about-badge page - #43

Merged
martinwoodward merged 7 commits into
mainfrom
martinwoodward-about-badge-simulator
Oct 21, 2026
Merged

martinwoodward merged 7 commits into
mainfrom
martinwoodward-about-badge-simulator

Conversation

@martinwoodward

Copy link
Copy Markdown
Contributor

The about-badge page showed a static photo. This replaces it with a live simulator on the editor's 3D badge model. It boots the Universe 2026 Mona OS 4.0 menu and runs the stock apps from badger/home. If the simulator errors, or the browser lacks WebGL or worker support, the page shows the original photo instead.

What's included

  • Shared 3D model with the /editor simulator. Zoom moves toward the screen when zooming in and toward the model centre when zooming out. The +/- buttons zoom in 5% steps.
  • Toolbar (about page and /editor):
    • Screen: close-up of the display.
    • Full: the whole badge, shown in place rather than browser full screen.
    • Rotate: turns the model 180 degrees and sets the upside-down input bit, so the firmware rotates the display and the capacitive pad directions swap. Zoom follows the screen in its new position.
    • In /editor, Rotate shares state with the existing "Upside down" checkbox.
  • Input: touch pads on the model, mapped the same way as the input test app.
  • Motion: browser DeviceMotion data feeds the IMU. Without it, the badge is assumed to be held upright.
  • Browser-backed shims:
    • Wi-Fi reports connected, and HTTP goes through the browser.
    • Bluetooth is inert, so Merge Conflict reaches its lobby and asks you to touch an opponent's badge.
    • USB mass storage shows the "USB Disk Mode" screen. HOME acts as RESET and reboots the badge.

Review notes

  • File sizes in public/simulator/filesystem.json are maintained by hand, so update them when editing files under public/simulator/filesystem/.
  • Only the capacitive pads flip on rotate. The physical buttons and keyboard arrows do not.
  • npm run test:editor still has the same failures it had before this PR (simulator examples, text/vector_text, raycast minimap). The tests added or updated here pass, and npm run build succeeds.

martinwoodward and others added 5 commits October 20, 2026 16:26
Replace the about-badge photo with an in-browser BadgeOS simulator that boots the menu and launches the bundled stock apps. Fall back to the badge photo when the browser lacks support or the simulator fails or times out.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
Reuse the editor's three.js badge model so the BadgeOS simulator looks like the physical badge. Keep the photo until the model and first frame are ready, and fall back to it when WebGL or the model fails.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
Sync launcher and apps from badger/home main, add shared firmware compat
shims, zoom toward the screen, and update status text.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
…ulator

Fix simulator boot broken by CRLF checkout of the staged filesystem; default IMU to upright when no motion data.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
…ntrols

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
Copilot AI balanced review requested due to automatic review settings October 21, 2026 01:44

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.

🟡 Changes recommended

Unresolved app-cleanup, startup timing, and control-accessibility defects affect simulator reliability and usability.

6 open issues
What changed in this PR

Replaces the about-badge photo with a live Mona OS simulator, reusing the editor’s 3D badge and retaining photo fallback.

Changes:

  • Adds launcher boot, stock-app loading, motion input, and shared orientation controls.
  • Refreshes bundled apps and simulator compatibility behavior.
  • Extends runtime tests and documents simulator limitations.
File Description
tests/​fixtures/​badge-editor-runtime.mjs Adds motion, HTTP fixtures, and configurable timeout.
tests/​badge-touch-motion.test.mjs Tests motion and touch mappings.
tests/​badge-os-simulator.test.mjs Tests launcher and HOME navigation.
tests/​badge-editor-runtime.test.mjs Extends firmware compatibility checks.
tests/​badge-editor-project.test.mjs Updates bundled app count.
src/​pages/​editor.astro Adds model toolbar controls.
src/​pages/​about-badge.astro Embeds the live simulator.
src/​lib/​badge-os-simulator.ts Loads apps and runs the launcher.
src/​lib/​badge-os-simulator-view.ts Coordinates boot, input, and fallback.
src/​lib/​badge-motion.ts Maps browser motion to badge readings.
src/​lib/​badge-editor.ts Connects motion and orientation controls.
src/​lib/​badge-editor-project.ts Includes firmware compatibility setup.
src/​lib/​badge-editor-model-controller.ts Preserves model rotation state.
src/​components/​badge-os-simulator.astro Defines simulator UI and fallback.
scripts/​sync-editor-apps.mjs Bundles launcher sources and stock metadata.
public/​simulator/​filesystem/​editor_support.py Swaps rotated touch directions.
public/​simulator/​filesystem.json Updates compatibility module size.
public/​editor-apps/​tomato/​README.md Adds timer instructions.
public/​editor-apps/​tennis/​README.md Adds game instructions.
public/​editor-apps/​system/​README.md Documents clock and battery controls.
public/​editor-apps/​snarky_sciuridae/​README.md Adds pet-care instructions.
public/​editor-apps/​snake/​README.md Adds game controls.
public/​editor-apps/​sketchy_sketch/​README.md Adds drawing instructions.
public/​editor-apps/​show/​README.md Documents the light show.
public/​editor-apps/​show/​__init__.py Adds light-show entry point.
public/​editor-apps/​settings/​README.md Documents editable settings.
public/​editor-apps/​sense/​README.md Documents sensor requirements.
public/​editor-apps/​rogue/​world.py Adds world and visibility logic.
public/​editor-apps/​rogue/​scrolls.py Adds scroll effects.
public/​editor-apps/​rogue/​save.py Adds game persistence.
public/​editor-apps/​rogue/​rings.py Adds ring effects.
public/​editor-apps/​rogue/​README.md Adds game instructions.
public/​editor-apps/​rogue/​monsters.py Adds enemies and combat.
public/​editor-apps/​rogue/​items.py Adds inventory item behavior.
public/​editor-apps/​rogue/​content.py Adds game constants.
public/​editor-apps/​pong/​README.md Documents multiplayer requirements.
public/​editor-apps/​plucky_cluck/​README.md Adds game instructions.
public/​editor-apps/​monapet/​README.md Adds pet-care instructions.
public/​editor-apps/​mona_pet/​ui.py Adds pet interface rendering.
public/​editor-apps/​mona_pet/​tufty.py Adds pet state and animation.
public/​editor-apps/​mona_pet/​README.md Documents pet controls.
public/​editor-apps/​mona_pet/​match.py Adds matching minigame.
public/​editor-apps/​mona_pet/​icons.py Adds icon rendering.
public/​editor-apps/​mona_pet/​food.py Adds food selection.
public/​editor-apps/​mona_pet/​clock.py Adds accelerated pet time.
public/​editor-apps/​mona_pet/​__init__.py Adds pet application flow.
public/​editor-apps/​mona_paint/​README.md Documents drawing and tilt controls.
public/​editor-apps/​merge_conflict/​README.md Documents multiplayer controls.
public/​editor-apps/​menu/​ui.py Adds launcher status rendering.
public/​editor-apps/​menu/​silhouettes.py Bundles silhouette geometry.
public/​editor-apps/​menu/​opening.py Adds opening animation.
public/​editor-apps/​menu/​mona.py Adds launcher character rendering.
public/​editor-apps/​menu/​gallery.py Adds launcher photo viewing.
public/​editor-apps/​menu/​celebration.py Adds achievement presentation.
public/​editor-apps/​menu/​__init__.py Adds launcher entry point.
public/​editor-apps/​mass_storage/​README.md Documents USB storage mode.
public/​editor-apps/​life/​README.md Adds simulation instructions.
public/​editor-apps/​life/​__init__.py Expands simulation and painting controls.
public/​editor-apps/​iss/​README.md Adds tracker instructions.
public/​editor-apps/​iss_tracker/​README.md Removes obsolete tracker documentation.
public/​editor-apps/​iss_tracker/​__init__.py Removes obsolete tracker implementation.
public/​editor-apps/​input_test/​README.md Documents input diagnostics.
public/​editor-apps/​hydrate/​README.md Adds hydration-tracking instructions.
public/​editor-apps/​ghost_signal/​README.md Adds game instructions.
public/​editor-apps/​gallery/​README.md Documents image browsing.
public/​editor-apps/​flappy/​README.md Adds game instructions.
public/​editor-apps/​flappy_mona/​README.md Documents game controls.
public/​editor-apps/​flappy_mona/​obstacle.py Adds obstacle behavior.
public/​editor-apps/​flappy_mona/​mona.py Adds player physics and animation.
public/​editor-apps/​flappy_mona/​__init__.py Adds game entry point.
public/​editor-apps/​extend_a_squirrel/​README.md Adds game instructions.
public/​editor-apps/​demos/​README.md Documents graphics demos.
public/​editor-apps/​Copilot/​README.md Documents session-monitor setup.
public/​editor-apps/​Copilot/​assets/​LICENSE.txt Includes artwork license.
public/​editor-apps/​contacts/​README.md Documents contact exchange.
public/​editor-apps/​commits/​README.md Adds game controls.
public/​editor-apps/​clock/​README.md Documents clock configuration.
public/​editor-apps/​camera/​README.md Documents camera setup and limitations.
public/​editor-apps/​camera/​camera_pairing.py Adds camera pairing support.
public/​editor-apps/​camera/​camera_launcher_icon.py Adds launcher icon geometry.
public/​editor-apps/​camera/​camera_core.py Adds transport and photo storage.
public/​editor-apps/​camera/​assets/​NOTICE.txt Includes asset attribution.
public/​editor-apps/​camera/​assets/​LICENSE-MDI.txt Includes icon license.
public/​editor-apps/​camera/​assets/​camera.svg Adds camera icon source.
public/​editor-apps/​camera/​assets/​camera-wireless.svg Adds wireless icon source.
public/​editor-apps/​brattal/​README.md Adds game instructions.
public/​editor-apps/​bee_amazed/​README.md Adds maze controls.
public/​editor-apps/​badge/​README.md Documents profile configuration.
public/​editor-apps/​30_minutes_to_alpha_centauri/​README.md Adds game instructions.
docs/​editor.md Documents simulator behavior and limitations.
.gitattributes Preserves simulator filesystem bytes.

Review effort: Balanced

Comment thread src/lib/badge-os-simulator.ts
Comment thread src/components/badge-os-simulator.astro Outdated
Comment thread src/lib/badge-os-simulator-view.ts Outdated
Comment thread src/lib/badge-os-simulator-view.ts
Comment thread src/lib/badge-os-simulator.ts Outdated
Comment thread src/pages/editor.astro Outdated
martinwoodward and others added 2 commits October 20, 2026 19:10
Adopt main's Screen/Full toggle ids and styling while keeping Rotate; each page's
markup sets the initial view. Use main's sparkle.py (with resume for the menu),
keep browser-backed Wi-Fi, and make the first-install test use the catalog size.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
- Run the active app's on_exit once when HOME returns to the menu
- Restore sys.path after every launch so menu paths don't accumulate
- Suspend the first-frame watchdog while the simulator is paused
- Support Enter/Space and assistive-technology clicks on badge buttons
- Let simulator toolbars wrap on narrow layouts

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1fc6a67b-c720-490b-a2f1-5f3b2cf7362a
@martinwoodward
martinwoodward merged commit 947ed46 into main Oct 21, 2026
2 checks passed
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