All you need is three backticks before and after - or highlight it and click the </> code button in the editor. I just edited your post :)
I think your code might have some issues with the way you're calling Bangle.loadWidgets(); multiple times (it's likely to eat up all your memory). Using the code I'd suggested above (with drawSplash replaced with your code) would likely work better.
Another option is I just added some code to the firmware (in cutting edge builds) to handle overlays.
So as a result, if you've got the latest firmware and you copy the following code into lockscreen.boot.js, every time your bangle locks, it'll overwrite the whole screen with a sunset picture, regardless of which app you're in.
Bangle.setLockScreen = on => {
if (on) Bangle.setLCDOverlay(require("heatshrink").decompress(atob("2Gw4f/hswln1qVo1Xqlv+2uw5v+9vhkmSpIC/AX4C/AX4C/AX4C/AXs7tu27dtxJB/IPeTHwQCD7BB/IPLCEAQrI2IP+Spw+HAQfEIP5BbkwEDkIaSzo+JAQXYIP5BXpgEDpBcWIP5BfyYKIhI+VzMkk4+KAQdsIP5B/II4rSoQ+TL5INEIP5BdYSlMBpjIJ2JB/IKUhHyWZCBo+JIP5BViQ+PkwQNyY+MIP5BVpAMLpjNOAYQ+NAQT0QIOitNkI4CyAJEmRcOoQGDHxlpLJJB/IJgCZIKDdLIP5B/klkAYXJHz4CBwgGEk5BKAQdspMyCwNtH0QCBkIGFIKIUCIP5B/INICBoQGEzpBM7AbEIP5BC24EBiQdEyZBcpBB/ILYKBsgqKmTLepxBL4hB/IJICB5InMzJEakM7IJOJCQpB/IIwCB2VJku2Fp1MIi0mIIvYB45B/IP5BKAQfJEhA1PiRNOFoWJBhBBUyB+VsgTQkJB/IP5BRAQXZHCYCNM5ICEpBB/IKDLMAUxB/IKXbthB/IP4CFDQe2IP5B+AQNJlpB/IP5EFDoLOEIP5B77MkyxB/IP5BEtg7bv/kIP5B/IMQCDILv8IP5BkASW3/dtIIuf/5B/IN+3/4IG/5BBBAfJIIX//xB/IJQdHAR+SIKf/9oUG//9AoN/BwJB/INO/F4YICGQRBD2Ebt4IBAApB/IP5BE7TaDDooCM/wCB2mSpJBQFgRBCtkAn5AH//2IJ/f3oFDnZBK9utIJPfGov8gEAIJF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bangle.isLocked());
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
All you need is three backticks before and after - or highlight it and click the
</> code
button in the editor. I just edited your post :)I think your code might have some issues with the way you're calling
Bangle.loadWidgets();
multiple times (it's likely to eat up all your memory). Using the code I'd suggested above (with drawSplash replaced with your code) would likely work better.Another option is I just added some code to the firmware (in cutting edge builds) to handle overlays.
So as a result, if you've got the latest firmware and you copy the following code into
lockscreen.boot.js
, every time your bangle locks, it'll overwrite the whole screen with a sunset picture, regardless of which app you're in.