Skip to content

WiFiS3: implement setTimeout functionality #339

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

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading