diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index ec8e05201a..4f49e73f47 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1554,7 +1554,8 @@ // Remove UART noise on serial line #define TERMINAL_SUPPORT 0 #define DEBUG_SERIAL_SUPPORT 0 - + #define SERIAL_BAUDRATE 115200 + // ----------------------------------------------------------------------------- // Tonbux Powerstrip02 // ----------------------------------------------------------------------------- diff --git a/code/espurna/rfbridge.ino b/code/espurna/rfbridge.ino index 47436c0603..e9d3f1f70e 100644 --- a/code/espurna/rfbridge.ino +++ b/code/espurna/rfbridge.ino @@ -522,7 +522,7 @@ void rfbSetup() { wsOnActionRegister(_rfbWebSocketOnAction); #endif - // Register oop + // Register loop espurnaRegisterLoop(rfbLoop); } diff --git a/code/espurna/system.ino b/code/espurna/system.ino index 48cf723eba..e6b5b9c5be 100644 --- a/code/espurna/system.ino +++ b/code/espurna/system.ino @@ -130,6 +130,22 @@ void systemLoop() { } +void _systemSetupSpecificHardware() { + + //The ESPLive has an ADC MUX which needs to be configured. + #if defined(MANCAVEMADE_ESPLIVE) + pinMode(16, OUTPUT); + digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B) + #endif + + // These devices use the hardware UART + // to communicate to secondary microcontrollers + #if defined(ITEAD_SONOFF_RFBRIDGE) || defined(ITEAD_SONOFF_DUAL) || defined(STM_RELAY) + Serial.begin(SERIAL_BAUDRATE); + #endif + +} + void systemSetup() { EEPROM.begin(EEPROM_SIZE); @@ -139,8 +155,6 @@ void systemSetup() { #if DEBUG_ESP_WIFI DEBUG_PORT.setDebugOutput(true); #endif - #elif defined(SERIAL_BAUDRATE) - Serial.begin(SERIAL_BAUDRATE); #endif #if SPIFFS_SUPPORT @@ -152,11 +166,8 @@ void systemSetup() { systemCheck(false); #endif - #if defined(ESPLIVE) - //The ESPLive has an ADC MUX which needs to be configured. - pinMode(16, OUTPUT); - digitalWrite(16, HIGH); //Defualt CT input (pin B, solder jumper B) - #endif + // Init device-specific hardware + _systemSetupSpecificHardware(); // Cache loop delay value to speed things (recommended max 250ms) _loop_delay = atol(getSetting("loopDelay", LOOP_DELAY_TIME).c_str());