From 1bc4a2600515d5954cf93ca19339a995551229ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 18 Aug 2017 14:01:50 +0200 Subject: [PATCH] Support for IteadStudio BN-SZ01 --- code/espurna/config/hardware.h | 11 +++++++++++ code/espurna/hardware.ino | 28 +++++++++++++++++++--------- code/platformio.ini | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 0e5f8448..b896b157 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -222,6 +222,17 @@ #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 +#elif defined(ITEAD_BNSZ01) + + #define MANUFACTURER "ITEAD" + #define DEVICE "BN-SZ01" + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CH1_PIN 12 + #define LIGHT_CH1_INVERSE 0 + // ----------------------------------------------------------------------------- // Electrodragon boards // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index db499306..53d6c4d8 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -230,10 +230,10 @@ void hwUpwardsCompatibility() { setSetting("ch2GPIO", 5); setSetting("ch3GPIO", 12); setSetting("ch4GPIO", 13); - setSetting("ch1Logic", 1); - setSetting("ch2Logic", 1); - setSetting("ch3Logic", 1); - setSetting("ch4Logic", 1); + setSetting("ch1Logic", 0); + setSetting("ch2Logic", 0); + setSetting("ch3Logic", 0); + setSetting("ch4Logic", 0); #endif #ifdef ITEAD_MOTOR @@ -267,11 +267,21 @@ void hwUpwardsCompatibility() { setSetting("ch3GPIO", 12); setSetting("ch4GPIO", 14); setSetting("ch5GPIO", 4); - setSetting("ch1Logic", 1); - setSetting("ch2Logic", 1); - setSetting("ch3Logic", 1); - setSetting("ch4Logic", 1); - setSetting("ch5Logic", 1); + setSetting("ch1Logic", 0); + setSetting("ch2Logic", 0); + setSetting("ch3Logic", 0); + setSetting("ch4Logic", 0); + setSetting("ch5Logic", 0); + #endif + + #ifdef ITEAD_BNSZ01 + setSetting("board", 25); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("ledGPIO", 13, 1); + setSetting("ledLogic", 1, 1); + setSetting("ch1GPIO", 12); + setSetting("ch1Logic", 0); #endif saveSettings(); diff --git a/code/platformio.ini b/code/platformio.ini index b5c86246..f581e1ea 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -461,3 +461,24 @@ build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=S upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 + +[env:bnsz01-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} -DITEAD_BNSZ01 + +[env:bnsz01-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} -DITEAD_BNSZ01 +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266