Skip to content

Commit f1f8aec

Browse files
committed
Change order of ethernet/radio intialization to avoid troubles.
1 parent 0534213 commit f1f8aec

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ void output(const char *fmt, ... ) {
101101

102102
void setup()
103103
{
104-
// Initialize gateway at maximum PA level, channel 70 and callback for write operations
105-
gw.begin(incomingMessage, 0, true, 0);
106104

107105
Ethernet.begin(mac, myIp);
108106
setupGateway(RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN, INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
@@ -116,6 +114,10 @@ void setup()
116114

117115
// give the Ethernet interface a second to initialize
118116
delay(1000);
117+
118+
// Initialize gateway at maximum PA level, channel 70 and callback for write operations
119+
gw.begin(incomingMessage, 0, true, 0);
120+
119121

120122
// start listening for clients
121123
server.begin();

libraries/MySensors/examples/MQTTGateway/MQTTGateway.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ void incomingMessage(const MyMessage &message) {
145145

146146
void setup()
147147
{
148-
// Initialize gateway at maximum PA level, channel 70 and callback for write operations
149-
gw.begin(incomingMessage, 0, true, 0);
150148
Ethernet.begin(TCP_MAC, TCP_IP);
151149

152150

@@ -177,6 +175,10 @@ void setup()
177175
// give the Ethernet interface a second to initialize
178176
delay(1000);
179177

178+
179+
// Initialize gateway at maximum PA level, channel 70 and callback for write operations
180+
gw.begin(incomingMessage, 0, true, 0);
181+
180182
// start listening for clients
181183
server.begin();
182184

0 commit comments

Comments
 (0)