Skip to content

Commit f63471f

Browse files
alextircovnicumcspr
authored andcommitted
hardware: add support for Gosund P1 Power Strip (xoseperez#2391)
1 parent 5a27524 commit f63471f

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

code/espurna/board.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,10 @@ int getBoardId() {
688688
return 158;
689689
#elif defined(PRODINO_WIFI)
690690
return 159;
691+
#elif defined(GOSUND_SP111)
692+
return 160;
693+
#elif defined(GOSUND_P1)
694+
return 161;
691695
#else
692696
return -1; // CUSTOM
693697
#endif

code/espurna/config/arduino.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
//#define GENERIC_V9261F
6767
//#define GIZWITS_WITTY_CLOUD
6868
//#define GOSUND_SP111
69+
//#define GOSUND_P1
6970
//#define GOSUND_WP3
7071
//#define GOSUND_WS1
7172
//#define GREEN_ESP8266RELAY

code/espurna/config/hardware.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,6 +3464,63 @@
34643464
#define HLW8012_POWER_RATIO 3414290
34653465
#define HLW8012_INTERRUPT_ON FALLING
34663466

3467+
// ----------------------------------------------------------------------------------------
3468+
// Power strip 15A - 3 Sockets + 3 USB ports
3469+
// This device uses just one digital button (main one). All other three buttons are connected
3470+
// to the ADC pin via resistors with different values. This approach is known under the name of
3471+
// "Resistor Ladder" - https://en.wikipedia.org/wiki/Resistor_ladder
3472+
// https://www.amazon.de/-/en/gp/product/B085XXCPRD
3473+
// ----------------------------------------------------------------------------------------
3474+
3475+
#elif defined(GOSUND_P1)
3476+
3477+
// Info
3478+
#define MANUFACTURER "GOSUND"
3479+
#define DEVICE "P1"
3480+
3481+
3482+
//Enable this to view buttons analog level.
3483+
//#define ANALOG_SUPPORT 1
3484+
3485+
// Disable UART noise
3486+
#define DEBUG_SERIAL_SUPPORT 0
3487+
3488+
// Buttons
3489+
#define BUTTON_PROVIDER_ANALOG_SUPPORT 1
3490+
#define BUTTON1_PIN 16
3491+
#define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
3492+
#define BUTTON1_RELAY 4
3493+
3494+
#define BUTTON2_PIN 17
3495+
#define BUTTON2_RELAY 3
3496+
#define BUTTON2_PROVIDER BUTTON_PROVIDER_ANALOG
3497+
#define BUTTON2_ANALOG_LEVEL 220
3498+
3499+
#define BUTTON3_PIN 17
3500+
#define BUTTON3_RELAY 2
3501+
#define BUTTON3_PROVIDER BUTTON_PROVIDER_ANALOG
3502+
#define BUTTON3_ANALOG_LEVEL 470
3503+
3504+
#define BUTTON4_PIN 17
3505+
#define BUTTON4_RELAY 1
3506+
#define BUTTON4_PROVIDER BUTTON_PROVIDER_ANALOG
3507+
#define BUTTON4_ANALOG_LEVEL 730
3508+
3509+
// Relays
3510+
#define RELAY1_PIN 14
3511+
#define RELAY2_PIN 12
3512+
#define RELAY3_PIN 13
3513+
#define RELAY4_PIN 5
3514+
#define RELAY4_TYPE RELAY_TYPE_INVERSE
3515+
3516+
// LEDs
3517+
#define LED1_PIN 2
3518+
#define LED1_PIN_INVERSE 1
3519+
3520+
// CSE7766
3521+
#define CSE7766_SUPPORT 1
3522+
#define CSE7766_RX_PIN 3
3523+
34673524
// ----------------------------------------------------------------------------------------
34683525
// Homecube 16A is similar but some pins differ and it also has RGB LEDs
34693526
// https://www.amazon.de/gp/product/B07D7RVF56/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1

code/platformio.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,10 @@ src_build_flags = -DGOSUND_WS1
873873
extends = env:esp8266-1m-base
874874
src_build_flags = -DGOSUND_SP111
875875

876+
[env:gosund-p1]
877+
extends = env:esp8266-1m-base
878+
src_build_flags = -DGOSUND_P1
879+
876880
[env:digoo-nx-sp202]
877881
extends = env:esp8266-1m-base
878882
src_build_flags = -DDIGOO_NX_SP202

0 commit comments

Comments
 (0)