From 8bad4218a0a2b0290c06bc8475e5a0089421f65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 19 Oct 2017 22:18:37 +0200 Subject: [PATCH] Added support Authometion LYT8266 (testing) --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 27 +++++++++++++++++++++++++++ code/espurna/hardware.ino | 16 ++++++++++++++++ code/espurna/light.ino | 8 ++++++++ code/platformio.ini | 23 +++++++++++++++++++++++ 5 files changed, 75 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 8f9f7909..0a0ff3a3 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -50,6 +50,7 @@ //#define INTERMITTECH_QUINLED //#define ARILUX_AL_LC06 //#define XENON_SM_PW702U +//#define AUTHOMETION_LYT8266 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 5e68fbd0..6e88422b 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1136,6 +1136,33 @@ #define LED1_PIN 4 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// AUTHOMETION LYT8266 +// https://authometion.com/shop/en/home/13-lyt8266.html +// ----------------------------------------------------------------------------- + +#elif defined(AUTHOMETION_LYT8266) + + // Info + #define MANUFACTURER "AUTHOMETION" + #define DEVICE "LYT8266" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // Channels + #define LIGHT_CH1_PIN 13 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 14 // BLUE + #define LIGHT_CH4_PIN 2 // WHITE + + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + + #define LIGHT_ENABLE_PIN 15 + // ----------------------------------------------------------------------------- // Unknown hardware // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index 0e9cca04..0f4e9450 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -541,6 +541,22 @@ void hwUpwardsCompatibility() { setSetting("relayGPIO", 1, 12); setSetting("relayType", 1, RELAY_TYPE_NORMAL); + #elif defined(AUTHOMETION_LYT8266) + + setSetting("board", 45); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("chGPIO", 1, 13); + setSetting("chGPIO", 2, 12); + setSetting("chGPIO", 3, 14); + setSetting("chGPIO", 4, 2); + setSetting("chLogic", 1, 0); + setSetting("chLogic", 2, 0); + setSetting("chLogic", 3, 0); + setSetting("chLogic", 4, 0); + setSetting("relays", 1); + setSetting("enGPIO", 15); + #else #error "UNSUPPORTED HARDWARE!" diff --git a/code/espurna/light.ino b/code/espurna/light.ino index 693827ff..eacad450 100644 --- a/code/espurna/light.ino +++ b/code/espurna/light.ino @@ -226,6 +226,10 @@ void _lightProviderUpdate() { _shadow(); + #ifdef LIGHT_ENABLE_PIN + digitalWrite(LIGHT_ENABLE_PIN, _lightState); + #endif + #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY9192 if (_lightState) { @@ -542,6 +546,10 @@ void _lightAPISetup() { void lightSetup() { + #ifdef LIGHT_ENABLE_PIN + pinMode(LIGHT_ENABLE_PIN, OUTPUT); + #endif + #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY9192 _my9291 = new my9291(MY9291_DI_PIN, MY9291_DCKI_PIN, MY9291_COMMAND, MY9291_CHANNELS); diff --git a/code/platformio.ini b/code/platformio.ini index 7f835845..31069197 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1026,6 +1026,29 @@ upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +[env:authometion-lyt8266] +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} -DAUTHOMETION_LYT8266 +monitor_baud = 115200 + +[env:authometion-lyt8266-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} -DAUTHOMETION_LYT8266 +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 +monitor_baud = 115200 + # ------------------------------------------------------------------------------ # GENERIC OTA ENVIRONMENTS # ------------------------------------------------------------------------------