From be2f4e0ed8fc9e9fc22302149dba1b21129dd433 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sat, 2 Sep 2023 14:27:51 +0200 Subject: [PATCH] IR bugfix - apply presets with fallback preset fallbacks did not work since 0.13.2. --- wled00/ir.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/wled00/ir.cpp b/wled00/ir.cpp index 65a3a7dec4..049a50a5fe 100644 --- a/wled00/ir.cpp +++ b/wled00/ir.cpp @@ -7,6 +7,7 @@ #if defined(WLED_DISABLE_INFRARED) void handleIR(){} #else +#warning IR enabled. IR Remotes are not officially supported in WLED-SR IRrecv* irrecv; //change pin in NpbWrapper.h @@ -68,17 +69,6 @@ void decBrightness() } } -// apply preset or fallback to a effect and palette if it doesn't exist -void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) -{ - byte prevError = errorFlag; - if (!applyPreset(presetID, CALL_MODE_BUTTON_PRESET)) { - effectCurrent = effectID; - effectPalette = paletteID; - errorFlag = prevError; //clear error 12 from non-existent preset - } -} - byte relativeChange(byte property, int8_t amount, byte lowerBoundary, byte higherBoundary) { int16_t new_val = (int16_t) property + amount; @@ -120,6 +110,19 @@ void changePalette(uint8_t pal) stateChanged = true; } +// apply preset or fallback to a effect and palette if it doesn't exist +void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID) +{ + byte prevError = errorFlag; + if (!applyPreset(presetID, CALL_MODE_BUTTON_PRESET)) { + effectCurrent = effectID; + effectPalette = paletteID; + errorFlag = prevError; //clear error 12 from non-existent preset + changeEffect(effectCurrent); + changePalette(effectPalette); + } +} + void changeEffectSpeed(int8_t amount) { if (effectCurrent != 0) {