esp8266 and wifi.scan() empty list

Posted on
  • try to get a list of Access Points but list is empty, any idea ?

    >reset();
    =undefined
     1v81.tve_unify_350abe6 Copyright 2015 G.Williams
    WARNING: the esp8266 port is in beta, do not expect everything to work
    Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
    var wifi = require("wifi");
    =function () { [native code] }
    >// no crash if list is empty
    =undefined
    >wifi.scan(function(arrayOfAcessPoints) {
    :  if ( arrayOfAcessPoints != null) {
    :    for (var i=0; i<arrayOfAcessPoints.length; i++) {
    :      print("Access point: " + i + " = " + JSON.stringify(arrayOfAcessPoints[i]));
    :  }
    :  }
    :  else {
    :  print("no Access points found");
    :  }
    :});
    =undefined
    no Access points found
    > 
    

    connecting to a non hidden access point works

    >var esp = require("ESP8266");
    =function () { [native code] }
    >var wifi = require("wifi");
    =function () { [native code] }
    >wifi.connect("SSSID", "password", true, function(err, ipInfo) {
    :  if (err) {
    :  print("not connected to requested AP");
    :  }
    :  else {
    :  print("We are now connected!");
    :  print("ipInfo: " + esp.getAddressAsString(ipInfo.ip));
    :  }
    :});
    =undefined
    We are now connected!
    ipInfo: 192.168.0.100
    
  • this is what AT tells


    1 Attachment

    • Bildschirmfoto 2015-11-26 um 18.15.23.JPG
  • Well, that looks fishy. If you have a few minutes, could you capture the debug log for the scan?

  • please advise how

  • Never mind, I can reproduce it just fine...

  • The debug log is on by default and comes out on uart1/gpio2. You can turn it off/on using require("ESP8266").logDebug(false/true). Be sure to turn it off if you are doing time-critical stuff. It will be off by default in an upcoming build...

  • will give it a try next time - thanks

  • If you enable the debug log you see stuff like:

    > jswrap_ESP8266_wifi_scan
    < jswrap_ESP8266_wifi_scan
    sl
    tick: 171571ms, heap: 12816
    scandone
    >> scanCB
     - ssid: tve-home
     - ssid: oc1
    << scanCB
    usl
    

    which shows that the scan returned the expected local APs. Now why they don't arrive in JS-land...

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

esp8266 and wifi.scan() empty list

Posted by Avatar for MaBe @MaBe

Actions