Init serial ports first (#20944)

This commit is contained in:
zeleps 2021-02-01 00:50:12 +02:00 committed by GitHub
parent c91a91008c
commit d49969ddf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -886,6 +886,17 @@ void setup() {
#endif #endif
#define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0) #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 // Set up these pins early to prevent suicide
#if HAS_KILL #if HAS_KILL
SETUP_LOG("KILL_PIN"); SETUP_LOG("KILL_PIN");
@ -918,17 +929,6 @@ void setup() {
#endif #endif
#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) #if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
mks_esp_wifi_init(); mks_esp_wifi_init();
WIFISERIAL.begin(WIFI_BAUDRATE); WIFISERIAL.begin(WIFI_BAUDRATE);