FastLED
3.10.8
Loading...
Searching...
No Matches
Test.ino
Go to the documentation of this file.
1
4
5
6
7
#include <
Arduino.h
>
8
#include <FastLED.h>
9
10
11
// Test configuration
12
13
// Compile-time regression for FastLED#4827: legacy sketches call libc memory
14
// functions unqualified on CRGB*. These must stay unambiguous on every board.
15
static
void
legacyLibcOnCrgb
() {
16
CRGB
src[4] = {
CRGB
(1, 2, 3),
CRGB
(4, 5, 6),
CRGB
(7, 8, 9),
CRGB
(10, 11, 12)};
17
CRGB
* dst =
static_cast<
CRGB
*
>
(malloc(
sizeof
(
CRGB
) * 4));
// ok bare allocation
18
if
(!dst) {
19
return
;
20
}
21
memset(dst, 0,
sizeof
(
CRGB
) * 4);
22
memcpy(dst, src,
sizeof
(
CRGB
) * 4);
23
memmove(dst + 1, dst,
sizeof
(
CRGB
) * 3);
24
if
(memcmp(dst, src,
sizeof
(
CRGB
)) != 0) {
25
Serial
.println(
"legacy libc copy mismatch"
);
26
}
27
free(dst);
// ok bare allocation
28
}
29
30
31
void
setup
() {
32
Serial
.begin(115200);
// Fast baud for avr8js
33
Serial
.println(
"Test setup starting"
);
34
legacyLibcOnCrgb
();
35
36
37
delay(100);
38
}
39
40
void
loop
() {
41
EVERY_N_MILLIS
(1000) {
42
Serial
.println(
"Test loop!"
);
43
}
44
#if defined(FASTLED_ESP32_IS_QEMU)
45
// Busy-wait under Espressif QEMU. delay() sleeps in vTaskDelay until a
46
// timer-alarm tick wakes the task; on a loaded host the emulator
47
// sometimes never delivers that wake-up and loop() stalls for good
48
// (FastLED#4845: ~1 s into the run, every local repro on esp32c3). The
49
// EVERY_N_MILLIS above still exercises millis().
50
delayMicroseconds(1000);
51
#else
52
delay(1);
// Yield to the idle task (feeds the task watchdog).
53
#endif
54
}
setup
void setup()
Definition
AnalogOutput.ino:58
loop
void loop()
Definition
AnalogOutput.ino:47
legacyLibcOnCrgb
static void legacyLibcOnCrgb()
Definition
Test.ino:15
arduino.h
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
EVERY_N_MILLIS
#define EVERY_N_MILLIS(N)
Checks whether to execute a block of code every N milliseconds.
Definition
lib8tion.h:1001
Serial
#define Serial
Definition
serial.h:309
dox
dox
fastled
examples
Test
Test.ino
Generated on Thu Oct 22 2026 05:45:49 for FastLED by
1.13.2