Skip to content

IoT first Wifi connection failed #156

@tidjidi

Description

@tidjidi

Hi team,
I made some Arduino cloud experiences, and discovered that systematically, the first Wifi connection trial failed, while the second is always fine. Very odd!
Thanks to DBG_VERBOSE mode, I noticed that Wifi Ids (SSID, PASS) are not loaded the first time...

So, digging a little bit in the libraries (ArduinoIoTCloud and Arduino_ConnectionHandler) to find my way, I created a patch to avoid this situation (maybe it's not the optimal solution, but for me it does the job! And that's fine).

Within the file WiFiConnectionHandler.cpp, in the method WiFiConnectionHandler::update_handleInit(), I added this short test (line 95 in release1.2.0 - within the test if (WiFi.status() != WL_CONNECTED)):

  if (WiFi.status() != WL_CONNECTED)
  {
     if (strlen(_settings.wifi.ssid) == 0) {
      DEBUG_ERROR("Network settings absent");
      return NetworkConnectionState::INIT;
     }
...

And as it worked with that patch, I didn't look further to find a reason why Wifi Ids are not received at that stage!

Thanks for all.
Thierry

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions