Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More IR remotes (24/40/44-keys) and select them in the settings #569

Merged
merged 2 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wled00/html_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,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 enabled: <input type="checkbox" name="IR"><br>
Infrared receiver type (0 = disabled): <input name="IR" type="number" min="0" max="4" 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>
Expand Down
195 changes: 149 additions & 46 deletions wled00/ir_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,145 @@
#define IR24_FADE 0xF7C837
#define IR24_SMOOTH 0xF7E817

/* 44-key defs, to be done later
#define IR44_BPlus 0xFF3AC5 //
#define IR44_BMinus 0xFFBA45 //
#define IR44_ON 0xFF827D //
#define IR44_OFF 0xFF02FD //
#define IR44_R 0xFF1AE5 //
#define IR44_G 0xFF9A65 //
#define IR44_B 0xFFA25D //
#define IR44_W 0xFF22DD //
#define IR44_B1 0xFF2AD5 //
#define IR44_B2 0xFFAA55 //
#define IR44_B3 0xFF926D //
#define IR44_B4 0xFF12ED //
#define IR44_B5 0xFF0AF5 //
#define IR44_B6 0xFF8A75 //
#define IR44_B7 0xFFB24D //
#define IR44_B8 0xFF32CD //
#define IR44_B9 0xFF38C7 //
#define IR44_B10 0xFFB847 //
#define IR44_B11 0xFF7887 //
#define IR44_B12 0xFFF807 //
#define IR44_B13 0xFF18E7 //
#define IR44_B14 0xFF9867 //
#define IR44_B15 0xFF58A7 //
#define IR44_B16 0xFFD827 //
#define IR44_UPR 0xFF28D7 //
#define IR44_UPG 0xFFA857 //
#define IR44_UPB 0xFF6897 //
#define IR44_QUICK 0xFFE817 //
#define IR44_DOWNR 0xFF08F7 //
#define IR44_DOWNG 0xFF8877 //
#define IR44_DOWNB 0xFF48B7 //
#define IR44_SLOW 0xFFC837 //
#define IR44_DIY1 0xFF30CF //
#define IR44_DIY2 0xFFB04F //
#define IR44_DIY3 0xFF708F //
#define IR44_AUTO 0xFFF00F //
#define IR44_DIY4 0xFF10EF //
#define IR44_DIY5 0xFF906F //
#define IR44_DIY6 0xFF50AF //
#define IR44_FLASH 0xFFD02F //
#define IR44_JUMP3 0xFF20DF //
#define IR44_JUMP7 0xFFA05F //
#define IR44_FADE3 0xFF609F //
#define IR44_FADE7 0xFFE01F //
*/
// 24-key defs for white remote control with CW / WW / CT+ and CT- keys (from ALDI LED pillar lamp)
#define IR24_CT_BRIGHTER 0xF700FF // BRI +
#define IR24_CT_DARKER 0xF7807F // BRI -
#define IR24_CT_OFF 0xF740BF // OFF
#define IR24_CT_ON 0xF7C03F // ON
#define IR24_CT_RED 0xF720DF // RED
#define IR24_CT_REDDISH 0xF710EF // REDDISH
#define IR24_CT_ORANGE 0xF730CF // ORANGE
#define IR24_CT_YELLOWISH 0xF708F7 // YELLOWISH
#define IR24_CT_YELLOW 0xF728D7 // YELLOW
#define IR24_CT_GREEN 0xF7A05F // GREEN
#define IR24_CT_GREENISH 0xF7906F // GREENISH
#define IR24_CT_TURQUOISE 0xF7B04F // TURQUOISE
#define IR24_CT_CYAN 0xF78877 // CYAN
#define IR24_CT_AQUA 0xF7A857 // AQUA
#define IR24_CT_BLUE 0xF7609F // BLUE
#define IR24_CT_DEEPBLUE 0xF750AF // DEEPBLUE
#define IR24_CT_PURPLE 0xF7708F // PURPLE
#define IR24_CT_MAGENTA 0xF748B7 // MAGENTA
#define IR24_CT_PINK 0xF76897 // PINK
#define IR24_CT_COLDWHITE 0xF7E01F // CW
#define IR24_CT_WARMWHITE 0xF7D02F // WW
#define IR24_CT_CTPLUS 0xF7F00F // CT+
#define IR24_CT_CTMINUS 0xF7C837 // CT-
#define IR24_CT_MEMORY 0xF7E817 // MEMORY

