diff --git a/usermods/rotary_encoder_change_effect/wled06_usermod.ino b/usermods/rotary_encoder_change_effect/wled06_usermod.ino index dbde9560..f004ba2f 100644 --- a/usermods/rotary_encoder_change_effect/wled06_usermod.ino +++ b/usermods/rotary_encoder_change_effect/wled06_usermod.ino @@ -39,7 +39,7 @@ void userLoop() { //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa - colorUpdated(6); + colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED); lastTime = millis(); } } diff --git a/usermods/stairway_wipe_basic/wled06_usermod.ino b/usermods/stairway_wipe_basic/wled06_usermod.ino index ab61c5af..3d493cc1 100644 --- a/usermods/stairway_wipe_basic/wled06_usermod.ino +++ b/usermods/stairway_wipe_basic/wled06_usermod.ino @@ -47,7 +47,7 @@ void userLoop() if (millis() + strip.timebase > (cycleTime - 25)) { //wipe complete effectCurrent = FX_MODE_STATIC; timeStaticStart = millis(); - colorUpdated(3); + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); wipeState = 2; } } else if (wipeState == 2) { //static @@ -59,7 +59,7 @@ void userLoop() #ifdef STAIRCASE_WIPE_OFF effectCurrent = FX_MODE_COLOR_WIPE; strip.timebase = 360 + (255 - effectSpeed)*75 - millis(); //make sure wipe starts fully lit - colorUpdated(3); + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); wipeState = 4; #else turnOff(); @@ -93,7 +93,7 @@ void startWipe() bool doReverse = (userVar0 == 2); seg.setOption(1, doReverse); - colorUpdated(3); + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); } void turnOff() @@ -104,7 +104,7 @@ void turnOff() transitionDelayTemp = 4000; //fade out slowly #endif bri = 0; - colorUpdated(3); + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); wipeState = 0; userVar0 = 0; previousUserVar0 = 0; diff --git a/wled00/const.h b/wled00/const.h index 1308bf5f..4d287572 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -7,6 +7,19 @@ #define AP_BEHAVIOR_ALWAYS 2 //Always open #define AP_BEHAVIOR_BUTTON_ONLY 3 //Only when button pressed for 6 sec +//Notifier callMode +#define NOTIFIER_CALL_MODE_INIT 0 // no updates on init, can be used to disable updates +#define NOTIFIER_CALL_MODE_DIRECT_CHANGE 1 +#define NOTIFIER_CALL_MODE_BUTTON 2 +#define NOTIFIER_CALL_MODE_NOTIFICATION 3 +#define NOTIFIER_CALL_MODE_NIGHTLIGHT 4 +#define NOTIFIER_CALL_MODE_NO_NOTIFY 5 +#define NOTIFIER_CALL_MODE_FX_CHANGED 6 +#define NOTIFIER_CALL_MODE_HUE 7 +#define NOTIFIER_CALL_MODE_PRESET_CYCLE 8 +#define NOTIFIER_CALL_MODE_BLYNK 9 +#define NOTIFIER_CALL_MODE_ALEXA 10 + //RGB to RGBW conversion mode #define RGBW_MODE_MANUAL_ONLY 0 //No automatic white channel calculation. Manual white channel slider #define RGBW_MODE_AUTO_BRIGHTER 1 //New algorithm. Adds as much white as the darkest RGBW channel diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 746f98d0..c04258f0 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -301,7 +301,7 @@ unsigned long buttonWaitTime = 0; bool notifyDirectDefault = notifyDirect; bool receiveNotifications = true; unsigned long notificationSentTime = 0; -byte notificationSentCallMode = 0; +byte notificationSentCallMode = NOTIFIER_CALL_MODE_INIT; bool notificationTwoRequired = false; //effects @@ -369,7 +369,7 @@ unsigned long realtimeTimeout = 0; //mqtt long lastMqttReconnectAttempt = 0; long lastInterfaceUpdate = 0; -byte interfaceUpdateCallMode = 0; +byte interfaceUpdateCallMode = NOTIFIER_CALL_MODE_INIT; char mqttStatusTopic[40] = ""; //this must be global because of async handlers #if AUXPIN >= 0 diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 6655dafd..f7485917 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -651,7 +651,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) if (pos < 1) XML_response(request); pos = req.indexOf("&NN"); //do not send UDP notifications this time - colorUpdated((pos > 0) ? 5:1); + colorUpdated((pos > 0) ? NOTIFIER_CALL_MODE_NO_NOTIFY : NOTIFIER_CALL_MODE_DIRECT_CHANGE); return true; } diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 8d41756b..820670c8 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -99,7 +99,7 @@ void beginStrip() #endif if (bootPreset>0) applyPreset(bootPreset, turnOnAtBoot, true, true); - colorUpdated(0); + colorUpdated(NOTIFIER_CALL_MODE_INIT); //init relay pin #if RLYPIN >= 0 diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index ab55df28..6af7416b 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -11,15 +11,15 @@ void notify(byte callMode, bool followUp=false) if (!udpConnected) return; switch (callMode) { - case 0: return; - case 1: if (!notifyDirect) return; break; - case 2: if (!notifyButton) return; break; - case 4: if (!notifyDirect) return; break; - case 6: if (!notifyDirect) return; break; //fx change - case 7: if (!notifyHue) return; break; - case 8: if (!notifyDirect) return; break; - case 9: if (!notifyDirect) return; break; - case 10: if (!notifyAlexa) return; break; + case NOTIFIER_CALL_MODE_INIT: return; + case NOTIFIER_CALL_MODE_DIRECT_CHANGE: if (!notifyDirect) return; break; + case NOTIFIER_CALL_MODE_BUTTON: if (!notifyButton) return; break; + case NOTIFIER_CALL_MODE_NIGHTLIGHT: if (!notifyDirect) return; break; + case NOTIFIER_CALL_MODE_FX_CHANGED: if (!notifyDirect) return; break; //fx change + case NOTIFIER_CALL_MODE_HUE: if (!notifyHue) return; break; + case NOTIFIER_CALL_MODE_PRESET_CYCLE: if (!notifyDirect) return; break; + case NOTIFIER_CALL_MODE_BLYNK: if (!notifyDirect) return; break; + case NOTIFIER_CALL_MODE_ALEXA: if (!notifyAlexa) return; break; default: return; } byte udpOut[WLEDPACKETSIZE]; @@ -157,9 +157,9 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP){ col[3] = p->property_values[DMXAddress+11]; //white colSec[3] = p->property_values[DMXAddress+12]; } - transitionDelayTemp = 0; // act fast - colorUpdated(3); // don't send UDP - return; // don't activate realtime live mode + transitionDelayTemp = 0; // act fast + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); // don't send UDP + return; // don't activate realtime live mode break; case DMX_MODE_MULTIPLE_RGB: @@ -329,7 +329,7 @@ void handleNotifications() if (nightlightActive) nightlightDelayMins = udpIn[7]; if (receiveNotificationBrightness || !someSel) bri = udpIn[2]; - colorUpdated(3); + colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); } else if (udpIn[0] > 0 && udpIn[0] < 5 && receiveDirect) //1 warls //2 drgb //3 drgbw { diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index fb0e8a7e..124e43bd 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -79,6 +79,7 @@ bool colorChanged() { if (col[i] != colIT[i]) return true; if (colSec[i] != colSecIT[i]) return true; + if (col[i] != colNlT[i]) return true; } if (bri != briIT) return true; return false; @@ -89,18 +90,24 @@ void colorUpdated(int callMode) { //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa - if (callMode != 0 && callMode != 1 && callMode != 5) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments + if (callMode != NOTIFIER_CALL_MODE_INIT && + callMode != NOTIFIER_CALL_MODE_DIRECT_CHANGE && + callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments bool fxChanged = strip.setEffectConfig(effectCurrent, effectSpeed, effectIntensity, effectPalette); if (!colorChanged()) { - if (nightlightActive && !nightlightActiveOld && callMode != 3 && callMode != 5) + if (nightlightActive && !nightlightActiveOld && + callMode != NOTIFIER_CALL_MODE_NOTIFICATION && + callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) { - notify(4); interfaceUpdateCallMode = 4; return; + notify(NOTIFIER_CALL_MODE_NIGHTLIGHT); + interfaceUpdateCallMode = NOTIFIER_CALL_MODE_NIGHTLIGHT; + return; } else if (fxChanged) { - notify(6); - if (callMode != 8) interfaceUpdateCallMode = 6; + notify(NOTIFIER_CALL_MODE_FX_CHANGED); + if (callMode != NOTIFIER_CALL_MODE_PRESET_CYCLE) interfaceUpdateCallMode = NOTIFIER_CALL_MODE_FX_CHANGED; if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0; if (isPreset) {isPreset = false;} else {currentPreset = -1;} @@ -110,7 +117,7 @@ void colorUpdated(int callMode) if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0; if (isPreset) {isPreset = false;} else {currentPreset = -1;} - if (callMode != 5 && nightlightActive && nightlightFade) + if (callMode != NOTIFIER_CALL_MODE_NO_NOTIFY && nightlightActive && nightlightFade) { briNlT = bri; nightlightDelayMs -= (millis() - nightlightStartTime); @@ -123,8 +130,8 @@ void colorUpdated(int callMode) } if (briT == 0) { - setLedsStandard(true); //do not color transition if starting from off - if (callMode != 3) resetTimebase(); //effect start from beginning + setLedsStandard(true); //do not color transition if starting from off + if (callMode != NOTIFIER_CALL_MODE_NOTIFICATION) resetTimebase(); //effect start from beginning } briIT = bri; @@ -135,7 +142,7 @@ void colorUpdated(int callMode) if (fadeTransition) { //set correct delay if not using notification delay - if (callMode != 3 && !jsonTransitionOnce) transitionDelayTemp = transitionDelay; + if (callMode != NOTIFIER_CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay; jsonTransitionOnce = false; if (transitionDelayTemp == 0) {setLedsStandard(); strip.trigger(); return;} @@ -158,7 +165,7 @@ void colorUpdated(int callMode) strip.trigger(); } - if (callMode == 8) return; + if (callMode == NOTIFIER_CALL_MODE_PRESET_CYCLE) return; //set flag to update blynk and mqtt interfaceUpdateCallMode = callMode; } @@ -167,12 +174,13 @@ void colorUpdated(int callMode) void updateInterfaces(uint8_t callMode) { #ifndef WLED_DISABLE_ALEXA - if (espalexaDevice != nullptr && callMode != 10) { + if (espalexaDevice != nullptr && callMode != NOTIFIER_CALL_MODE_ALEXA) { espalexaDevice->setValue(bri); espalexaDevice->setColor(col[0], col[1], col[2]); } #endif - if (callMode != 9 && callMode != 5) updateBlynk(); + if (callMode != NOTIFIER_CALL_MODE_BLYNK && + callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) updateBlynk(); doPublishMqtt = true; lastInterfaceUpdate = millis(); } @@ -233,7 +241,7 @@ void handleNightlight() { for (byte i=0; i<4; i++) col[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper); // fading from actual color to secondary color } - colorUpdated(5); + colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY); } if (nper >= 1) { @@ -241,7 +249,7 @@ void handleNightlight() if (!nightlightFade) { bri = nightlightTargetBri; - colorUpdated(5); + colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY); } updateBlynk(); if (bri == 0) briLast = briNlT; @@ -257,7 +265,7 @@ void handleNightlight() applyPreset(presetCycCurr,presetApplyBri,presetApplyCol,presetApplyFx); presetCycCurr++; if (presetCycCurr > presetCycleMax) presetCycCurr = presetCycleMin; if (presetCycCurr > 25) presetCycCurr = 1; - colorUpdated(8); + colorUpdated(NOTIFIER_CALL_MODE_PRESET_CYCLE); presetCycledTime = millis(); } } diff --git a/wled00/wled09_button.ino b/wled00/wled09_button.ino index 86227dc3..1cd868be 100644 --- a/wled00/wled09_button.ino +++ b/wled00/wled09_button.ino @@ -7,7 +7,7 @@ void shortPressAction() if (!macroButton) { toggleOnOff(); - colorUpdated(2); + colorUpdated(NOTIFIER_CALL_MODE_BUTTON); } else { applyMacro(macroButton); } diff --git a/wled00/wled12_alexa.ino b/wled00/wled12_alexa.ino index c3bc01ab..9c27041b 100644 --- a/wled00/wled12_alexa.ino +++ b/wled00/wled12_alexa.ino @@ -41,7 +41,7 @@ void onAlexaChange(EspalexaDevice* dev) if (bri == 0) { bri = briLast; - colorUpdated(10); + colorUpdated(NOTIFIER_CALL_MODE_ALEXA); } } else applyMacro(macroAlexaOn); } else if (m == EspalexaDeviceProperty::off) @@ -52,13 +52,13 @@ void onAlexaChange(EspalexaDevice* dev) { briLast = bri; bri = 0; - colorUpdated(10); + colorUpdated(NOTIFIER_CALL_MODE_ALEXA); } } else applyMacro(macroAlexaOff); } else if (m == EspalexaDeviceProperty::bri) { bri = espalexaDevice->getValue(); - colorUpdated(10); + colorUpdated(NOTIFIER_CALL_MODE_ALEXA); } else //color { uint32_t color = espalexaDevice->getRGB(); @@ -67,7 +67,7 @@ void onAlexaChange(EspalexaDevice* dev) col[1] = ((color >> 8) & 0xFF); col[2] = (color & 0xFF); if (useRGBW && col[3] == 0) colorRGBtoRGBW(col); // do not touch white value if EspalexaDevice.cpp did set the white channel - colorUpdated(10); + colorUpdated(NOTIFIER_CALL_MODE_ALEXA); } } diff --git a/wled00/wled15_hue.ino b/wled00/wled15_hue.ino index da400f5e..77e6622c 100644 --- a/wled00/wled15_hue.ino +++ b/wled00/wled15_hue.ino @@ -6,7 +6,7 @@ void handleHue() { if (hueReceived) { - colorUpdated(7); hueReceived = false; + colorUpdated(NOTIFIER_CALL_MODE_HUE); hueReceived = false; if (hueStoreAllowed && hueNewKey) { saveSettingsToEEPROM(); //save api key diff --git a/wled00/wled16_blynk.ino b/wled00/wled16_blynk.ino index c09d0c18..ea4d6877 100644 --- a/wled00/wled16_blynk.ino +++ b/wled00/wled16_blynk.ino @@ -41,45 +41,45 @@ void updateBlynk() BLYNK_WRITE(V0) { bri = param.asInt();//bri - colorUpdated(9); + colorUpdated(NOTIFIER_CALL_MODE_BLYNK); } BLYNK_WRITE(V1) { blHue = param.asInt();//hue colorHStoRGB(blHue*10,blSat,(false)? colSec:col); - colorUpdated(9); + colorUpdated(NOTIFIER_CALL_MODE_BLYNK); } BLYNK_WRITE(V2) { blSat = param.asInt();//sat colorHStoRGB(blHue*10,blSat,(false)? colSec:col); - colorUpdated(9); + colorUpdated(NOTIFIER_CALL_MODE_BLYNK); } BLYNK_WRITE(V3) { bool on = (param.asInt()>0); - if (!on != !bri) {toggleOnOff(); colorUpdated(9);} + if (!on != !bri) {toggleOnOff(); colorUpdated(NOTIFIER_CALL_MODE_BLYNK);} } BLYNK_WRITE(V4) { effectCurrent = param.asInt()-1;//fx - colorUpdated(9); + colorUpdated(NOTIFIER_CALL_MODE_BLYNK); } BLYNK_WRITE(V5) { effectSpeed = param.asInt();//sx - colorUpdated(9); + colorUpdated(NOTIFIER_CALL_MODE_BLYNK); } BLYNK_WRITE(V6) { effectIntensity = param.asInt();//ix - colorUpdated(9); + colorUpdated(NOTIFIER_CALL_MODE_BLYNK); } BLYNK_WRITE(V7) diff --git a/wled00/wled17_mqtt.ino b/wled00/wled17_mqtt.ino index aa72b9e1..db34a742 100644 --- a/wled00/wled17_mqtt.ino +++ b/wled00/wled17_mqtt.ino @@ -12,7 +12,7 @@ void parseMQTTBriPayload(char* payload) uint8_t in = strtoul(payload, NULL, 10); if (in == 0 && bri > 0) briLast = bri; bri = in; - colorUpdated(1); + colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE); } } @@ -60,7 +60,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties if (strstr(topic, "/col")) { colorFromDecOrHexString(col, (char*)payload); - colorUpdated(1); + colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE); } else if (strstr(topic, "/api")) { String apireq = "win&"; diff --git a/wled00/wled19_json.ino b/wled00/wled19_json.ino index 219ef8bc..852dfdac 100644 --- a/wled00/wled19_json.ino +++ b/wled00/wled19_json.ino @@ -154,7 +154,7 @@ bool deserializeState(JsonObject root) } } - colorUpdated(noNotification ? 5:1); + colorUpdated(noNotification ? NOTIFIER_CALL_MODE_NO_NOTIFY : NOTIFIER_CALL_MODE_DIRECT_CHANGE); ps = root["psave"] | -1; if (ps >= 0) savePreset(ps); diff --git a/wled00/wled20_ir.ino b/wled00/wled20_ir.ino index 113b19b5..617518c3 100644 --- a/wled00/wled20_ir.ino +++ b/wled00/wled20_ir.ino @@ -29,7 +29,7 @@ bool decodeIRCustom(uint32_t code) default: return false; } - if (code != IRCUSTOM_MACRO1) colorUpdated(2); //don't update color again if we apply macro, it already does it + if (code != IRCUSTOM_MACRO1) colorUpdated(NOTIFIER_CALL_MODE_BUTTON); //don't update color again if we apply macro, it already does it return true; } @@ -51,25 +51,25 @@ void decodeIR(uint32_t code) irTimesRepeated++; if (lastValidCode == IR24_BRIGHTER || lastValidCode == IR40_BPLUS ) { - relativeChange(&bri, 10); colorUpdated(2); + relativeChange(&bri, 10); colorUpdated(NOTIFIER_CALL_MODE_BUTTON); } else if (lastValidCode == IR24_DARKER || lastValidCode == IR40_BMINUS ) { - relativeChange(&bri, -10, 5); colorUpdated(2); + relativeChange(&bri, -10, 5); colorUpdated(NOTIFIER_CALL_MODE_BUTTON); } if (lastValidCode == IR40_WPLUS) { - relativeChangeWhite(10); colorUpdated(2); + relativeChangeWhite(10); colorUpdated(NOTIFIER_CALL_MODE_BUTTON); } else if (lastValidCode == IR40_WMINUS) { - relativeChangeWhite(-10, 5); colorUpdated(2); + relativeChangeWhite(-10, 5); colorUpdated(NOTIFIER_CALL_MODE_BUTTON); } else if ((lastValidCode == IR24_ON || lastValidCode == IR40_ON) && irTimesRepeated > 7 ) { nightlightActive = true; nightlightStartTime = millis(); - colorUpdated(2); + colorUpdated(NOTIFIER_CALL_MODE_BUTTON); } return; } @@ -85,11 +85,12 @@ void decodeIR(uint32_t code) case 3: decodeIR40(code); break; // blue 40-key remote with 25%, 50%, 75% and 100% keys case 4: decodeIR44(code); break; // white 44-key remote with color-up/down keys and DIY1 to 6 keys case 5: decodeIR21(code); break; // white 21-key remote - case 6: decodeIR6(code); break; // black 6-key learning remote defaults: "CH" controls brightness, + case 6: decodeIR6(code); break; // black 6-key learning remote defaults: "CH" controls brightness, // "VOL +" controls effect, "VOL -" controls colour/palette, "MUTE" // sets bright plain white default: return; } + colorUpdated(NOTIFIER_CALL_MODE_BUTTON); //for notifier, IR is considered a button input } //code <= 0xF70000 also invalid } @@ -125,7 +126,6 @@ void decodeIR24(uint32_t code) default: return; } lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input } void decodeIR24OLD(uint32_t code) @@ -158,7 +158,6 @@ void decodeIR24OLD(uint32_t code) default: return; } lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input } @@ -194,7 +193,6 @@ void decodeIR24CT(uint32_t code) default: return; } lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input } @@ -253,7 +251,6 @@ void decodeIR40(uint32_t code) case IR40_FLASH : if (!applyPreset(4)) { effectCurrent = FX_MODE_RAINBOW; effectPalette = 0; } break; } lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input } void decodeIR44(uint32_t code) @@ -317,12 +314,11 @@ void decodeIR44(uint32_t code) case IR44_FADE7 : bri = 255; break; } lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input } void decodeIR21(uint32_t code) { - switch (code) { + switch (code) { case IR21_BRIGHTER: relativeChange(&bri, 10); break; case IR21_DARKER: relativeChange(&bri, -10, 5); break; case IR21_OFF: briLast = bri; bri = 0; break; @@ -345,51 +341,42 @@ void decodeIR21(uint32_t code) case IR21_FADE: if (!applyPreset(3)) { effectCurrent = FX_MODE_BREATH; effectPalette = 0; } break; case IR21_SMOOTH: if (!applyPreset(4)) { effectCurrent = FX_MODE_RAINBOW; effectPalette = 0; } break; default: return; - } - lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input + } + lastValidCode = code; } void decodeIR6(uint32_t code) { - - switch (code) { - case IR6_POWER: toggleOnOff(); break; - case IR6_CHANNEL_UP: relativeChange(&bri, 10); break; - case IR6_CHANNEL_DOWN: relativeChange(&bri, -10, 5); break; - case IR6_VOLUME_UP: /* next effect */ relativeChange(&effectCurrent, 1); break; - case IR6_VOLUME_DOWN: - /* next palette */ - - relativeChange(&effectPalette, 1); - - switch(lastIR6ColourIdx) - { - case 0: colorFromUint32(COLOR_RED); break; - case 1: colorFromUint32(COLOR_REDDISH); break; - case 2:colorFromUint32(COLOR_ORANGE); break; - case 3:colorFromUint32(COLOR_YELLOWISH); break; - case 4:colorFromUint32(COLOR_GREEN); break; - case 5:colorFromUint32(COLOR_GREENISH); break; - case 6:colorFromUint32(COLOR_TURQUOISE); break; - case 7: colorFromUint32(COLOR_CYAN); break; - case 8:colorFromUint32(COLOR_BLUE); break; - case 9:colorFromUint32(COLOR_DEEPBLUE); break; - case 10:colorFromUint32(COLOR_PURPLE); break; - case 11:colorFromUint32(COLOR_PINK); break; - case 12:colorFromUint32(COLOR_WHITE); break; - default:break; - - } - - lastIR6ColourIdx++; - if(lastIR6ColourIdx > 12) lastIR6ColourIdx = 0; - + switch (code) { + case IR6_POWER: toggleOnOff(); break; + case IR6_CHANNEL_UP: relativeChange(&bri, 10); break; + case IR6_CHANNEL_DOWN: relativeChange(&bri, -10, 5); break; + case IR6_VOLUME_UP: /* next effect */ relativeChange(&effectCurrent, 1); break; + case IR6_VOLUME_DOWN: + /* next palette */ + relativeChange(&effectPalette, 1); + switch(lastIR6ColourIdx) { + case 0: colorFromUint32(COLOR_RED); break; + case 1: colorFromUint32(COLOR_REDDISH); break; + case 2:colorFromUint32(COLOR_ORANGE); break; + case 3:colorFromUint32(COLOR_YELLOWISH); break; + case 4:colorFromUint32(COLOR_GREEN); break; + case 5:colorFromUint32(COLOR_GREENISH); break; + case 6:colorFromUint32(COLOR_TURQUOISE); break; + case 7: colorFromUint32(COLOR_CYAN); break; + case 8:colorFromUint32(COLOR_BLUE); break; + case 9:colorFromUint32(COLOR_DEEPBLUE); break; + case 10:colorFromUint32(COLOR_PURPLE); break; + case 11:colorFromUint32(COLOR_PINK); break; + case 12:colorFromUint32(COLOR_WHITE); break; + default:break; + } + lastIR6ColourIdx++; + if(lastIR6ColourIdx > 12) lastIR6ColourIdx = 0; break; - case IR6_MUTE: effectCurrent = 0; effectPalette = 0; colorFromUint32(COLOR_WHITE); bri=255; break; - } - lastValidCode = code; - colorUpdated(2); //for notifier, IR is considered a button input + case IR6_MUTE: effectCurrent = 0; effectPalette = 0; colorFromUint32(COLOR_WHITE); bri=255; break; + } + lastValidCode = code; }