From 387d4cea58736e2fd0fec971fe3854cd1b29772a Mon Sep 17 00:00:00 2001 From: ziggurat29 <30310677+ziggurat29@users.noreply.github.com> Date: Tue, 24 Mar 2020 14:34:14 -0500 Subject: [PATCH] Board definition for the Gosund WP3 smart socket (#2191) Co-authored-by: ziggurat29 --- code/espurna/board.ino | 2 ++ code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 32 ++++++++++++++++++++++++++++++++ code/platformio.ini | 4 ++++ 4 files changed, 39 insertions(+) diff --git a/code/espurna/board.ino b/code/espurna/board.ino index 553a760c..4139b435 100644 --- a/code/espurna/board.ino +++ b/code/espurna/board.ino @@ -648,6 +648,8 @@ int getBoardId() { return 155; #elif defined(GENERIC_ESP01_512KB) return 156; + #elif defined(GOSUND_WP3) + return 157; #else return -1; // CUSTOM #endif diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 2c0e5900..6e5a9040 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -60,6 +60,7 @@ //#define GENERIC_GU10 //#define GENERIC_V9261F //#define GIZWITS_WITTY_CLOUD +//#define GOSUND_WP3 //#define GOSUND_WS1 //#define GREEN_ESP8266RELAY //#define HAMA_WIFI_STECKDOSE_00176533 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 268d6ba5..413564cb 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -3242,6 +3242,38 @@ #define HLW8012_POWER_RATIO 3580841 #define HLW8012_INTERRUPT_ON FALLING +// ----------------------------------------------------------------------------- +// The Gosund WP3 is based on ESP8285, so 1 MB internal flash (DOUT required) +// The module has no-connect: TX, RX, RST, AD, GPIO5, (and GPIO0, +// GPIO2 via test points on the back of the module) +// and these are wired to devices: +// GPIO4: /BTN +// GPIO12: /LED blue +// GPIO13: /LED red +// GPIO14: RELAY +// ----------------------------------------------------------------------------- + +#elif defined(GOSUND_WP3) + + // Info + #define MANUFACTURER "GOSUND" + #define DEVICE "WP3" + + // Buttons + #define BUTTON1_PIN 4 + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + + // Relays + #define RELAY1_PIN 14 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 12 + #define LED1_PIN_INVERSE 1 + + #define LED2_PIN 13 + #define LED2_PIN_INVERSE 1 + // ----------------------------------------------------------------------------- // Several boards under different names uing a power chip labelled BL0937 or HJL-01 // Also model number KS-602S diff --git a/code/platformio.ini b/code/platformio.ini index 83c95a6c..25774a06 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -809,6 +809,10 @@ build_flags = ${common.build_flags_1m0m} -DTECKIN_SP22_V14 board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DTECKIN_SP23_V13 +[env:gosund-wp3] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DGOSUND_WP3 + [env:gosund-ws1] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DGOSUND_WS1