// 24-key defs for old remote control
#define IR24_OLD_BRIGHTER 0xFF906F // Brightness Up
#define IR24_OLD_DARKER 0xFFB847 // Brightness Down
#define IR24_OLD_OFF 0xFFF807 // Power OFF
#define IR24_OLD_ON 0xFFB04F // Power On
#define IR24_OLD_RED 0xFF9867 // RED
#define IR24_OLD_REDDISH 0xFFE817 // Light RED
#define IR24_OLD_ORANGE 0xFF02FD // Orange
#define IR24_OLD_YELLOWISH 0xFF50AF // Light Orange
#define IR24_OLD_YELLOW 0xFF38C7 // YELLOW
#define IR24_OLD_GREEN 0xFFD827 // GREEN
#define IR24_OLD_GREENISH 0xFF48B7 // Light GREEN
#define IR24_OLD_TURQUOISE 0xFF32CD // TURQUOISE
#define IR24_OLD_CYAN 0xFF7887 // CYAN
#define IR24_OLD_AQUA 0xFF28D7 // AQUA
#define IR24_OLD_BLUE 0xFF8877 // BLUE
#define IR24_OLD_DEEPBLUE 0xFF6897 // Dark BLUE
#define IR24_OLD_PURPLE 0xFF20DF // PURPLE
#define IR24_OLD_MAGENTA 0xFF708F // MAGENTA
#define IR24_OLD_PINK 0xFFF00F // PINK
#define IR24_OLD_WHITE 0xFFA857 // WHITE
#define IR24_OLD_FLASH 0xFFB24D // FLASH Mode
#define IR24_OLD_STROBE 0xFF00FF // STROBE Mode
#define IR24_OLD_FADE 0xFF58A7 // FADE Mode
#define IR24_OLD_SMOOTH 0xFF30CF // SMOOTH Mode

// 40-key defs for blue remote control
#define IR40_BPLUS 0xFF3AC5 //
#define IR40_BMINUS 0xFFBA45 //
#define IR40_OFF 0xFF827D //
#define IR40_ON 0xFF02FD //
#define IR40_RED 0xFF1AE5 //
#define IR40_GREEN 0xFF9A65 //
#define IR40_BLUE 0xFFA25D //
#define IR40_WHITE 0xFF22DD // natural white
#define IR40_REDDISH 0xFF2AD5 //
#define IR40_GREENISH 0xFFAA55 //
#define IR40_DEEPBLUE 0xFF926D //
#define IR40_WARMWHITE2 0xFF12ED // warmest white
#define IR40_ORANGE 0xFF0AF5 //
#define IR40_TURQUOISE 0xFF8A75 //
#define IR40_PURPLE 0xFFB24D //
#define IR40_WARMWHITE 0xFF32CD // warm white
#define IR40_YELLOWISH 0xFF38C7 //
#define IR40_CYAN 0xFFB847 //
#define IR40_MAGENTA 0xFF7887 //
#define IR40_COLDWHITE 0xFFF807 // cold white
#define IR40_YELLOW 0xFF18E7 //
#define IR40_AQUA 0xFF9867 //
#define IR40_PINK 0xFF58A7 //
#define IR40_COLDWHITE2 0xFFD827 // coldest white
#define IR40_WPLUS 0xFF28D7 // white chanel bright plus
#define IR40_WMINUS 0xFFA857 // white chanel bright minus
#define IR40_WOFF 0xFF6897 // white chanel on
#define IR40_WON 0xFFE817 // white chanel off
#define IR40_W25 0xFF08F7 // white chanel 25%
#define IR40_W50 0xFF8877 // white chanel 50%
#define IR40_W75 0xFF48B7 // white chanel 75%
#define IR40_W100 0xFFC837 // white chanel 100%
#define IR40_JUMP3 0xFF30CF // JUMP3
#define IR40_FADE3 0xFFB04F // FADE3
#define IR40_JUMP7 0xFF708F // JUMP7
#define IR40_QUICK 0xFFF00F // QUICK
#define IR40_FADE7 0xFF10EF // FADE7
#define IR40_FLASH 0xFF906F // FLASH
#define IR40_AUTO 0xFF50AF // AUTO
#define IR40_SLOW 0xFFD02F // SLOW

