mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-18 08:46:35 +00:00
Add configSet for lv_color_t variables
This commit is contained in:
parent
b073983275
commit
a3f2890ea0
@ -85,7 +85,19 @@ bool configSet(uint16_t& value, const JsonVariant& setting, const __FlashStringH
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool configSet(lv_color_t& value, const JsonVariant& setting, const __FlashStringHelper* fstr_name)
|
||||||
|
{
|
||||||
|
lv_color32_t c32;
|
||||||
|
if(!setting.isNull() && Parser::haspPayloadToColor(setting.as<const char*>(), c32)) {
|
||||||
|
lv_color_t val = lv_color_make(c32.ch.red, c32.ch.green, c32.ch.blue);
|
||||||
|
if(value.full != val.full) {
|
||||||
|
confDebugSet(fstr_name);
|
||||||
|
value = val;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
void configSetupDebug(JsonDocument& settings)
|
void configSetupDebug(JsonDocument& settings)
|
||||||
{
|
{
|
||||||
debugSetup(settings[FPSTR(FP_DEBUG)]);
|
debugSetup(settings[FPSTR(FP_DEBUG)]);
|
||||||
@ -199,7 +211,8 @@ DeserializationError configRead(JsonDocument& settings, bool setupdebug = false)
|
|||||||
#if HASP_USE_CONFIG > 0 && defined(HASP_GPIO_TEMPLATE)
|
#if HASP_USE_CONFIG > 0 && defined(HASP_GPIO_TEMPLATE)
|
||||||
// Load custom GPIO template
|
// Load custom GPIO template
|
||||||
char json[96];
|
char json[96];
|
||||||
snprintf(json, sizeof(json), PSTR("{\"%s\":%s}"), (char*)(FPSTR(FP_GPIO_CONFIG)), (char*)(FPSTR(HASP_GPIO_TEMPLATE)));
|
snprintf(json, sizeof(json), PSTR("{\"%s\":%s}"), (char*)(FPSTR(FP_GPIO_CONFIG)),
|
||||||
|
(char*)(FPSTR(HASP_GPIO_TEMPLATE)));
|
||||||
dispatch_config((char*)(FPSTR(FP_GPIO)), json, TAG_CONF);
|
dispatch_config((char*)(FPSTR(FP_GPIO)), json, TAG_CONF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user