@@ -42,11 +42,11 @@ int CWifi::begin(const char* ssid) {
42
42
}
43
43
44
44
/* -------------------------------------------------------------------------- */
45
- int CWifi::begin (const char * ssid, const char *passphrase) {
45
+ int CWifi::begin (const char * ssid, const char *passphrase, uint8_t mode ) {
46
46
/* -------------------------------------------------------------------------- */
47
47
string res = " " ;
48
48
modem.begin ();
49
- modem.write (string (PROMPT (_MODE)),res, " %s%d\r\n " , CMD_WRITE (_MODE), 1 );
49
+ modem.write (string (PROMPT (_MODE)),res, " %s%d\r\n " , CMD_WRITE (_MODE), mode );
50
50
51
51
if (passphrase == nullptr ) {
52
52
if (!modem.write (string (PROMPT (_BEGINSTA)),res, " %s%s\r\n " , CMD_WRITE (_BEGINSTA), ssid)) {
@@ -400,7 +400,7 @@ IPAddress CWifi::localIP() {
400
400
IPAddress local_IP (0 ,0 ,0 ,0 );
401
401
402
402
if (modem.write (string (PROMPT (_MODE)),res, " %s" , CMD_READ (_MODE))) {
403
- if (atoi (res.c_str ()) == 1 ) {
403
+ if (atoi (res.c_str ()) == 1 || atoi (res. c_str ()) == 3 ) {
404
404
if (modem.write (string (PROMPT (_IPSTA)),res, " %s%d\r\n " , CMD_WRITE (_IPSTA), IP_ADDR)) {
405
405
local_IP.fromString (res.c_str ());
406
406
}
0 commit comments