• Sun 2020.04.26

    While trying out the online IDE

    https://www.espruino.com/ide/

    and loading working code (it was working Feb 2017) I notice that orange 'Module Wifi not found' errors pop up.

    The call detail appears to remain the same:

    https://www.espruino.com/Reference#http
    https://www.espruino.com/Reference#Wifi



    Snippet is pretty basic

    var wifi = require("Wifi");
    
    function c() {
    
    wifi.connect("2WIRE", {password: "33212052"},
      function(err){
      if(err)console.log(err);
      else console.log("connected!");
    });
    
    }
    
    function g() {
      
    require("http").get("http://pur3.co.uk/h­ello.txt", function(res) {
    
      res.on('data', function(data) {
        console.log("HTTP> "+data);
      });
      res.on('close', function(data) {
        console.log("Connection closed");
      });
    });
    
    }
    
    

    Console output

    >>> Sent
    >>> Loading modules
    loadModule(Wifi)
    loadModule(http)
    ERROR: getURL("https://www.espruino.com/modules­/http.min.js") error : Not Found
    ERROR: getURL("https://www.espruino.com/modules­/Wifi.min.js") error : Not Found
    ERROR: getURL("https://www.espruino.com/modules­/http.js") error : Not Found
    WARNING: [notify_warn] Module http not found
    ERROR: getURL("https://www.espruino.com/modules­/Wifi.js") error : Not Found
    WARNING: [notify_warn] Module Wifi not found
    >>> Minifying
    

    Which when loading in the browser also confirms a 404

    https://www.espruino.com/modules/http.mi­n.js
    404
    https://www.espruino.com/modules/http.js­
    404
    



    Surprisingly I get the 'Hello World' text back, but when I attempt to view any of the connection details, such as the IP or AP:

    >console.log( wifi.getIP() );
    undefined
    =undefined
    Uncaught Error: Function "a" not found!
     at line 1 col 165
    ...ce(15,-1);else if("OK"==d){a(null,b);return}return h}
                                  ^
    in function "c" called from line 1 col 25
    g=void 0;var b;c&&(b=c(a))?(g=e,c=b):clearTimeout(d);­void 0=...
                            ^
    in function "g" called from line 2 col 4
    g(f)}b=b.substr(a+1);if(p&&d)return q("");"\n"==b[0]&&(b=b.s...
       ^
    in function called from system
    Uncaught Error: Function "a" not found!
     at line 1 col 15
    if(void 0===d)a("Timeout");else{if("+CIFSR:STAIP­"==d.substr(...
                  ^
    in function "c" called from line 1 col 15
    g=void 0;c&&c();void 0===g&&0<k.length&&f.cmd.apply(f,k.shif.­..
                  ^
    

    I can see the wifi variable is populated,

    >wifi
    ={
      connect: function (a,b,c) { ... },
      disconnect: function (a) { ... },
      startAP: function (a,b,c) { ... },
      stopAP: function (a) { ... },
      scan: function (a) { ... },
      getIP: function (a) { ... },
    
    . . . . 
    
    >e()
    {
      "VERSION": "2v04",
      "GIT_COMMIT": "3956264e",
      "BOARD": "ESPRUINOWIFI",
    

    Is it possible this last 2V05 is the culprit?

    I'll try some reflashing in the mean time. But that wont work if the modules aren't there, correct? (yes)

    Minification and Esprima are both set to No Minification and offline

  • @Robin, both of these modules are buit-in - part of the firmeware - therefore, to no surprise - the browser er shows 404 when going after these modules... ;

    Something else is going on on your board... don't know what... Do you have a special build that would not include these items?

    What is the board you are trying to run this code on?

  • Sun 2020.04.26

    Well Good Morning @allObjects haven't seen you here in a while. ;-)

    'Do you have a special build '

    No. Need to stay with stock board in order to support forum responses.

    'What is the board you are trying to run this code on'

    Doesn't the process.env show that? I suppose attempting to load a specific build on a different board should be confirmed, but this is a stock Espruino WiFi.

    'Something else is going on on your board'

    I don't see how. Haven't mod'd but wondered if there is some kind of build minification that isn't occuring with the now built in modules.

    'no surprise - the browser er shows 404 when going after these modules'

    But why? If the syntax is correct as the docs show, and the modules are now built in, then the error shouldn't be there in the first place. Having someone new to Espruino see that will open up a can of worms.

  • Just did a reset(1) and loaded just two lines of code which I copied from the docs:

    var wifi = require("Wifi");
    
    var r = require("Wifi").getIP();
    

    and get a unique new error for the second require:

    2v04 (c) 2019 G.Williams
    >Uncaught Error: Cannot read property 'cmd' of undefined
     at line 1 col 11
    var b={};f.cmd("AT+CIFSR\r\n",1E3,function h(d){if(void 0===...
              ^
    in function "getIP" called from line 1 col 31
    var r = require("Wifi").getIP();
                                  ^
    > 
    
    
    >wifi
    ={
      connect: function (a,b,c) { ... },
      disconnect: function (a) { ... },
      startAP: function (a,b,c) { ... },
      stopAP: function (a) { ... },
      scan: function (a) { ... },
      getIP: function (a) { ... },
      setIP: function (a,b) { ... },
      getAPIP: function (a) { ... },
      setAPIP: function (a,b) { ... },
      setHostname: function (a,b) { ... },
      ping: function (a,b) { ... },
      turbo: function (a,b) { ... },
      debug: function () { ... }
     }
    >wifi.getIP()
    Uncaught Error: Cannot read property 'cmd' of undefined
     at line 1 col 11
    var b={};f.cmd("AT+CIFSR\r\n",1E3,function h(d){if(void 0===...
              ^
    in function "getIP" called from line 1 col 12
    wifi.getIP()
               ^
    > 
    

    So something in the Wifi module.


    EDIT: Just loaded up the native .exe app and get identical results. Dump() of the two lines above:

    >dump()
    var wifi = {
      "connect": function (a,b,c) {
      var d="";c=c||function(){};void 0!==b.password&&(d=b.password);u(k.CLIEN­T,function(b){if(b)return c(b);f.cmd("AT+CWJAP="+JSON.stringify(a)­+","+JSON.stringify(d)+
    "\r\n",2E4,function m(a){if(0<=["WIFI DISCONNECT","WIFI CONNECTED","WIFI GOT IP","+CWJAP:1"].indexOf(a))return m;"OK"!=a?setTimeout(c,0,"WiFi connect failed: "+(a?a:"Timeout")):setTimeout(c,0,null)}­)})
    },
      "disconnect": function (a) {C(k.CLIENT,a)},
      "startAP": function (a,b,c) {
      c=c||function(){};b=b||{};if(!b.password­||8>b.password.length)throw Error("Password must be at least 8 characters");var d=b.password?"3":"0";if(b.authMode&&(d={­open:0,wpa:2,wpa2:3,wpa_wpa2:4}[b.authMo­de],void 0===d))throw Error("Unknown authMode "+
    b.authMode);void 0===b.channel&&(b.channel=5);u(k.AP,func­tion(e){if(e)return c(e);f.cmd("AT+CWSAP="+JSON.stringify(a)­+","+JSON.stringify(b.password)+","+b.ch­annel+","+d+"\r\n",5E3,function(a){"OK"!­=a?c("CWSAP failed: "+(a?a:"Timeout")):(n|=k.AP,c(null))})})­
    },
      "stopAP": function (a) {n&=~k.AP;C(k.AP,a)},
      "scan": function (a) {
      var b=[];u(k.CLIENT,function(c){if(c)return a(c);f.cmdReg("AT+CWLAP\r\n",5E3,"+CWLAP­:",function(a){a=a.slice(8,-1).split(","­);b.push({ssid:JSON.parse(a[1]),authMode­:H[a[0]],
    rssi:parseInt(a[2]),mac:JSON.parse(a[3])­,channel:JSON.parse(a[4])})},function(){­a(null,b)})})
    },
      "getIP": function (a) {var b={};f.cmd("AT+CIFSR\r\n",1E3,function h(d){if(void 0===d)a("Timeout");else{if("+CIFSR:STAIP­"==d.substr(0,12))b.ip=d.slice(14,-1);el­se if("+CIFSR:STAMAC"==d.substr(0,13))b.mac­=d.slice(15,-1);else if("OK"==d){a(null,b);return}return h}})},
      "setIP": function (a,b) {
      if("object"==typeof a&&a.ip){var c=[JSON.stringify(a.ip)];a.gw&&(c.push(J­SON.stringify(a.gw)),c.push(JSON.stringi­fy(a.netmask||
    "255.255.255.0")));c="AT+CIPSTA_CUR="+c.­join(",")+"\r\n";var d=3E3}else c="AT+CWDHCP_CUR=1,1\r\n",d=2E4;f.cmd(c,­d,function(a){if("OK"==a)b(null);else return b("setIP failed: "+(a?a:"Timeout"))})
    },
      "getAPIP": function (a) {
      var b={};f.cmd("AT+CIPAP_CUR?\r\n",1E3,funct­ion h(d){if(void 0===d)a("Timeout");else if("OK"==d)f.cmd("AT+CIPAPMAC_CUR?\r\n",­1E3,function m(d){if(void 0===d)a("Timeout");else if("OK"==d)a(null,b);else return"+CIPAPMAC_CUR"==d.substr(0,14)&&(­b.mac=JSON.parse(d.substr(10))),m});
    else return"+CIPAP_CUR"==d.substr(0,10)&&(d=d­.split(":"),"gateway"==d[1]&&"gw"==d[1],­b[d[1]]=JSON.parse(d[2])),h})
    },
      "setAPIP": function (a,b) {var c=[JSON.stringify(a.ip)];a.gw&&(c.push(J­SON.stringify(a.gw)),c.push(JSON.stringi­fy(a.netmask||"255.255.255.0")));f.cmd("­AT+CIPAP_CUR="+c.join(",")+"\r\n",3E3,fu­nction(a){if("OK"==a)b(null);else return b("setAPIP failed: "+(a?a:"Timeout"))})},
      "setHostname": function (a,b) {
      u(k.CLIENT,function(c){if(c)return b(c);f.cmd("AT+CWHOSTNAME="+JSON.stringi­fy(a)+
    "\r\n",500,function(a){b("OK"==a?null:a)­})})
    },
      "ping": function (a,b) {var c;f.cmd('AT+PING="'+a+'"\r\n',1E3,functi­on l(a){if(a&&"+"==a[0])return c=a.substr(1),l;"OK"==a?b(c):b()})},
      "turbo": function (a,b) {var c=a?!0===a?921600:a:115200;f.cmd("AT+UAR­T_CUR="+c+",8,1,0,2\r\n",500,function(a)­{"OK"!=a?b&&b("Baud rate switch to "+c+" failed: "+(a?a:"Timeout")):(t.setup(c,{rx:A3,tx:­A2,cts:x}),b&&b(null))})},
      "debug": function () {return {wifiMode:p,connected:n,socks:e,sockData­:g}}
     };
    var r = undefined;
    =undefined
    > 
    

    L17 CIFSR - Uncaught Error: Cannot read property 'cmd' of undefined
    var f doesn't appear to be defined anywhere

  • and, . . . to rule out a second request of the module, one line of code:

    var wifi = require("Wifi");
    

    and immediate dump after upload:

    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    >
    >dump()
    var wifi = {
      "connect": function (a,b,c) {
      var d="";c=c||function(){};void 0!==b.password&&(d=b.password);u(k.CLIEN­T,function(b){if(b)return c(b);f.cmd("AT+CWJAP="+JSON.stringify(a)­+","+JSON.stringify(d)+
    "\r\n",2E4,function m(a){if(0<=["WIFI DISCONNECT","WIFI CONNECTED","WIFI GOT IP","+CWJAP:1"].indexOf(a))return m;"OK"!=a?setTimeout(c,0,"WiFi connect failed: "+(a?a:"Timeout")):setTimeout(c,0,null)}­)})
    },
      "disconnect": function (a) {C(k.CLIENT,a)},
      "startAP": function (a,b,c) {
      c=c||function(){};b=b||{};if(!b.password­||8>b.password.length)throw Error("Password must be at least 8 characters");var d=b.password?"3":"0";if(b.authMode&&(d={­open:0,wpa:2,wpa2:3,wpa_wpa2:4}[b.authMo­de],void 0===d))throw Error("Unknown authMode "+
    b.authMode);void 0===b.channel&&(b.channel=5);u(k.AP,func­tion(e){if(e)return c(e);f.cmd("AT+CWSAP="+JSON.stringify(a)­+","+JSON.stringify(b.password)+","+b.ch­annel+","+d+"\r\n",5E3,function(a){"OK"!­=a?c("CWSAP failed: "+(a?a:"Timeout")):(n|=k.AP,c(null))})})­
    },
      "stopAP": function (a) {n&=~k.AP;C(k.AP,a)},
      "scan": function (a) {
      var b=[];u(k.CLIENT,function(c){if(c)return a(c);f.cmdReg("AT+CWLAP\r\n",5E3,"+CWLAP­:",function(a){a=a.slice(8,-1).split(","­);b.push({ssid:JSON.parse(a[1]),authMode­:H[a[0]],
    rssi:parseInt(a[2]),mac:JSON.parse(a[3])­,channel:JSON.parse(a[4])})},function(){­a(null,b)})})
    },
      "getIP": function (a) {var b={};f.cmd("AT+CIFSR\r\n",1E3,function h(d){if(void 0===d)a("Timeout");else{if("+CIFSR:STAIP­"==d.substr(0,12))b.ip=d.slice(14,-1);el­se if("+CIFSR:STAMAC"==d.substr(0,13))b.mac­=d.slice(15,-1);else if("OK"==d){a(null,b);return}return h}})},
      "setIP": function (a,b) {
      if("object"==typeof a&&a.ip){var c=[JSON.stringify(a.ip)];a.gw&&(c.push(J­SON.stringify(a.gw)),c.push(JSON.stringi­fy(a.netmask||
    "255.255.255.0")));c="AT+CIPSTA_CUR="+c.­join(",")+"\r\n";var d=3E3}else c="AT+CWDHCP_CUR=1,1\r\n",d=2E4;f.cmd(c,­d,function(a){if("OK"==a)b(null);else return b("setIP failed: "+(a?a:"Timeout"))})
    },
      "getAPIP": function (a) {
      var b={};f.cmd("AT+CIPAP_CUR?\r\n",1E3,funct­ion h(d){if(void 0===d)a("Timeout");else if("OK"==d)f.cmd("AT+CIPAPMAC_CUR?\r\n",­1E3,function m(d){if(void 0===d)a("Timeout");else if("OK"==d)a(null,b);else return"+CIPAPMAC_CUR"==d.substr(0,14)&&(­b.mac=JSON.parse(d.substr(10))),m});
    else return"+CIPAP_CUR"==d.substr(0,10)&&(d=d­.split(":"),"gateway"==d[1]&&"gw"==d[1],­b[d[1]]=JSON.parse(d[2])),h})
    },
      "setAPIP": function (a,b) {var c=[JSON.stringify(a.ip)];a.gw&&(c.push(J­SON.stringify(a.gw)),c.push(JSON.stringi­fy(a.netmask||"255.255.255.0")));f.cmd("­AT+CIPAP_CUR="+c.join(",")+"\r\n",3E3,fu­nction(a){if("OK"==a)b(null);else return b("setAPIP failed: "+(a?a:"Timeout"))})},
      "setHostname": function (a,b) {
      u(k.CLIENT,function(c){if(c)return b(c);f.cmd("AT+CWHOSTNAME="+JSON.stringi­fy(a)+
    "\r\n",500,function(a){b("OK"==a?null:a)­})})
    },
      "ping": function (a,b) {var c;f.cmd('AT+PING="'+a+'"\r\n',1E3,functi­on l(a){if(a&&"+"==a[0])return c=a.substr(1),l;"OK"==a?b(c):b()})},
      "turbo": function (a,b) {var c=a?!0===a?921600:a:115200;f.cmd("AT+UAR­T_CUR="+c+",8,1,0,2\r\n",500,function(a)­{"OK"!=a?b&&b("Baud rate switch to "+c+" failed: "+(a?a:"Timeout")):(t.setup(c,{rx:A3,tx:­A2,cts:x}),b&&b(null))})},
      "debug": function () {return {wifiMode:p,connected:n,socks:e,sockData­:g}}
     };
    =undefined
    >wifi
    ={
      connect: function (a,b,c) { ... },
      disconnect: function (a) { ... },
      startAP: function (a,b,c) { ... },
      stopAP: function (a) { ... },
      scan: function (a) { ... },
      getIP: function (a) { ... },
      setIP: function (a,b) { ... },
      getAPIP: function (a) { ... },
      setAPIP: function (a,b) { ... },
      setHostname: function (a,b) { ... },
      ping: function (a,b) { ... },
      turbo: function (a,b) { ... },
      debug: function () { ... }
     }
    >wifi.getIP
    =function (a) { ... }
    >console.log( wifi.getIP )
    function (a) {var b={};f.cmd("AT+CIFSR\r\n",1E3,function h(d){if(void 0===d)a("Timeout");else{if("+CIFSR:STAIP­"==d.substr(0,12))b.ip=d.slice(14,-1);el­se if("+CIFSR:STAMAC"==d.substr(0,13))b.mac­=d.slice(15,-1);else if("OK"==d){a(null,b);return}return h}})}
    =undefined
    >console.log( wifi.getIP() )
    Uncaught Error: Cannot read property 'cmd' of undefined
     at line 1 col 11
    var b={};f.cmd("AT+CIFSR\r\n",1E3,function h(d){if(void 0===...
              ^
    in function "getIP" called from line 1 col 25
    console.log( wifi.getIP() )
                            ^
    > 
    
  • Using the docs:

    https://www.espruino.com/Reference#l_Wif­i_getIP

    and line note L414

    https://github.com/espruino/Espruino/blo­b/master/libs/network/jswrap_wifi.c#L409­

    'An object representing the station IP information, if available immediately (ONLY on ESP8266/ESP32)'

    As I read that, the ONLY reference is for ESP's IF 'available immediately' as a comma separates the detail, delineating the return object.

    If this is specific to ESP's, then the note is in the wrong place as it should stand out for the entire function, but then why have IP detail NOT be available for Espruino WiFi devices then as the build includes that function. Doesn't make sense. As the module WiFi is for Espruino WiFi devices:

    Heading 'Connect to an AP'

    https://www.espruino.com/WiFi

    then that return value should be there for those also.


    EDIT: Attempt as an AP

    >wifi.startAP('EspruinoAP', { password: '0123456789', authMode: 'wpa2' }, function(err) {
    :  if (err) throw err;
    :  console.log("Connected!");
    :});
    =undefined
    Connected!
    >wifi
    ={
      connect: function (a,b,c) { ... },
      disconnect: function (a) { ... },
      startAP: function (a,b,c) { ... },
      stopAP: function (a) { ... },
      scan: function (a) { ... },
      getIP: function (a) { ... },
      setIP: function (a,b) { ... },
      getAPIP: function (a) { ... },
      setAPIP: function (a,b) { ... },
      setHostname: function (a,b) { ... },
      ping: function (a,b) { ... },
      turbo: function (a,b) { ... },
      debug: function () { ... },
      at: {
        debug: function (a) { ... },
        cmd: function (a,b,c) { ... },
        write: function (a) { ... },
        cmdReg: function (a,b,c,d,e) { ... },
        registerLine: function (a,b) { ... },
        unregisterLine: function (a) { ... },
        register: function (a,b) { ... },
        unregister: function (a) { ... },
        isBusy: function () { ... },
        getData: function (a,b) { ... }
       }
     }
    >wifi.getIP()
    =undefined
    Uncaught Error: Function "a" not found!
     at line 1 col 165
    ...ce(15,-1);else if("OK"==d){a(null,b);return}return h}
                                  ^
    in function "c" called from line 1 col 25
    g=void 0;var b;c&&(b=c(a))?(g=e,c=b):clearTimeout(d);­void 0=...
                            ^
    in function "g" called from line 2 col 4
    g(f)}b=b.substr(a+1);if(p&&d)return q("");"\n"==b[0]&&(b=b.s...
       ^
    in function called from system
    Uncaught Error: Function "a" not found!
     at line 1 col 15
    if(void 0===d)a("Timeout");else{if("+CIFSR:STAIP­"==d.substr(...
                  ^
    in function "c" called from line 1 col 15
    g=void 0;c&&c();void 0===g&&0<k.length&&f.cmd.apply(f,k.shif.­..
                  ^
    in function called from system
    > 
    
  • Best to look at the actual board reference: https://www.espruino.com/WiFi#using-wifi­

    /* Get the IP and MAC address when connected to an AP and call
    `callback(err, { ip : ..., mac : ...})`. If err isn't null,
    it contains a string describing the error. You must be connected to
    an access point to be able to call this successfully. For AP mode use getAPIP
    */
    exports.getIP = function (callback) { ... }
    

    So:

    wifi.getIP(function(err,ip) {
      print(ip);
    });
    

    An object representing the station IP information, if available immediately (ONLY on ESP8266/ESP32).

    I feel like this is reasonably clear. Or at least given it not working you could try using the other method of calling it.

    • On ESP32/ESP8266 you get the result back immediately (if you want it)
    • On other devices you don't get a result back immediately, and need to use the callback
  • ...reason for it is that - like on Espruino Wifi - there has some async communication (over serial() to go on between Epruino wifi object and the espressif ESP8266 ESP-12X to get the data. It is async in order to not hog the Espruino side. On ESP32 and ESP8266 (standalone, Espruino runs on ESP8266EX chip), it is just direct register / memory / synchronous API access.

  • Tue 2020.04.28

    Thank you @Gordon and @allObjects. It appears that the optional callback, isn't optional.



    Is anyone able to confirm that the online WebIDE is capable of copying more than twenty lines at a time to the clipboard, using the Chrome browser on a Windows10 PC. An article I found claims the limit is 4Meg and I'm sure I'm not near that.

    https://www.espruino.com/ide/

       native WebIDE .exe
    In the Left-hand console side of the .exe app WebIDE, it is possible to click-drag upward through that side, collecting the entire contents, say 100+lines, as the mouse button is released.

       online IDE
    But, when I perform this task with the online IDE, I'm not permitted (the copy just doesn't complete) to allow scrolling to occur to capture more than what is shown ~20 lines.

    I'm currently stuck. With a combination of dump() and trace() I filled the console with way more than several hundred lines I want to now save. Should I chose to disconnect, and attempt this task with the .exe app, then I lose whatever is currently in the device memory, not allowing further analysis. As soon as I attempt to move the mouse above the console window to enable scrolling, the highlighting disappears, thus capturing just what is seen. Should I chose to reboot to see if this is a browser issue, I also lose the data, and may not be any further ahead.

    Short of copy-n-paste, then stitch each ~20 line block, I'm out of ideas.

    I need to compare what appears to be a different behavior using the same sequence of operation between the native app and the online IDE. I'm attempting to grab the content from the online right now.

    If this multiple line scroll feature is not available for the online version, it should be, and knowing whether it is possible will confirm I need to continue with copy-n-paste, as painful as that currently is.

    Thank you in advance.

  • Tue 2020.04.28

    While mulling around, I remembered I had seen a link for the emulator:

    post #2   http://forum.espruino.com/conversations/­341313/

    I've answered my own curiosity. So, now the question becomes what caused the online IDE to start dismissing the highlit area when the mouse moves to the chrome window boundry trim?

  • @Robin, the wifi object has a life cycle... and .getIP() can only be executed when it is (had) a connection. That's the reason why you get >Uncaught Error: Cannot read property 'cmd' of undefined at line 1 col 11 var b={};f.cmd("AT+CIFSR\r\n",... with up-arrow (accent circumflex - ^) pointing to cmd property of (minimized) f variable in Post #4. Variable/property f of/within wifi object is undefined until connection exists. (yes, it could be handled 'gracefully'... on cost of space/variables not available to the application anymore... : ).

    The life cycle and the communication between the application stack and the wifi stack together with your application of them explains the error you get.

    Most of the time requiring a module is only making the code object available to the application with no (or minimal) setup. The typical .connect() then returns an object that is functionally alive and a service to the application.

  • Sat 2020.05.02

    Continuation of #10 post

    I'm believe I'm experiencing a Captain Obvious ID-10-T situation and haven't found the secret here.

    I need to edit/debug an existing online module using the online WebIDE.

    When using the native .exe WebIDE, it is possible to ?map? to the local file system where deploying the module is then accessible through the require() statement.

    http://www.espruino.com/Writing+Modules

    When using the online WebIDE however, we are now presented with a new unique challenge.

    https://www.espruino.com/ide/

    In order to debug a file using the Chrome Developer Tools F12 option, the sources tab doesn't reveal the code file to debug, nor the ability to access files on the local drive, although we are able to use console.log() statements to write to the console.

    Short of creating a stand alone module using the steps in the link above, what/how is the recommended process to debug both uploaded code and that of an existing online .js module?

  • I need to edit/debug an existing online module using the online WebIDE.

    Do you mean debugging part of the Web IDE, or a module running on Espruino?

    Given the rest of this post I'd assume you mean a module running on Espruino. You can't 'map' a local file at the moment, nor can you use 'Chrome Developer tools' (those are for Chrome).

    The easiest way to do it is to add:

    Modules.addCached("mymodule",function() { 
     // modulecode
    });
    

    to the front of the source file you upload. You can then view/modify the code pretty quickly.

    On the online IDE you can also upload directly to a storage file called modulefile, and can set the 'Load after saving' option to 'default' - you can then work directly with the module you're interested in.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Sanity check for Wifi and http modules please getIP getAPIP

Posted by Avatar for Robin @Robin

Actions