From f840a5420f702475b02bbc0127e90450f8f13112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sat, 25 Aug 2018 17:55:19 +0200 Subject: [PATCH] Clean up new devices --- code/espurna/config/arduino.h | 3 +- code/espurna/config/hardware.h | 75 +++++++++++++++++++--------------- code/espurna/migrate.ino | 10 +++++ code/platformio.ini | 75 ++++++++++++++++++++++------------ 4 files changed, 103 insertions(+), 60 deletions(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index bb1763c0..dbb29a57 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -91,7 +91,8 @@ //#define BH_ONOFRE //#define ITEAD_SONOFF_IFAN02 //#define GENERIC_AG_L4 -#define ALLTERCO_SHELLY1 +//#define ALLTERCO_SHELLY1 +//#define LOHAS_9W //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index c4fad55c..9620c0ff 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -743,25 +743,6 @@ #define MY92XX_MAPPING 4, 3, 5, 0, 1 #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1 -#elif defined(LOHAS_9W) - - // Info - #define MANUFACTURER "LOHAS" - #define DEVICE "E27_9W" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX - #define DUMMY_RELAY_COUNT 1 - - // Light - #define LIGHT_CHANNELS 5 - #define MY92XX_MODEL MY92XX_MODEL_MY9231 - #define MY92XX_CHIPS 2 - #define MY92XX_DI_PIN 13 - #define MY92XX_DCKI_PIN 15 - #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT - #define MY92XX_MAPPING 0, 1, 2, 3, 4 - #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1 - #elif defined(ITEAD_SONOFF_LED) // Info @@ -2476,7 +2457,6 @@ #define HLW8012_POWER_RATIO 3414290 #define HLW8012_INTERRUPT_ON FALLING - // ----------------------------------------------------------------------------- // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01) // https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5 @@ -2522,6 +2502,8 @@ #define HLW8012_POWER_RATIO 3414290 #define HLW8012_INTERRUPT_ON FALLING +// ----------------------------------------------------------------------------- + #elif defined(GENERIC_AG_L4) // Info @@ -2566,6 +2548,45 @@ #define LIGHT_CH1_INVERSE 0 #define LIGHT_CH2_INVERSE 0 #define LIGHT_CH3_INVERSE 0 + +// ----------------------------------------------------------------------------- + +#elif defined(ALLTERCO_SHELLY1) + + // Info + #define MANUFACTURER "ALLTERCO" + #define DEVICE "SHELLY1" + + // Buttons + #define BUTTON1_PIN 5 + #define BUTTON1_MODE BUTTON_SWITCH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 4 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + +// ----------------------------------------------------------------------------- + +#elif defined(LOHAS_9W) + + // Info + #define MANUFACTURER "LOHAS" + #define DEVICE "E27_9W" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX + #define DUMMY_RELAY_COUNT 1 + + // Light + #define LIGHT_CHANNELS 5 + #define MY92XX_MODEL MY92XX_MODEL_MY9231 + #define MY92XX_CHIPS 2 + #define MY92XX_DI_PIN 13 + #define MY92XX_DCKI_PIN 15 + #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT + #define MY92XX_MAPPING 0, 1, 2, 3, 4 + #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1 + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- @@ -2747,20 +2768,6 @@ #define NETBIOS_SUPPORT 1 #define SSDP_SUPPORT 1 -#elif defined(ALLTERCO_SHELLY1) - - // Info - #define MANUFACTURER "ALLTERCO" - #define DEVICE "SHELLY1" - - // Buttons - #define BUTTON1_PIN 5 - #define BUTTON1_MODE BUTTON_SWITCH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 4 - #define RELAY1_TYPE RELAY_TYPE_NORMAL #endif // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 7d2789c5..14f80b05 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1095,6 +1095,16 @@ void migrate() { setSetting("relayGPIO", 0, 4); setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(LOHAS_9W) + + setSetting("board", 84); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_MY92XX); + setSetting("myModel", MY92XX_MODEL_MY9231); + setSetting("myChips", 2); + setSetting("myDIGPIO", 13); + setSetting("myDCKIGPIO", 15); + setSetting("relays", 1); #else diff --git a/code/platformio.ini b/code/platformio.ini index 2a727151..c71fdb65 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -671,31 +671,6 @@ upload_flags = ${common.upload_flags} monitor_speed = ${common.monitor_speed} extra_scripts = ${common.extra_scripts} -[env:lohas-e27-9w] -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} -DLOHAS_9W -monitor_speed = ${common.monitor_speed} -extra_scripts = ${common.extra_scripts} - -[env:lohas-e27-9w-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} -DLOHAS_9W -upload_speed = ${common.upload_speed} -upload_port = ${common.upload_port} -upload_flags = ${common.upload_flags} -monitor_speed = ${common.monitor_speed} -extra_scripts = ${common.extra_scripts} - [env:itead-sonoff-t1-1ch] platform = ${common.platform} framework = ${common.framework} @@ -2471,3 +2446,53 @@ upload_speed = ${common.upload_speed} upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} + +[env:lohas-e27-9w] +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} -DLOHAS_9W +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:lohas-e27-9w-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} -DLOHAS_9W +upload_speed = ${common.upload_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:allterco-sheely1] +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} -DALLTERCO_SHELLY1 +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:allterco-sheely1-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} -DALLTERCO_SHELLY1 +upload_speed = ${common.upload_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts}