Added vrsion info to autodiscovery packet.

pull/1683/head
Blaz Kristan 2021-03-04 14:34:36 +01:00
rodzic 5553964d52
commit 6c997f573a
7 zmienionych plików z 1683 dodań i 1664 usunięć

Wyświetl plik

@ -6,11 +6,11 @@ String getNodeTypeDisplayString(uint8_t nodeType) {
case NODE_TYPE_ID_ESP8266: return F("ESP8266");
case NODE_TYPE_ID_ESP32: return F("ESP32");
}
return "";
return "Undefined";
}
NodeStruct::NodeStruct() :
age(0), nodeType(0)
age(0), nodeType(0), build(0)
{
for (uint8_t i = 0; i < 4; ++i) { ip[i] = 0; }
}

Wyświetl plik

@ -27,6 +27,7 @@ struct NodeStruct
uint8_t unit;
uint8_t age;
uint8_t nodeType;
uint32_t build;
};
typedef std::map<uint8_t, NodeStruct> NodesMap;

Wyświetl plik

@ -148,6 +148,10 @@ button {
padding-bottom: 8px;
}
.valtd i {
font-size: small;
}
.slider-icon
{
transform: translate(6px,3px);

Wyświetl plik

@ -453,7 +453,7 @@ function populateNodes(i)
var o = i.nodes[x];
if (o.name) {
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) {

Plik diff jest za duży Load Diff

Wyświetl plik

@ -549,6 +549,7 @@ void serializeInfo(JsonObject root)
node[F("type")] = getNodeTypeDisplayString(it->second.nodeType);
node[F("ip")] = it->second.ip.toString();
node[F("age")] = it->second.age;
node[F("build")] = it->second.build;
}
}
}

Wyświetl plik

@ -186,6 +186,11 @@ void handleNotifications()
it->second.nodeName = tmpNodeName;
it->second.nodeName.trim();
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;
}
@ -414,7 +419,8 @@ void sendSysInfoUDP(uint8_t repeats)
// 6: 32 char name
// 38: 1 byte node type id
// 39: 1 byte node id
// 40 bytes total
// 40: 4 byte version ID
// 44 bytes total
// send my info to the world...
for (;repeats--;)
@ -423,7 +429,7 @@ void sendSysInfoUDP(uint8_t repeats)
escapedMac // mac address
*/
uint8_t data[40] = {0};
uint8_t data[44] = {0};
data[0] = 255;
data[1] = 1;
@ -440,9 +446,13 @@ void sendSysInfoUDP(uint8_t repeats)
#endif
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);
notifier2Udp.beginPacket(broadcastIP, udpPort2);
notifier2Udp.write(data, 40);
notifier2Udp.write(data, sizeof(data));
notifier2Udp.endPacket();
if (repeats) delay(500);
@ -467,5 +477,6 @@ void sendSysInfoUDP(uint8_t repeats)
it->second.nodeType = NODE_TYPE_ID_UNDEFINED;
#endif
it->second.unit = ip[3];
it->second.build = VERSION;
}
}