2021-03-09 15:23:19 +00:00
|
|
|
#ifndef WLED_NODESTRUCT_H
|
|
|
|
#define WLED_NODESTRUCT_H
|
2021-01-22 15:17:18 +00:00
|
|
|
|
|
|
|
/*********************************************************************************************\
|
|
|
|
* NodeStruct from the ESP Easy project (https://github.com/letscontrolit/ESPEasy)
|
|
|
|
\*********************************************************************************************/
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <IPAddress.h>
|
|
|
|
|
2021-03-09 16:21:19 +00:00
|
|
|
#define NODE_TYPE_ID_UNDEFINED 0
|
2023-07-13 20:21:15 +00:00
|
|
|
#define NODE_TYPE_ID_ESP8266 82 // should be 1
|
|
|
|
#define NODE_TYPE_ID_ESP32 32 // should be 2
|
|
|
|
#define NODE_TYPE_ID_ESP32S2 33 // etc
|
2022-11-02 13:56:50 +00:00
|
|
|
#define NODE_TYPE_ID_ESP32S3 34
|
|
|
|
#define NODE_TYPE_ID_ESP32C3 35
|
2021-01-22 15:17:18 +00:00
|
|
|
|
|
|
|
/*********************************************************************************************\
|
|
|
|
* NodeStruct
|
|
|
|
\*********************************************************************************************/
|
|
|
|
struct NodeStruct
|
|
|
|
{
|
|
|
|
String nodeName;
|
|
|
|
IPAddress ip;
|
|
|
|
uint8_t age;
|
2023-07-13 20:21:15 +00:00
|
|
|
union {
|
|
|
|
uint8_t nodeType; // a waste of space as we only have 5 types
|
|
|
|
struct {
|
|
|
|
uint8_t type : 7; // still a waste of space (4 bits would be enough and future-proof)
|
|
|
|
bool on : 1;
|
|
|
|
};
|
|
|
|
};
|
2021-03-04 13:34:36 +00:00
|
|
|
uint32_t build;
|
2021-03-09 15:23:19 +00:00
|
|
|
|
|
|
|
NodeStruct() : age(0), nodeType(0), build(0)
|
|
|
|
{
|
2024-07-11 19:22:58 +00:00
|
|
|
for (unsigned i = 0; i < 4; ++i) { ip[i] = 0; }
|
2021-03-09 15:23:19 +00:00
|
|
|
}
|
2021-01-22 15:17:18 +00:00
|
|
|
};
|
|
|
|
typedef std::map<uint8_t, NodeStruct> NodesMap;
|
|
|
|
|
2021-03-09 15:23:19 +00:00
|
|
|
#endif // WLED_NODESTRUCT_H
|