MacManley / f1-24-udp

F1 24 UDP Telemetry Parser for use on ESP32 / ESP8266 microcontrollers
MIT License
1 stars 0 forks source link

WiFiUdp.h #1

Open Fredrik2002 opened 2 weeks ago

Fredrik2002 commented 2 weeks ago

Hey there,

Is there any chance that I can make the parser working without any kind of Arduino ? I logically run into this problem when I try to run the short code in README.md (this file is nowhere)

F1_24_UDP.cpp:5:10: fatal error: WiFiUdp.h: No such file or directory
    5 | #include <WiFiUdp.h>
      |          ^~~~~~~~~~~
compilation terminated.

Is this library "WiFiUdp.h" only usable in Arduino ? I would just like to print out to the console some information about the players for now

Thanks !

MacManley commented 2 weeks ago

Yes, it is currently only useable in Arduino, I have made it specifically for ESP32 and ESP8266 Boards. Originally in my F1 23 Library I left it up to the user to handle the UDP packets and pass the data stream in themselves, however I changed it to include the WiFiUdp.h library. I could very easily upload versions of both the F1 23 and F1 24 libraries without the WifiUdp.h logic for those looking to use it outside of the Arduino ecosystem, if that would be to your liking? The only files needing changes would be F1_24_UDP.h and F1_24_UDP.cpp.

Fredrik2002 commented 2 weeks ago

Yeah I'd like to give it a try (if it doesn't require you too much time obvisouly)

MacManley commented 1 week ago

I am currently trialing and testing the library without the WifiUdp.h library for use outside Arduino ecosystem. If I was to remove this it would mean the user has to handle the datastream and networking themselves in their program, which I can provide examples for. I am busy as of recent so it could be another while until it's released. If you want to mess around with it yourself, you can remove the WifiUdp.h library and all of the functions associated with it from the code, and instead use the parser->push() function in your program to pass the datastream into (make sure to move the push() function to public).

Fredrik2002 commented 1 week ago

Thanks for your answer, sorry I'm not familiar with networking in C++

If my understanding is correct, the push method takes an argument, which comes from the Udp.read method, which requires the WifiUdp.h library. My problem is that I don't have any easy way of collecting the datastream the same way as the WifiUdp does

while(Udp.available())
       {
        Udp.read(packetBuffer, packetSize);
       }
       push(packetBuffer);

I'll take a deeper look into it later on if you don't have an easy way of doing it either

MacManley commented 1 week ago

Yes, you would be correct. The WiFiUdp library essentially allows the ESP board to read the UDP stream from the specified port (20777), this library is available automatically in the Arduino IDE upon adding ESP8266 to the Board Manager. You would need an understanding of networking in C++ to use it without the WiFiUdp library. As I mentioned, I can provide an example in the non-Arduino version of the library with a specific way of doing the networking side of things, and let it be up to you to use a different approach altogether or just use the networking library/code I provide.