fix random resets by initializing all pointers with nullptr
This commit is contained in:
parent
88b8ef9c01
commit
8d9738492d
@ -10,11 +10,11 @@ namespace Ha {
|
|||||||
uint16_t (*publisher)(const char* topic, const char* message);
|
uint16_t (*publisher)(const char* topic, const char* message);
|
||||||
|
|
||||||
struct DeviceConfig {
|
struct DeviceConfig {
|
||||||
const char* id;
|
const char* id = nullptr;
|
||||||
const char* name;
|
const char* name = nullptr;
|
||||||
const char* model;
|
const char* model = nullptr;
|
||||||
const char* manufacturer;
|
const char* manufacturer = nullptr;
|
||||||
const char* area;
|
const char* area = nullptr;
|
||||||
DeviceConfig* parent = nullptr;
|
DeviceConfig* parent = nullptr;
|
||||||
|
|
||||||
DeviceConfig(const char* id, const char* name) : id(id), name(name) {}
|
DeviceConfig(const char* id, const char* name) : id(id), name(name) {}
|
||||||
@ -56,14 +56,14 @@ namespace Ha {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Component {
|
struct Component {
|
||||||
|
const char* name = nullptr;
|
||||||
char* id = nullptr;
|
char* id = nullptr;
|
||||||
const char* name;
|
const char* type = nullptr;
|
||||||
const char* type;
|
|
||||||
char configTopic[TOPIC_SIZE];
|
char configTopic[TOPIC_SIZE];
|
||||||
DeviceConfig* mainDevice = nullptr;
|
DeviceConfig* mainDevice = nullptr;
|
||||||
static List<Component> components;
|
static List<Component> components;
|
||||||
|
|
||||||
Component(const char* name, const char* id, const char* type) : id((char*)id), name(name), type(type) {
|
Component(const char* name, const char* id, const char* type) : name(name), id((char*)id), type(type) {
|
||||||
sprintf(configTopic, "homeassistant/%s/%s/%s/config", type, MAIN_DEVICE_ID, id);
|
sprintf(configTopic, "homeassistant/%s/%s/%s/config", type, MAIN_DEVICE_ID, id);
|
||||||
components.add(this);
|
components.add(this);
|
||||||
}
|
}
|
||||||
@ -136,7 +136,6 @@ namespace Ha {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Switch : Command<Switch>, StateConfig<Switch> {
|
struct Switch : Command<Switch>, StateConfig<Switch> {
|
||||||
const char* area;
|
|
||||||
|
|
||||||
virtual void onCommand(const char* msg){}
|
virtual void onCommand(const char* msg){}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user