// 44-key defs, to be done later
#define IR44_BPLUS 0xFF3AC5 //
#define IR44_BMINUS 0xFFBA45 //
#define IR44_OFF 0xFF827D //
#define IR44_ON 0xFF02FD //
#define IR44_RED 0xFF1AE5 //
#define IR44_GREEN 0xFF9A65 //
#define IR44_BLUE 0xFFA25D //
#define IR44_WHITE 0xFF22DD // natural white
#define IR44_REDDISH 0xFF2AD5 //
#define IR44_GREENISH 0xFFAA55 //
#define IR44_DEEPBLUE 0xFF926D //
#define IR44_WARMWHITE2 0xFF12ED // warmest white
#define IR44_ORANGE 0xFF0AF5 //
#define IR44_TURQUOISE 0xFF8A75 //
#define IR44_PURPLE 0xFFB24D //
#define IR44_WARMWHITE 0xFF32CD // warm white
#define IR44_YELLOWISH 0xFF38C7 //
#define IR44_CYAN 0xFFB847 //
#define IR44_MAGENTA 0xFF7887 //
#define IR44_COLDWHITE 0xFFF807 // cold white
#define IR44_YELLOW 0xFF18E7 //
#define IR44_AQUA 0xFF9867 //
#define IR44_PINK 0xFF58A7 //
#define IR44_COLDWHITE2 0xFFD827 // coldest white
#define IR44_REDPLUS 0xFF28D7 //
#define IR44_GREENPLUS 0xFFA857 //
#define IR44_BLUEPLUS 0xFF6897 //
#define IR44_QUICK 0xFFE817 //
#define IR44_REDMINUS 0xFF08F7 //
#define IR44_GREENMINUS 0xFF8877 //
#define IR44_BLUEMINUS 0xFF48B7 //
#define IR44_SLOW 0xFFC837 //
#define IR44_DIY1 0xFF30CF //
#define IR44_DIY2 0xFFB04F //
#define IR44_DIY3 0xFF708F //
#define IR44_AUTO 0xFFF00F //
#define IR44_DIY4 0xFF10EF //
#define IR44_DIY5 0xFF906F //
#define IR44_DIY6 0xFF50AF //
#define IR44_FLASH 0xFFD02F //
#define IR44_JUMP3 0xFF20DF //
#define IR44_JUMP7 0xFFA05F //
#define IR44_FADE3 0xFF609F //
#define IR44_FADE7 0xFFE01F //

#define COLOR_RED 0xFF0000
#define COLOR_REDDISH 0xFF7800
Expand All @@ -93,3 +186,13 @@
#define COLOR_MAGENTA 0xFF00DC
#define COLOR_PINK 0xFF00A0
#define COLOR_WHITE 0xFFFFDC
#define COLOR_WARMWHITE2 0xFFAA69
#define COLOR_WARMWHITE 0xFFBF8E
#define COLOR_NEUTRALWHITE 0xFFD4B4
#define COLOR_COLDWHITE 0xFFE9D9
#define COLOR_COLDWHITE2 0xFFFFFF
#define COLOR2_WARMWHITE2 0xFFFF9900
#define COLOR2_WARMWHITE 0xFF825A00
#define COLOR2_NEUTRALWHITE 0xFF000000
#define COLOR2_COLDWHITE 0xFF7F7F7F
#define COLOR2_COLDWHITE2 0xFFFFFFFF
Comment on lines +189 to +198
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more colors - the ones that begin with "COLOR2_" are 32 bit / RGBW - the other ones 24 bit / RGB.

