dancol90 / ESP8266Ping

Ping library for ESP8266 Arduino core
GNU Lesser General Public License v2.1
261 stars 134 forks source link

Average time should be calculated over succesful pings, not over total number of pings #17

Closed me21 closed 6 years ago

me21 commented 6 years ago

For example, if there were 2 pings, one of which was unsuccessful, average time would be calculated twice less than it should be. Don't forget the case when there were no successful ping to avoid division by zero.

https://github.com/dancol90/ESP8266Ping/blob/939aa25635794b11287de7c7fed3a7e864f370f7/src/ESP8266Ping.impl.h#L98 https://github.com/dancol90/ESP8266Ping/blob/939aa25635794b11287de7c7fed3a7e864f370f7/src/ESP8266Ping.impl.h#L99

dancol90 commented 6 years ago

You're right, I've solved it in 7b43b4feddf6ebd90c70400428c991a573e7c5ad Thanks for the feedback!