Make sending udp packets much faster

Turns out parsing IP address string is very slow
This commit is contained in:
Oleg Kalachev 2025-05-06 04:32:36 +03:00
parent 4a4642bcf6
commit a491b28201

View File

@ -11,7 +11,6 @@
#define WIFI_SSID "flix"
#define WIFI_PASSWORD "flixwifi"
#define WIFI_UDP_IP "255.255.255.255"
#define WIFI_UDP_PORT 14550
WiFiUDP udp;
@ -24,7 +23,7 @@ void setupWiFi() {
void sendWiFi(const uint8_t *buf, int len) {
if (WiFi.softAPIP() == IPAddress(0, 0, 0, 0) && WiFi.status() != WL_CONNECTED) return;
udp.beginPacket(WIFI_UDP_IP, WIFI_UDP_PORT);
udp.beginPacket(WiFi.softAPBroadcastIP(), WIFI_UDP_PORT);
udp.write(buf, len);
udp.endPacket();
}