Tone clears display on ED1

Issue #93 resolved
José García created an issue

Hello,

We found that Tone functions clear the display the first time we use them. It can be reproduced again doing “clear memory and variables".

Edutec team at Citilab

Comments (4)

  1. José García reporter

    Hello,

    The problem is in _measureLoopOverhead, it has a call to “clear display”. It's this function necessary in boards than have tone support ?

    Regards.

  2. John Maloney repo owner

    Although confusing, that behavior was intentional. However, we don’t need it anymore, so I’ll remove it. Thanks for reporting it.

    Details: Originally, we generated tones on the micro:bit entirely in MicroBlocks code because the Arduino library for the micro:bit did not support the tone() API call. To accurately estimate the loop overhead so we could generate reasonably accurate pitches, it was necessary to turn off the display.

    However, I recently implemented interrupt-driven tone and servo functions in the micro:bit VM. That support (which already existed for most other platforms) results in smoother sound when other things are running (e.g. servos, display updates, etc.). Since the display update overhead was only an issue when measuring the loop overhead on the micro:bit and Calliope, we can now remove the “clear display” block from _measureLoopOverhead. That change will be in the next release. Feel free to use a patched version of the Tone library until then.

  3. Log in to comment