From e7658ec5f5689a4d37cc60d89d73d03f7bdb3bd1 Mon Sep 17 00:00:00 2001 From: zeleps <39417467+zeleps@users.noreply.github.com> Date: Mon, 1 Feb 2021 00:50:12 +0200 Subject: [PATCH] Init serial ports first (#20944) --- Marlin/src/MarlinCore.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 51e0efafd..8692e9219 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -886,6 +886,17 @@ void setup() { #endif #define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0) + MYSERIAL0.begin(BAUDRATE); + millis_t serial_connect_timeout = millis() + 1000UL; + while (!MYSERIAL0.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } + + #if HAS_MULTI_SERIAL && !HAS_ETHERNET + MYSERIAL1.begin(BAUDRATE); + serial_connect_timeout = millis() + 1000UL; + while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } + #endif + SERIAL_ECHOLNPGM("start"); + // Set up these pins early to prevent suicide #if HAS_KILL SETUP_LOG("KILL_PIN"); @@ -918,17 +929,6 @@ void setup() { #endif #endif - MYSERIAL0.begin(BAUDRATE); - millis_t serial_connect_timeout = millis() + 1000UL; - while (!MYSERIAL0.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } - - #if HAS_MULTI_SERIAL && !HAS_ETHERNET - MYSERIAL1.begin(BAUDRATE); - serial_connect_timeout = millis() + 1000UL; - while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } - #endif - SERIAL_ECHOLNPGM("start"); - #if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE) mks_esp_wifi_init(); WIFISERIAL.begin(WIFI_BAUDRATE);