From a33b463c74fe1037edde8c94e9a75ad5fc633709 Mon Sep 17 00:00:00 2001 From: Gregor Baues Date: Wed, 19 May 2021 17:21:27 +0200 Subject: [PATCH] updated config example check for MQTT / Ethernet setup --- MQTTInterface.cpp | 2 +- config.example.h | 3 +++ defines.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MQTTInterface.cpp b/MQTTInterface.cpp index af9d25a..9d5eccf 100644 --- a/MQTTInterface.cpp +++ b/MQTTInterface.cpp @@ -404,7 +404,7 @@ bool MQTTInterface::setupNetwork() IPAddress ip = Ethernet.localIP(); // reassign the obtained ip address DIAG(F("IP: %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); DIAG(F("Port:%d"), IP_PORT); - + return true; } diff --git a/config.example.h b/config.example.h index c562136..9da47a0 100644 --- a/config.example.h +++ b/config.example.h @@ -98,11 +98,14 @@ The configuration file for DCC-EX Command Station // library from or get via the libray manager either from the IDE // or PIO +// The following is only needed if the Broker requires it. cf broker descriptions below #define MQTT_USER "your broker user name" #define MQTT_PWD "your broker passwd" #define MQTT_PREFIX "prefix if required by the broker" +// UNCOMMENT THE FOLLOWING LINE TO ENABLE MQTT // #define ENABLE_MQTT true + // Set the used broker to one of the configurations from MQTTBrokers.h where some // public freely avaiable brokers are configured diff --git a/defines.h b/defines.h index d1a2446..8517440 100644 --- a/defines.h +++ b/defines.h @@ -40,7 +40,11 @@ // MQTT handles ethernet on it's own #if ENABLE_MQTT && (defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_SAMD_ZERO) || defined(TEENSYDUINO)) +#if ENABLE_ETHERNET + #error Ethernet and MQTT can not be enabled simultaneaously +#else #define MQTT_ON true +#endif #endif // #if WIFI_ON && ETHERNET_ON