added support for 21-key remote

This commit is contained in:
recliq 2020-01-19 12:53:44 +01:00
parent 125e21900a
commit 8c69a4cb7a
3 changed files with 54 additions and 1 deletions

View File

@ -189,7 +189,7 @@ const char PAGE_settings_sync[] PROGMEM = R"=====(<!DOCTYPE html>
<h2>Sync setup</h2>
<h3>Button setup</h3>
On/Off button enabled: <input type="checkbox" name="BT"><br>
Infrared receiver type (0 = disabled): <input name="IR" type="number" min="0" max="4" required><br>
Infrared receiver type (0 = disabled): <input name="IR" type="number" min="0" max="5" required><br>
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control" target="_blank">IR info</a>
<h3>WLED Broadcast</h3>
UDP Port: <input name="UP" type="number" min="1" max="65535" required><br>

View File

@ -170,6 +170,29 @@
#define IR44_FADE3 0xFF609F //
#define IR44_FADE7 0xFFE01F //
//Infrared codes for 21-key remote https://images-na.ssl-images-amazon.com/images/I/51NMA0XucnL.jpg
#define IR21_BRIGHTER 0xFFE01F
#define IR21_DARKER 0xFFA857
#define IR21_OFF 0xFF629D
#define IR21_ON 0xFFA25D
#define IR21_RED 0xFF6897
#define IR21_REDDISH 0xFF30CF
#define IR21_ORANGE 0xFF10EF
#define IR21_YELLOWISH 0xFF42BD
#define IR21_GREEN 0xFF9867
#define IR21_GREENISH 0xFF18E7
#define IR21_TURQUOISE 0xFF38C7
#define IR21_CYAN 0xFF4AB5
#define IR21_BLUE 0xFFB04F
#define IR21_DEEPBLUE 0xFF7A85
#define IR21_PURPLE 0xFF5AA5
#define IR21_PINK 0xFF52AD
#define IR21_WHITE 0xFF906F
#define IR21_FLASH 0xFFE21D
#define IR21_STROBE 0xFF22DD
#define IR21_FADE 0xFF02FD
#define IR21_SMOOTH 0xFFC23D
#define COLOR_RED 0xFF0000
#define COLOR_REDDISH 0xFF7800
#define COLOR_ORANGE 0xFFA000

View File

@ -83,6 +83,7 @@ void decodeIR(uint32_t code)
case 2: decodeIR24CT(code); break; // white 24-key remote with CW, WW, CT+ and CT- keys
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
default: return;
}
}
@ -315,6 +316,35 @@ void decodeIR44(uint32_t code)
colorUpdated(2); //for notifier, IR is considered a button input
}
void decodeIR21(uint32_t 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;
case IR21_ON: bri = briLast; break;
case IR21_RED: colorFromUint32(COLOR_RED); break;
case IR21_REDDISH: colorFromUint32(COLOR_REDDISH); break;
case IR21_ORANGE: colorFromUint32(COLOR_ORANGE); break;
case IR21_YELLOWISH: colorFromUint32(COLOR_YELLOWISH); break;
case IR21_GREEN: colorFromUint32(COLOR_GREEN); break;
case IR21_GREENISH: colorFromUint32(COLOR_GREENISH); break;
case IR21_TURQUOISE: colorFromUint32(COLOR_TURQUOISE); break;
case IR21_CYAN: colorFromUint32(COLOR_CYAN); break;
case IR21_BLUE: colorFromUint32(COLOR_BLUE); break;
case IR21_DEEPBLUE: colorFromUint32(COLOR_DEEPBLUE); break;
case IR21_PURPLE: colorFromUint32(COLOR_PURPLE); break;
case IR21_PINK: colorFromUint32(COLOR_PINK); break;
case IR21_WHITE: colorFromUint32(COLOR_WHITE); effectCurrent = 0; break;
case IR21_FLASH: if (!applyPreset(1)) effectCurrent = FX_MODE_COLORTWINKLE; break;
case IR21_STROBE: if (!applyPreset(2)) effectCurrent = FX_MODE_RAINBOW_CYCLE; break;
case IR21_FADE: if (!applyPreset(3)) effectCurrent = FX_MODE_BREATH; break;
case IR21_SMOOTH: if (!applyPreset(4)) effectCurrent = FX_MODE_RAINBOW; break;
default: return;
}
lastValidCode = code;
colorUpdated(2); //for notifier, IR is considered a button input
}
void initIR()
{