Skip to content

Commit 9001793

Browse files
committed
Merge branch 'mdev' into P4_experimental
2 parents ef4cef5 + d58cb49 commit 9001793

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

usermods/audioreactive/audio_reactive.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,16 +1159,16 @@ class AudioReactive : public Usermod {
11591159
#endif
11601160
// new "V2" audiosync struct - 44 Bytes
11611161
struct __attribute__ ((packed)) audioSyncPacket { // WLEDMM "packed" ensures that there are no additional gaps
1162-
char header[6]; // 06 Bytes offset 0
1162+
char header[6]; // 06 Bytes offset 0 - "00002" for protocol version 2 ( includes \0 for c-style string termination)
11631163
uint8_t pressure[2]; // 02 Bytes, offset 6 - sound pressure as fixed point (8bit integer, 8bit fraction)
11641164
float sampleRaw; // 04 Bytes offset 8 - either "sampleRaw" or "rawSampleAgc" depending on soundAgc setting
11651165
float sampleSmth; // 04 Bytes offset 12 - either "sampleAvg" or "sampleAgc" depending on soundAgc setting
11661166
uint8_t samplePeak; // 01 Bytes offset 16 - 0 no peak; >=1 peak detected. In future, this will also provide peak Magnitude
1167-
uint8_t frameCounter; // 01 Bytes offset 17 - track duplicate/out of order packets
1168-
uint8_t fftResult[16]; // 16 Bytes offset 18
1169-
uint16_t zeroCrossingCount; // 02 Bytes, offset 34
1170-
float FFT_Magnitude; // 04 Bytes offset 36
1171-
float FFT_MajorPeak; // 04 Bytes offset 40
1167+
uint8_t frameCounter; // 01 Bytes offset 17 - rolling counter to track duplicate/out of order packets
1168+
uint8_t fftResult[16]; // 16 Bytes offset 18 - 16 GEQ channels, each channel has one byte (uint8_t)
1169+
uint16_t zeroCrossingCount; // 02 Bytes, offset 34 - number of zero crossings seen in 23ms
1170+
float FFT_Magnitude; // 04 Bytes offset 36 - largest FFT result from a single run (raw value, can go up to 4096)
1171+
float FFT_MajorPeak; // 04 Bytes offset 40 - frequency (Hz) of largest FFT result
11721172
};
11731173

11741174
// old "V1" audiosync struct - 83 Bytes payload, 88 bytes total - for backwards compatibility

wled00/e131.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//DDP protocol support, called by handleE131Packet
1212
//handles RGB data only
1313
void handleDDPPacket(e131_packet_t* p) {
14+
static bool ddpSeenPush = false; // have we seen a push yet?
1415
int lastPushSeq = e131LastSequenceNumber[0];
1516

1617
//reject late packets belonging to previous frame (assuming 4 packets max. before push)
@@ -34,6 +35,7 @@ void handleDDPPacket(e131_packet_t* p) {
3435
uint16_t c = 0;
3536
if (p->flags & DDP_TIMECODE_FLAG) c = 4; //packet has timecode flag, we do not support it, but data starts 4 bytes later
3637

38+
if (realtimeMode != REALTIME_MODE_DDP) ddpSeenPush = false; // just starting, no push yet
3739
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP);
3840

3941
if (!realtimeOverride || (realtimeMode && useMainSegmentOnly)) {
@@ -44,7 +46,8 @@ void handleDDPPacket(e131_packet_t* p) {
4446
}
4547

4648
bool push = p->flags & DDP_PUSH_FLAG;
47-
if (push) {
49+
ddpSeenPush |= push;
50+
if (!ddpSeenPush || push) { // if we've never seen a push, or this is one, render display
4851
e131NewData = true;
4952
byte sn = p->sequenceNum & 0xF;
5053
if (sn) e131LastSequenceNumber[0] = sn;
@@ -350,7 +353,6 @@ void handleArtnetPollReply(IPAddress ipAddress) {
350353

351354
switch (DMXMode) {
352355
case DMX_MODE_DISABLED:
353-
return; // nothing to do
354356
break;
355357

356358
case DMX_MODE_SINGLE_RGB:
@@ -395,9 +397,17 @@ void handleArtnetPollReply(IPAddress ipAddress) {
395397
break;
396398
}
397399

398-
for (uint16_t i = startUniverse; i <= endUniverse; ++i) {
399-
sendArtnetPollReply(&artnetPollReply, ipAddress, i);
400+
if (DMXMode != DMX_MODE_DISABLED) {
401+
for (uint16_t i = startUniverse; i <= endUniverse; ++i) {
402+
sendArtnetPollReply(&artnetPollReply, ipAddress, i);
403+
}
400404
}
405+
406+
#ifdef WLED_ENABLE_DMX
407+
if (e131ProxyUniverse > 0 && (DMXMode == DMX_MODE_DISABLED || (e131ProxyUniverse < startUniverse || e131ProxyUniverse > endUniverse))) {
408+
sendArtnetPollReply(&artnetPollReply, ipAddress, e131ProxyUniverse);
409+
}
410+
#endif
401411
}
402412

403413
void prepareArtnetPollReply(ArtPollReply *reply) {

wled00/presets.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ void handlePresets()
233233
DEBUG_PRINT(F("Applying preset: "));
234234
DEBUG_PRINTLN(tmpPreset);
235235

236+
#if defined(ARDUINO_ARCH_ESP32) // WLEDMM we apply this workaround to all esp32 boards (S3 and classic esp32 included)
237+
//#if defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32C3)
238+
unsigned long start = millis();
239+
while (strip.isUpdating() && millis() - start < FRAMETIME_FIXED) delay(1); // wait for strip to finish updating, accessing FS during sendout causes glitches // WLEDMM delay instead of yield
240+
#endif
241+
236242
#ifdef ARDUINO_ARCH_ESP32
237243
if (tmpPreset==255 && tmpRAMbuffer!=nullptr) {
238244
deserializeJson(*fileDoc,tmpRAMbuffer);

wled00/udp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ void realtimeLock(uint32_t timeoutMs, byte md)
201201
if (realtimeOverride) return;
202202
if (arlsForceMaxBri) strip.setBrightness(scaledBri(255), true);
203203
if (briT > 0 && md == REALTIME_MODE_GENERIC) strip.show();
204+
205+
if (realtimeMode && !realtimeOverride && useMainSegmentOnly) strip.getMainSegment().startFrame(); // WLEDMM make sure the main segment is ready for drawing
204206
}
205207

206208
void exitRealtime() {

wled00/wled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
// version code in format yymmddb (b = daily build)
10-
#define VERSION 2412200
10+
#define VERSION 2412300
1111

1212
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
1313
#define _MoonModules_WLED_

0 commit comments

Comments
 (0)