Skip to content

Commit 0bf1d2b

Browse files
committed
Merge branch 'mdev' into MM-V4
2 parents 42a515d + 4df16b4 commit 0bf1d2b

11 files changed

Lines changed: 149 additions & 106 deletions

File tree

platformio.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ lib_deps =
256256
;; https://github.com/softhack007/FastLED.git#ESP32-C6 ;; patched version needed for -C6
257257
IRremoteESP8266 @ 2.8.2
258258
;;makuna/NeoPixelBus @ 2.7.5 ;; WLEDMM will be added in board specific sections
259-
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.2.1 ;; newer with bugfixes and stability improvements
259+
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.0
260260
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
261261
#TFT_eSPI
262262
#For compatible OLED display uncomment following
@@ -334,7 +334,7 @@ lib_deps_compat =
334334
fastled/FastLED @ 3.6.0
335335
IRremoteESP8266 @ 2.8.2
336336
makuna/NeoPixelBus @ 2.7.9
337-
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.2.1
337+
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.0
338338

339339

340340
[esp32]
@@ -1045,7 +1045,7 @@ AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT ;; WLE
10451045
AR_lib_deps = https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3
10461046

10471047
animartrix_build_flags = -D USERMOD_ANIMARTRIX ;; WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick
1048-
animartrix_lib_deps = https://github.com/netmindz/animartrix.git#657f754783268b648e1d56b3cd31c810379d0c89 ;; Dirty state fix
1048+
animartrix_lib_deps = https://github.com/netmindz/animartrix.git#bd556cef92a6fee9777c0a7304c9de1a84cba184 ;; init state fix
10491049
animartrix_lib_ignore = animartrix ;; to remove the animartrix lib dependancy (saves a few bytes)
10501050

10511051
DMXin_build_flags = -D WLED_ENABLE_DMX_INPUT ;; WLEDMM DMX physical input - requires ESP-IDF v4.4.x

usermods/audioreactive/audio_reactive.h

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,54 +1836,62 @@ class AudioReactive : public Usermod {
18361836
agcSensitivity = 128.0f; // substitute - V1 format does not include this value
18371837
}
18381838

