From 99c3d24bbdedbccbd8daf8f9a3852a5704f01781 Mon Sep 17 00:00:00 2001 From: Ken Nixon Date: Fri, 6 May 2022 12:47:37 +0200 Subject: [PATCH] hw: add support for Itead Sonoff POW R3 (#2506) Added support for Itead Sonoff POW R3 (https://itead.cc/product/sonoff-powr3/) This device is essentially the same as the POW R2, except: - the relay is a normally closed type, - the current and power ratings of the device are higher. --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 28 ++++++++++++++++++++++++++++ code/platformio.ini | 4 ++++ code/platformio_ota.ini | 3 +++ 4 files changed, 36 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index f172c369..2a49e400 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -97,6 +97,7 @@ //#define ITEAD_SONOFF_MINI //#define ITEAD_SONOFF_POW //#define ITEAD_SONOFF_POW_R2 +//#define ITEAD_SONOFF_POW_R3 //#define ITEAD_SONOFF_RF //#define ITEAD_SONOFF_RFBRIDGE //#define ITEAD_SONOFF_S31 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 8db47539..02beb93b 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -570,6 +570,34 @@ #endif #define CSE7766_RX_PIN 3 +#elif defined(ITEAD_SONOFF_POW_R3) + + // Info + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_POW_R3" + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_INVERSE + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + + // Disable UART noise + #define DEBUG_SERIAL_SUPPORT 0 + + // CSE7766 + #ifndef CSE7766_SUPPORT + #define CSE7766_SUPPORT 1 + #endif + #define CSE7766_RX_PIN 3 + #elif defined(ITEAD_SONOFF_DUAL) // Info diff --git a/code/platformio.ini b/code/platformio.ini index 913e8439..79593cf3 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -425,6 +425,10 @@ build_src_flags = -DITEAD_SONOFF_POW extends = env:esp8266-1m-base build_src_flags = -DITEAD_SONOFF_POW_R2 -DDISABLE_POSTMORTEM_STACKDUMP +[env:itead-sonoff-pow-r3] +extends = env:esp8266-1m-base +build_src_flags = -DITEAD_SONOFF_POW_R3 -DDISABLE_POSTMORTEM_STACKDUMP + [env:itead-sonoff-dual] extends = env:esp8266-1m-base build_src_flags = -DITEAD_SONOFF_DUAL -DDISABLE_POSTMORTEM_STACKDUMP diff --git a/code/platformio_ota.ini b/code/platformio_ota.ini index ca54407c..366f35cc 100644 --- a/code/platformio_ota.ini +++ b/code/platformio_ota.ini @@ -39,6 +39,9 @@ extends = env:itead-sonoff-pow [env:itead-sonoff-pow-r2-ota] extends = env:itead-sonoff-pow-r2 +[env:itead-sonoff-pow-r3-ota] +extends = env:itead-sonoff-pow-r3 + [env:itead-sonoff-dual-ota] extends = env:itead-sonoff-dual