I have a NODE gathering ping statistics.
I now want to migrate to an ESP32 - but the ping library I'm using
doesnt work for the ESP32.
This library claims to work on the ESP32 but I haven't tested it as I need more detailed stats
(ie for a ping count of eg 4 average latency and packet loss count)
I do not use millis() and delay() with the ESP32 and I write all my ESP32 code using freeRTOS, which would make a significant difference in operations.
Having delved through the library code the issue is that the ping timeout is set to 1 second.
.. Which is a bit annoying as the library SEEMS to allow it to be specified in usec.
thanks @Idahowalker - am I missing something obvious?
I could set the pingNumber to 1 - but I still cant find any way to change the timeout. And as its presently 1 second then I cant allow a repeat in less than 1 second.
void loop() {
checkSwitches();
timeNow = millis();
if (timeNow >= (timeWas + (timeInterval * 1000))) {
timeWas = timeNow;
Serial.print("Pinging ip ");
Serial.println(remote_ip);
//ping it
if (Ping.ping(remote_ip, pingNumber)) {
//produces values for pingTime, expectedCount, success, errors
pingStats();
showDone = false; //prepare to update display
}
showStats();
}
}
I just thought that if there is a ESp32 ping library that can return ping time in milli seconds that it might be better to use instead of rolling your own.
Thanks @Idahowalker
to clarify I'm using the marian c library and I've modified it #4 to give me the stats I need.
Its working MUCH better than the 8266 giving sensible values for pings.
I'm just concerned about the blocking code as I now want to add more functions.