diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index ea6e9c83..2e4a9e6b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -19,6 +19,7 @@ //#define ITEAD_S20 //#define ITEAD_SONOFF_TOUCH //#define ITEAD_SONOFF_POW +//#define ITEAD_SONOFF_POW_R2 //#define ITEAD_SONOFF_DUAL //#define ITEAD_SONOFF_DUAL_R2 //#define ITEAD_SONOFF_4CH diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 37f2c596..ae4d52c0 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -379,6 +379,31 @@ #define HLW8012_CF1_PIN 13 #define HLW8012_CF_PIN 14 +#elif defined(ITEAD_SONOFF_POW_R2) + + // Info + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_POW_R2" + + // Buttons + #define BUTTON1_PIN 0 + #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 15 + #define LED1_PIN_INVERSE 0 + + // CSE7766 + #ifndef CSE7766_SUPPORT + #define CSE7766_SUPPORT 1 + #endif + #define CSE7766_PIN 1 + #elif defined(ITEAD_SONOFF_DUAL) // Info diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 8bf615a0..04190b79 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -905,6 +905,19 @@ void migrate() { setSetting("relayType", 3, RELAY_TYPE_NORMAL); setSetting("relayType", 4, RELAY_TYPE_NORMAL); + #elif defined(ITEAD_SONOFF_POW_R2) + + setSetting("board", 71); + setSetting("ledGPIO", 0, 15); + setSetting("ledLogic", 0, 1); + setSetting("btnGPIO", 0, 0); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 12); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("selGPIO", 5); + setSetting("cf1GPIO", 13); + setSetting("cfGPIO", 14); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index db86f9e3..badea42f 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -447,6 +447,31 @@ upload_flags = ${common.upload_flags} monitor_baud = 115200 extra_scripts = ${common.extra_scripts} +[env:itead-sonoff-pow-r2] +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} -DITEAD_SONOFF_POW_R2 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:itead-sonoff-pow-r2-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} -DITEAD_SONOFF_POW_R2 +upload_speed = 115200 +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + [env:itead-sonoff-dual] platform = ${common.platform} framework = arduino