修复自定义名称过长可能导致系统崩溃的问题

This commit is contained in:
Your Name
2025-04-09 22:53:12 +08:00
parent e6d430c37c
commit 34e1cabc53
3 changed files with 5 additions and 4 deletions

View File

@@ -52,7 +52,7 @@
static bool is_http_init;
static bool is_handlers_registered;
const struct httpd_wsgi_call g_app_handlers[];
char power_info_json[1952] = {0};
char power_info_json[2560] = {0};
char up_time[16] = "00:00:00";
/*

View File

@@ -530,7 +530,7 @@ void UserMqttHassAuto(char socket_id) {
socket_id--;
char *send_buf = NULL;
char *topic_buf = NULL;
send_buf = (char *) malloc(600);
send_buf = (char *) malloc(800);
topic_buf = (char *) malloc(64);
if (send_buf != NULL && topic_buf != NULL) {
sprintf(topic_buf, "homeassistant/switch/%s/socket_%d/config", str_mac, socket_id);
@@ -691,6 +691,7 @@ void UserMqttHassAutoPower(void) {
"\"object_id\":\"tc1_%s_sut\","
"\"state_topic\":\"homeassistant/sensor/%s/startupTime/state\","
"\"icon\":\"mdi:clock-time-three-outline\","
"\"entity_category\":\"diagnostic\","
"\"value_template\":\"{{ value_json.startupTime }}\",""\"device\":{"
"\"identifiers\":[\"tc1_%s\"],"
"\"name\":\"%s\","

View File

@@ -10,8 +10,8 @@
#define MQTT_CMD_TIMEOUT 5000 // 5s
#define MQTT_YIELD_TMIE 5000 // 5s
#define MAX_MQTT_TOPIC_SIZE (256)
#define MAX_MQTT_DATA_SIZE (1024)
#define MAX_MQTT_TOPIC_SIZE (512)
#define MAX_MQTT_DATA_SIZE (2048)
#define MAX_MQTT_SEND_QUEUE_SIZE (10)
#define MQTT_SERVER user_config->mqtt_ip