Skip to content

Commit 8ec2ebd

Browse files
committed
Sent startup message to controller when it connects.
1 parent aeb9f30 commit 8ec2ebd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@
6262
#endif
6363

6464
// Use this if you have attached a Ethernet ENC28J60 shields
65-
#include <UIPEthernet.h>
65+
//#include <UIPEthernet.h>
6666

6767
// Use this fo WizNET module and Arduino Ethernet Shield
68-
//#include <Ethernet.h>
68+
#include <Ethernet.h>
6969

7070

7171
#define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
@@ -97,6 +97,7 @@ EthernetServer server = EthernetServer(IP_PORT);
9797

9898
char inputString[MAX_RECEIVE_LENGTH] = ""; // A string to hold incoming commands from serial/ethernet interface
9999
int inputPos = 0;
100+
bool sentReady = false;
100101

101102
void w5100_spi_en(boolean enable)
102103
{
@@ -151,7 +152,7 @@ void setup()
151152
server.begin();
152153
w5100_spi_en(false);
153154

154-
//output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"), C_INTERNAL, I_GATEWAY_READY);
155+
output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"), C_INTERNAL, I_GATEWAY_READY);
155156

156157
}
157158

@@ -170,7 +171,12 @@ void loop()
170171
EthernetClient client = server.available();
171172

172173
if (client) {
173-
174+
if (!sentReady) {
175+
// Send gateway startup message when first client connects
176+
output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"), C_INTERNAL, I_GATEWAY_READY);
177+
sentReady = true;
178+
}
179+
174180
// if got 1 or more bytes
175181
if (client.available()) {
176182
// read the bytes incoming from the client

0 commit comments

Comments
 (0)