From 06ebab31b51e4bb90c7bf5565c09dfb41283691f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 10 Oct 2019 13:25:55 +0200 Subject: [PATCH] Support for Teckin SP21 --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 24 ++++++++++++++++++++++++ code/espurna/migrate.ino | 10 ++++++++++ code/platformio.ini | 10 ++++++++++ 4 files changed, 45 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 65caa256..54f36927 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -116,6 +116,7 @@ //#define SMARTLIFE_MINI_SMART_SOCKET //#define STM_RELAY //#define TECKIN_SP20 +//#define TECKIN_SP21 //#define TECKIN_SP22_V14 //#define TINKERMAN_ESPURNA_H06 //#define TINKERMAN_ESPURNA_H08 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 9d8e3d9b..cc1a97ba 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2916,6 +2916,30 @@ // BUTTON1 and LED1 are using Serial pins #define DEBUG_SERIAL_SUPPORT 0 +// ----------------------------------------------------------------------------- +// Teckin SP21 +// ----------------------------------------------------------------------------- + +#elif defined(TECKIN_SP21) + + // Info + #define MANUFACTURER "TECKIN" + #define DEVICE "SP21" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 15 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 2 + #define LED1_PIN_INVERSE 1 + + // ----------------------------------------------------------------------------- // Teckin SP22 v1.4 - v1.6 // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index a0ca943c..3447fae6 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1339,6 +1339,16 @@ void migrate() { setSetting("relayGPIO", 0, 12); setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(TECKIN_SP21) + + setSetting("board", 100); + setSetting("ledGPIO", 0, 2); + setSetting("ledLogic", 0, 1); + setSetting("btnGPIO", 0, 13); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 15); + 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 d6de28fc..2304974b 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1335,6 +1335,16 @@ build_flags = ${common.build_flags_1m0m} -DBLITZWOLF_BWSHPX_V23 upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:teckin-sp21] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DTECKIN_SP21 + +[env:teckin-sp21-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DTECKIN_SP21 +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:teckin-sp22-v14] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DTECKIN_SP22_V14