• We have reset() to reset without loading or running onInit(), but there doesn't seem to be a way to load the stored code without running onInit(). Load() states that it runs onInit(), and reset doesn't load anything.

    Am I missing something simple? It would be useful to be able to get back to the clean, pre-onInit code, so that you could edit a function and save() it again - without having to have the clean code available to re-send (for example, if programming over something other than the IDE. Particularly relevant due to the memory constraints, where functions used to initialize things are deleted after they run to free the memory up.

  • I am probably too ignorant to suggest anything...but I'm willing to look silly if it helps me learn :)

    Could you put some code at the top of onInit() which does an early exit if a button is held down?

  • Mmm, that would work, just if(digitalRead(pin)){return;} or something. Only takes 2.5 memory units.

  • @DrAzzy, how can you tell how much memory is used?

  • In terms of stored code size, which is what I was referring to (since that's usually what you're up against) - you get ~12 bytes per jsvar.

  • is that from trace()? I looked at that but really didn't see anything like "2.5 memory units".

  • The easiest way to check memory is to run process.memory() - it gives you the number of variables that are used.

    As far as not running onInit - I'd afraid there is nothing built-in, so as Manxome says you'd have to put something at the start of it.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Is there a function to load the saved program *without* running onInit()?

Posted by Avatar for DrAzzy @DrAzzy

Actions