mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 09:39:33 +00:00
Make sending udp packets much faster
Turns out parsing IP address string is very slow
This commit is contained in:
parent
4a4642bcf6
commit
a491b28201
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#define WIFI_SSID "flix"
|
#define WIFI_SSID "flix"
|
||||||
#define WIFI_PASSWORD "flixwifi"
|
#define WIFI_PASSWORD "flixwifi"
|
||||||
#define WIFI_UDP_IP "255.255.255.255"
|
|
||||||
#define WIFI_UDP_PORT 14550
|
#define WIFI_UDP_PORT 14550
|
||||||
|
|
||||||
WiFiUDP udp;
|
WiFiUDP udp;
|
||||||
@ -24,7 +23,7 @@ void setupWiFi() {
|
|||||||
|
|
||||||
void sendWiFi(const uint8_t *buf, int len) {
|
void sendWiFi(const uint8_t *buf, int len) {
|
||||||
if (WiFi.softAPIP() == IPAddress(0, 0, 0, 0) && WiFi.status() != WL_CONNECTED) return;
|
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.write(buf, len);
|
||||||
udp.endPacket();
|
udp.endPacket();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user