• Thanks for the info. I might do the saving on kill event.

    Is there any other way ? Like just writing something to some memory location (I need to store a bool), some function call, anything ?
    I wanted to check if I could just write something at some memory location at random.

    The experiment:

    1.st: I find some memory address that I could potentially use by:

    var testArray = new Int8Array(10);
    E.getAddressOf(testArray,true);
    

    Return is 536883628;

    Then I write some number to this address:

    var num = 1 + 4 + 16 + 64;
    testArray[0] = num;
    testArray[1] = num;
    

    And check the output

    peek8(536883628,1);
    

    The return is 85, as expected.

    Now I reload the watch (long press on btn3).
    And try again.
    This time I get a different number (120 instead of 85).
    So this tells me the memory was changed and
    I can't use this trick to store some number between reboots.
    Is there another way ? Like some other memory location,
    some function to set some parameter ?

    Do I understand this correctly: long-pressing button 3 (or using load) will completely reset the js interpreter, and read all .boot files and so on ?
    Would it be possible to use a saved state of the interpreter (saved with http://www.espruino.com/Reference#l__glo­bal_save) which gets loaded at the beginning of a .boot script and contains a Int8Array ?

    Or is there really no way to achieve this ?

About

Avatar for Matjaz @Matjaz started