Skip to content

Commit a090351

Browse files
mobrembskiMichał Obrembski
authored andcommitted
Add MY_MQTT_ETH_INIT_DELAY to configuration
MY_MQTT_ETH_INIT_DELAY configuration field is useful for adjusting Ethernet Chip initialisation delay time by library user.
1 parent 8f1f8ad commit a090351

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

MyConfig.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,17 @@
15511551
*/
15521552
//#define MY_MQTT_CLIENT_KEY
15531553

1554+
/**
1555+
* @def MY_MQTT_ETH_INIT_DELAY
1556+
* @brief Set a delay for Ethernet initialisation.
1557+
*
1558+
* This define is useful if you want to change default Ethernet chip initialisation
1559+
* delay time to other value. By default, it is 1000ms
1560+
* Example: @code #define MY_MQTT_ETH_INIT_DELAY 1 @endcode
1561+
*/
1562+
#ifndef MY_MQTT_ETH_INIT_DELAY
1563+
#define MY_MQTT_ETH_INIT_DELAY 1000
1564+
#endif
15541565
/**
15551566
* @def MY_IP_ADDRESS
15561567
* @brief Static ip address of gateway. If not defined, DHCP will be used.
@@ -2323,6 +2334,7 @@
23232334
#define MY_MQTT_CA_CERT
23242335
#define MY_MQTT_CLIENT_CERT
23252336
#define MY_MQTT_CLIENT_KEY
2337+
#define MY_MQTT_ETH_INIT_DELAY
23262338
#define MY_SIGNAL_REPORT_ENABLED
23272339
// general
23282340
#define MY_WITH_LEDS_BLINKING_INVERSE

core/MyGatewayTransportMQTTClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ bool gatewayTransportConnect(void)
194194
Ethernet.localIP()[0],
195195
Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
196196
// give the Ethernet interface a second to initialize
197-
delay(1000);
197+
delay(MY_MQTT_ETH_INIT_DELAY);
198198
#endif
199199
return true;
200200
}

0 commit comments

Comments
 (0)