-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update init.lua example to use new wifi.sta.config() implementation #1953
Conversation
docs/en/upload.md
Outdated
-- Define WiFi station event callbacks | ||
wifi_connect_event = function(T) | ||
print("Connection to AP("..T.SSID..") established!") | ||
print("Wating for ip...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. Should be Waiting
.
👍 in general |
1cb7551
to
1d80d02
Compare
Woah, a really elaborate template, thanks. Did you consider to drop the "Inspired by " note at the end (it has deviated quite a bit)? I'll add some notes/questions inline. @jmattsson what does your cautious "in general" mean? I interpret this as if you were not fully satisfied with the proposal? |
docs/en/upload.md
Outdated
-- Define WiFi station event callbacks | ||
wifi_connect_event = function(T) | ||
print("Connection to AP("..T.SSID..") established!") | ||
print("Waiting for ip...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Waiting for IP address..."?
docs/en/upload.md
Outdated
for key,val in pairs(wifi.eventmon.reason) do | ||
if val == T.reason then | ||
print("Disconnect reason:"..T.reason.."("..key..")") | ||
reason_string=key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you keep reason_string
? I don't see it being used anywhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to add the disconnect reason to the final abort message, but I decided not to and I forgot to remove this variable.
docs/en/upload.md
Outdated
--the list and returns the string corresponding to the disconnect reason. | ||
for key,val in pairs(wifi.eventmon.reason) do | ||
if val == T.reason then | ||
print("Disconnect reason:"..T.reason.."("..key..")") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Disconnect reason: "..val.." ("..key..")"
?
docs/en/upload.md
Outdated
return | ||
end | ||
-- total_tries: how many times the station will attempt to connect to the AP. | ||
local total_tries = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a default value I would increase this significantly (or drop it altogether) to accommodate for intermittent AP reboots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does 30 sound good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does but I haven't tested how this translates to time. Would it be safe to assume that APs take anywhere between 30s and 60s to boot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My Comcast Xfinity gateway(Arris technicolor tc8305c) takes about 2.5 min to reboot and the interval between NO_AP_FOUND
disconnect events is about 2.25 seconds, so I think a value of 75 should cover most cases.
Oh, just the typo at the time :) |
c5d9ae9
to
d77ba57
Compare
…odemcu#1953) * Update init.lua example in upload.md with new station config format * Fixed typo in description of wifi.eventmon.register() * Fixed typo and improved example init.lua in docs/en/upload.md
Fixes #1951 .
dev
branch rather than formaster
.docs/en/*
.When I updated the function
wifi.sta.config()
to accept a table for station configuration, I forgot to update theinit.lua
example indocs/en/upload.md
accordingly.The new version of the example also makes use of the event monitor rather than a timer to catch station events.