diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index c68354c4..5fcb29ef 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -277,6 +277,18 @@ #define DUMMY_RELAY_COUNT 6 #define TRACK_RELAY_STATUS 0 +#elif defined(SONOFF_B1) + + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_B1" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192 + #define DUMMY_RELAY_COUNT 1 + + #define MY9291_DI_PIN 13 + #define MY9291_DCKI_PIN 15 + #define MY9291_COMMAND MY9291_COMMAND_DEFAULT + // ----------------------------------------------------------------------------- // Electrodragon boards // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index c29cc594..00e05e7c 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -314,6 +314,14 @@ void hwUpwardsCompatibility() { setSetting("relayLogic", 4, 0); #endif + #ifdef SONOFF_B1 + setSetting("board", 28); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_MY9192); + setSetting("myDIGPIO", 12); + setSetting("myDCKIGPIO", 14); + #endif + saveSettings(); } diff --git a/code/platformio.ini b/code/platformio.ini index 03fcc812..d237ff56 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1,4 +1,4 @@ -4ch[platformio] +[platformio] env_default = d1-debug src_dir = espurna data_dir = espurna/data @@ -283,6 +283,27 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +[env:sonoff-b1-debug] +platform = espressif8266 +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_B1 + +[env:sonoff-b1-debug-ota] +platform = espressif8266 +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DSONOFF_B1 +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 + [env:rfbridge-debug] platform = espressif8266 framework = arduino