From ba8f625fb0b5c2b57f562745e9b7e361641d1bb7 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 16 May 2021 08:04:43 +0200 Subject: [PATCH] move DCC::begin() after communications --- CommandStation-EX.ino | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index 2d2bec0..c8a3aed 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -59,13 +59,7 @@ void setup() // Responsibility 1: Start the usb connection for diagnostics // This is normally Serial but uses SerialUSB on a SAMD processor Serial.begin(115200); - - // Responsibility 2: Start the DCC engine. - // Note: this provides DCC with two motor drivers, main and prog, which handle the motor shield(s) - // Standard supported devices have pre-configured macros but custome hardware installations require - // detailed pin mappings and may also require modified subclasses of the MotorDriver to implement specialist logic. - // STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h - DCC::begin(MOTOR_SHIELD_TYPE); + DIAG(F("License GPLv3 fsf.org (c) dcc-ex.com")); CONDITIONAL_LCD_START { @@ -74,8 +68,9 @@ void setup() LCD(1,F("Lic GPLv3")); } -// Start the WiFi interface on a MEGA, Uno cannot currently handle WiFi - + // Responsibility 2: Start all the communications before the DCC engine + // Start the WiFi interface on a MEGA, Uno cannot currently handle WiFi + // Start Ethernet if it exists #if WIFI_ON WifiInterface::setup(WIFI_SERIAL_LINK_SPEED, F(WIFI_SSID), F(WIFI_PASSWORD), F(WIFI_HOSTNAME), IP_PORT, WIFI_CHANNEL); #endif // WIFI_ON @@ -84,6 +79,13 @@ void setup() EthernetInterface::setup(); #endif // ETHERNET_ON + // Responsibility 3: Start the DCC engine. + // Note: this provides DCC with two motor drivers, main and prog, which handle the motor shield(s) + // Standard supported devices have pre-configured macros but custome hardware installations require + // detailed pin mappings and may also require modified subclasses of the MotorDriver to implement specialist logic. + // STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h + DCC::begin(MOTOR_SHIELD_TYPE); + #if defined(RMFT_ACTIVE) RMFT::begin(); #endif