Skip to content

Commit 2ebb61a

Browse files
authored
Merge pull request #193 from troyhacks/P4_experimental
P4 experimental
2 parents 50c1323 + ea67391 commit 2ebb61a

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

wled00/FX.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ uint16_t mode_partyjerk() {
20122012
speed = SEGMENT.speed * map2(SEGMENT.custom2, 0, 255, 0, 100);
20132013
} else {
20142014
speed = SEGMENT.speed;
2015-
};
2015+
}
20162016

20172017
SEGENV.step += speed;
20182018
counter = SEGENV.step >> 8;
@@ -5171,6 +5171,10 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
51715171
unsigned i_20 = i * 20.0f;
51725172
float t_maxdim = t * (maxDim - i);
51735173
float angle = float(DEG_TO_RAD) * t_maxdim;
5174+
// WLEDMM reduce angle to [0 ... 2*PI] - several times faster than letting sinf() do the job
5175+
float baseAngle = max(0.0f, floorf(angle * float(1.0 / M_TWOPI)) * float(M_TWOPI)); // multiple of 2_PI (360 deg) that's included in angle
5176+
angle -= baseAngle;
5177+
51745178
int mySin = sinf(angle) * i;
51755179
int myCos = cosf(angle) * i;
51765180

wled00/udp.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -782,18 +782,6 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
782782
#endif
783783
if (packet_buffer[0] != 0x41) memcpy(packet_buffer, ART_NET_HEADER, 12); // copy in the Art-Net header if it isn't there already
784784

785-
// Volumetric test code
786-
// static byte *buffer = (byte *) heap_caps_calloc_prefer(length*3*72, sizeof(byte), 3, MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT); // MALLOC_CAP_TCM seems to have alignment issues.
787-
// memmove(buffer+(length*3),buffer,length*3*7);
788-
// memcpy(buffer,buffer_in,length*3);
789-
// framenumber++;
790-
// if (framenumber >= 8) {
791-
// framenumber = 0;
792-
// } else {
793-
// // return 0;
794-
// }
795-
// length *= 8;
796-
797785
switch (type) {
798786
case 0: // DDP
799787
{
@@ -897,9 +885,10 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
897885
static byte* buffer = nullptr; // Declare static buffer
898886
static size_t buffer_size = 0; // Track the buffer size
899887

888+
#ifdef ESP32 // the older ESP boards should not attempt this.
900889
if (volume_depth > 1) { // always assume to buffer output
901890
size_t new_size = (length * (isRGBW ? 4 : 3) * volume_depth);
902-
if (buffer == nullptr || buffer_size != new_size) {
891+
if (buffer == nullptr || buffer_size < new_size) {
903892
if (buffer != nullptr) {
904893
heap_caps_free(buffer);
905894
}
@@ -912,6 +901,7 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
912901
} else {
913902
buffer = buffer_in;
914903
}
904+
#endif
915905

916906
AsyncUDP artnetudp;// AsyncUDP so we can just blast packets.
917907

@@ -997,11 +987,6 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
997987
// have several Art-Net devices being broadcast to, and should only
998988
// be called in that situation.
999989

1000-
// Art-Net broadcast mode (setting Art-Net to 255.255.255.255) should ONLY
1001-
// be used if you know what you're doing, as that is a lot of pixels being
1002-
// sent to EVERYTHING on your network, including WiFi devices - and can
1003-
// overwhelm them if you have a lot of Art-Net data being broadcast.
1004-
1005990
#ifdef ARTNET_SYNC_ENABLED
1006991

1007992
// This block sends Art-Net "ArtSync" packets. Can't do this with AsyncUDP because it doesn't support source port binding.

0 commit comments

Comments
 (0)