• I think you are mixing two ways of running code at startup. there is the E.on('init'... which is useful with method save(). This is (older?) simpler way - you set various things and then run save() and everything is magically saved and restored on boot (if you are lucky :-).

    Then there is another (IMO more deterministic and more transparent) way of never ever using save() method and just saving to flash via button in IDE that will produce .bootcde and/or .bootrst files. Those files run from the beginning so you don't need to call E.on('init'.. like when using save() but you simply run the stuff directly from top to bottom.

    Depends on you which way you prefer but mixing both may produce unexpected results.

    In the code you linked above the stuff in E.on may actually run as last thing at startup after all your code below it, maybe that's not what you want? see the order in https://www.espruino.com/Saving#boot-pro­cess

About

Avatar for fanoush @fanoush started