Browse Source

Support for Sonoff 4CH PRO

fastled
Xose Pérez 7 years ago
parent
commit
fc5937fa9b
3 changed files with 71 additions and 1 deletions
  1. +27
    -0
      code/espurna/config/hardware.h
  2. +22
    -0
      code/espurna/hardware.ino
  3. +22
    -1
      code/platformio.ini

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

@ -190,6 +190,33 @@
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_4CH_PRO)
#define MANUFACTURER "ITEAD"
#define DEVICE "SONOFF_4CH_PRO"
#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 BUTTON4_PIN 14
#define BUTTON4_RELAY 4
#define BUTTON4_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 RELAY4_PIN 15
#define RELAY4_PIN_INVERSE 0
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(ITEAD_1CH_INCHING)
// The inching functionality is managed by a misterious IC in the board.


+ 22
- 0
code/espurna/hardware.ino View File

@ -292,6 +292,28 @@ void hwUpwardsCompatibility() {
setSetting("relayProvider", RELAY_PROVIDER_RFBRIDGE);
#endif
#ifdef SONOFF_4CH_PRO
setSetting("board", 27);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0);
setSetting("btnGPIO", 2, 9);
setSetting("btnGPIO", 3, 10);
setSetting("btnGPIO", 4, 14);
setSetting("btnRelay", 1, 2);
setSetting("btnRelay", 2, 3);
setSetting("btnRelay", 3, 4);
setSetting("btnRelay", 4, 0);
setSetting("relayGPIO", 1, 12);
setSetting("relayGPIO", 2, 5);
setSetting("relayGPIO", 3, 4);
setSetting("relayGPIO", 4, 15);
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
setSetting("relayLogic", 3, 0);
setSetting("relayLogic", 4, 0);
#endif
saveSettings();
}

+ 22
- 1
code/platformio.ini View File

@ -1,4 +1,4 @@
[platformio]
4ch[platformio]
env_default = d1-debug
src_dir = espurna
data_dir = espurna/data
@ -199,6 +199,27 @@ upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-4ch-pro-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_4CH_PRO
[env:sonoff-4ch-pro-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_4CH_PRO
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-touch-debug]
platform = espressif8266
framework = arduino


Loading…
Cancel
Save