Closed akansha104 closed 4 years ago
I can confirm this behavior. Have exactly the same problem
Same here, this library doesn't work. The debug statistics are wrong too:
DEBUG: ping reply total_count = 10 resp_time = 0 seqno = 0 timeout_count = 931264192 bytes = 1074308350 total_bytes = 10 total_time = -2146594692 ping_err = 1
i think this is a regression introduced after merging @adynis pull request. I don't have at the moment a ESP32 board to properly test the modificaiton.I took his proof. I think I can do a revert (or you could try to use another library version , prior to 1.3) In the mean time.
I solved the problem modifing your library and ping.cpp library, removing the bugs. Now the code is much simpler and, most of all, working well.
@marian-craciunescu : wait wait, do not revert yet :) Please allow me to test also, I didn't see these comments until now. In this evening/night I will test and comment here.
PS. There were also some existing other pull requests from me, I will check if the issue was already solved by my other pull requests, since in my overall copy of the code it was working fine after many tests on ESP32-wroom-32D
If you are planning to fix the bugs, I can give you some hint: 1) ping.cpp - 336: local variable pingresp cannot be passed to an external function. Big bug here. 2) Function pointers are totally useless, because the ping_start function is synchronous, so the best thing to do is add the ping results in the ping_option pointer, removing the fixed and useless data and adding the relevant data as transmitted and received packet, and average time.
Those two are the most relevant fixes that I made to the library. I don't need call ping function async, but if you need I think the easier way is to use a timer.
@andrea1984 since you already did the work,can you raise a PR ?
ping.cpp - 336: local variable pingresp cannot be passed to an external function. Big bug here. that is a local variable which is passed as a pointer to the function.The Local variable will exist in the that scope and still can be used by the called function
recv_function()
Function pointers are totally useless, because the ping_start function is synchronous, so the best thing to do is add the ping results in the ping_option pointer, removing the fixed and useless data and adding the relevant data as transmitted and received packet, and average time.
I can also merge @adynis work (Since it was left in somewhat of a limbo). @andrea1984 it would be great if you can also test it .
Oky, I did some tests, short conclusion : if you merge PullRequest #15 (which includes issue #8 and issue #9) then also the problem mentioned by @akansha104 is solved !
For more details on the results shown after merging pr #15 , pleasee check https://github.com/marian-craciunescu/ESP32Ping/issues/9#issuecomment-614313475 where I've added some examples.
@andrea1984 : 1.) It works, like @marian-craciunescu mentioned, it's no technical problem. Right now, in master, the issue is different (see issue #8 and eventually issue #9). 2.) I'm not sure I understand, but I think you can check my pullRequest #15 which works fine with transmitting all the information through pingresp.
Sorry, my fault for the first issue. Yes is not a bug my first sentence on ping.cpp. I was thinking that in some way the function worked async, but obviously not. Those callback functions are not really callback because there is not any async mechanism. For this reason are completely useless, and what I've done is completely remove them, because all the result ping data can be returned when the ping function (ping_start) is executed.
@adynis @akansha104 @andrea1984 @varandaas can you give a test to version 1.5 of the library. I've ordered a new ESP32 board I willl receive it in 2-3 weeks
Thanks for the merge; it corresponds now to the code I was initially using. I re-did some quick checks now for a valid host and an invalid host and it looks like expected. The only minor observation I did: the README.md (change int to float). I did a pull request with only this change. Of course that additional feedback from others would be very useful !
@adynis @akansha104 @andrea1984 @varandaas can you give a test to version 1.5 of the library. I've ordered a new ESP32 board I willl receive it in 2-3 weeks
Yeah sure i will check with with the updated library version. Thanks Akansha
Hey Guys any updates on the testing ? @akansha104 @andrea1984 @varandaas ?
Yeah, did some testing yesterday and deployed the code on 3 devices. So far so good, seems solved 👍
Thank you so much, guys!
one more tester and I will close this issue
Yes it works
Hi, I want ESP32 server to ping my local host(PC) on same network. But ESP32 is always successfully pinging irrespective of remote host in network or not. I am using <ESP32Ping .h library. I am attaching code:
Please suggest me how to resolve this Regards