3
3
using namespace std ;
4
4
5
5
/* -------------------------------------------------------------------------- */
6
- CWifi::CWifi () : _timeout(50000 ){
6
+ CWifi::CWifi () : _timeout(10000 ){
7
7
}
8
8
/* -------------------------------------------------------------------------- */
9
9
@@ -36,7 +36,7 @@ int CWifi::begin(const char* ssid, const char *passphrase) {
36
36
string res = " " ;
37
37
modem.begin ();
38
38
modem.write (string (PROMPT (_MODE)),res, " %s%d\r\n " , CMD_WRITE (_MODE), 1 );
39
-
39
+
40
40
if (passphrase == nullptr ) {
41
41
if (!modem.write (string (PROMPT (_BEGINSTA)),res, " %s%s\r\n " , CMD_WRITE (_BEGINSTA), ssid)) {
42
42
return WL_CONNECT_FAILED;
@@ -49,10 +49,10 @@ int CWifi::begin(const char* ssid, const char *passphrase) {
49
49
}
50
50
51
51
unsigned long start_time = millis ();
52
- while (millis () - start_time < 10000 ){
52
+ while (millis () - start_time < _timeout ){
53
53
if (status () == WL_CONNECTED) {
54
54
return WL_CONNECTED;
55
- }
55
+ }
56
56
}
57
57
return WL_CONNECT_FAILED;
58
58
}
@@ -555,7 +555,7 @@ unsigned long CWifi::getTime() {
555
555
556
556
557
557
void CWifi::setTimeout (unsigned long timeout) {
558
- ( void )(timeout);
558
+ _timeout = timeout;
559
559
}
560
560
561
561
0 commit comments