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);
|
||||
|
||||
struct DeviceConfig {
|
||||
const char* id;
|
||||
const char* name;
|
||||
const char* model;
|
||||
const char* manufacturer;
|
||||
const char* area;
|
||||
const char* id = nullptr;
|
||||
const char* name = nullptr;
|
||||
const char* model = nullptr;
|
||||
const char* manufacturer = nullptr;
|
||||
const char* area = nullptr;
|
||||
DeviceConfig* parent = nullptr;
|
||||
|
||||
DeviceConfig(const char* id, const char* name) : id(id), name(name) {}
|
||||
@ -56,14 +56,14 @@ namespace Ha {
|
||||
};
|
||||
|
||||
struct Component {
|
||||
const char* name = nullptr;
|
||||
char* id = nullptr;
|
||||
const char* name;
|
||||
const char* type;
|
||||
const char* type = nullptr;
|
||||
char configTopic[TOPIC_SIZE];
|
||||
DeviceConfig* mainDevice = nullptr;
|
||||
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);
|
||||
components.add(this);
|
||||
}
|
||||
@ -136,7 +136,6 @@ namespace Ha {
|
||||
};
|
||||
|
||||
struct Switch : Command<Switch>, StateConfig<Switch> {
|
||||
const char* area;
|
||||
|
||||
virtual void onCommand(const char* msg){}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user