From d0853121d7e2f109359f24f46b32ad7c4f22e405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 18 Aug 2017 16:11:56 +0200 Subject: [PATCH] Initial support for Sonoff LED --- code/espurna/config/hardware.h | 16 ++++++++++++++++ code/espurna/hardware.ino | 12 ++++++++++++ code/platformio.ini | 21 +++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 5fcb29ef..24ddce22 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -289,6 +289,22 @@ #define MY9291_DCKI_PIN 15 #define MY9291_COMMAND MY9291_COMMAND_DEFAULT +#elif defined(SONOFF_LED) + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_LED" + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + #define LIGHT_CH1_PIN 12 // Cold white + #define LIGHT_CH2_PIN 14 // Warm white + + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + // ----------------------------------------------------------------------------- // Electrodragon boards // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index 00e05e7c..dd61c474 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -322,6 +322,18 @@ void hwUpwardsCompatibility() { setSetting("myDCKIGPIO", 14); #endif + #ifdef SONOFF_LED + setSetting("board", 29); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("ledGPIO", 13, 1); + setSetting("ledLogic", 1, 1); + setSetting("ch1GPIO", 12); + setSetting("ch1Logic", 0); + setSetting("ch2GPIO", 14); + setSetting("ch2Logic", 0); + #endif + saveSettings(); } diff --git a/code/platformio.ini b/code/platformio.ini index d237ff56..f5cad460 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -304,6 +304,27 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +[env:sonoff-led-debug] +platform = espressif8266 +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} -DSONOFF_LED + +[env:sonoff-led-debug-ota] +platform = espressif8266 +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} -DSONOFF_LED +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 + [env:rfbridge-debug] platform = espressif8266 framework = arduino