From 4b2a4ffaa40aefc3c2a59c754e6b2ce90def3e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 25 Jan 2018 00:05:57 +0100 Subject: [PATCH] Added support for MagicHome LED Controller 2.3 --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 29 +++++++++++++++++++++++++++++ code/espurna/migrate.ino | 15 +++++++++++++++ code/platformio.ini | 24 ++++++++++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 4cdc35d2..feb0859b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -59,6 +59,7 @@ //#define ARILUX_AL_LC11 //#define ARILUX_AL_LC02 //#define WEMOS_D1_TARPUNA_SHIELD +//#define MAGICHOME_LED_CONTROLLER_23 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index edbefa8c..7b950002 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -914,6 +914,35 @@ #define IR_PIN 4 #define IR_BUTTON_SET 1 +#elif defined(MAGICHOME_LED_CONTROLLER_23) + + // Info + #define MANUFACTURER "MAGICHOME" + #define DEVICE "LED_CONTROLLER_23" + #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 + + // Light + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 12 // RED + #define LIGHT_CH2_PIN 5 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 15 // WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + + // IR + #define IR_SUPPORT 1 + #define IR_PIN 4 + #define IR_BUTTON_SET 1 + // ----------------------------------------------------------------------------- // HUACANXING H801 & H802 // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index de7476fb..2dea8499 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -698,6 +698,21 @@ void migrate() { setSetting("chLogic", 3, 0); setSetting("relays", 1); + #elif defined(MAGICHOME_LED_CONTROLLER_23) + + setSetting("board", 53); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("chGPIO", 0, 12); + setSetting("chGPIO", 1, 5); + setSetting("chGPIO", 2, 13); + setSetting("chGPIO", 3, 15); + setSetting("chLogic", 0, 0); + setSetting("chLogic", 1, 0); + setSetting("chLogic", 2, 0); + setSetting("chLogic", 3, 0); + setSetting("relays", 1); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index e3bd0fea..2290bf2f 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -882,6 +882,30 @@ upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 extra_scripts = ${common.extra_scripts} +[env:magichome-led-controller-23] +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_23 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:magichome-led-controller-23-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_23 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + [env:huacanxing-h801] platform = ${common.platform} framework = arduino