You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Nice! And yes, sorry for not pulling in the bootloader change as it was.

    Did you try const [discoveredApp] = allClockApps().sort((a, b) => a.sortorder - b.sortorder);? Because Espruino doesn't support destructuring so I'd have thought this might error.

    Is there any way less invasive than calling load()

    Actually, I think you should be able to call load("clock_app_name.js") which at least doesn't require any bootloader mods at all - so it could go in a Widget...

    Bangle.on("lcdPower", function onLcdPower(on) {
      if (!on && " random" === clockApp) {
        // use your previous bootloader code to find a random `clockApp`
        load(clockApp); //< clockApp is the filename, not the file contents
      }
    });
    

    But yes, that forces the screen on. I guess potentially we could have some kind of firmware change that allows it to stay off... Other option is just to load the random clock on the lcdPower on event?

    One option is actually just to modify the clock apps themselves. If each clock app provided a unload() function that unregistered any event handlers, it would be pretty easy to call unload() and then eval() a new clock app.

    Worst case you could detect if a clock didn't implement unload() and then do the load(clockFilename) command.

    P.S. I was scared to load a different bootloader to my watch but I went for it!

    Maybe the word 'bootloader' is overly scary! You can do what you want in JS and you'll always be able to recover the Bangle with 'install default apps' in the App Loader, so go for it!

About

Avatar for Gordon @Gordon started