• Saving status of a processor has its caveats... even with Espruino boards you can run in trouble - even though they do a much better job, because it is @Gordon's way to make things easy... for small, simple apps... If it get a bit more complicated and you have connected devices that do initialization work, saving does only save Espruino status at best but not the status of your peripherals.

    Therefore, save the code only in non-running code but with an onInit() function setup that kicks everything off (except you know the impact of what you are doing...). With that, you make sure that nothing gets missed and nothing gets doubled.

    In case you worry about the require()... their sequence does not really matter: Before the code is uploaded by the IDE, the IDE parses your code for require("<moduleName>") and uploads related modules, even nested / recursive - into the Modules Cache. And only after that, your main code / application is uploaded.


Avatar for allObjects @allObjects started