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

Datalogger unpredictable behavior in MakeCode UI

Open ssande-fwd opened this issue 6 months ago • 4 comments

Describe the bug I am using the datalogger for the first time. I thought the datalog would show up in the MakeCode UI and it seems to have a presence, but I can't get any reliable behavior. I found issue #4916 which makes it seem like you are not able to view datalogs other than by opening the data file, but then what are these interfaces for?

The three things I've seen pop up when I'm using it (screenshots below):

  • A "Data Log" button in the simulator data
  • A data table corresponding to the data logger in the simulator data
  • A "Show data device" button next to "Show data simulator"

Only the data table has actually shown logged data, but it only shows a log that happened in on start, nothing further.

To Reproduce When just using a micro:bit:

  1. Add datalogger extension
  2. Use this code input.onButtonPressed(Button.A, function () { datalogger.log(datalogger.createCV("test", 0)) }) datalogger.setColumnTitles("test") datalogger.log(datalogger.createCV("test", 0))
  3. Observe that the on start datalog transiently shows up in the simulator data but nothing else.

The other variants require our hardware to get to show up. The "Data Log" button seems to be the hardest to reproduce.

Expected behavior If I can't view datalogs then I don't expect there to be a data log interface or any data logs visible. When there are interfaces that don't work it makes me feel like there's something wrong with my implementation, but I can't find anything amiss.

Screenshots

Image Image Image

micro:bit version (please complete the following information): V2.21

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Chrome
  • Version 138.0.7204.101

ssande-fwd avatar Jul 18 '25 16:07 ssande-fwd

It looks like this test determines if the console and data log buttons appear https://github.com/microsoft/pxt/blob/a0a5464b07c5843c21be0c65385eaae3351d8c1f/webapp/src/serial.tsx#L679

Only in the sim data display, and only if both CSV and data log data messages have been received https://makecode.microbit.org/_77h1r8CcpJWV

The mirror to serial block can make the micro:bit send datal og data to serial https://makecode.microbit.org/_J2pi5aUi4P9d

martinwork avatar Jul 21 '25 22:07 martinwork

Ok nice! So if you want to see the data live you just have to use the mirror to serial block. I don't do much hardware stuff so that didn't jump out at me. It says in the docs it's supposed to be on by default, but doesn't seem to be the case. https://makecode.microbit.org/reference/datalogger/mirror-to-serial

ssande-fwd avatar Jul 22 '25 15:07 ssande-fwd

I think for an average user something like "show data logs in MakeCode ON/OFF" would have more meaning.

ssande-fwd avatar Jul 22 '25 15:07 ssande-fwd

It says in the docs it's supposed to be on by default

The default was changed in https://github.com/microsoft/pxt-microbit/pull/4671. See https://github.com/lancaster-university/codal-microbit-v2/issues/167

martinwork avatar Jul 22 '25 21:07 martinwork