From a491b282012af2eff8bae684cf3d5ac89c8f6060 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 6 May 2025 04:32:36 +0300 Subject: [PATCH] Make sending udp packets much faster Turns out parsing IP address string is very slow --- flix/wifi.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flix/wifi.ino b/flix/wifi.ino index 0ebd19d..c23365a 100644 --- a/flix/wifi.ino +++ b/flix/wifi.ino @@ -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(); }