From d60ff79eda540789aec05ab45b9e9ff4572f9fc2 Mon Sep 17 00:00:00 2001 From: Esteban Zapata Rojas Date: Tue, 12 May 2020 15:06:57 -0500 Subject: [PATCH] hardware: Add support for HUGOAI smart socket plug. (#2243) * hardware: Add support for HUGOAI smart socket plug. * Update code/platformio.ini Co-authored-by: pezinek Co-authored-by: Max Prokhorov Co-authored-by: pezinek --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 36 ++++++++++++++++++++++++++++++++++ code/platformio.ini | 6 +++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index ab219742..b8e21c12 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -70,6 +70,7 @@ //#define HOMECUBE_16A //#define HUACANXING_H801 //#define HUACANXING_H802 +//#define HUGOAI_AWP02L_N //#define HYKKER_SMART_HOME_POWER_PLUG //#define IKE_ESPIKE //#define INTERMITTECH_QUINLED diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 343fbbf6..6b0c64b2 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1487,6 +1487,42 @@ #define LIGHT_CH3_PIN 13 // BLUE #define LIGHT_CH4_PIN 15 // WHITE +// ----------------------------------------------------------------------------- +// HUGOAI AWP02L-N +// Pin equivalence extracted from https://templates.blakadder.com/hugoai_awp02l-n.html +// +// It follows almost same structure as AOYCOCR X5P with only 1 LED on GPIO02 +// +// ----------------------------------------------------------------------------- + +#elif defined(HUGOAI_AWP02L_N) + #define MANUFACTURER "HUGOAI" + #define DEVICE "AWP02L-N" + + // 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 (blue) 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 2 + #define LED1_PIN_INVERSE 1 + #define LED1_MODE LED_MODE_FOLLOW + #define LED1_RELAY 1 + // ----------------------------------------------------------------------------- // Jan Goedeke Wifi Relay // https://github.com/JanGoe/esp8266-wifi-relay diff --git a/code/platformio.ini b/code/platformio.ini index ad19fb71..f4044277 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -353,7 +353,7 @@ src_build_flags = -DTINKERMAN_RFM69GW -DNOWSAUTH [env:foxel-lightfox-dual] extends = env:esp8266-1m-base -src_build_flags = +src_build_flags = -DFOXEL_LIGHTFOX_DUAL -DDISABLE_POSTMORTEM_STACKDUMP @@ -1006,3 +1006,7 @@ src_build_flags = -DKINGART_CURTAIN_SWITCH [env:aoycocr-x5p] extends = env:esp8266-1m-base src_build_flags = -DAOYCOCR_X5P + +[env:hugoai-awp02l-n] +extends = env:esp8266-1m-base +src_build_flags = -DHUGOAI_AWP02L_N