Skip to content

Add WiFi.ping() #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ping: fix timeout in case of count > 1
  • Loading branch information
pennam committed Nov 27, 2024
commit 030bdf82b36512f8d53f0ee06092b53bd2c2777d
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