• Although I am using the cli with rollup if I use the webide with this code below I get the same issue (callbacks are never called) even with "reset before send" in the IDE set.

    If I send

    reset(1)  // reset ram, clear flash
    require('Wifi').save('clear') // clear wifi credentials
    console.log('RAM,flash, and wifi settings have been cleared')

    separately before uploading same issue, no callbacks called.

    if I press my hard reset button on esp board then send/upload callbacks are called.
    if I then send/upload the same program then the callbacks are not called

    this behavior is totally consistent. That soft reset(1) never fixes the issue which I assume is that the previous code is running or for whatever reason no callbacks are called.
    I put in a console.log('udpdated code 2'); // increment for each send and I can see each upload that the just sent update is running but the callbacks never get called until I first do a hard reset.

    So what about my question can the firmware be running multiple scripts? or otherwise what would be causing the callbacks to be silent until a hard reset?? I have not investigated further because as I said unlike linux I just don't understand how espruino firmware manages memory and js processes.

    var wifi = require('Wifi');
    var data = { wifi:{ ssid:'zoesplace',
      'static':{ ip:'',
        gw:'' } } };
      function connect(opts) {
        wifi.on('connected', () => {
          console.log('ESP connected to AP');
          console.log('udpdated code 2'); // increment for each send
           wifi.ping('',function (res) {console.log('in ping callback', res.respTime,'ms');});
           setTimeout(function (val) {console.log('test timeout done');},5000);
        wifi.on('disconnected', () => {
          console.log('ESP disconnected from AP');
        var state = wifi.getStatus();
        console.log('determining wifi status');
        if (state.ssid === opts.ssid & state.station === 'connected') {
          console.log('already connected to', state.ssid);
        } else {
          console.log('not connected...connecting');
          wifi.connect(opts.ssid, {
            password: opts.password
          }, function (err) {
            console.log('in connect callback');
            if (err) { console.log('wifi connection error', err);}

Avatar for dgk @dgk started