Skip to content

Commit

Permalink
ping: fix timeout in case of count > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Nov 27, 2024
1 parent 46e6416 commit 030bdf8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/WiFiS3/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,13 @@ int CWifi::ping(const char* host, uint8_t ttl, uint8_t count) {
/* -------------------------------------------------------------------------- */
int ret = WL_PING_ERROR;
modem.begin();
/* ping timeout is 1s and interval another 1s */
modem.timeout((count * 2000) + MODEM_TIMEOUT);
string res = "";
if (modem.write(string(PROMPT(_PING)), res, "%s,%s,%d,%d\r\n", CMD_WRITE(_PING), host, ttl, count)) {
ret = atoi(res.c_str());
}
modem.timeout(MODEM_TIMEOUT);
return ret;
}

Expand Down

0 comments on commit 030bdf8

Please sign in to comment.