@@ -332,27 +332,18 @@ IPAddress CWifi::localIP() {
332
332
int attempts = 0 ;
333
333
IPAddress local_IP (0 ,0 ,0 ,0 );
334
334
335
- do {
336
- delay (100 );
337
- if (modem.write (string (PROMPT (_MODE)),res, " %s" , CMD_READ (_MODE))) {
338
- if (atoi (res.c_str ()) == 1 ) {
339
- if (modem.write (string (PROMPT (_IPSTA)),res, " %s%d\r\n " , CMD_WRITE (_IPSTA), IP_ADDR)) {
340
-
341
- local_IP.fromString (res.c_str ());
342
-
343
- }
335
+ if (modem.write (string (PROMPT (_MODE)),res, " %s" , CMD_READ (_MODE))) {
336
+ if (atoi (res.c_str ()) == 1 ) {
337
+ if (modem.write (string (PROMPT (_IPSTA)),res, " %s%d\r\n " , CMD_WRITE (_IPSTA), IP_ADDR)) {
338
+ local_IP.fromString (res.c_str ());
344
339
}
345
- else if (atoi (res.c_str ()) == 2 ) {
346
- if (modem.write (string (PROMPT (_IPSOFTAP)),res, CMD (_IPSOFTAP))) {
347
-
348
- local_IP.fromString (res.c_str ());
349
- }
340
+ }
341
+ else if (atoi (res.c_str ()) == 2 ) {
342
+ if (modem.write (string (PROMPT (_IPSOFTAP)),res, CMD (_IPSOFTAP))) {
343
+ local_IP.fromString (res.c_str ());
350
344
}
351
345
}
352
- attempts++;
353
346
}
354
- while (local_IP == IPAddress (0 ,0 ,0 ,0 ) && attempts < 50 );
355
-
356
347
return local_IP;
357
348
}
358
349
0 commit comments