Closed rhubarbdog closed 6 years ago
I can replicate this, on a working micro:bit with MicroPython v1.0.0-rc2, the reset button works on USB power but not on battery. On USB the KL26 tracks the button state and while it's pressed it holds the nrf51 reset line, so in this case it is DAPLink that resets the nRF51. On battery power the nRF51 needs to programmatically do a hard reset on button pressed.
@dpgeorge Looking at the current master I couldn't find anywhere where the reset button could be configured (this is where the uBit does it: https://github.com/lancaster-university/microbit/blob/master/source/MicroBit.cpp#L63 and L90-L91). I had a quick look at MicroPython v0.9 and couldn't easily find anything there either. It's possible the old v1.4 DAL configured the reset button at the same time it created the uBit instance that was included in that version.
Thanks for the report. Indeed we must configure the soft reset button manually at start up. See #550 for a patch that does this.
Note that there is a slight difference with reset behaviour when running on battery: the reset occurs as soon as you press the button, whereas when running on USB holding the reset button down will hold the device in reset until you let go of the reset button. This may have real consequences for users, eg they want to start a timer upon reset and hold down the reset button until they are ready to start timing. To have the same behaviour on battery the start-up code could check if reset is held down and wait until it is released before it starts executing. The downside of doing this is that it's different to how the C++ code would work (and how makecode works).
I do agree that the different behaviour between USB and battery reset is not great, but taking in consideration that DAL and MakeCode and MicroPython v0.9 reset as soon as the button is pressed, then it's probably better to keep the same behaviour as #550 has done. Thanks Damien!
taking in consideration that DAL and MakeCode and MicroPython v0.9 reset as soon as the button is pressed, then it's probably better to keep the same behaviour
Yes I agree, best not to change behaviour now.
When on battery power pressing reset does nothing with versions 1.7.9 that was shipped with mu 1.0.0 beta 12 and MicroPython v1.9.2-34-gd64154c73 on 2017-09-01; micro:bit v1.0.0-rc.2 with nRF51822 Whilst using site https://python.microbit.org/v/1 or the equivalent program in microsoft makecode blocks. The reset button works on battery