From 251f92a880bb9e05a4f1ae085f07ec88a7872d96 Mon Sep 17 00:00:00 2001 From: gn0st1c Date: Thu, 15 Mar 2018 18:36:43 +0300 Subject: [PATCH 1/2] support for tunbox powerstrip02 support for tunbox powerstrip02 --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 34 ++++++++++++++++++++++++++++++++++ code/espurna/migrate.ino | 20 ++++++++++++++++++++ code/platformio.ini | 26 +++++++++++++++++++++++++- 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index de97e03a..f5b03d9b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -62,6 +62,7 @@ //#define WEMOS_D1_TARPUNA_SHIELD //#define GIZWITS_WITTY_CLOUD //#define EUROMATE_WIFI_STECKER_SCHUKO +//#define TONBUX_POWERSTRIP02 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 8aaa8626..e795d5d9 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1531,6 +1531,40 @@ #define TERMINAL_SUPPORT 0 #define DEBUG_SERIAL_SUPPORT 0 +// ----------------------------------------------------------------------------- +// Tonbux Powerstrip02 +// ----------------------------------------------------------------------------- + +#elif defined(TONBUX_POWERSTRIP02) + + // Info + #define MANUFACTURER "Tonbux" + #define DEVICE "Powerstrip02" + + // Buttons + #define BUTTON1_PIN 5 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 0 + + // Relays + #define RELAY1_PIN 4 + #define RELAY1_TYPE RELAY_TYPE_INVERSE + #define RELAY2_PIN 13 + #define RELAY2_TYPE RELAY_TYPE_INVERSE + #define RELAY3_PIN 12 + #define RELAY3_TYPE RELAY_TYPE_INVERSE + #define RELAY4_PIN 14 + #define RELAY4_TYPE RELAY_TYPE_INVERSE + // Not a relay. USB ports on/off + #define RELAY5_PIN 16 + #define RELAY5_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 0 // 1 blue led + #define LED1_PIN_INVERSE 0 + #define LED2_PIN 3 // 3 red leds + #define LED2_PIN_INVERSE 0 + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 51c07aad..b4a0e9ef 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -739,6 +739,26 @@ void migrate() { setSetting("relayGPIO", 0, 5); setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(TONBUX_POWERSTRIP02) + + setSetting("board", 56); + setSetting("relayGPIO", 0, 4); + setSetting("relayGPIO", 1, 13); + setSetting("relayGPIO", 2, 12); + setSetting("relayGPIO", 3, 14); + setSetting("relayGPIO", 4, 16); + setSetting("relayType", 0, RELAY_TYPE_INVERSE); + setSetting("relayType", 1, RELAY_TYPE_INVERSE); + setSetting("relayType", 2, RELAY_TYPE_INVERSE); + setSetting("relayType", 3, RELAY_TYPE_INVERSE); + setSetting("relayType", 4, RELAY_TYPE_NORMAL); + setSetting("ledGPIO", 0, 0); + setSetting("ledLogic", 0, 0); + setSetting("ledGPIO", 1, 3); + setSetting("ledLogic", 1, 0); + setSetting("btnGPIO", 0, 5); + setSetting("btnRelay", 0, 0); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 33f79b95..4f93772b 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1473,7 +1473,31 @@ upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} -[env:stm-relay-ota] +[env:tunbox-powerstrip02] +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} -DTONBUX_POWERSTRIP02 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:tunbox-powerstrip02-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} -DTONBUX_POWERSTRIP02 +upload_speed = 115200 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +extra_scripts = ${common.extra_scripts} + +[env:stm-relay] platform = ${common.platform} framework = arduino board = esp01_1m From 7506f0542b499117999e42fb516b9319befcef14 Mon Sep 17 00:00:00 2001 From: gn0st1c Date: Thu, 15 Mar 2018 19:34:46 +0300 Subject: [PATCH 2/2] support for Lingan SWA1 support for Lingan SWA1 --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 27 +++++++++++++++++++++++++-- code/espurna/migrate.ino | 10 ++++++++++ code/platformio.ini | 24 ++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index f5b03d9b..a76e9e4d 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -63,6 +63,7 @@ //#define GIZWITS_WITTY_CLOUD //#define EUROMATE_WIFI_STECKER_SCHUKO //#define TONBUX_POWERSTRIP02 +//#define LINGAN_SWA1 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index e795d5d9..a7d9d22f 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1561,9 +1561,32 @@ // LEDs #define LED1_PIN 0 // 1 blue led - #define LED1_PIN_INVERSE 0 + #define LED1_PIN_INVERSE 1 #define LED2_PIN 3 // 3 red leds - #define LED2_PIN_INVERSE 0 + #define LED2_PIN_INVERSE 1 + +// ----------------------------------------------------------------------------- +// Lingan SWA1 +// ----------------------------------------------------------------------------- + +#elif defined(LINGAN_SWA1) + + // Info + #define MANUFACTURER "LINGAN" + #define DEVICE "SWA1" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 5 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 4 + #define LED1_PIN_INVERSE 1 // ----------------------------------------------------------------------------- // TEST boards (do not use!!) diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index b4a0e9ef..25a0a8fe 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -759,6 +759,16 @@ void migrate() { setSetting("btnGPIO", 0, 5); setSetting("btnRelay", 0, 0); + #elif defined(LINGAN_SWA1) + + setSetting("board", 57); + setSetting("ledGPIO", 0, 4); + setSetting("ledLogic", 0, 1); + setSetting("btnGPIO", 0, 13); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 5); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 4f93772b..6a1f8223 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1497,6 +1497,30 @@ upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +[env:lingan-swa1] +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} -DLINGAN_SWA1 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:lingan-swa1-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} -DLINGAN_SWA1 +upload_speed = 115200 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +extra_scripts = ${common.extra_scripts} + [env:stm-relay] platform = ${common.platform} framework = arduino