Report Bugs Here

Moderator: Mmiscool

User avatar
By lew247
#51837 I hadn't thought of a timer, that works perfectly and I can connect using the web interface as well
Thank you :D

One question if you don't mind

If I have the program like this
Code: Select allmemclear
PRINT time()
timer 30*1000, [time]
wait


[time]
PRINT time()
wait


Is it possible to get it to do something else while it's waiting for the time
Like sending the local weather data using the post command every 15 minutes but still have the timer waiting to do the rest of the program?

like this
Code: Select allmemclear
PRINT time()
timer 30*1000, [time]
wait
timer 15*60*1000, [update]
wait

[time]
PRINT time()
wait

[update]
send weather update code here
wait


Would something like that work or can you do something while it's "waiting"?

EDIT: I noticed if I close the webpage and then at a later stage reconnect to http://192.168.1.8/input?
It prints EVERYTHING it had previously printed as well as all the print statements inbetween

I can imagine the buffer filling up

Is there a way to clear the buffer so when I connect to http://192.168.1.8/input? it will ONLY print what happens AFTER I connect?

serialflush would clear the serial port, is there a similar command for the web socket?
User avatar
By Oldbod
#51877 Hi. Sorry to be a pain. Been experimenting with this build this morning, and running the program repeatedly seems to produce a varying error.

The program is just displaying networks and rssi. All output initiated by me is to serial; that's because I wanted to avoid as far as possible the complexities of working with the network/browser.

Here's the serial output, captured when working from edit,run, etc tab.

start save
/default.bas/29
end of save!!
START
8AFTER SCAN
SKYDCE42-77
EE-BrightBox-npw3he-82
SKYED3DC-89
HP-Print-5C-Photosmart 7520-88
BTWifi-with-FON-91
BTWifi-X-91
SKY2D82F-93
SKYED1C8-88
landless-63
FI.SSID-4
END
post connect attempt
Done...
0 winsock connected 192.168.1.18
0 winsock Disconnected!
START
11AFTER SCAN
EE-BrightBox-npw3he-80
SKYDCE42-75
SKYED3DC-87
HP-Print-5C-Photosmart 7520-93
BTWifi-X-91
BTHub5-GS2F-93
60aMD-93
SKYED1C8-85
landless-65
FI.SSID112
END
post connect attempt
Done...
0 winsock connected 192.168.1.18
0 winsock Disconnected!
START
8AFTER SCAN
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


My source looks like this (sorry about the mess, fiddled a lot experimenting)

WIFIOFF
DEBUGOff
memclear
SERIALPRINTLN "START"
SERIALprint WIFI.SCAN()
'RETURNGUI
'DELAY 3000
'SERIALPRINTLN "HELLO"
'LET N = 3
r = WIFI.SCAN()
'DELAY 3000
'CLS
SERIALPRINTLN "AFTER SCAN"
let X = 0
for X = 1 to r
gosub [loopingbranch]
next X
SERIALPRINTLN "END"
SERIALPRINTLN "post connect attempt"
END

[loopingbranch]
SERIALPRINT WIFI.SSID(X)
'serialprintln " "
serialprintln wifi.rssi(X)
DELAY 3000
return


I'm wondering if the wifi.rssi (X) might be trying to read a value no longer accessible. If I limit the for/next to a value much lower than the number found, it appears to work ok. On the last run I got the dump of source, before that just a few characters as you can see. If ssid/rssi array starts from 0 that would explain it....should have thought of that.

The format section of the flash tool abends, not sure if it's done anything but it's very quick - a second or two at most. (only tried this on Vista and a single nodemcu). The fomat in settings appears to work fine, not sure if this does the same thing or not.

The revised code flash works brilliantly. If I had a quibble it would be that the progess doesn't seem to display until the write is complete, but frankly who cares?

You don't need to apologise for putting up frequent versions - everybody knows this is an incredibly quickly evolving product and I'm sure greatly appreciates the huge amount of effort that goes into something like this. And it couldn't say alpha more clearly on the tin! I know cause I've been there that you want it to be perfect from the off, but it's too big for that. The only way to test every possible combination is by people using it, and they'll do that in ways and combinations you never drempt of. Or possibly had nightmares about :). Keep up the good work, try to take the odd minute or even week off, and it'll be even more brilliant.