diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index 101f3f6..5a5b83c 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -116,8 +116,22 @@ void setup() #endif #if ENABLE_WIFI + bool wifiUp = false; + Serial1.begin(WIFI_SERIAL_LINK_SPEED); - WifiInterface::setup(Serial1, F("Your network name"), F("your network password"), F("DCCEX"), 3532); + wifiUp = WifiInterface::setup(Serial1, WIFI_SSID, WIFI_PASSWORD, WIFI_HOSTNAME, WIFI_PORT); +#if defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) + if (!wifiUp) + { + Serial2.begin(WIFI_SERIAL_LINK_SPEED); + wifiUp = WifiInterface::setup(Serial2, WIFI_SSID, WIFI_PASSWORD, WIFI_HOSTNAME, WIFI_PORT); + } + if (!wifiUp) + { + Serial3.begin(WIFI_SERIAL_LINK_SPEED); + wifiUp = WifiInterface::setup(Serial3, WIFI_SSID, WIFI_PASSWORD, WIFI_HOSTNAME, WIFI_PORT); + } +#endif #endif // Responsibility 3: Start the DCC engine. diff --git a/config.example.h b/config.example.h index c0fc4d3..7726bca 100644 --- a/config.example.h +++ b/config.example.h @@ -58,6 +58,7 @@ The configuration file for DCC++ EX Command Station #define WIFI_SSID "" #define WIFI_PASSWORD "" #define WIFI_HOSTNAME "" + #define WIFI_PORT 3252 // This defines the speed at which the Arduino will communicate with the ESP8266 module.