Skip to content

Commit 6c997f5

Browse files
committed
Added vrsion info to autodiscovery packet.
1 parent 5553964 commit 6c997f5

File tree

7 files changed

+1683
-1664
lines changed

7 files changed

+1683
-1664
lines changed

wled00/NodeStruct.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ String getNodeTypeDisplayString(uint8_t nodeType) {
66
case NODE_TYPE_ID_ESP8266: return F("ESP8266");
77
case NODE_TYPE_ID_ESP32: return F("ESP32");
88
}
9-
return "";
9+
return "Undefined";
1010
}
1111

1212
NodeStruct::NodeStruct() :
13-
age(0), nodeType(0)
13+
age(0), nodeType(0), build(0)
1414
{
1515
for (uint8_t i = 0; i < 4; ++i) { ip[i] = 0; }
1616
}

wled00/NodeStruct.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct NodeStruct
2727
uint8_t unit;
2828
uint8_t age;
2929
uint8_t nodeType;
30+
uint32_t build;
3031
};
3132
typedef std::map<uint8_t, NodeStruct> NodesMap;
3233

wled00/data/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ button {
148148
padding-bottom: 8px;
149149
}
150150

151+
.valtd i {
152+
font-size: small;
153+
}
154+
151155
.slider-icon
152156
{
153157
transform: translate(6px,3px);

wled00/data/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ function populateNodes(i)
453453
var o = i.nodes[x];
454454
if (o.name) {
455455
var url = `<button class="btn btna-icon tab" onclick="location.assign('http://${o.ip}');">${o.name}</button>`;
456-
urows += inforow(url,o.type);
456+
urows += inforow(url,`${o.type}<br><i>${o.build==0?"N/A":o.build}</i>`);
457457
}
458458
}
459459
if (i.nodes.length>0) {

wled00/html_ui.h

Lines changed: 1660 additions & 1658 deletions
Large diffs are not rendered by default.

wled00/json.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ void serializeInfo(JsonObject root)
549549
node[F("type")] = getNodeTypeDisplayString(it->second.nodeType);
550550
node[F("ip")] = it->second.ip.toString();
551551
node[F("age")] = it->second.age;
552+
node[F("build")] = it->second.build;
552553
}
553554
}
554555
}

wled00/udp.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ void handleNotifications()
186186
it->second.nodeName = tmpNodeName;
187187
it->second.nodeName.trim();
188188
it->second.nodeType = udpIn[38];
189+
uint32_t build = 0;
190+
if (len >= 44)
191+
for (byte i=0; i<sizeof(uint32_t); i++)
192+
build |= udpIn[40+i]<<(8*i);
193+
it->second.build = build;
189194
}
190195
return;
191196
}
@@ -414,7 +419,8 @@ void sendSysInfoUDP(uint8_t repeats)
414419
// 6: 32 char name
415420
// 38: 1 byte node type id
416421
// 39: 1 byte node id
417-
// 40 bytes total
422+
// 40: 4 byte version ID
423+
// 44 bytes total
418424

419425
// send my info to the world...
420426
for (;repeats--;)
@@ -423,7 +429,7 @@ void sendSysInfoUDP(uint8_t repeats)
423429
escapedMac // mac address
424430
*/
425431

426-
uint8_t data[40] = {0};
432+
uint8_t data[44] = {0};
427433
data[0] = 255;
428434
data[1] = 1;
429435

@@ -440,9 +446,13 @@ void sendSysInfoUDP(uint8_t repeats)
440446
#endif
441447
data[39] = ip[3]; // unit ID == last IP number
442448

449+
uint32_t build = VERSION;
450+
for (byte i=0; i<sizeof(uint32_t); i++)
451+
data[40+i] = (build>>(8*i)) & 0xFF;
452+
443453
IPAddress broadcastIP(255, 255, 255, 255);
444454
notifier2Udp.beginPacket(broadcastIP, udpPort2);
445-
notifier2Udp.write(data, 40);
455+
notifier2Udp.write(data, sizeof(data));
446456
notifier2Udp.endPacket();
447457

448458
if (repeats) delay(500);
@@ -467,5 +477,6 @@ void sendSysInfoUDP(uint8_t repeats)
467477
it->second.nodeType = NODE_TYPE_ID_UNDEFINED;
468478
#endif
469479
it->second.unit = ip[3];
480+
it->second.build = VERSION;
470481
}
471482
}

0 commit comments

Comments
 (0)