You are reading a single comment by @Robin and its replies. Click here to read the full conversation.
  • (**edit: ** oh, I think I misunderstood your last suggestion about setting b, never mind 😊)

    Sure, I'll try that 🙂.

    I've updated the test code to:

    let b;
    function onInit() {
        setTimeout(() => {
            b = 1;
        }, 5000);
    }
    

    The dump now first produces:

    >dump()
    var b = undefined;
    function onInit() {
      setTimeout(() => {
            b = 1;
        }, 5000);
    }
    setTimeout(function (undefined) {b = 1;}, 1840.55); // 1
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    let b;
    function onInit() {
        setTimeout(() => {
            b = 1;
        }, 5000);
    }=undefined
    

    And after > 5 s

    >dump()
    var b = 1;
    function onInit() {
      setTimeout(() => {
            b = 1;
        }, 5000);
    }
    pinMode(D0, "input_pullup", true);
    pinMode(D12, "input_pullup", true);
    pinMode(D13, "input_pullup", true);
    pinMode(D14, "input_pullup", true);
    pinMode(D15, "input_pullup", true);
    pinMode(D18, "input_pullup", true);
    pinMode(D19, "input_pullup", true);
    pinMode(D21, "input_pullup", true);
    pinMode(D22, "input_pullup", true);
    pinMode(D25, "input_pullup", true);
    pinMode(D26, "input_pullup", true);
    pinMode(D27, "input_pullup", true);
    pinMode(D34, "input_pullup", true);
    pinMode(D35, "input_pullup", true);
    pinMode(D36, "input_pullup", true);
    pinMode(D37, "input_pullup", true);
    pinMode(D38, "input_pullup", true);
    pinMode(D39, "input_pullup", true);
    // Code saved with E.setBootCode
    let b;
    function onInit() {
        setTimeout(() => {
            b = 1;
        }, 5000);
    }=undefined
    

    I think I'm at a point where I really need to now what dump() is supposed to do exactly 🤔. Because if its description is something like "Will return your code transformed to es2015, your default pin configuration, and a copy of your original code", the output makes sense.
    I've read https://www.espruino.com/Reference#l__global_dump of course, but I don't know what is meant by "current interpreter state", or more specifically what the interpreter is supposed to hold exactly 🙂.

    I think I need @Gordon, just to see if we're on to something, or if the dump() output is as expected.

About

Avatar for Robin @Robin started