From 375a9e8f1c852ec0a7b617922d945d6cf78587f2 Mon Sep 17 00:00:00 2001 From: Esteban Zapata Rojas Date: Thu, 30 Apr 2020 12:52:07 -0500 Subject: [PATCH 1/2] hardware: Add support for Aoycocr X5P Plug. This change allow espurna to control Aoycocr X5P Plug devices, which has the same behaviour as the GOSUND WP3 but using different GPIO pins for relay, button and leds. --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 41 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index d1a1de6e94..a496827d88 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -15,6 +15,7 @@ //#define ALLTERCO_SHELLY1PM //#define ALLTERCO_SHELLY2 //#define ALLTERCO_SHELLY25 +//#define AOYCOCR_X5P //#define ARILUX_AL_LC01 //#define ARILUX_AL_LC02 //#define ARILUX_AL_LC02_V14 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index b13c7b62f8..4e1b9f9b38 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -3281,7 +3281,7 @@ // ----------------------------------------------------------------------------- // 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, +// 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 @@ -3618,6 +3618,45 @@ #define I2C_SDA_PIN 12 #define I2C_SCL_PIN 14 +// ----------------------------------------------------------------------------- +// This device has teh same behaviour as the GOSUND WP3, but with different GPIO pin values +// GPIO equivalents extracted from https://templates.blakadder.com/aoycocr_X5P.html + +#elif defined(AOYCOCR_X5P) + + // Info + #define MANUFACTURER "AOYCOCR" + #define DEVICE "X5P" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + // the defaults are reasonable, but you can change them as desired + //#define BUTTON1_PRESS BUTTON_ACTION_NONE + //#define BUTTON1_CLICK BUTTON_ACTION_TOGGLE + //#define BUTTON1_DBLCLICK BUTTON_ACTION_AP + //#define BUTTON1_LNGCLICK BUTTON_ACTION_RESET + //#define BUTTON1_LNGLNGCLICK BUTTON_ACTION_FACTORY + + // Relays + #define RELAY1_PIN 15 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + + // LED1 (red) indicates on/off state; you could use LED_MODE_FOLLOW_INVERSE + // so that the LED lights the button when 'off' so it can be found easily. + #define LED1_PIN 0 + #define LED1_PIN_INVERSE 1 + #define LED1_MODE LED_MODE_FOLLOW + #define LED1_RELAY 1 + + // LED2 (blue) indicates wifi activity + #define LED2_PIN 2 + #define LED2_PIN_INVERSE 1 + #define LED2_MODE LED_MODE_WIFI + // ----------------------------------------------------------------------------- // also works with https://www.amazon.com/gp/product/B07TMY394G/ From c225626d639b3c0913f82fe4247b545c93395646 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Thu, 30 Apr 2020 21:52:03 +0300 Subject: [PATCH 2/2] Update platformio.ini --- code/platformio.ini | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/platformio.ini b/code/platformio.ini index b2d34c8284..5554af3a9d 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -998,3 +998,7 @@ src_build_flags = -DEHOMEDIY_WT02 [env:ehomediy-wt03] extends = env:esp8266-1m-base src_build_flags = -DEHOMEDIY_WT03 + +[env:aoycocr-x5p] +extends = env:esp8266-1m-base +src_build_flags = -DAOYCOCR_X5P