22#define NUM_LEDS ((WIDTH) * (HEIGHT))
26#define WATERWIDTH (WIDTH + 2)
27#define WATERHEIGHT (HEIGHT + 2)
30void wu_water(uint8_t *
const buf, uint16_t
x, uint16_t
y, uint8_t bright);
41 uint8_t index_4bit = (index >> 12);
43 uint8_t
offset = (uint8_t)(index >> 4);
45 const fl::CRGB* entry = &(pal[0]) + index_4bit;
46 uint8_t red1 = entry->red;
47 uint8_t green1 = entry->green;
48 uint8_t blue1 = entry->blue;
52 if (index_4bit == 15) {
60 red1 = scale8_LEAVING_R1_DIRTY(red1, f1);
61 green1 = scale8_LEAVING_R1_DIRTY(green1, f1);
62 blue1 = scale8_LEAVING_R1_DIRTY(blue1, f1);
65 uint8_t red2 = entry->red;
66 uint8_t green2 = entry->green;
67 uint8_t blue2 = entry->blue;
68 red2 = scale8_LEAVING_R1_DIRTY(red2,
offset);
69 green2 = scale8_LEAVING_R1_DIRTY(green2,
offset);
70 blue2 = scale8_LEAVING_R1_DIRTY(blue2,
offset);
82 return fl::CRGB(red1, green1, blue1);
89uint16_t
XY(uint8_t
x, uint8_t
y) {
95 static uint8_t buffer = 0;
96 uint8_t *
const bufA = &
water[buffer][0];
97 buffer = (buffer + 1) % 2;
98 uint8_t *
const bufB = &
water[buffer][0];
109 static uint16_t pal_offset = 0;
113 for (uint8_t
x = 0;
x <
WIDTH;
x++) {
133 dst[0] -= dst[0] >> 6;
140void wu_water(uint8_t *
const buf, uint16_t
x, uint16_t
y, uint8_t bright) {
142 uint8_t xx =
x & 0xff, yy =
y & 0xff, ix = 255 - xx, iy = 255 - yy;
144 #define WU_WEIGHT(a, b) ((uint8_t)(((a) * (b) + (a) + (b)) >> 8))
150 for (uint8_t i = 0; i < 4; i++) {
151 uint8_t local_x = (
x >> 8) + (i & 1);
152 uint8_t local_y = (
y >> 8) + ((i >> 1) & 1);
155 uint16_t this_bright = bright * wu[i];
156 buf[
xy] = qadd8(buf[
xy], this_bright >> 8);
fl::UISlider brightness("Brightness", BRIGHTNESS, 0, 255)
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
void process_water(uint8_t *src, uint8_t *dst)
fl::CRGB MyColorFromPaletteExtended(const fl::CRGBPalette16 &pal, uint16_t index, uint8_t brightness, TBlendType blendType)
uint16_t XY(uint8_t x, uint8_t y)
void wu_water(uint8_t *const buf, uint16_t x, uint16_t y, uint8_t bright)
uint8_t water[2][WATERWIDTH *WATERHEIGHT]
unsigned int xy(unsigned int x, unsigned int y)
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
const TProgmemRGBPalette16 RainbowColors_p
HSV Rainbow.
LIB8STATIC u8 beatsin8(accum88 beats_per_minute, u8 lowest=0, u8 highest=255, u32 timebase=0, u8 phase_offset=0) FL_NOEXCEPT
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
LIB8STATIC u16 beatsin16(accum88 beats_per_minute, u16 lowest=0, u16 highest=65535, u32 timebase=0, u16 phase_offset=0) FL_NOEXCEPT
Generates a 16-bit sine wave at a given BPM that oscillates within a given range.
Representation of an 8-bit RGB pixel (Red, Green, Blue)