From 7e536be79c790a9b5b7f8031e9d80fc38fe18a0a Mon Sep 17 00:00:00 2001 From: Laine Walker-Avina Date: Mon, 5 Aug 2019 09:01:05 -0700 Subject: [PATCH] Add iselector-sm-pw702 (#1837) --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 25 +++++++++++++++++++++++++ code/espurna/migrate.ino | 12 ++++++++++++ code/platformio.ini | 10 ++++++++++ 4 files changed, 48 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index c6c725b6..6a8cf4e6 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -129,6 +129,7 @@ //#define WION_50055 //#define WORKCHOICE_ECOPLUG //#define XENON_SM_PW702U +//#define ISELECTOR_SM_PW702 //#define XIAOMI_SMART_DESK_LAMP //#define YIDIAN_XSSSA05 //#define YJZK_SWITCH_1CH diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index b6684f93..79651e9c 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1820,6 +1820,31 @@ #define LED1_PIN 4 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// ISELECTOR SM-PW702 +// ----------------------------------------------------------------------------- + +#elif defined(ISELECTOR_SM_PW702) + + // Info + #define MANUFACTURER "ISELECTOR" + #define DEVICE "SM_PW702" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 4 //BLUE + #define LED1_PIN_INVERSE 0 + #define LED2_PIN 5 //RED + #define LED2_PIN_INVERSE 1 + // ----------------------------------------------------------------------------- // AUTHOMETION LYT8266 // https://authometion.com/shop/en/home/13-lyt8266.html diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 0f084b55..68b49675 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1315,6 +1315,18 @@ void migrate() { setSetting("chLogic", 3, 0); setSetting("relays", 1); + #elif defined(ISELECTOR_SM_PW702) + + setSetting("board", 98); + setSetting("ledGPIO", 0, 4); + setSetting("ledLogic", 0, 0); + setSetting("ledGPIO", 1, 5); + setSetting("ledLogic", 0, 0); + setSetting("btnGPIO", 0, 13); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 12); + 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 65055e05..397477a0 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -896,6 +896,16 @@ build_flags = ${common.build_flags_1m0m} -DXENON_SM_PW702U upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:iselector-sm-pw702] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DISELECTOR_SM_PW702 + +[env:iselector-sm-pw702-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DISELECTOR_SM_PW702 +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:authometion-lyt8266] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DAUTHOMETION_LYT8266