Skip to content

Commit cf29547

Browse files
committed
Send static IPs from node to server
Otherwise they get lost and we lose the user made setting
1 parent d51c468 commit cf29547

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arduino/discovery.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ int discover_set_int(char *buf, int start, int val)
3232
return discover_set_str(buf, start, out);
3333
}
3434

35+
int discover_set_ip(char *buf, int start, IPAddress &ip)
36+
{
37+
uint8_t data[4];
38+
data[0] = ip[0];
39+
data[1] = ip[1];
40+
data[2] = ip[2];
41+
data[3] = ip[3];
42+
return discover_set_buf(buf, start, data, 4);
43+
}
44+
3545
static int extract_ip(const char *buf, int buf_len, int start, IPAddress &ip_out)
3646
{
3747
if (buf_len < start)
@@ -88,6 +98,10 @@ static bool discover_send_pkt()
8898
pktlen = discover_set_int(buf, pktlen, node_type);
8999
pktlen = discover_set_str(buf, pktlen, node_desc);
90100
pktlen = discover_set_str(buf, pktlen, VERSION);
101+
pktlen = discover_set_ip(buf, pktlen, static_ip);
102+
pktlen = discover_set_ip(buf, pktlen, static_nm);
103+
pktlen = discover_set_ip(buf, pktlen, static_gw);
104+
pktlen = discover_set_ip(buf, pktlen, dns);
91105

92106
udp.write(buf, pktlen);
93107

0 commit comments

Comments
 (0)