From 8234c6eab1ecc679c73f142ff5aa8079aed794be Mon Sep 17 00:00:00 2001 From: Oskar Joelsson Date: Tue, 17 Mar 2020 08:25:42 +0100 Subject: [PATCH] support for esp8266 serial, UART_TO_MQTT --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 20 ++++++++++++++++++++ code/espurna/migrate.ino | 6 +++++- code/platformio.ini | 10 ++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 142712d32a..196733e63c 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -30,6 +30,7 @@ //#define EHOMEDIY_WT02 //#define EHOMEDIY_WT03 //#define ELECTRODRAGON_WIFI_IOT +//#define ESP8266_SERIAL //#define ESPURNA_BASE //#define ESPURNA_CORE //#define ETEKCITY_ESW01_USA diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 2f696a7c47..93283cce5b 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -4299,6 +4299,26 @@ #define RELAY3_TYPE RELAY_TYPE_NORMAL #define RELAY4_TYPE RELAY_TYPE_NORMAL +// ----------------------------------------------------------------------------- +// ESP8266 Serial, example for use connected to a arduino +// +// ----------------------------------------------------------------------------- + +#elif defined(ESP8266_SERIAL) + + // Info + #define MANUFACTURER "ESP8266" + #define DEVICE "SERIAL" + + // Serial to MQTT + #define UART_MQTT_SUPPORT 1 + #define UART_MQTT_USE_SOFT 0 + #define UART_MQTT_HW_PORT Serial + #define UART_MQTT_BAUDRATE 115200 + #define TERMINAL_SUPPORT 0 + #define DEBUG_SERIAL_SUPPORT 0 + #define UART_MQTT_BUFFER_SIZE 256 + // ----------------------------------------------------------------------------- #else diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 91cc3ebd82..28754fb4ac 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1401,7 +1401,7 @@ void migrate() { #elif defined(GENERIC_E14) - setSetting("board", 104); + setSetting("board", 105); setSetting("relayProvider", RELAY_PROVIDER_LIGHT); setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); setSetting("chGPIO", 0, 4); @@ -1414,6 +1414,10 @@ void migrate() { setSetting("chLogic", 3, 0); setSetting("relays", 1); + #elif defined(ESP8266_SERIAL) + + setSetting("board", 106); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index dc6f1af3a5..e0328d669b 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1736,6 +1736,16 @@ build_flags = ${common.build_flags_4m1m} -DLINKSPRITE_LINKNODE_R4 upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:esp8266-serial] +board = ${common.board_4m} +build_flags = ${common.build_flags_4m1m} -DESP8266_SERIAL + +[env:esp8266-serial-ota] +board = ${common.board_4m} +build_flags = ${common.build_flags_4m1m} -DESP8266_SERIAL +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:ehomediy-wt02] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DEHOMEDIY_WT02