Report Bugs Here

Moderator: Mmiscool

User avatar
By Mmiscool
#51908 Hello.

I would ask you try to highlight the errors int he output.

keep in mind each time you use the wifi.scan() function it will run the scan again. I noticed you serial print this first and then assign the value to a variable. This actually runs the scan twice and could lead to a different number of networks being found for the serialprint of the number verses the value of r.


I striped away most of the cruft. See the following example.

Also why use wifioff?

Code: Select allmemclear
SERIALPRINTLN "START"
r = WIFI.SCAN()
SERIALprint r

SERIALPRINTLN "AFTER SCAN"

for X = 1 to r
gosub [loopingbranch]
next X
SERIALPRINTLN "END"
SERIALPRINTLN "post connect attempt"
wait

[loopingbranch]
SERIALPRINT WIFI.SSID(X) & " : "
serialprintln wifi.rssi(X)
return


And this is my output.
Code: Select allSTART
4 AFTER SCAN
FBI-survallince : -89
Mole2 : -65
57845b : -90
  : 99
END
post connect attempt
User avatar
By Oldbod
#51951 First sorry about hijacking a thread. Don't quite know how I did that, but now I'm here...


A subset of the output is probably more intelligible. The unexpected output is the lines I have prefixed with a $$.

EE-BrightBox-npw3he-81
SKYDCE42-70
SKYED3DC-85
HP-Print-5C-Photosmart 7520-90
BTWifi-X-93
BTHub5-GS2F-91
BTWifi-with-FON-93
60aMD-92
SKYED1C8-88
landless-65
$$È[06]"~^`");
$$if (res[0].toLowerCase() == "var") {
$$connection.send("OK");
$$for (i = 0; i < document.getElementsByName(res[1]).length; i++) {
$$document.getElementsByName(res[1])[i].value = res[2];
$$}
$$
$$return;
$$}
$$if (res[0].toLowerCase() == "varname") {
$$connection.send("OK");
$$document.getElementsByName("var" + res[1].toString())[0].value = res[2];
$$return;
$$}
$$if (res[0].toLowerCase() == "code") {
$$connection.send("OK");
$$document.getElementById("lcode").value = res[1];
$$document.getElementById("lno").value = res[2];
$$return;
$$}
$$
$$
$$if (res[0].toLowerCase() == "print") {
$$//alert(e);
$$var bla = document.body.innerHTML;
$$document.open();
$$document.write(bla + '<hr>' + res[1]);
$$documeÔ[10]?[08]"[06]67
END
post connect attempt
Done...
0 winsock connected 192.168.1.18


Embarrassing confession - when I copied the source code I inadvertently omitted the apostrophe from the start of the first (wifioff) line - sorry about that, not helpful.

Running the code as you have de-crudded it produces the same effective result - the entry for ssid in the array at the highest index value (the one returned by wifi.scan() ) is a duff string, of varying length. In my particular case, the last part of this string was a lump of a literal embedded in the program code,(see below). I tested this by changing the value of the string and the displayed output changed to match. I'm wondering if there's any possibility that that count might be off?

Hope this helps a bit. I'm going to flash the latest release next, just wanted to clarify as well as I could what was happening first.

Here's the output::::
0 winsock Disconnected!
START
5AFTER SCAN
SKYDCE42 : -79
EE-BrightBox-npw3he : -86
SKYED3DC : -90
landless : -66
f[07]R SCAN : -59 <<<<< original
END
post connect attempt
0 winsock connected 192.168.1.18
0 winsock Disconnected!
Done...
start save
/default.bas/21
end of save!!
START
5AFTER SCAt
SKYDCE42 : -81
EE-BrightBox-npw3he : -86
SKYED3DC : -89
landless : -66
f[07]R SCAt : -60 <<<< as modified
END
post connect attempt
0 winsock connected 192.168.1.18
User avatar
By Oldbod
#51953 Quick update - I updated to v20 and ran the same code a few times..
Same issue I think.

Heres some serial output captures....


Starts after this line------
0 winsock Disconnected!
START
7AFTER SCAN
SKYDCE42 : -73
EE-BrightBox-npw3he : -82
SKY2D82F : -89
SKYED3DC : -83
SKYED1C8 : -81
landless : -72
Ä[06]R SCAN : 0 <<<<<<<
END
post connect attempt
0 winsock connected 192.168.4.2
0 winsock Disconnected!
Done...
start save
/default.bas/22
end of save!!
START
12AFTER SCAt
SKYDCE42 : -70
SKY2D82F : -88
EE-BrightBox-npw3he : -81
SKYED3DC : -84
BTHub5-GS2F : -89
BTWifi-with-FON : -89
BTWifi-X : -87
TALKTALK0BAE11 : -89
SKYED1C8 : -80
SKY8F3BA : -91
landless : -71
˜[07]Areturn%0D%0A%0D%0A%0D%0A%0D%0A : 0 <<<< the long string again...
END
post connect attempt
0 winsock connected 192.168.4.2
Last line before this one -------

hope this helps. Don't know if this could be affected by the version of my nodemcu, if there's anything i can check please do shout. Thanks very much for all your help with this, really appreciate it....
User avatar
By lew247
#51960 Just to add to the V3 thread:
The format in the flasher doesn't work and the ESP crashes ocassionally
It outputs a load of hex numbers then reboots
V3 Alpha 20