From 257e9e471d21e2185db2896142b862d18cd03d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Tue, 17 Oct 2017 20:42:28 +0200 Subject: [PATCH] Merge MagicHome LED Controller 2.0 & IR versions --- code/espurna/config/hardware.h | 52 +++++++++------------------------- code/espurna/hardware.ino | 2 +- code/platformio.ini | 30 +++----------------- 3 files changed, 18 insertions(+), 66 deletions(-) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 676dfda4..b4a89c6b 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -706,15 +706,19 @@ #define LIGHT_CH3_INVERSE 0 #define LIGHT_CH4_INVERSE 0 -#elif defined(MAGICHOME_LED_CONTROLLER_2_0) +#elif defined(MAGICHOME_LED_CONTROLLER_20) // Info #define MANUFACTURER "MAGICHOME" - #define DEVICE "LED_CONTROLLER_2_0" + #define DEVICE "LED_CONTROLLER_20" #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER #define DUMMY_RELAY_COUNT 1 + // LEDs + #define LED1_PIN 2 + #define LED1_PIN_INVERSE 1 + // Channels #define LIGHT_CH1_PIN 5 // RED #define LIGHT_CH2_PIN 12 // GREEN @@ -726,43 +730,14 @@ #define LIGHT_CH3_INVERSE 0 #define LIGHT_CH4_INVERSE 0 -// ----------------------------------------------------------------------------- -// LED Controller With IR -// ----------------------------------------------------------------------------- - -#elif defined(MAGICHOME_LED_CONTROLLER_IR) - - // Info - #define MANUFACTURER "MAGICHOME" - #define DEVICE "LED_CONTROLLER_IR" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 - - // Channels (for board version 2.0) - #define LIGHT_CH1_PIN 5 // RED - #define LIGHT_CH2_PIN 12 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - //#define LIGHT_CH4_PIN 14 // WHITE ? #define LIGHT_IR_PIN 4 // IR LED - - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 - #define LIGHT_PROVIDER_EXPERIMENTAL_RGB_ONLY_HSV_IR 1 // 24 Buttons Set of the IR Remote #ifndef IR_BUTTONS_SET - #define IR_BUTTONS_SET 1 + #define IR_BUTTONS_SET 1 #endif - //Remote Buttons SET 1 (for the original Remote shipped with the controller) #if IR_BUTTONS_SET == 1 #define IR_BUTTON_0 0xFF906F // Brightness + @@ -797,39 +772,38 @@ #endif //Remote Buttons SET 2 (another identical IR Remote shipped with another controller) - #if IR_BUTTONS_SET == 2 + #if IR_BUTTONS_SET == 2 #define IR_BUTTON_0 0xFF00FF // Brightness + #define IR_BUTTON_1 0xFF807F // Brightness - #define IR_BUTTON_2 0xFF40BF // OFF #define IR_BUTTON_3 0xFFC03F // ON - + #define IR_BUTTON_4 0xFF20DF // RED #define IR_BUTTON_5 0xFFA05F // GREEN #define IR_BUTTON_6 0xFF609F // BLUE #define IR_BUTTON_7 0xFFE01F // WHITE - + #define IR_BUTTON_8 0xFF10EF // "Red" 1 #define IR_BUTTON_9 0xFF906F // "Green" 1 #define IR_BUTTON_10 0xFF50AF // "Blue" 1 #define IR_BUTTON_11 0xFFD02F // FLASH Mode - + #define IR_BUTTON_12 0xFF30CF // "Red" 2 #define IR_BUTTON_13 0xFFB04F // "Green" 2 #define IR_BUTTON_14 0xFF708F // "Blue" 2 #define IR_BUTTON_15 0xFFF00F // STROBE Mode - + #define IR_BUTTON_16 0xFF08F7 // "Red" 3 #define IR_BUTTON_17 0xFF8877 // "Green" 3 #define IR_BUTTON_18 0xFF48B7 // "Blue" 3 #define IR_BUTTON_19 0xFFC837 // FADE Mode - + #define IR_BUTTON_20 0xFF28D7 // "Red" 4 #define IR_BUTTON_21 0xFFA857 // "Green" 4 #define IR_BUTTON_22 0xFF6897 // "Blue" 4 #define IR_BUTTON_23 0xFFE817 // SMOOTH Mode #endif - // ----------------------------------------------------------------------------- // HUACANXING H801 // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index aebe4a22..427a9301 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -499,7 +499,7 @@ void hwUpwardsCompatibility() { setSetting("chLogic", 2, 0); setSetting("relays", 1); - #elif defined(MAGICHOME_LED_CONTROLLER_2_0) + #elif defined(MAGICHOME_LED_CONTROLLER_20) setSetting("board", 42); setSetting("relayProvider", RELAY_PROVIDER_LIGHT); diff --git a/code/platformio.ini b/code/platformio.ini index f2610444..633c73da 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -730,46 +730,24 @@ upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 -[env:magichome-led-controller-2-0] +[env:magichome-led-controller-20] platform = ${common.platform} framework = arduino board = esp01_1m board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_2_0 +build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_20 monitor_baud = 115200 -[env:magichome-led-controller-2-0-ota] +[env:magichome-led-controller-20-ota] platform = ${common.platform} framework = arduino board = esp01_1m board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_2_0 -upload_port = "192.168.4.1" -upload_flags = --auth=fibonacci --port 8266 -monitor_baud = 115200 - -[env:magichome-led-controller-ir] -platform = ${common.platform} -framework = arduino -board = esp01_1m -board_flash_mode = dout -lib_deps = ${common.lib_deps} -lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_IR -monitor_baud = 115200 - -[env:magichome-led-controller-ir-ota] -platform = ${common.platform} -framework = arduino -board = esp01_1m -board_flash_mode = dout -lib_deps = ${common.lib_deps} -lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_IR +build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_20 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200