diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index f3c79868..7b8e2420 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -69,6 +69,7 @@ //#define ITEAD_SONOFF_DUAL_R2 //#define ITEAD_SONOFF_IFAN02 //#define ITEAD_SONOFF_LED +//#define ITEAD_SONOFF_MINI //#define ITEAD_SONOFF_POW //#define ITEAD_SONOFF_POW_R2 //#define ITEAD_SONOFF_RF diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index c686e109..5b664b62 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -314,6 +314,28 @@ #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 +#elif defined(ITEAD_SONOFF_MINI) + + // Info + #define MANUFACTURER "ITEAD" + #define DEVICE "SONOFF_MINI" + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + #define BUTTON2_PIN 14 + #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH + #define BUTTON2_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + #elif defined(ITEAD_SONOFF_TH) // Info diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 68b49675..a0ca943c 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1327,6 +1327,18 @@ void migrate() { setSetting("relayGPIO", 0, 12); setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(ITEAD_SONOFF_MINI) + + setSetting("board", 99); + setSetting("ledGPIO", 0, 13); + setSetting("ledLogic", 0, 1); + setSetting("btnGPIO", 0, 0); + setSetting("btnRelay", 0, 0); + setSetting("btnGPIO", 1, 4); + setSetting("btnRelay", 1, 0); + setSetting("relayGPIO", 0, 12); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 0e27c94f..287cbe2c 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -354,6 +354,16 @@ build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_RF upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:itead-sonoff-mini] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_MINI + +[env:itead-sonoff-mini-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_MINI +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:itead-sonoff-th] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DITEAD_SONOFF_TH