microsoft / microsoft/pxt-microbit

Align MakeCode simulator behaviour with CODAL behaviour during concurrent access to LED display

Open
#4,982 3 comments 0 reactions 1 assignee View on GitHub

@eanders-ms is already working on this.

Since May 30, 2023.

P2 Simulator
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

The MakeCode simulator behaves subtly differently to the micro:bit hardware when running programs that attempt concurrent access to the display, resulting in content being displayed in a different order.

To Reproduce
Run the following program (or similar) in the simulator.
image

The simulator interleaves the display icons between each forever loop, displaying:

  • Big Heart
  • Smiley
  • Small Heart
  • Surprised Face

Expected behaviour
The micro:bit firmware (CODAL) by design gives priority to fibers already holding a lock on the display before using a fair round-robin algorithm to allow other fibers access to the display. i.e. back to back operations that access the display are treated as atomic, allowing more intuitive behave for kids and teachers.

The hardware therefore results in the following display order:

  • Big Heart
  • Small Heart
  • Smiley
  • Surprised Face

Screenshots
As above

micro:bit version (please complete the following information):
All versions (anticipated). Verified on V1.3 and V2.21.

Desktop (please complete the following information):
All versions (anticipated). Tested on:

  • OS: Windows 11
  • Browser: Chrome
  • Version 111.0.5563.64

Smartphone (please complete the following information):
-N/A

Additional context
Please note previous discussion here:
https://github.com/lancaster-university/codal-microbit-v2/issues/253

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.