diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index b5637636..85de053b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -119,6 +119,7 @@ //#define TECKIN_SP20 //#define TECKIN_SP21 //#define TECKIN_SP22_V14 +//#define TFLAG_NX_SMX00 //#define TINKERMAN_ESPURNA_H06 //#define TINKERMAN_ESPURNA_H08 //#define TINKERMAN_ESPURNA_SWITCH diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 478d4dac..1082ab62 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -3965,6 +3965,49 @@ // Disable UART noise #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 + + // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 3447fae6..1b4dd8ba 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1349,6 +1349,29 @@ void migrate() { setSetting("relayGPIO", 0, 15); 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 // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index d1a8a4ee..ff8828f5 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1383,6 +1383,16 @@ build_flags = ${common.build_flags_1m0m} -DDIGOO_NX_SP202 upload_port = ${common.ota_upload_port} 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] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DHOMECUBE_16A