Browse Source

Initial support for Itead Sonoff POW R2

rfm69
Colin Shorts 6 years ago
parent
commit
9136c99ae2
4 changed files with 64 additions and 0 deletions
  1. +1
    -0
      code/espurna/config/arduino.h
  2. +25
    -0
      code/espurna/config/hardware.h
  3. +13
    -0
      code/espurna/migrate.ino
  4. +25
    -0
      code/platformio.ini

+ 1
- 0
code/espurna/config/arduino.h View File

@ -19,6 +19,7 @@
//#define ITEAD_S20 //#define ITEAD_S20
//#define ITEAD_SONOFF_TOUCH //#define ITEAD_SONOFF_TOUCH
//#define ITEAD_SONOFF_POW //#define ITEAD_SONOFF_POW
//#define ITEAD_SONOFF_POW_R2
//#define ITEAD_SONOFF_DUAL //#define ITEAD_SONOFF_DUAL
//#define ITEAD_SONOFF_DUAL_R2 //#define ITEAD_SONOFF_DUAL_R2
//#define ITEAD_SONOFF_4CH //#define ITEAD_SONOFF_4CH


+ 25
- 0
code/espurna/config/hardware.h View File

@ -379,6 +379,31 @@
#define HLW8012_CF1_PIN 13 #define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14 #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) #elif defined(ITEAD_SONOFF_DUAL)
// Info // Info


+ 13
- 0
code/espurna/migrate.ino View File

@ -905,6 +905,19 @@ void migrate() {
setSetting("relayType", 3, RELAY_TYPE_NORMAL); setSetting("relayType", 3, RELAY_TYPE_NORMAL);
setSetting("relayType", 4, 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 #else
// Allow users to define new settings without migration config // Allow users to define new settings without migration config


+ 25
- 0
code/platformio.ini View File

@ -447,6 +447,31 @@ upload_flags = ${common.upload_flags}
monitor_baud = 115200 monitor_baud = 115200
extra_scripts = ${common.extra_scripts} 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] [env:itead-sonoff-dual]
platform = ${common.platform} platform = ${common.platform}
framework = arduino framework = arduino


Loading…
Cancel
Save