Skip to content

Commit

Permalink
Do not init Serial based on SERIAL_BAUDRATE (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoseperez committed Apr 17, 2018
1 parent eef1138 commit 8189f90
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion code/espurna/rfbridge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ void rfbSetup() {
wsOnActionRegister(_rfbWebSocketOnAction);
#endif

// Register oop
// Register loop
espurnaRegisterLoop(rfbLoop);

}
Expand Down
25 changes: 18 additions & 7 deletions code/espurna/system.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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());
Expand Down

0 comments on commit 8189f90

Please sign in to comment.