Browse Source

Support for Allterco Shelly2

sonoffsc
Xose Pérez 6 years ago
parent
commit
bbbfa8e91a
4 changed files with 58 additions and 0 deletions
  1. +1
    -0
      code/espurna/config/arduino.h
  2. +20
    -0
      code/espurna/config/hardware.h
  3. +12
    -0
      code/espurna/migrate.ino
  4. +25
    -0
      code/platformio.ini

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

@ -96,6 +96,7 @@
//#define YJZK_SWITCH_1CH //#define YJZK_SWITCH_1CH
//#define YJZK_SWITCH_3CH //#define YJZK_SWITCH_3CH
//#define XIAOMI_SMART_DESK_LAMP //#define XIAOMI_SMART_DESK_LAMP
//#define ALLTERCO_SHELLY2
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Features (values below are non-default values) // Features (values below are non-default values)


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

@ -2654,6 +2654,26 @@
#define RELAY1_PIN 4 #define RELAY1_PIN 4
#define RELAY1_TYPE RELAY_TYPE_NORMAL #define RELAY1_TYPE RELAY_TYPE_NORMAL
#elif defined(ALLTERCO_SHELLY2)
// Info
#define MANUFACTURER "ALLTERCO"
#define DEVICE "SHELLY2"
// Buttons
#define BUTTON1_PIN 12
#define BUTTON2_PIN 14
#define BUTTON1_MODE BUTTON_SWITCH
#define BUTTON2_MODE BUTTON_SWITCH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 4
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_PIN 5
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(LOHAS_9W) #elif defined(LOHAS_9W)


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

@ -1163,6 +1163,18 @@ void migrate() {
setSetting("encBtnGPIO", 0, 2); setSetting("encBtnGPIO", 0, 2);
setSetting("encMode", ENCODER_MODE_RATIO); setSetting("encMode", ENCODER_MODE_RATIO);
#elif defined(ALLTERCO_SHELLY2)
setSetting("board", 88);
setSetting("btnGPIO", 0, 12);
setSetting("btnGPIO", 1, 14);
setSetting("btnRelay", 0, 0);
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 0, 4);
setSetting("relayGPIO", 1, 5);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
setSetting("relayType", 1, RELAY_TYPE_NORMAL);
#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

@ -2574,6 +2574,31 @@ upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed} monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:allterco-shelly2]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_2m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY2
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:allterco-shelly2-ota]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_2m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY2
upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:xiaomi-smart-desk-lamp] [env:xiaomi-smart-desk-lamp]
platform = ${common.platform} platform = ${common.platform}
framework = ${common.framework} framework = ${common.framework}


Loading…
Cancel
Save