pxt-microbit icon indicating copy to clipboard operation
pxt-microbit copied to clipboard

web USB reset of micro:bit upsets data logging programs

Open jaustin opened this issue 3 years ago • 12 comments

When data logging, the micro:bit has a timestamp which is 'time since boot' - this is nice for quickly previewing data.

If you plug in a battery and then do things over a long period of time the time stamps are reliable, except if you are using MakeCode and web USB - in which case the micro:bit gets arbitrarily reset in a set of cases - certainly when you plug the micro:bit back in while web USB is connected.

The result is that your data doesn't have continuous time stamps.

Is it possible to avoid resetting the micro:bit so often with web USB?

CC @martinwork who noticed that beta does this more than live in https://github.com/microsoft/pxt-microbit/issues/4676#issuecomment-1133945430

jaustin avatar May 23 '22 11:05 jaustin

Related: https://github.com/microsoft/pxt-microbit/issues/3418, https://github.com/microsoft/pxt-microbit/issues/3357

martinwork avatar May 23 '22 12:05 martinwork

This is a daplink issue, it resets when setting the baudrate.

pelikhan avatar May 24 '22 23:05 pelikhan

Do you have to set the buadrate? If MakeCode is always 115200 and the micro:bit defaults to that, is it actually necessary?

jaustin avatar May 26 '22 10:05 jaustin

We don't know if the user flashed a program using another environment or changed the baudrate

pelikhan avatar May 26 '22 15:05 pelikhan

But if they have serial at a different baudrate, MakeCode doesn't support that anyway (eg #3537) , and if they changed the baudrate somewhere else, that's a pretty uncommon use-case to drive resetting everyone's board (and therefore resetting all timestamps on data logging programs).

jaustin avatar May 26 '22 15:05 jaustin

Any change in this space would require testing accross (1) V1 vs V2 (2) data logger vs not data logger (3) all versions of DapLink in circulation.

pelikhan avatar Jun 01 '22 19:06 pelikhan

Added flags to skip those resets: https://github.com/microsoft/pxt-microbit/commit/347f1e11e66fb3001f644435b83592c76e133d6f

pelikhan avatar Jun 01 '22 19:06 pelikhan

Fixed

abchatra avatar Jun 01 '22 19:06 abchatra

@jaustin what is the plan of action here?

abchatra avatar Jun 01 '22 19:06 abchatra

We reset while setting the baud rate for logging.

abchatra avatar Jun 10 '22 15:06 abchatra

For the next release get rid of the second reset.

abchatra avatar Jun 10 '22 15:06 abchatra

Requires a hardware test rig with all versions of DAPLink to validate behavior.

pelikhan avatar Jun 10 '22 15:06 pelikhan

No actionable thing for makecode here.

abchatra avatar Mar 16 '23 16:03 abchatra