mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Merge pull request #155 from arovak/gpio_template
gpio template via user_config_override
This commit is contained in:
commit
ba8f3f017c
@ -53,7 +53,7 @@ struct moodlight_t
|
|||||||
};
|
};
|
||||||
moodlight_t moodlight;
|
moodlight_t moodlight;
|
||||||
|
|
||||||
static void dispatch_config(const char* topic, const char* payload);
|
// static void dispatch_config(const char* topic, const char* payload);
|
||||||
// void dispatch_group_value(uint8_t groupid, int16_t state, lv_obj_t * obj);
|
// void dispatch_group_value(uint8_t groupid, int16_t state, lv_obj_t * obj);
|
||||||
|
|
||||||
/* Sends the payload out on the state/subtopic
|
/* Sends the payload out on the state/subtopic
|
||||||
@ -401,7 +401,7 @@ void dispatch_output_idle_state(uint8_t state)
|
|||||||
|
|
||||||
#if HASP_USE_CONFIG > 0
|
#if HASP_USE_CONFIG > 0
|
||||||
// Get or Set a part of the config.json file
|
// Get or Set a part of the config.json file
|
||||||
static void dispatch_config(const char* topic, const char* payload)
|
void dispatch_config(const char* topic, const char* payload)
|
||||||
{
|
{
|
||||||
DynamicJsonDocument doc(128 * 2);
|
DynamicJsonDocument doc(128 * 2);
|
||||||
char buffer[128 * 2];
|
char buffer[128 * 2];
|
||||||
|
@ -71,6 +71,8 @@ void dispatch_normalized_group_value(uint8_t groupid, lv_obj_t* obj, int16_t val
|
|||||||
|
|
||||||
void dispatch_state_subtopic(const char* subtopic, const char* payload);
|
void dispatch_state_subtopic(const char* subtopic, const char* payload);
|
||||||
|
|
||||||
|
void dispatch_config(const char* topic, const char* payload);
|
||||||
|
|
||||||
/* ===== Getter and Setter Functions ===== */
|
/* ===== Getter and Setter Functions ===== */
|
||||||
|
|
||||||
/* ===== Read/Write Configuration ===== */
|
/* ===== Read/Write Configuration ===== */
|
||||||
|
@ -152,13 +152,11 @@ void configRead(JsonDocument& settings, bool setupdebug = false)
|
|||||||
|
|
||||||
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
||||||
LOG_ERROR(TAG_CONF, F(D_FILE_LOAD_FAILED), configFile.c_str());
|
LOG_ERROR(TAG_CONF, F(D_FILE_LOAD_FAILED), configFile.c_str());
|
||||||
#ifdef HASP_GPIO_TEMPLATE
|
#endif
|
||||||
char json[100];
|
#if HASP_USE_CONFIG > 0 && defined(HASP_GPIO_TEMPLATE)
|
||||||
snprintf(json, sizeof(json), PSTR("{\"%s\":{\"%s\":%s}}"), (char*)(FPSTR(FP_GPIO)), (char*)(FPSTR(FP_GPIO_CONFIG)), (char*)(FPSTR(HASP_GPIO_TEMPLATE)));
|
char json[96];
|
||||||
error = deserializeJson(settings, json);
|
snprintf(json, sizeof(json), PSTR("{\"%s\":%s}"), (char*)(FPSTR(FP_GPIO_CONFIG)), (char*)(FPSTR(FP_GPIO_TEMPLATE)));
|
||||||
gpioSetConfig(settings[FPSTR(FP_GPIO)]);
|
dispatch_config((char*)(FPSTR(FP_GPIO)), json);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user