diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index bd753f16..9b71d77b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -110,6 +110,7 @@ //#define MAGICHOME_ZJ_WFMN_B_11 //#define GBLIFE_RGBW_SOCKET //#define SMARTLIFE_MINI_SMART_SOCKET +//#define GOSUND_SP1_V23 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 92ac23a8..6babb365 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2651,7 +2651,7 @@ // * Blitzwolf (https://www.amazon.es/Inteligente-Temporización-Dispositivos-Cualquier-BlitzWolf/dp/B07BMQP142) // * HomeCube (https://www.amazon.de/Steckdose-Homecube-intelligente-Verbrauchsanzeige-funktioniert/dp/B076Q2LKHG) // * Coosa (https://www.amazon.com/COOSA-Monitoring-Function-Campatible-Assiatant/dp/B0788W9TDR) -// * Goosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5) +// * Gosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5) // * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC) // ----------------------------------------------------------------------------- @@ -2774,6 +2774,47 @@ #define HLW8012_POWER_RATIO 2533110 #define HLW8012_INTERRUPT_ON FALLING +// ----------------------------------------------------------------------------- +// Several boards under different names uing a power chip labelled BL0937 or HJL-01 +// ----------------------------------------------------------------------------- + +#elif defined(GOSUND_SP1_V23) + + // Info + #define MANUFACTURER "GOSUND" + #define DEVICE "SP1_v23" + + // Buttons + #define BUTTON1_PIN 3 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 14 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 1 + #define LED1_PIN_INVERSE 1 + #define LED2_PIN 13 + #define LED2_PIN_INVERSE 0 + #define LED2_MODE LED_MODE_FINDME + #define LED2_RELAY 1 + + // HJL01 / BL0937 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 5 + #define HLW8012_CF_PIN 4 + + #define HLW8012_SEL_CURRENT LOW + #define HLW8012_CURRENT_RATIO 25740 + #define HLW8012_VOLTAGE_RATIO 313400 + #define HLW8012_POWER_RATIO 3414290 + #define HLW8012_INTERRUPT_ON FALLING + // ---------------------------------------------------------------------------------------- // 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 diff --git a/code/platformio.ini b/code/platformio.ini index f4543225..8127828a 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2730,6 +2730,32 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} +[env:gosund-sp1-v23] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DGOSUND_SP1_V23 +upload_speed = ${common.upload_speed} +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:gosund-sp1-v23-ota] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DGOSUND_SP1_V23 +upload_speed = ${common.upload_speed} +monitor_speed = ${common.monitor_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +extra_scripts = ${common.extra_scripts} + [env:homecube-16a] platform = ${common.platform} framework = ${common.framework}