Skip to content

Commit 030bdf8

Browse files
committed
ping: fix timeout in case of count > 1
1 parent 46e6416 commit 030bdf8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: libraries/WiFiS3/src/WiFi.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,13 @@ int CWifi::ping(const char* host, uint8_t ttl, uint8_t count) {
572572
/* -------------------------------------------------------------------------- */
573573
int ret = WL_PING_ERROR;
574574
modem.begin();
575+
/* ping timeout is 1s and interval another 1s */
576+
modem.timeout((count * 2000) + MODEM_TIMEOUT);
575577
string res = "";
576578
if (modem.write(string(PROMPT(_PING)), res, "%s,%s,%d,%d\r\n", CMD_WRITE(_PING), host, ttl, count)) {
577579
ret = atoi(res.c_str());
578580
}
581+
modem.timeout(MODEM_TIMEOUT);
579582
return ret;
580583
}
581584

0 commit comments

Comments
 (0)