Browse Source

Support for TFlag NX-SM100 and NX-SM200 power monitoring switches

master
Xose Pérez 5 years ago
parent
commit
0a11a74f94
4 changed files with 77 additions and 0 deletions
  1. +1
    -0
      code/espurna/config/arduino.h
  2. +43
    -0
      code/espurna/config/hardware.h
  3. +23
    -0
      code/espurna/migrate.ino
  4. +10
    -0
      code/platformio.ini

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

@ -119,6 +119,7 @@
//#define TECKIN_SP20 //#define TECKIN_SP20
//#define TECKIN_SP21 //#define TECKIN_SP21
//#define TECKIN_SP22_V14 //#define TECKIN_SP22_V14
//#define TFLAG_NX_SMX00
//#define TINKERMAN_ESPURNA_H06 //#define TINKERMAN_ESPURNA_H06
//#define TINKERMAN_ESPURNA_H08 //#define TINKERMAN_ESPURNA_H08
//#define TINKERMAN_ESPURNA_SWITCH //#define TINKERMAN_ESPURNA_SWITCH


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

@ -3965,6 +3965,49 @@
// Disable UART noise // Disable UART noise
#define DEBUG_SERIAL_SUPPORT 0 #define DEBUG_SERIAL_SUPPORT 0
// -----------------------------------------------------------------------------
// TFLAG NX-SM100 & NX-SM200
// -----------------------------------------------------------------------------
#elif defined(TFLAG_NX_SMX00)
// Info
#define MANUFACTURER "TFLAG"
#define DEVICE "NX_SMX00"
// Buttons
#define BUTTON1_PIN 13
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 0
#define LED1_PIN_INVERSE 1
#define LED1_MODE LED_MODE_FOLLOW_INVERSE
#define LED1_RELAY 1
#define LED2_PIN 15
#define LED2_PIN_INVERSE 1
#define LED2_MODE LED_MODE_WIFI
// HJL01 / BL0937
#ifndef HLW8012_SUPPORT
#define HLW8012_SUPPORT 1
#endif
#define HLW8012_SEL_PIN 16
#define HLW8012_CF1_PIN 14
#define HLW8012_CF_PIN 5
#define HLW8012_SEL_CURRENT LOW
#define HLW8012_CURRENT_RATIO 632
#define HLW8012_VOLTAGE_RATIO 313400
#define HLW8012_POWER_RATIO 3711185
#define HLW8012_INTERRUPT_ON FALLING
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


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

@ -1349,6 +1349,29 @@ void migrate() {
setSetting("relayGPIO", 0, 15); setSetting("relayGPIO", 0, 15);
setSetting("relayType", 0, RELAY_TYPE_NORMAL); setSetting("relayType", 0, RELAY_TYPE_NORMAL);
#elif defined(TFLAG_NX_SMX00)
setSetting("board", 101);
setSetting("ledGPIO", 0, 0);
setSetting("ledLogic", 0, 1);
setSetting("ledMode", 0, LED_MODE_FOLLOW_INVERSE);
setSetting("ledRelay", 0, 0);
setSetting("ledGPIO", 1, 15);
setSetting("ledLogic", 1, 1);
setSetting("ledMode", 1, LED_MODE_WIFI);
setSetting("btnGPIO", 0, 13);
setSetting("btnRelay", 0, 0);
setSetting("relayGPIO", 0, 12);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
setSetting("selGPIO", 16);
setSetting("cf1GPIO", 14);
setSetting("cfGPIO", 5);
setSetting("pwrRatioC", 632);
setSetting("pwrRatioV", 313400);
setSetting("pwrRatioP", 3711185);
setSetting("hlwSelC", LOW);
setSetting("hlwIntM", FALLING);
#else #else
// Allow users to define new settings without migration config // Allow users to define new settings without migration config


+ 10
- 0
code/platformio.ini View File

@ -1383,6 +1383,16 @@ build_flags = ${common.build_flags_1m0m} -DDIGOO_NX_SP202
upload_port = ${common.ota_upload_port} upload_port = ${common.ota_upload_port}
upload_flags = ${common.ota_upload_flags} upload_flags = ${common.ota_upload_flags}
[env:tflag-nx-smx00]
board = ${common.board_1m}
build_flags = ${common.build_flags_1m0m} -DTFLAG_NX_SMX00
[env:tflag-nx-smx00-ota]
board = ${common.board_1m}
build_flags = ${common.build_flags_1m0m} -DTFLAG_NX_SMX00
upload_port = ${common.ota_upload_port}
upload_flags = ${common.ota_upload_flags}
[env:homecube-16a] [env:homecube-16a]
board = ${common.board_1m} board = ${common.board_1m}
build_flags = ${common.build_flags_1m0m} -DHOMECUBE_16A build_flags = ${common.build_flags_1m0m} -DHOMECUBE_16A


Loading…
Cancel
Save