diff --git a/wled00/html_settings.h b/wled00/html_settings.h index d6cf7490..c54bf5ff 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -189,7 +189,7 @@ const char PAGE_settings_sync[] PROGMEM = R"=====(

Sync setup

Button setup

On/Off button enabled:
-Infrared receiver type (0 = disabled):
+Infrared receiver type (0 = disabled):
IR info

WLED Broadcast

UDP Port:
diff --git a/wled00/ir_codes.h b/wled00/ir_codes.h index 8c42126c..a3988e6d 100644 --- a/wled00/ir_codes.h +++ b/wled00/ir_codes.h @@ -4,6 +4,16 @@ #define IRCUSTOM_ONOFF 0xA55AEA15 //Pioneer RC-975R "+FAV" button (example) #define IRCUSTOM_MACRO1 0xFFFFFFFF //placeholder, will never be checked for +// Default IR codes for 6-key learning remote https://www.aliexpress.com/item/4000307837886.html +// This cheap remote has the advantage of being more powerful (longer range) than cheap credit-card remotes +#define IR6_POWER 0xFF0FF0 +#define IR6_CHANNEL_UP 0xFF8F70 +#define IR6_CHANNEL_DOWN 0xFF4FB0 +#define IR6_VOLUME_UP 0xFFCF30 +#define IR6_VOLUME_DOWN 0xFF2FD0 +#define IR6_MUTE 0xFFAF50 + + //Infrared codes for 24-key remote from http://woodsgood.ca/projects/2015/02/13/rgb-led-strip-controllers-ir-codes/ #define IR24_BRIGHTER 0xF700FF #define IR24_DARKER 0xF7807F diff --git a/wled00/wled20_ir.ino b/wled00/wled20_ir.ino index 00f13ffc..113b19b5 100644 --- a/wled00/wled20_ir.ino +++ b/wled00/wled20_ir.ino @@ -14,6 +14,7 @@ decode_results results; unsigned long irCheckedTime = 0; uint32_t lastValidCode = 0; uint16_t irTimesRepeated = 0; +uint8_t lastIR6ColourIdx = 0; //Add what your custom IR codes should trigger here. Guide: https://github.com/Aircoookie/WLED/wiki/Infrared-Control @@ -84,6 +85,9 @@ 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, + // "VOL +" controls effect, "VOL -" controls colour/palette, "MUTE" + // sets bright plain white default: return; } } @@ -346,6 +350,49 @@ void decodeIR21(uint32_t code) colorUpdated(2); //for notifier, IR is considered a button input } +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; + + 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 +} + + void initIR() { if (irEnabled > 0)