On 28 August I wrote that my simple count_datagrams.p found about 85 per second on two different Linux machines BUT the counting datagrams per second code running on my NodeMCU module counted only about 80. I didn't think that important enough to track down.
Today I tried counting datagrams AND running the line-following robot car. It worked GREAT and I was able to drive it all over the kitchen, controlling it with the app on my phone. It seemed that the delay that I removed fixed everything.
As a final cleanup, I made put both code sets together in one source module and allowed either function to be selected at compile time. I got clean compiles on both versions of the code then tested. The datagram counting version ran great but the datagram displaying version had the same problem as before - most datagrams were NOT getting through.
The only addition was the display every packet code. It takes TIME to write to the display every time and that is too much time lost.
I recompiled the NodeMCU code to again count packets but this time display a two second count instead of a one second count. With the UDP Joystick phone app set to send every 10 ms, the one second count was 80 or 81 but the two second count was about 170. Writing to the display is causing packets to be missed! That accounts for the difference between the Perl code and the NodeMCU code.
The fix is to not write to the display too much. I should be able to handle that!
Working version of the code to be uploaded soon.