From dc26a696429a66a76a3fd2d643d3e8cdb9f4a288 Mon Sep 17 00:00:00 2001 From: Vencislav Atanasov Date: Tue, 2 Jul 2019 05:43:29 +0300 Subject: [PATCH] Add support for MagicHome RGBWW LED strip (#1787) * Add support for MagicHome RGBWW LED strip This adds support for MagicHome 5 channel LED strip. It is using ESP8285 board, labelled as ESP-M4, has 5 powerful MOSFETs (M3006D, up to 80A! continuous/160A peak) at 12-24V. They are driven by smaller transistors. Red LED is connected to 3.3V power supply, and can't be controller. Green LED is connected to GPIO. Pin mappings: BTN IO0 R Q8 Q2 IO14 G Q6 Q3 IO12 B Q9 Q4 IO13 WW Q10 Q5 IO15 CW Q7 Q1 IO5 GREEN_LED IO2 Looks like the same board is used in another product which has support for RF remote, but mine doesn't, so I don't include RF config, if yours has it should be a simple copy/paste job to add it. * Add config for push button * Fix copy/paste mistake * Turn on/off LEDs using the push button --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 31 +++++++++++++++++++++++++++++++ code/platformio.ini | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 71450a8a..83bf372f 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -95,6 +95,7 @@ //#define MAGICHOME_LED_CONTROLLER_20 //#define MAGICHOME_ZJ_WFMN_A_11 //#define MAGICHOME_ZJ_WFMN_B_11 +//#define MAGICHOME_ZJ_ESPM_5CH_B_13 //#define MANCAVEMADE_ESPLIVE //#define MAXCIO_WDE004 //#define MAXCIO_WUS002S diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 49a5ad35..6148c6f3 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1289,6 +1289,37 @@ #define RFB_DIRECT 1 #define RFB_RX_PIN 4 +#elif defined(MAGICHOME_ZJ_ESPM_5CH_B_13) + + // Info + #define MANUFACTURER "MAGICHOME" + #define DEVICE "ZJ_ESPM_5CH_B_13" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // LEDs + #define LED1_PIN 2 + #define LED1_PIN_INVERSE 1 + + // Light + #define LIGHT_CHANNELS 5 + #define LIGHT_CH1_PIN 14 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 5 // COLD WHITE + #define LIGHT_CH5_PIN 15 // WARM WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #define LIGHT_CH5_INVERSE 0 + // ----------------------------------------------------------------------------- // HUACANXING H801 & H802 // ----------------------------------------------------------------------------- diff --git a/code/platformio.ini b/code/platformio.ini index de5a562d..d03c49d4 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1393,6 +1393,30 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} +[env:magichome-zj-espm-5ch-b-13] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DMAGICHOME_ZJ_ESPM_5CH_B_13 +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:magichome-zj-espm-5ch-b-13-ota] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DMAGICHOME_ZJ_ESPM_5CH_B_13 +monitor_speed = ${common.monitor_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +extra_scripts = ${common.extra_scripts} + [env:huacanxing-h801] platform = ${common.platform} framework = ${common.framework}