Skip to content

Commit

Permalink
WiFiS3: implement setTimeout functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam authored and delta-G committed Jun 29, 2024
1 parent ea49790 commit 4bc3c5e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libraries/WiFiS3/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using namespace std;

/* -------------------------------------------------------------------------- */
CWifi::CWifi() : _timeout(50000){
CWifi::CWifi() : _timeout(10000){
}
/* -------------------------------------------------------------------------- */

Expand Down Expand Up @@ -36,7 +36,7 @@ int CWifi::begin(const char* ssid, const char *passphrase) {
string res = "";
modem.begin();
modem.write(string(PROMPT(_MODE)),res, "%s%d\r\n" , CMD_WRITE(_MODE), 1);

if(passphrase == nullptr) {
if(!modem.write(string(PROMPT(_BEGINSTA)),res, "%s%s\r\n" , CMD_WRITE(_BEGINSTA), ssid)) {
return WL_CONNECT_FAILED;
Expand All @@ -49,10 +49,10 @@ int CWifi::begin(const char* ssid, const char *passphrase) {
}

unsigned long start_time = millis();
while(millis() - start_time < 10000){
while(millis() - start_time < _timeout){
if(status() == WL_CONNECTED) {
return WL_CONNECTED;
}
}
}
return WL_CONNECT_FAILED;
}
Expand Down Expand Up @@ -555,7 +555,7 @@ unsigned long CWifi::getTime() {


void CWifi::setTimeout(unsigned long timeout) {
(void)(timeout);
_timeout = timeout;
}


Expand Down

0 comments on commit 4bc3c5e

Please sign in to comment.