• Great!

    In an ideal world I'd be able to make the Telnet service low-level enough that it could survive a reset. It's on my Todo list for Espruino WiFi, but it's not straightforward!

    I think the easiest option is just to make reset do something different on Espruino:

    global.reset=function() {
      clearWatch();
      clearInterval();
      console.log("-= RESET =-");
    }
    

    Just to post up the complete code that I have (in case it's useful for anyone):

    var WIFI_NAME = "";
    var WIFI_OPTIONS = { password : "" };
    
    var wifi = require("Wifi");
    wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
      if (err) {
        console.log("Connection error: "+err);
        return;
      }
      console.log("Connected!");
      wifi.getIP(print);
      
      require("net").createServer(function(con­n) {
        conn.on('close', x=>USB.setConsole());
        conn.pipe(LoopbackA);
        LoopbackA.pipe(conn);
        LoopbackB.setConsole();
      }).listen(23);
    });
    global.reset=function() {
      clearWatch();
      clearInterval();
      console.log("-= RESET =-");
    };
    

    It would actually be possible to check process.env.CONSOLE=="LoopbackB" inside reset and to avoid doing a reset only in the cases where code was uploaded over WiFi.

About

Avatar for Gordon @Gordon started