Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0a88ec9

Browse files
authored
Merge pull request #450 from pennam/remove-retry-local-ip
WiFiS3: remove retries to get localIP
2 parents 635f01e + 68bdf78 commit 0a88ec9

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

‎libraries/WiFiS3/src/WiFi.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -332,27 +332,18 @@ IPAddress CWifi::localIP() {
332332
int attempts = 0;
333333
IPAddress local_IP(0,0,0,0);
334334

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());
344339
}
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());
350344
}
351345
}
352-
attempts++;
353346
}
354-
while(local_IP == IPAddress(0,0,0,0) && attempts < 50);
355-
356347
return local_IP;
357348
}
358349

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /