• That's as you'd expect I think?

    /* 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. This doesn't work
    when only in AP mode (the IP address is always
    exports.getIP = function (callback) { ... }

    So it's that there are two arguments returned by the callback - err and ip. It's odd, but it's just the way node.js tended to handle callback functions that can return an error, so I wanted to keep things compliant with them.

    Since on EspruinoWiFi the WiFi is basically async, getIP can't immediately return an IP address.

    Unfortunately when running on ESP8266 the callback format is different - it's something I'd like to change to bring everything more in-line really.

  • doooh... me... sorry bothering you for the callback... now I recall that the first argument is the error, and if first argument - error - is null, second argument is the actual data...

    I adjusted my code and it does what I needed. THANKS...

    Adjusted with 'assuming' I get no err(or) in getIP():

      wifi.getIP(function(err,data){ console.log("getIP() in callback: ",data.ip); }));

    with console output:

    Running onInit()...
    getIP() in callback:

Avatar for allObjects @allObjects started