Closed hasenradball closed 6 months ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.
:white_check_mark: hasenradball
:x: cmaglie
You have signed the CLA already but the status is still pending? Let us recheck it.
Memory usage change @ 494c0f7d793fde422a075334fc6ac7e9c4e745f4
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:mbed_nano:nanorp2040connect |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:uno2018:mode=on |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrvidor4000 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:nano_33_iot |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
if I want wait for connection result I can use begin
. so waitForConnectionResult is not useful. esp8266 and esp32 have waitForConnectionResult because their begin
is not blocking.
connect
is useful if state()
is checked later in loop() to do some communication over WiFi
@JAndrassy If you don`t see ann benefit for waitForConnect then please look at PR #263. With this approach there are indroduced small benefits. And please read the explanations. Thanks Frank
@263 changes begin
. how is it related to waitForConnectResult?
@JAndrassy It is related in this way:
please take two min. to read the explanations in #263 .
If waitForConnectResult is no way for you, maybee we can improve the begin methods slightly. 😊
I have no objection to connect
.
there is nothing to improve in begin
. it is a normal time for the esp32. around 3 seconds for the first and a 1 second for repeated begin
@JAndrassy maybee you looked in the wrong code.
Chances in begin are located in #263 .
And one hint to the benefit if a non blocking connect! Why to wait if wifi is connected? Use a non blocking connect method an let the wifi connecting in background. Do meanwhile other stuff in setup. And check the connection status at the end of setup.
again. I have no objection to your connect
.
I responded about begin to your "maybee we can improve the begin methods slightly."
@JAndrassy Thanks for your reply. I will rework it to add only the necessary changes. Will you add the connect method from the existing branch to the master to be able to be used?
I am just a contributor here. I would like my own PR be merged.
@JAndrassy can we then move further discussions for begin
to #263 ?
Hi @JAndrassy,
I removed the waitForConnectResult
, now only the non blocking connect method added here.
Memory usage change @ 46b83a0da871958c06db97081b2dccf4cc2fe967
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:mbed_nano:nanorp2040connect |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:uno2018:mode=on |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrvidor4000 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:nano_33_iot |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
I think you would achieve same as this connect
with setting timeout to a very short time for begin
@JAndrassy
Could be, BUT if you look at the code, the value of timeout
is hardcoded!
And if I want to use an non blocking connect method
, I don't want to step into the src file first and make changes in the constructor!
Thats's not my way of smart software development!
That's the reason I wanted to add a method like waitForConnectResult
because here you are able to define the timeout as function parameter!
But lets say with the both PR (#263 and #264) I would be happy because all is possible.
there is WiFi.setTimeout
Yes, you are right I saw it in the same time you wrote.
Is there an big point to add the connect methods?
I actually had an idea about simplify the connect methods by using the setTimeout()
method like:
This would be much cleaner than this approach:
@JAndrassy using setTimeout(0)
before begin()
works fine.
So I would say there is no real need to introduce a connect()
method.
why to update/benefits
With this approach we introduce the methods
connect
which is an non blocking wifi connect methodNow we can start the wifi connection without blocking..
Changes in methods
tested on
Arduino Nano 33 IOT