• I am now storing the widget state in the SAMPLER register, with these two functions (and not setting it to false on boot):

    function getAlertsStoredState() {
        var addr = 0x40012508;
        var val = peek8(addr);
        val = val & 1;
        return val == 1;
      }
      
      function setAlertsStoredState( state ) {
        var addr = 0x40012508;
        var val = peek8(addr) & 254;
        if( state == true )
        {
          val = val + 1;
        }
        poke8(addr,val);
      }
    

    So far it looks like it works the way I intended.
    I would be interested to know if there is a way to make some code run only on first boot, but not on bnt3 long presses, but otherwise it works as expected.

    Thanks for all the advice and replies.

About

Avatar for Matjaz @Matjaz started