FastLED 3.10.8
Loading...
Searching...
No Matches
Test.ino
#include <Arduino.h>
#include <FastLED.h>
// Test configuration
// Compile-time regression for FastLED#4827: legacy sketches call libc memory
// functions unqualified on CRGB*. These must stay unambiguous on every board.
static void legacyLibcOnCrgb() {
CRGB src[4] = {CRGB(1, 2, 3), CRGB(4, 5, 6), CRGB(7, 8, 9), CRGB(10, 11, 12)};
CRGB* dst = static_cast<CRGB*>(malloc(sizeof(CRGB) * 4)); // ok bare allocation
if (!dst) {
return;
}
memset(dst, 0, sizeof(CRGB) * 4);
memcpy(dst, src, sizeof(CRGB) * 4);
memmove(dst + 1, dst, sizeof(CRGB) * 3);
if (memcmp(dst, src, sizeof(CRGB)) != 0) {
Serial.println("legacy libc copy mismatch");
}
free(dst); // ok bare allocation
}
void setup() {
Serial.begin(115200); // Fast baud for avr8js
Serial.println("Test setup starting");
delay(100);
}
void loop() {
Serial.println("Test loop!");
}
#if defined(FASTLED_ESP32_IS_QEMU)
// Busy-wait under Espressif QEMU. delay() sleeps in vTaskDelay until a
// timer-alarm tick wakes the task; on a loaded host the emulator
// sometimes never delivers that wake-up and loop() stalls for good
// (FastLED#4845: ~1 s into the run, every local repro on esp32c3). The
// EVERY_N_MILLIS above still exercises millis().
#else
delay(1); // Yield to the idle task (feeds the task watchdog).
#endif
}
void setup()
void loop()
static void legacyLibcOnCrgb()
Definition Test.ino:15
fl::CRGB CRGB
Definition crgb.h:25
#define EVERY_N_MILLIS(N)
Checks whether to execute a block of code every N milliseconds.
Definition lib8tion.h:1001
void delay(u32 ms, bool run_async=true) FL_NO_EXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
void delayMicroseconds(u32 us) FL_NO_EXCEPT
Delay for a given number of microseconds.
#define Serial
Definition serial.h:309