diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 24ddce22..8e838e23 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -305,6 +305,57 @@ #define LIGHT_CH1_INVERSE 0 #define LIGHT_CH2_INVERSE 0 +#elif defined(SONOFF_T1_1CH) + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_T1_1CH" + #define BUTTON1_PIN 9 + #define BUTTON1_RELAY 1 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define RELAY1_PIN 5 + #define RELAY1_PIN_INVERSE 0 + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + +#elif defined(SONOFF_T1_2CH) + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_T1_2CH" + #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON2_PIN 10 + #define BUTTON2_RELAY 2 + #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 + #define RELAY2_PIN 4 + #define RELAY2_PIN_INVERSE 0 + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + +#elif defined(SONOFF_T1_3CH) + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_T1_3CH" + #define BUTTON1_PIN 0 + #define BUTTON1_RELAY 1 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON2_PIN 9 + #define BUTTON2_RELAY 2 + #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON3_PIN 10 + #define BUTTON3_RELAY 3 + #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define RELAY1_PIN 12 + #define RELAY1_PIN_INVERSE 0 + #define RELAY2_PIN 5 + #define RELAY2_PIN_INVERSE 0 + #define RELAY3_PIN 4 + #define RELAY3_PIN_INVERSE 0 + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + // ----------------------------------------------------------------------------- // Electrodragon boards // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index 60b13a63..c5b0fd16 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -342,6 +342,48 @@ void hwUpwardsCompatibility() { setSetting("relays", 1); #endif + #ifdef SONOFF_T1_1CH + setSetting("board", 30); + setSetting("ledGPIO", 1, 13); + setSetting("ledLogic", 1, 1); + setSetting("btnGPIO", 1, 9); + setSetting("btnRelay", 1, 1); + setSetting("relayGPIO", 1, 5); + setSetting("relayLogic", 1, 0); + #endif + + #ifdef SONOFF_T1_2CH + setSetting("board", 31); + setSetting("ledGPIO", 1, 13); + setSetting("ledLogic", 1, 1); + setSetting("btnGPIO", 1, 0); + setSetting("btnGPIO", 2, 10); + setSetting("btnRelay", 1, 1); + setSetting("btnRelay", 2, 2); + setSetting("relayGPIO", 1, 12); + setSetting("relayGPIO", 2, 4); + setSetting("relayLogic", 1, 0); + setSetting("relayLogic", 2, 0); + #endif + + #ifdef SONOFF_T1_3CH + setSetting("board", 32); + setSetting("ledGPIO", 1, 13); + setSetting("ledLogic", 1, 1); + setSetting("btnGPIO", 1, 0); + setSetting("btnGPIO", 2, 9); + setSetting("btnGPIO", 3, 10); + setSetting("btnRelay", 1, 1); + setSetting("btnRelay", 2, 2); + setSetting("btnRelay", 3, 3); + setSetting("relayGPIO", 1, 12); + setSetting("relayGPIO", 2, 5); + setSetting("relayGPIO", 3, 4); + setSetting("relayLogic", 1, 0); + setSetting("relayLogic", 2, 0); + setSetting("relayLogic", 3, 0); + #endif + saveSettings(); } diff --git a/code/platformio.ini b/code/platformio.ini index 3d47d34e..3c90fbf9 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -304,6 +304,69 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +[env:sonoff-t1-1ch-debug] +platform = espressif8266 +framework = arduino +board = esp8285 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_T1_1CH + +[env:sonoff-t1-1ch-debug-ota] +platform = espressif8266 +framework = arduino +board = esp8285 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_T1_1CH +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 + +[env:sonoff-t1-2ch-debug] +platform = espressif8266 +framework = arduino +board = esp8285 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_T1_2CH + +[env:sonoff-t1-2ch-debug-ota] +platform = espressif8266 +framework = arduino +board = esp8285 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_T1_2CH +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 + +[env:sonoff-t1-3ch-debug] +platform = espressif8266 +framework = arduino +board = esp8285 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_T1_3CH + +[env:sonoff-t1-3ch-debug-ota] +platform = espressif8266 +framework = arduino +board = esp8285 +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_T1_3CH +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 + [env:sonoff-led-debug] platform = espressif8266 framework = arduino