You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Honestly, I'm not sure. Mainly it'll be allocating the string, so:

    var evalneed='How much is needed for eval ?';
    var cmd = `var x = E.toString(".bootcde")); ST.eraseAll(); ST.write(".bootcde",x); console.log("survived");'
    if (x===undefined) { throw new Error("Not enough RAM for .bootcde"); }
        else {
    evalneed=''; // Required for eval
    // Ugly hack !
           // Here i do a reset via my custom watchdog function.

    would probably be pretty safe.

    Or... you could just do:

    eval('var x = E.toString(".bootcde")); if (x===undefined) throw new Error("Not enough RAM for .bootcde"); ST.eraseAll(); ST.write(".bootcde",x); console.log("survived");');

    Which might be tidier/safer?


Avatar for Gordon @Gordon started