mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2025-10-29 11:33:20 +00:00
HA ENUMS PR FIX (remove 1kB from stack)
This commit is contained in:
parent
1a291a82ad
commit
60a7d1371c
@ -18,7 +18,7 @@ Sensor - https://www.home-assistant.io/integrations/sensor.mqtt/
|
||||
|
||||
//Buffer used to populate values in cJSON_Add* calls. The values are based on
|
||||
//CFG_GetShortDeviceName and clientId so it needs to be bigger than them. +64 for light/switch/etc.
|
||||
static char g_hassBuffer[CGF_MQTT_CLIENT_ID_SIZE + 64];
|
||||
static char g_hassBuffer[CGF_MQTT_CLIENT_ID_SIZE + 128];
|
||||
const char *g_template_lowMidHigh = "{% if value == '0' %}\n"
|
||||
" Low\n"
|
||||
"{% elif value == '1' %}\n"
|
||||
@ -622,9 +622,10 @@ HassDeviceInfo* hass_init_device_info(ENTITY_TYPE type, int index, const char* p
|
||||
}
|
||||
|
||||
if (type == HASS_READONLYENUM) {
|
||||
char value_template[1024];
|
||||
CMD_GenEnumValueTemplate(g_enums[index], value_template, sizeof(value_template));
|
||||
cJSON_AddStringToObject(info->root, "value_template", value_template);
|
||||
// Sorry, you can't do that on stack
|
||||
//char value_template[1024];
|
||||
CMD_GenEnumValueTemplate(g_enums[index], g_hassBuffer, sizeof(g_hassBuffer));
|
||||
cJSON_AddStringToObject(info->root, "value_template", g_hassBuffer);
|
||||
}
|
||||
|
||||
cJSON_AddStringToObject(info->root, "uniq_id", info->unique_id); //unique_id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user