Merge pull request #4263 from DedeHai/palette_FX_fix

fixed palette FX to more closely match original 1D version
This commit is contained in:
netmindz 2024-11-27 19:48:00 +00:00 committed by GitHub
commit b83f0f461c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1966,7 +1966,7 @@ uint16_t mode_palette() {
const bool inputAnimateRotation = SEGMENT.check2; const bool inputAnimateRotation = SEGMENT.check2;
const bool inputAssumeSquare = SEGMENT.check3; const bool inputAssumeSquare = SEGMENT.check3;
const angleType theta = (!inputAnimateRotation) ? (inputRotation * maxAngle / staticRotationScale) : (((strip.now * ((inputRotation >> 4) +1)) & 0xFFFF) * animatedRotationScale); const angleType theta = (!inputAnimateRotation) ? ((inputRotation + 128) * maxAngle / staticRotationScale) : (((strip.now * ((inputRotation >> 4) +1)) & 0xFFFF) * animatedRotationScale);
const mathType sinTheta = sinFunction(theta); const mathType sinTheta = sinFunction(theta);
const mathType cosTheta = cosFunction(theta); const mathType cosTheta = cosFunction(theta);
@ -2016,8 +2016,8 @@ uint16_t mode_palette() {
colorIndex = ((inputSize - 112) * colorIndex) / 16; colorIndex = ((inputSize - 112) * colorIndex) / 16;
} }
// Finally, shift the palette a bit. // Finally, shift the palette a bit.
const int paletteOffset = (!inputAnimateShift) ? (inputShift-128) : (((strip.now * ((inputShift >> 3) +1)) & 0xFFFF) >> 8); const int paletteOffset = (!inputAnimateShift) ? (inputShift) : (((strip.now * ((inputShift >> 3) +1)) & 0xFFFF) >> 8);
colorIndex += paletteOffset; colorIndex -= paletteOffset;
const uint32_t color = SEGMENT.color_wheel((uint8_t)colorIndex); const uint32_t color = SEGMENT.color_wheel((uint8_t)colorIndex);
if (isMatrix) { if (isMatrix) {
SEGMENT.setPixelColorXY(x, y, color); SEGMENT.setPixelColorXY(x, y, color);
@ -2028,7 +2028,7 @@ uint16_t mode_palette() {
} }
return FRAMETIME; return FRAMETIME;
} }
static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Shift,Size,Rotation,,,Animate Shift,Animate Rotation,Anamorphic;;!;12;c1=128,c2=128,c3=128,o1=1,o2=1,o3=0"; static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Shift,Size,Rotation,,,Animate Shift,Animate Rotation,Anamorphic;;!;12;ix=112,c1=0,o1=1,o2=0,o3=1";
// WLED limitation: Analog Clock overlay will NOT work when Fire2012 is active // WLED limitation: Analog Clock overlay will NOT work when Fire2012 is active