diff --git a/AIO_Firmware_PIO/src/app/server/web_setting.cpp b/AIO_Firmware_PIO/src/app/server/web_setting.cpp index e6f721b..0c1b58f 100644 --- a/AIO_Firmware_PIO/src/app/server/web_setting.cpp +++ b/AIO_Firmware_PIO/src/app/server/web_setting.cpp @@ -315,7 +315,7 @@ void rgb_setting() void weather_setting() { - char buf[2048]; + char buf[4096]; char key[64]; char timeUpdataInterval[32]; char weatherUpdataInterval[32]; diff --git a/AIO_Firmware_PIO/src/app/weather/weather.cpp b/AIO_Firmware_PIO/src/app/weather/weather.cpp index b9f5f66..7214c00 100644 --- a/AIO_Firmware_PIO/src/app/weather/weather.cpp +++ b/AIO_Firmware_PIO/src/app/weather/weather.cpp @@ -87,17 +87,13 @@ static uint8_t *json_buffer = NULL; static void write_config(WT_Config *cfg) { - char tmp[16] = {0}; // 将配置数据保存在文件中(持久化) String w_data; cfg->location_info.country.toLowerCase(); w_data = w_data + cfg->key + "\n"; - snprintf(tmp, 15, "%lu\n", cfg->weatherUpdataInterval); - w_data += tmp; - snprintf(tmp, 15, "%lu\n", cfg->timeUpdataInterval); - w_data += tmp; - snprintf(tmp, 15, "%u\n", cfg->auto_get_location); - w_data += tmp; + w_data = w_data + String(cfg->weatherUpdataInterval) + "\n"; + w_data = w_data + String(cfg->timeUpdataInterval) + "\n"; + w_data = w_data + String(cfg->auto_get_location) + "\n"; w_data = w_data + cfg->location_info.country + "\n"; w_data = w_data + cfg->location_info.province + "\n"; w_data = w_data + cfg->location_info.city + "\n"; @@ -110,7 +106,7 @@ static void read_config(WT_Config *cfg) { // 如果有需要持久化配置文件 可以调用此函数将数据存在flash中 // 配置文件名最好以APP名为开头 以".cfg"结尾,以免多个APP读取混乱 - char info[128] = {0}; + char info[512] = {0}; uint16_t size = g_flashCfg.readFile(WEATHER_CONFIG_PATH, (uint8_t *)info); info[size] = 0; if (size == 0) @@ -628,9 +624,6 @@ static int weather_exit_callback(void *param) } // 释放运行数据 - delete cfg_data; - delete run_data; - delete task_param_data; if (get_response != NULL) { free(get_response);