Browse Source

hardware: add support for Gosund P1 Power Strip (#2391)

mcspr-patch-1
Alex. Tircovnicu 4 years ago
committed by GitHub
parent
commit
289c8cb49c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 0 deletions
  1. +4
    -0
      code/espurna/board.cpp
  2. +1
    -0
      code/espurna/config/arduino.h
  3. +57
    -0
      code/espurna/config/hardware.h
  4. +4
    -0
      code/platformio.ini

+ 4
- 0
code/espurna/board.cpp View File

@ -688,6 +688,10 @@ int getBoardId() {
return 158;
#elif defined(PRODINO_WIFI)
return 159;
#elif defined(GOSUND_SP111)
return 160;
#elif defined(GOSUND_P1)
return 161;
#else
return -1; // CUSTOM
#endif


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

@ -66,6 +66,7 @@
//#define GENERIC_V9261F
//#define GIZWITS_WITTY_CLOUD
//#define GOSUND_SP111
//#define GOSUND_P1
//#define GOSUND_WP3
//#define GOSUND_WS1
//#define GREEN_ESP8266RELAY


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

@ -3464,6 +3464,63 @@
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING
// ----------------------------------------------------------------------------------------
// Power strip 15A - 3 Sockets + 3 USB ports
// This device uses just one digital button (main one). All other three buttons are connected
// to the ADC pin via resistors with different values. This approach is known under the name of
// "Resistor Ladder" - https://en.wikipedia.org/wiki/Resistor_ladder
// https://www.amazon.de/-/en/gp/product/B085XXCPRD
// ----------------------------------------------------------------------------------------
#elif defined(GOSUND_P1)
// Info
#define MANUFACTURER "GOSUND"
#define DEVICE "P1"
//Enable this to view buttons analog level.
//#define ANALOG_SUPPORT 1
// Disable UART noise
#define DEBUG_SERIAL_SUPPORT 0
// Buttons
#define BUTTON_PROVIDER_ANALOG_SUPPORT 1
#define BUTTON1_PIN 16
#define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 4
#define BUTTON2_PIN 17
#define BUTTON2_RELAY 3
#define BUTTON2_PROVIDER BUTTON_PROVIDER_ANALOG
#define BUTTON2_ANALOG_LEVEL 220
#define BUTTON3_PIN 17
#define BUTTON3_RELAY 2
#define BUTTON3_PROVIDER BUTTON_PROVIDER_ANALOG
#define BUTTON3_ANALOG_LEVEL 470
#define BUTTON4_PIN 17
#define BUTTON4_RELAY 1
#define BUTTON4_PROVIDER BUTTON_PROVIDER_ANALOG
#define BUTTON4_ANALOG_LEVEL 730
// Relays
#define RELAY1_PIN 14
#define RELAY2_PIN 12
#define RELAY3_PIN 13
#define RELAY4_PIN 5
#define RELAY4_TYPE RELAY_TYPE_INVERSE
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// CSE7766
#define CSE7766_SUPPORT 1
#define CSE7766_RX_PIN 3
// ----------------------------------------------------------------------------------------
// Homecube 16A is similar but some pins differ and it also has RGB LEDs
// https://www.amazon.de/gp/product/B07D7RVF56/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1


+ 4
- 0
code/platformio.ini View File

@ -873,6 +873,10 @@ src_build_flags = -DGOSUND_WS1
extends = env:esp8266-1m-base
src_build_flags = -DGOSUND_SP111
[env:gosund-p1]
extends = env:esp8266-1m-base
src_build_flags = -DGOSUND_P1
[env:digoo-nx-sp202]
extends = env:esp8266-1m-base
src_build_flags = -DDIGOO_NX_SP202


Loading…
Cancel
Save