Added vrsion info to autodiscovery packet.
This commit is contained in:
parent
5553964d52
commit
6c997f573a
@ -6,11 +6,11 @@ String getNodeTypeDisplayString(uint8_t nodeType) {
|
|||||||
case NODE_TYPE_ID_ESP8266: return F("ESP8266");
|
case NODE_TYPE_ID_ESP8266: return F("ESP8266");
|
||||||
case NODE_TYPE_ID_ESP32: return F("ESP32");
|
case NODE_TYPE_ID_ESP32: return F("ESP32");
|
||||||
}
|
}
|
||||||
return "";
|
return "Undefined";
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeStruct::NodeStruct() :
|
NodeStruct::NodeStruct() :
|
||||||
age(0), nodeType(0)
|
age(0), nodeType(0), build(0)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < 4; ++i) { ip[i] = 0; }
|
for (uint8_t i = 0; i < 4; ++i) { ip[i] = 0; }
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ struct NodeStruct
|
|||||||
uint8_t unit;
|
uint8_t unit;
|
||||||
uint8_t age;
|
uint8_t age;
|
||||||
uint8_t nodeType;
|
uint8_t nodeType;
|
||||||
|
uint32_t build;
|
||||||
};
|
};
|
||||||
typedef std::map<uint8_t, NodeStruct> NodesMap;
|
typedef std::map<uint8_t, NodeStruct> NodesMap;
|
||||||
|
|
||||||
|
@ -148,6 +148,10 @@ button {
|
|||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.valtd i {
|
||||||
|
font-size: small;
|
||||||
|
}
|
||||||
|
|
||||||
.slider-icon
|
.slider-icon
|
||||||
{
|
{
|
||||||
transform: translate(6px,3px);
|
transform: translate(6px,3px);
|
||||||
|
@ -453,7 +453,7 @@ function populateNodes(i)
|
|||||||
var o = i.nodes[x];
|
var o = i.nodes[x];
|
||||||
if (o.name) {
|
if (o.name) {
|
||||||
var url = `<button class="btn btna-icon tab" onclick="location.assign('http://${o.ip}');">${o.name}</button>`;
|
var url = `<button class="btn btna-icon tab" onclick="location.assign('http://${o.ip}');">${o.name}</button>`;
|
||||||
urows += inforow(url,o.type);
|
urows += inforow(url,`${o.type}<br><i>${o.build==0?"N/A":o.build}</i>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i.nodes.length>0) {
|
if (i.nodes.length>0) {
|
||||||
|
3318
wled00/html_ui.h
3318
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -549,6 +549,7 @@ void serializeInfo(JsonObject root)
|
|||||||
node[F("type")] = getNodeTypeDisplayString(it->second.nodeType);
|
node[F("type")] = getNodeTypeDisplayString(it->second.nodeType);
|
||||||
node[F("ip")] = it->second.ip.toString();
|
node[F("ip")] = it->second.ip.toString();
|
||||||
node[F("age")] = it->second.age;
|
node[F("age")] = it->second.age;
|
||||||
|
node[F("build")] = it->second.build;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,11 @@ void handleNotifications()
|
|||||||
it->second.nodeName = tmpNodeName;
|
it->second.nodeName = tmpNodeName;
|
||||||
it->second.nodeName.trim();
|
it->second.nodeName.trim();
|
||||||
it->second.nodeType = udpIn[38];
|
it->second.nodeType = udpIn[38];
|
||||||
|
uint32_t build = 0;
|
||||||
|
if (len >= 44)
|
||||||
|
for (byte i=0; i<sizeof(uint32_t); i++)
|
||||||
|
build |= udpIn[40+i]<<(8*i);
|
||||||
|
it->second.build = build;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -414,7 +419,8 @@ void sendSysInfoUDP(uint8_t repeats)
|
|||||||
// 6: 32 char name
|
// 6: 32 char name
|
||||||
// 38: 1 byte node type id
|
// 38: 1 byte node type id
|
||||||
// 39: 1 byte node id
|
// 39: 1 byte node id
|
||||||
// 40 bytes total
|
// 40: 4 byte version ID
|
||||||
|
// 44 bytes total
|
||||||
|
|
||||||
// send my info to the world...
|
// send my info to the world...
|
||||||
for (;repeats--;)
|
for (;repeats--;)
|
||||||
@ -423,7 +429,7 @@ void sendSysInfoUDP(uint8_t repeats)
|
|||||||
escapedMac // mac address
|
escapedMac // mac address
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t data[40] = {0};
|
uint8_t data[44] = {0};
|
||||||
data[0] = 255;
|
data[0] = 255;
|
||||||
data[1] = 1;
|
data[1] = 1;
|
||||||
|
|
||||||
@ -440,9 +446,13 @@ void sendSysInfoUDP(uint8_t repeats)
|
|||||||
#endif
|
#endif
|
||||||
data[39] = ip[3]; // unit ID == last IP number
|
data[39] = ip[3]; // unit ID == last IP number
|
||||||
|
|
||||||
|
uint32_t build = VERSION;
|
||||||
|
for (byte i=0; i<sizeof(uint32_t); i++)
|
||||||
|
data[40+i] = (build>>(8*i)) & 0xFF;
|
||||||
|
|
||||||
IPAddress broadcastIP(255, 255, 255, 255);
|
IPAddress broadcastIP(255, 255, 255, 255);
|
||||||
notifier2Udp.beginPacket(broadcastIP, udpPort2);
|
notifier2Udp.beginPacket(broadcastIP, udpPort2);
|
||||||
notifier2Udp.write(data, 40);
|
notifier2Udp.write(data, sizeof(data));
|
||||||
notifier2Udp.endPacket();
|
notifier2Udp.endPacket();
|
||||||
|
|
||||||
if (repeats) delay(500);
|
if (repeats) delay(500);
|
||||||
@ -467,5 +477,6 @@ void sendSysInfoUDP(uint8_t repeats)
|
|||||||
it->second.nodeType = NODE_TYPE_ID_UNDEFINED;
|
it->second.nodeType = NODE_TYPE_ID_UNDEFINED;
|
||||||
#endif
|
#endif
|
||||||
it->second.unit = ip[3];
|
it->second.unit = ip[3];
|
||||||
|
it->second.build = VERSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user