Skip to content

Add Palette Sweep effect for full palette animation across segments - #1

Merged
lucastcox merged 2 commits into
mainfrom
copilot/add-custom-animation-palette-sweep
Feb 27, 2026
Merged

lucastcox merged 2 commits into
mainfrom
copilot/add-custom-animation-palette-sweep

Conversation

Copilot AI commented Feb 27, 2026 •

Copy link
Copy Markdown

Adds a new 1D effect that sweeps an entire color palette head-to-tail across a segment, with optional bidirectional (ping-pong) mode.

Changes

  • FX.h: Added FX_MODE_PALETTE_SWEEP (ID 218), incremented MODE_COUNT to 219
  • FX.cpp: Implemented mode_palette_sweep() with effect registration

Parameters

Parameter Function
Speed Animation speed
Scale (Intensity) Palette repetitions: 0→1/4x, 128→1x, 255→4x
Ping-pong (check1) Bidirectional sweep vs continuous loop

Implementation

void mode_palette_sweep(void)
{
  // Triangle wave offset for ping-pong mode
  if (pingPong) {
    uint16_t phase = (counter >> 8) & 0x1FF;
    offset = (phase >= 256) ? 511 - phase : phase;
  } else {
    offset = (counter >> 8) & 0xFF;
  }
  
  for (unsigned i = 0; i < SEGLEN; i++) {
    uint16_t paletteIndex = ((i * paletteScale) / SEGLEN + offset) & 0xFF;
    SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(paletteIndex, false, true, 0));
  }
}

Effect metadata: "Palette Sweep@!,Scale,,,,Ping-pong;;!"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.registry.nm1.platformio.org
    • Triggering command: /home/REDACTED/.local/bin/pio pio run -e esp32dev (dns block)
  • api.registry.platformio.org
    • Triggering command: /home/REDACTED/.local/bin/pio pio run -e esp32dev (dns block)
  • collector.platformio.org
    • Triggering command: /home/REDACTED/.local/bin/pio pio run -e esp32dev (dns block)
  • dl.espressif.com
    • Triggering command: /usr/bin/curl curl -sI REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: lucastcox <6495989+lucastcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Add custom animation for full color palette sweep Add Palette Sweep effect for full palette animation across segments Feb 27, 2026
@lucastcox
lucastcox marked this pull request as ready for review February 27, 2026 16:48
@lucastcox
lucastcox merged commit 274a7f9 into main Feb 27, 2026
1 check passed
@lucastcox
lucastcox deleted the copilot/add-custom-animation-palette-sweep branch February 27, 2026 19:09
@lucastcox
lucastcox restored the copilot/add-custom-animation-palette-sweep branch February 27, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants