Browse Source

Itead Sonoff Mini support

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

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

@ -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


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

@ -306,6 +306,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


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

@ -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


+ 10
- 0
code/platformio.ini View File

@ -353,6 +353,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


Loading…
Cancel
Save