You are reading a single comment by @Kaoron and its replies.
Click here to read the full conversation.
-
I do use the watchdog already, a lot of my early code comes from your demo and jeffmer's repo.
However what I'd like to do is to create a few graphics routines in C to avoid the overhead from the interpreter. At the moment I'm drawing overlays upon overlays to achieve masking, which is pretty suboptimal.
Gotta put my head into custom builds but that's a lot of foreign stuff to take in :).
Edit : That
jswrap_graphics.c
file is brutal.
Nice :-)
Use watchdog, ping it only when button is not held. Something like this https://github.com/fanoush/ds-d6/blob/master/espruino/DFU/Magic3/code.js#L1C1-L6C1
will reboot if something freezes the interpreter event loop or you hold the button. With Rock you can even use the second button for that (BTN2)
If you flashed my bootloader then it is standard Espruino bootloader so it should enter DFU mode when you hold button at reboot time for less than 3 seconds or it enters Espruino but avoids running any js code at startup if you hold it longer (test it now :-), if you put watchdog pinging on BTN2 then you could decide to just reboot (by holding BTN2) or also enter DFU or skip code at startup by holding both.
You could also enable watchdog directly inside C startup code if you modify Espruino FW and are afraid of freezing at FW initialization before js code is executed.
Also if you don't use or trust watchdog then keep battery level low and/or enable something that drains battery fast to let it die sooner (backlight, or maybe Serial port is more harmless - it should die in a day or two from full battery) and you can then hold BTN1 before you attach charger.