Skip to content

Commit

Permalink
fix for UDP endPacket failing after an attempt to connect to an non e…
Browse files Browse the repository at this point in the history
…xistent WiFi network
  • Loading branch information
maidnl committed Sep 30, 2024
1 parent 931f0bb commit 2a92205
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libraries/WiFi/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ int arduino::WiFiClass::begin(const char* ssid, const char* passphrase, wl_enc_t
_security = ap_list[connected_ap].get_security();
} else {
// For hidden networks, the security mode must be set explicitly.
// if ENC_TYPE_UNKNOWN this means that is the default value and so the user
// has not set it... no worth trying, it is probably an unknown (not hidden)
// interface
if(security == ENC_TYPE_UNKNOWN) {
_currentNetworkStatus = WL_CONNECT_FAILED;
return _currentNetworkStatus;
}
_security = enum2sec(security);
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/src/WiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class WiFiClass : public MbedSocketClass {
* param passphrase: Passphrase. Valid characters in a passphrase
* must be between ASCII 32-126 (decimal).
*/
int begin(const char* ssid, const char* passphrase, wl_enc_type security = ENC_TYPE_CCMP);
int begin(const char* ssid, const char* passphrase, wl_enc_type security = ENC_TYPE_UNKNOWN);

// Inherit config methods from the parent class
using MbedSocketClass::config;
Expand Down

0 comments on commit 2a92205

Please sign in to comment.