Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad interaction between radio and jacdac proxy mode #6005

Closed
tballmsft opened this issue Nov 8, 2024 · 6 comments
Closed

bad interaction between radio and jacdac proxy mode #6005

tballmsft opened this issue Nov 8, 2024 · 6 comments
Assignees
Labels

Comments

@tballmsft
Copy link
Contributor

tballmsft commented Nov 8, 2024

See https://makecode.microbit.org/_Eei0YxUotXsy

The program uses the Jacdac extension and sends a radio message. The bad behavior:

  1. the second microbit sim starts up and then disappears
  2. the first microbit sim goes into jacdac proxy mode, which also causes a reset of micro:bit sim (via control.reset)

Expected behavior:

  1. the second micro:bit sim stays up
  2. the first micro:bit sim does not go into jacdac proxy mode
@tballmsft
Copy link
Contributor Author

tballmsft commented Nov 9, 2024

OK. Here's what's going on (a bad interaction between features):

  • the radio message starts the new mbit sim
  • the new mbit sim runs a second instance of jacdac, so now there are two mbits on the bus
  • the first mbit goes into proxy mode, which also causes reset, so the second mbit goes away

Sigh...

@tballmsft
Copy link
Contributor Author

tballmsft commented Nov 9, 2024

I think the solution here is for the Jacdac extension to have a way to specify that only one code (mbit) simulator is allowed. @eanders-ms, @pelikhan, @abchatra - what do you think? This can easily be done via providing a new method in the simulator framework that can be called from Static TypeScript.

@tballmsft tballmsft removed the bug label Nov 9, 2024
@tballmsft
Copy link
Contributor Author

The above changes provide a function to turn off multiple simulators (for the rest of a program execution). See following program

input.onButtonPressed(Button.A, function () {
    radio.sendNumber(0)
})
input.onButtonPressed(Button.B, function () {
	control.reset()
})
input.onButtonPressed(Button.AB, function () {
    control.singleSimulator()
})

@tballmsft
Copy link
Contributor Author

approved and committed (will need to bump pxt, pxt-common-packages, pxt-microbit): @abchatra

@tballmsft tballmsft reopened this Nov 12, 2024
@tballmsft tballmsft assigned abchatra and unassigned eanders-ms Nov 12, 2024
@abchatra
Copy link
Collaborator

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants