Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P4 experimental #193

Merged
merged 9 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ uint16_t mode_partyjerk() {
speed = SEGMENT.speed * map2(SEGMENT.custom2, 0, 255, 0, 100);
} else {
speed = SEGMENT.speed;
};
}

SEGENV.step += speed;
counter = SEGENV.step >> 8;
Expand Down Expand Up @@ -5171,6 +5171,10 @@ uint16_t mode_2DDrift() { // By: Stepko https://editor.soulmateli
unsigned i_20 = i * 20.0f;
float t_maxdim = t * (maxDim - i);
float angle = float(DEG_TO_RAD) * t_maxdim;
// WLEDMM reduce angle to [0 ... 2*PI] - several times faster than letting sinf() do the job
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
angle -= baseAngle;

int mySin = sinf(angle) * i;
int myCos = cosf(angle) * i;

Expand Down
21 changes: 3 additions & 18 deletions wled00/udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,18 +782,6 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
#endif
if (packet_buffer[0] != 0x41) memcpy(packet_buffer, ART_NET_HEADER, 12); // copy in the Art-Net header if it isn't there already

// Volumetric test code
// 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.
// memmove(buffer+(length*3),buffer,length*3*7);
// memcpy(buffer,buffer_in,length*3);
// framenumber++;
// if (framenumber >= 8) {
// framenumber = 0;
// } else {
// // return 0;
// }
// length *= 8;

switch (type) {
case 0: // DDP
{
Expand Down Expand Up @@ -897,9 +885,10 @@ uint8_t IRAM_ATTR_YN realtimeBroadcast(uint8_t type, IPAddress client, uint16_t
static byte* buffer = nullptr; // Declare static buffer
static size_t buffer_size = 0; // Track the buffer size

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

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

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

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

#ifdef ARTNET_SYNC_ENABLED

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