Browse Source

Support for Digoo/Oxaoxe NX-SP202 (#1502)

rules-rpn
Xose Pérez 5 years ago
parent
commit
b878c71306
5 changed files with 94 additions and 1 deletions
  1. +1
    -0
      code/espurna/config/arduino.h
  2. +45
    -0
      code/espurna/config/hardware.h
  3. +21
    -0
      code/espurna/migrate.ino
  4. +1
    -1
      code/espurna/sensor.ino
  5. +26
    -0
      code/platformio.ini

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

@ -116,6 +116,7 @@
//#define GOSUND_WS1 //#define GOSUND_WS1
//#define ARILUX_AL_LC02_V14 //#define ARILUX_AL_LC02_V14
//#define BLITZWOLF_BWSHPX_V23 //#define BLITZWOLF_BWSHPX_V23
//#define DIGOO_NX_SP202
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Features (values below are non-default values) // Features (values below are non-default values)


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

@ -3393,6 +3393,51 @@
#define LED1_PIN 4 #define LED1_PIN 4
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// Oxaoxe NX-SP202
// Digoo NX-SP202 (not tested)
// Digoo DG-SP202 (not tested)
// https://github.com/xoseperez/espurna/issues/1502
// -----------------------------------------------------------------------------
#elif defined(DIGOO_NX_SP202)
// Info
#define MANUFACTURER "DIGOO"
#define DEVICE "NX_SP202"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_PIN 16
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 15
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_PIN 14
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 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 23296
#define HLW8012_VOLTAGE_RATIO 310085
#define HLW8012_POWER_RATIO 3368471
#define HLW8012_INTERRUPT_ON FALLING
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// TEST boards (do not use!!) // TEST boards (do not use!!)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 21
- 0
code/espurna/migrate.ino View File

@ -1268,6 +1268,27 @@ void migrate() {
setSetting("relayGPIO", 1, 15); // Left outlet setSetting("relayGPIO", 1, 15); // Left outlet
setSetting("relayType", 1, RELAY_TYPE_NORMAL); setSetting("relayType", 1, RELAY_TYPE_NORMAL);
#elif defined(DIGOO_NX_SP202)
setSetting("board", 95);
setSetting("ledGPIO", 0, 13);
setSetting("ledLogic", 0, 1);
setSetting("btnGPIO", 0, 0);
setSetting("btnRelay", 0, 0);
setSetting("btnGPIO", 1, 16);
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 0, 15);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
setSetting("relayGPIO", 1, 14);
setSetting("relayType", 1, RELAY_TYPE_NORMAL);
setSetting("selGPIO", 12);
setSetting("cf1GPIO", 5);
setSetting("cfGPIO", 4);
setSetting("pwrRatioC", 23296);
setSetting("pwrRatioV", 310085);
setSetting("pwrRatioP", 3368471);
setSetting("hlwSelC", LOW);
setSetting("hlwIntM", FALLING);
#else #else


+ 1
- 1
code/espurna/sensor.ino View File

@ -1404,7 +1404,7 @@ void sensorLoop() {
// Get the first relay state // Get the first relay state
#if SENSOR_POWER_CHECK_STATUS #if SENSOR_POWER_CHECK_STATUS
bool relay_off = (relayCount() > 0) && (relayStatus(0) == 0);
bool relay_off = (relayCount() == 1) && (relayStatus(0) == 0);
#endif #endif
// Get readings // Get readings


+ 26
- 0
code/platformio.ini View File

@ -2902,6 +2902,32 @@ upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags} upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:digoo-nx-sp202]
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} -DDIGOO_NX_SP202
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:digoo-nx-sp202-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} -DDIGOO_NX_SP202
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] [env:homecube-16a]
platform = ${common.platform} platform = ${common.platform}
framework = ${common.framework} framework = ${common.framework}


Loading…
Cancel
Save