@@ -87,17 +87,13 @@ static uint8_t *json_buffer = NULL;
8787
8888static void write_config (WT_Config *cfg)
8989{
90- char tmp[16 ] = {0 };
9190 // 将配置数据保存在文件中(持久化)
9291 String w_data;
9392 cfg->location_info .country .toLowerCase ();
9493 w_data = w_data + cfg->key + " \n " ;
95- snprintf (tmp, 15 , " %lu\n " , cfg->weatherUpdataInterval );
96- w_data += tmp;
97- snprintf (tmp, 15 , " %lu\n " , cfg->timeUpdataInterval );
98- w_data += tmp;
99- snprintf (tmp, 15 , " %u\n " , cfg->auto_get_location );
100- w_data += tmp;
94+ w_data = w_data + String (cfg->weatherUpdataInterval ) + " \n " ;
95+ w_data = w_data + String (cfg->timeUpdataInterval ) + " \n " ;
96+ w_data = w_data + String (cfg->auto_get_location ) + " \n " ;
10197 w_data = w_data + cfg->location_info .country + " \n " ;
10298 w_data = w_data + cfg->location_info .province + " \n " ;
10399 w_data = w_data + cfg->location_info .city + " \n " ;
@@ -110,7 +106,7 @@ static void read_config(WT_Config *cfg)
110106{
111107 // 如果有需要持久化配置文件 可以调用此函数将数据存在flash中
112108 // 配置文件名最好以APP名为开头 以".cfg"结尾,以免多个APP读取混乱
113- char info[128 ] = {0 };
109+ char info[512 ] = {0 };
114110 uint16_t size = g_flashCfg.readFile (WEATHER_CONFIG_PATH, (uint8_t *)info);
115111 info[size] = 0 ;
116112 if (size == 0 )
@@ -628,9 +624,6 @@ static int weather_exit_callback(void *param)
628624 }
629625
630626 // 释放运行数据
631- delete cfg_data;
632- delete run_data;
633- delete task_param_data;
634627 if (get_response != NULL )
635628 {
636629 free (get_response);
0 commit comments