1839-
bool receiveAudioData() // check & process new data. return TRUE in case that new audio data was received.
1840-
{
1839+
bool receiveAudioData() {
18411840
if (!udpSyncConnected) return false;
18421841
bool haveFreshData = false;
1843-
18441842
size_t packetSize = 0;
1845-
// WLEDMM use exception handler to catch out-of-memory errors
1846-
#if __cpp_exceptions
1847-
try{
1843+
static uint8_t fftUdpBuffer[UDPSOUND_MAX_PACKET + 1] = {0};
1844+
size_t lastValidPacketSize = 0;
1845+
1846+
// Loop to read all available packets
1847+
while (true) {
1848+
#if __cpp_exceptions
1849+
try {
18481850
packetSize = fftUdp.parsePacket();
1849-
} catch(...) {
1850-
packetSize = 0; // low heap memory -> discard packet.
1851-
#ifdef ARDUINO_ARCH_ESP32
1852-
fftUdp.flush(); // this does not work on 8266
1853-
#endif
1851+
} catch (...) {
1852+
packetSize = 0;
1853+
#ifdef ARDUINO_ARCH_ESP32
1854+
fftUdp.flush();
1855+
#endif
18541856
DEBUG_PRINTLN(F("receiveAudioData: parsePacket out of memory exception caught!"));
18551857
USER_FLUSH();
1858+
continue; // Skip to next iteration
18561859
}
1857-
#else
1860+
#else
18581861
packetSize = fftUdp.parsePacket();
1859-
#endif
1862+
#endif
18601863

1861-
#ifdef ARDUINO_ARCH_ESP32
1862-
if ((packetSize > 0) && ((packetSize < 5) || (packetSize > UDPSOUND_MAX_PACKET))) fftUdp.flush(); // discard invalid packets (too small or too big)
1863-
#endif
1864-
if ((packetSize > 5) && (packetSize <= UDPSOUND_MAX_PACKET)) {
1865-
static uint8_t fftUdpBuffer[UDPSOUND_MAX_PACKET+1] = { 0 }; // static buffer for receiving, to reuse the same memory and avoid heap fragmentation
1866-
//DEBUGSR_PRINTLN("Received UDP Sync Packet");
1867-
fftUdp.read(fftUdpBuffer, packetSize);
1864+
#ifdef ARDUINO_ARCH_ESP32
1865+
if ((packetSize > 0) && ((packetSize < 5) || (packetSize > UDPSOUND_MAX_PACKET))) {
1866+
fftUdp.flush();
1867+
continue; // Skip invalid packets
1868+
}
1869+
#endif
1870+
1871+
if (packetSize == 0) break; // No more packets available
18681872

1869-
// VERIFY THAT THIS IS A COMPATIBLE PACKET
1870-
if (packetSize == sizeof(audioSyncPacket) && (isValidUdpSyncVersion((const char *)fftUdpBuffer))) {
1873+
if ((packetSize > 5) && (packetSize <= UDPSOUND_MAX_PACKET)) {
1874+
fftUdp.read(fftUdpBuffer, packetSize);
1875+
lastValidPacketSize = packetSize;
1876+
}
1877+
}
1878+
1879+
// Process only the last valid packet
1880+
if (lastValidPacketSize > 0) {
1881+
if (lastValidPacketSize == sizeof(audioSyncPacket) && (isValidUdpSyncVersion((const char *)fftUdpBuffer))) {
18711882
receivedFormat = 2;
1872-
haveFreshData = decodeAudioData(packetSize, fftUdpBuffer);
1873-
//DEBUGSR_PRINTLN("Finished parsing UDP Sync Packet v2");
1883+
haveFreshData = decodeAudioData(lastValidPacketSize, fftUdpBuffer);
1884+
} else if (lastValidPacketSize == sizeof(audioSyncPacket_v1) && (isValidUdpSyncVersion_v1((const char *)fftUdpBuffer))) {
1885+
decodeAudioData_v1(lastValidPacketSize, fftUdpBuffer);
1886+
receivedFormat = 1;
1887+
haveFreshData = true;
18741888
} else {
1875-
if (packetSize == sizeof(audioSyncPacket_v1) && (isValidUdpSyncVersion_v1((const char *)fftUdpBuffer))) {
1876-
decodeAudioData_v1(packetSize, fftUdpBuffer);
1877-
receivedFormat = 1;
1878-
//DEBUGSR_PRINTLN("Finished parsing UDP Sync Packet v1");
1879-
haveFreshData = true;
1880-
} else receivedFormat = 0; // unknown format
1889+
receivedFormat = 0; // unknown format
18811890
}
18821891
}
18831892
return haveFreshData;
18841893
}
18851894

1886-
18871895
//////////////////////
18881896
// usermod functions//
18891897
//////////////////////
@@ -2319,6 +2327,7 @@ class AudioReactive : public Usermod {
23192327
static float syncVolumeSmth = 0;
23202328
bool have_new_sample = false;
23212329
if (millis() - lastTime > delayMs) {
2330+
// DEBUG_PRINTF(F("AR reading at %d compared to %d max\n"), millis() - lastTime, delayMs); // TroyHacks
23222331
have_new_sample = receiveAudioData();
23232332
if (have_new_sample) {
23242333
last_UDPTime = millis();

usermods/usermod_v2_animartrix/usermod_v2_animartrix.h

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -388,58 +388,58 @@ class AnimartrixUsermod : public Usermod {
388388

389389
if(!enabled) return;
390390

391-
strip.addEffect(255, &mode_Module_Experiment10, _data_FX_mode_Module_Experiment10);
392-
strip.addEffect(255, &mode_Module_Experiment9, _data_FX_mode_Module_Experiment9);
393-
strip.addEffect(255, &mode_Module_Experiment8, _data_FX_mode_Module_Experiment8);
394-
strip.addEffect(255, &mode_Module_Experiment7, _data_FX_mode_Module_Experiment7);
395-
strip.addEffect(255, &mode_Module_Experiment6, _data_FX_mode_Module_Experiment6);
396-
strip.addEffect(255, &mode_Module_Experiment5, _data_FX_mode_Module_Experiment5);
397-
strip.addEffect(255, &mode_Module_Experiment4, _data_FX_mode_Module_Experiment4);
398-
strip.addEffect(255, &mode_Zoom2, _data_FX_mode_Zoom2);
399-
strip.addEffect(255, &mode_Module_Experiment3, _data_FX_mode_Module_Experiment3);
400-
strip.addEffect(255, &mode_Module_Experiment2, _data_FX_mode_Module_Experiment2);
401-
strip.addEffect(255, &mode_Module_Experiment1, _data_FX_mode_Module_Experiment1);
402-
strip.addEffect(255, &mode_Parametric_Water, _data_FX_mode_Parametric_Water);
403-
strip.addEffect(255, &mode_Water, _data_FX_mode_Water);
404-
strip.addEffect(255, &mode_Complex_Kaleido_6, _data_FX_mode_Complex_Kaleido_6);
405-
strip.addEffect(255, &mode_Complex_Kaleido_5, _data_FX_mode_Complex_Kaleido_5);
406-
strip.addEffect(255, &mode_Complex_Kaleido_4, _data_FX_mode_Complex_Kaleido_4);
407-
strip.addEffect(255, &mode_Complex_Kaleido_3, _data_FX_mode_Complex_Kaleido_3);
408-
strip.addEffect(255, &mode_Complex_Kaleido_2, _data_FX_mode_Complex_Kaleido_2);
409-
strip.addEffect(255, &mode_Complex_Kaleido, _data_FX_mode_Complex_Kaleido);
410-
strip.addEffect(255, &mode_SM10, _data_FX_mode_SM10);
411-
strip.addEffect(255, &mode_SM9, _data_FX_mode_SM9);
412-
strip.addEffect(255, &mode_SM8, _data_FX_mode_SM8);
413-
// strip.addEffect(255, &mode_SM7, _data_FX_mode_SM7);
414-
strip.addEffect(255, &mode_SM6, _data_FX_mode_SM6);
415-
strip.addEffect(255, &mode_SM5, _data_FX_mode_SM5);
416-
strip.addEffect(255, &mode_SM4, _data_FX_mode_SM4);
417-
strip.addEffect(255, &mode_SM3, _data_FX_mode_SM3);
418-
strip.addEffect(255, &mode_SM2, _data_FX_mode_SM2);
419-
strip.addEffect(255, &mode_SM1, _data_FX_mode_SM1);
420-
strip.addEffect(255, &mode_Big_Caleido, _data_FX_mode_Big_Caleido);
421-
strip.addEffect(255, &mode_RGB_Blobs5, _data_FX_mode_RGB_Blobs5);
422-
strip.addEffect(255, &mode_RGB_Blobs4, _data_FX_mode_RGB_Blobs4);
423-
strip.addEffect(255, &mode_RGB_Blobs3, _data_FX_mode_RGB_Blobs3);
424-
strip.addEffect(255, &mode_RGB_Blobs2, _data_FX_mode_RGB_Blobs2);
425-
strip.addEffect(255, &mode_RGB_Blobs, _data_FX_mode_RGB_Blobs);
426-
strip.addEffect(255, &mode_Polar_Waves, _data_FX_mode_Polar_Waves);
427-
strip.addEffect(255, &mode_Slow_Fade, _data_FX_mode_Slow_Fade);
428-
strip.addEffect(255, &mode_Zoom, _data_FX_mode_Zoom);
429-
strip.addEffect(255, &mode_Hot_Blob, _data_FX_mode_Hot_Blob);
430-
strip.addEffect(255, &mode_Spiralus2, _data_FX_mode_Spiralus2);
431-
strip.addEffect(255, &mode_Spiralus, _data_FX_mode_Spiralus);
432-
strip.addEffect(255, &mode_Yves, _data_FX_mode_Yves);
433-
strip.addEffect(255, &mode_Scaledemo1, _data_FX_mode_Scaledemo1);
434-
strip.addEffect(255, &mode_Lava1, _data_FX_mode_Lava1);
435-
strip.addEffect(255, &mode_Caleido3, _data_FX_mode_Caleido3);
436-
strip.addEffect(255, &mode_Caleido2, _data_FX_mode_Caleido2);
437-
strip.addEffect(255, &mode_Caleido1, _data_FX_mode_Caleido1);
438-
strip.addEffect(255, &mode_Distance_Experiment, _data_FX_mode_Distance_Experiment);
439-
strip.addEffect(255, &mode_Center_Field, _data_FX_mode_Center_Field);
440-
strip.addEffect(255, &mode_Waves, _data_FX_mode_Waves);
441-
strip.addEffect(255, &mode_Chasing_Spirals, _data_FX_mode_Chasing_Spirals);
442-
strip.addEffect(255, &mode_Rotating_Blob, _data_FX_mode_Rotating_Blob);
391+
strip.addEffect(203, &mode_Module_Experiment10, _data_FX_mode_Module_Experiment10);
392+
strip.addEffect(204, &mode_Module_Experiment9, _data_FX_mode_Module_Experiment9);
393+
strip.addEffect(205, &mode_Module_Experiment8, _data_FX_mode_Module_Experiment8);
394+
strip.addEffect(206, &mode_Module_Experiment7, _data_FX_mode_Module_Experiment7);
395+
strip.addEffect(207, &mode_Module_Experiment6, _data_FX_mode_Module_Experiment6);
396+
strip.addEffect(208, &mode_Module_Experiment5, _data_FX_mode_Module_Experiment5);
397+
strip.addEffect(209, &mode_Module_Experiment4, _data_FX_mode_Module_Experiment4);
398+
strip.addEffect(210, &mode_Zoom2, _data_FX_mode_Zoom2);
399+
strip.addEffect(211, &mode_Module_Experiment3, _data_FX_mode_Module_Experiment3);
400+
strip.addEffect(212, &mode_Module_Experiment2, _data_FX_mode_Module_Experiment2);
401+
strip.addEffect(213, &mode_Module_Experiment1, _data_FX_mode_Module_Experiment1);
402+
strip.addEffect(214, &mode_Parametric_Water, _data_FX_mode_Parametric_Water);
403+
strip.addEffect(215, &mode_Water, _data_FX_mode_Water);
404+
strip.addEffect(216, &mode_Complex_Kaleido_6, _data_FX_mode_Complex_Kaleido_6);
405+
strip.addEffect(217, &mode_Complex_Kaleido_5, _data_FX_mode_Complex_Kaleido_5);
406+
strip.addEffect(218, &mode_Complex_Kaleido_4, _data_FX_mode_Complex_Kaleido_4);
407+
strip.addEffect(219, &mode_Complex_Kaleido_3, _data_FX_mode_Complex_Kaleido_3);
408+
strip.addEffect(220, &mode_Complex_Kaleido_2, _data_FX_mode_Complex_Kaleido_2);
409+
strip.addEffect(221, &mode_Complex_Kaleido, _data_FX_mode_Complex_Kaleido);
410+
strip.addEffect(222, &mode_SM10, _data_FX_mode_SM10);
411+
strip.addEffect(223, &mode_SM9, _data_FX_mode_SM9);
412+
strip.addEffect(224, &mode_SM8, _data_FX_mode_SM8);
413+
// strip.addEffect(225, &mode_SM7, _data_FX_mode_SM7);
414+
strip.addEffect(226, &mode_SM6, _data_FX_mode_SM6);
415+
strip.addEffect(227, &mode_SM5, _data_FX_mode_SM5);
416+
strip.addEffect(228, &mode_SM4, _data_FX_mode_SM4);
417+
strip.addEffect(229, &mode_SM3, _data_FX_mode_SM3);
418+
strip.addEffect(230, &mode_SM2, _data_FX_mode_SM2);
419+
strip.addEffect(231, &mode_SM1, _data_FX_mode_SM1);
420+
strip.addEffect(232, &mode_Big_Caleido, _data_FX_mode_Big_Caleido);
421+
strip.addEffect(233, &mode_RGB_Blobs5, _data_FX_mode_RGB_Blobs5);
422+
strip.addEffect(234, &mode_RGB_Blobs4, _data_FX_mode_RGB_Blobs4);
423+
strip.addEffect(235, &mode_RGB_Blobs3, _data_FX_mode_RGB_Blobs3);
424+
strip.addEffect(236, &mode_RGB_Blobs2, _data_FX_mode_RGB_Blobs2);
425+
strip.addEffect(237, &mode_RGB_Blobs, _data_FX_mode_RGB_Blobs);
426+
strip.addEffect(238, &mode_Polar_Waves, _data_FX_mode_Polar_Waves);
427+
strip.addEffect(239, &mode_Slow_Fade, _data_FX_mode_Slow_Fade);
428+
strip.addEffect(240, &mode_Zoom, _data_FX_mode_Zoom);
429+
strip.addEffect(241, &mode_Hot_Blob, _data_FX_mode_Hot_Blob);
430+
strip.addEffect(242, &mode_Spiralus2, _data_FX_mode_Spiralus2);
431+
strip.addEffect(243, &mode_Spiralus, _data_FX_mode_Spiralus);
432+
strip.addEffect(244, &mode_Yves, _data_FX_mode_Yves);
433+
strip.addEffect(245, &mode_Scaledemo1, _data_FX_mode_Scaledemo1);
434+
strip.addEffect(246, &mode_Lava1, _data_FX_mode_Lava1);
435+
strip.addEffect(247, &mode_Caleido3, _data_FX_mode_Caleido3);
436+
strip.addEffect(248, &mode_Caleido2, _data_FX_mode_Caleido2);
437+
strip.addEffect(249, &mode_Caleido1, _data_FX_mode_Caleido1);
438+
strip.addEffect(250, &mode_Distance_Experiment, _data_FX_mode_Distance_Experiment);
439+
strip.addEffect(251, &mode_Center_Field, _data_FX_mode_Center_Field);
440+
strip.addEffect(252, &mode_Waves, _data_FX_mode_Waves);
441+
strip.addEffect(253, &mode_Chasing_Spirals, _data_FX_mode_Chasing_Spirals);
442+
strip.addEffect(254, &mode_Rotating_Blob, _data_FX_mode_Rotating_Blob);
443443

444444
initDone = true;
445445
}

wled00/data/settings_leds.htm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@
246246
gId("dig"+n+"W").innerHTML = "<br />You need at least 1 output!";
247247
}
248248
if (outputs > 1 && fps_limit > 33333/leds_per_output) gId("dig"+n+"W").innerHTML += "<br />FPS limit may be too high for WS281x pixels.";
249-
if (outputs*leds_per_output != total_leds) gId("dig"+n+"W").innerHTML += "<br />Total LEDs doesn't match outputs * LEDs per output.";
249+
if (outputs*leds_per_output != total_leds) gId("dig"+n+"W").innerHTML += "<br />Length ("+total_leds+") doesn't match Number of Outputs * LEDs Per Output ("+outputs*leds_per_output+").";
250250
if (last_octet == 255) {
251251
if (total_leds <= 1024) gId("dig"+n+"W").innerHTML += "<br />Art-Net is in broadcast mode.";
252252
if (total_leds > 1024) gId("dig"+n+"W").innerHTML += "<br />You are sending a lot of broadcast data. Be cautious.";
253253
}
254+
gId("dig"+n+"W").innerHTML += "<br />Art-Net starting universe is "+d.e131Universe+". Change this in <a href='/settings/sync'>Sync Interfaces</a>.";
254255
}
255256
if (!(t > 28 && t < 32)) d.getElementsByName("WO"+n)[0].value = 0; // reset swapping
256257
gId("dig"+n+"c").style.display = ((t >= 40 && t < 48)||(t >= 100 && t < 110)) ? "none":"inline"; // hide count for analog and HUB75
@@ -422,6 +423,7 @@
422423
<option value="80">DDP RGB (network)</option>
423424
<!--option value="81">E1.31 RGB (network)</option-->
424425
<option value="82">Art-Net RGB (network)</option>
426+
<option value="83">Art-Net RGBW (network)</option>
425427
<option value="88">DDP RGBW (network)</option>
426428
<option value="101">Hub75Matrix 32x32</option>
427429
<option value="102">Hub75Matrix 64x32</option>

wled00/data/settings_sync.htm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<div class="helpB"><button type="button" onclick="H()">?</button></div>
8181
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
8282
</div>
83-
<h2>Sync setup</h2>
83+
<h2>Sync Interfaces</h2>
8484
<h3>WLED Broadcast</h3>
8585
UDP Port: <input name="UP" type="number" min="1" max="65535" class="d5" required><br>
8686
2nd Port: <input name="U2" type="number" min="1" max="65535" class="d5" required><br>
@@ -139,7 +139,7 @@ <h3>Instance List</h3>
139139
<h3>Realtime</h3>
140140
Receive UDP realtime: <input type="checkbox" name="RD"><br>
141141
Use main segment only: <input type="checkbox" name="MO"><br><br>
142-
<i>Network DMX input</i><br>
142+
<i>Network DMX</i><br>
143143
Type:
144144
<select name=DI onchange="SP(); adj();">
145145
<option value=5568>E1.31 (sACN)</option>
@@ -148,7 +148,7 @@ <h3>Realtime</h3>
148148
</select><br>
149149
<div id=xp>Port: <input name="EP" type="number" min="1" max="65535" value="5568" class="d5" required><br></div>
150150
Multicast: <input type="checkbox" name="EM"><br>
151-
Start universe: <input name="EU" type="number" min="0" max="63999" required><br>
151+
Start universe: <input name="EU" type="number" min="0" max="63999" required> (Also used for sending Art-Net)<br>
152152
<i>Reboot required.</i> Check out <a href="https://github.com/LedFx/LedFx" target="_blank">LedFx</a>!<br>
153153
Skip out-of-sequence packets: <input type="checkbox" name="ES"><br>
154154
DMX start address: <input name="DA" type="number" min="1" max="510" required><br>

wled00/dmx_input.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class DMXInput
1919
void disable();
2020
void enable();
2121

22+
/// True if dmx is currently connected
23+
bool isConnected() const { return connected; }
24+
2225
private:
2326
/// @return true if rdm identify is active
2427
bool isIdentifyOn() const;

wled00/file.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ static bool bufferedFind(const char *target, bool fromStart = true) {
6666

6767
size_t index = 0;
6868
byte buf[FS_BUFSIZE];
69+
#if ESP_IDF_VERSION_MAJOR >= 4
70+
f.setBufferSize(FS_BUFSIZE);
71+
#endif
6972
if (fromStart) f.seek(0);
7073

7174
while (f.position() < f.size() -1) {
@@ -107,6 +110,9 @@ static bool bufferedFindSpace(size_t targetLen, bool fromStart = true) {
107110

108111
size_t index = 0; // better to use size_t instead if uint16_t
109112
byte buf[FS_BUFSIZE];
113+
#if ESP_IDF_VERSION_MAJOR >= 4
114+
f.setBufferSize(FS_BUFSIZE);
115+
#endif
110116
if (fromStart) f.seek(0);
111117

112118
while (f.position() < f.size() -1) {
@@ -150,7 +156,9 @@ static bool bufferedFindObjectEnd() {
150156
uint16_t objDepth = 0; //num of '{' minus num of '}'. return once 0
151157
//size_t start = f.position();
152158
byte buf[FS_BUFSIZE];
153-
159+
#if ESP_IDF_VERSION_MAJOR >= 4
160+
f.setBufferSize(FS_BUFSIZE);
161+
#endif
154162
while (f.position() < f.size() -1) {
155163
size_t bufsize = f.read(buf, FS_BUFSIZE); // better to use size_t instead of uint16_t
156164
size_t count = 0;
@@ -175,7 +183,9 @@ static void writeSpace(size_t l)
175183
{
176184
byte buf[FS_BUFSIZE];
177185
memset(buf, ' ', FS_BUFSIZE);
178-
186+
#if ESP_IDF_VERSION_MAJOR >= 4
187+
f.setBufferSize(FS_BUFSIZE);
188+
#endif
179189
while (l > 0) {
180190
size_t block = (l>FS_BUFSIZE) ? FS_BUFSIZE : l;
181191
f.write(buf, block);

wled00/network.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ int getSignalQuality(int rssi)
161161
return quality;
162162
}
163163

164+
#if ESP_IDF_VERSION_MAJOR >= 4
165+
#define SYSTEM_EVENT_ETH_CONNECTED ARDUINO_EVENT_ETH_CONNECTED
166+
#define SYSTEM_EVENT_ETH_DISCONNECTED ARDUINO_EVENT_ETH_DISCONNECTED
167+
#define SYSTEM_EVENT_ETH_START ARDUINO_EVENT_ETH_START
168+
#define SYSTEM_EVENT_ETH_GOT_IP ARDUINO_EVENT_ETH_GOT_IP
169+
#endif
164170

165171
//handle Ethernet connection event
166172
void WiFiEvent(WiFiEvent_t event)
@@ -170,12 +176,21 @@ void WiFiEvent(WiFiEvent_t event)
170176
case SYSTEM_EVENT_ETH_START:
171177
DEBUG_PRINTLN(F("ETH Started"));
172178
break;
179+
case SYSTEM_EVENT_ETH_GOT_IP:
180+
if (Network.isEthernet()) {
181+
if (!apActive) {
182+
DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Disabling WIFi"));
183+
WiFi.disconnect(true);
184+
} else {
185+
DEBUG_PRINTLN(F("WiFi Connected *and* ETH Connected. Leaving AP WiFi active"));
186+
}
187+
} else {
188+
DEBUG_PRINTLN(F("WiFi Connected. No ETH"));
189+
}
190+
break;
173191
case SYSTEM_EVENT_ETH_CONNECTED:
174192
{
175193
DEBUG_PRINTLN(F("ETH Connected"));
176-
if (!apActive) {
177-
WiFi.disconnect(true);
178-
}
179194
if (staticIP != (uint32_t)0x00000000 && staticGateway != (uint32_t)0x00000000) {
180195
ETH.config(staticIP, staticGateway, staticSubnet, IPAddress(8, 8, 8, 8));
181196
} else {

wled00/udp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
911911
const uint_fast16_t ARTNET_CHANNELS_PER_PACKET = isRGBW?512:510; // 512/4=128 RGBW LEDs, 510/3=170 RGB LEDs
912912

913913
uint_fast16_t bufferOffset = 0;
914-
uint_fast16_t hardware_output_universe = 0;
914+
uint_fast16_t hardware_output_universe = e131Universe; // start at the universe defined in Sync Setup
915915

916916
sequenceNumber++;
917917

0 commit comments

Comments
 (0)