7 changes: 3 additions & 4 deletions wled00/wled00.ino
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@

#ifdef ARDUINO_ARCH_ESP32
#undef WLED_USE_ANALOG_LEDS // Solid RGBW not implemented for ESP32 yet
/*#ifndef WLED_DISABLE_INFRARED
#include <IRremote.h>
#endif*/ //there are issues with ESP32 infrared, so it is disabled for now
#else
#ifndef WLED_DISABLE_INFRARED
#include <IRremoteESP8266.h>
Expand Down Expand Up @@ -160,7 +157,7 @@ bool syncToggleReceive = false; //UIs which only have a single but

//Sync CONFIG
bool buttonEnabled = true;
bool irEnabled = false; //Infrared receiver
byte irEnabled = 0; //Infrared receiver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this changes the "ON/OFF" checkbox to a value entry field (0 to 4) with 0=disabled, 1=1st remote, 2=2nd remote etc. /// 4 different IR remotes in total.


uint16_t udpPort = 21324; //WLED notifier default port
uint16_t udpRgbPort = 19446; //Hyperion port
Expand Down Expand Up @@ -288,6 +285,7 @@ byte briOld = 0;
byte briT = 0;
byte briIT = 0;
byte briLast = 128; //brightness before turned off. Used for toggle function
byte whiteLast = 128; //white channel before turned off. Used for toggle function

//button
bool buttonPressedBefore = false;
Expand Down Expand Up @@ -507,6 +505,7 @@ void setup() {

//main program loop
void loop() {
handleIR(); //2nd call to function needed for ESP32 to return valid results -- should be good for ESP8266, too
handleConnection();
handleSerial();
handleNotifications();
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled02_xml.ino
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void getSettingsJS(byte subPage, char* dest)
if (subPage == 4)
{
sappend('c',"BT",buttonEnabled);
sappend('c',"IR",irEnabled);
sappend('v',"IR",irEnabled);
sappend('v',"UP",udpPort);
sappend('c',"RB",receiveNotificationBrightness);
sappend('c',"RC",receiveNotificationColor);
Expand Down
2 changes: 1 addition & 1 deletion wled00/wled03_set.ino
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
if (subPage == 4)
{
buttonEnabled = request->hasArg("BT");
irEnabled = request->hasArg("IR");
irEnabled = request->arg("IR").toInt();
int t = request->arg("UP").toInt();
if (t > 0) udpPort = t;
receiveNotificationBrightness = request->hasArg("RB");
Expand Down
23 changes: 23 additions & 0 deletions wled00/wled14_colors.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ void colorFromUint32(uint32_t in, bool secondary)
}
}

//load a color without affecting the white channel
void colorFromUint24(uint32_t in, bool secondary = false)
{
if (secondary) {
colSec[0] = in >> 16 & 0xFF;
colSec[1] = in >> 8 & 0xFF;
colSec[2] = in & 0xFF;
} else {
col[0] = in >> 16 & 0xFF;
col[1] = in >> 8 & 0xFF;
col[2] = in & 0xFF;
}
}

//relatively change white brightness, minumum A=5
void relativeChangeWhite(int8_t amount, byte lowerBoundary =0)
{
int16_t new_val = (int16_t) col[3] + amount;
if (new_val > 0xFF) new_val = 0xFF;
else if (new_val < lowerBoundary) new_val = lowerBoundary;
col[3] = new_val;
}

void colorHStoRGB(uint16_t hue, byte sat, byte* rgb) //hue, sat to rgb
{
float h = ((float)hue)/65535.0;
Expand Down
Loading