Skip to content

Commit 8e6da0e

Browse files
committed
Refine code
1. Change the time unit to minutes. 2. Web Setting display tips. 3. Determine whether the setting numbers are compliant. 4. Fix possible memory leak. 5. Change config file name. 6. Fix the end of snprintf string may not be '\0'.
1 parent e66ddc4 commit 8e6da0e

File tree

2 files changed

+131
-92
lines changed

2 files changed

+131
-92
lines changed

AIO_Firmware_PIO/src/app/server/web_setting.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,18 @@ String file_size(int bytes)
7171

7272
#define WEATHER_SETTING "<form method=\"GET\" action=\"saveWeatherConf\">" \
7373
"<label class=\"input\"><span>和风天气KEY</span><input type=\"text\"name=\"key\"value=\"%s\"></label>" \
74-
"<label class=\"input\"><span>天气更新周期(毫秒)</span><input type=\"text\"name=\"weatherUpdataInterval\"value=\"%s\"></label>" \
75-
"<label class=\"input\"><span>日期更新周期(毫秒)</span><input type=\"text\"name=\"timeUpdataInterval\"value=\"%s\"></label>" \
74+
"<label class=\"input\"><span>天气更新周期(分钟)</span><input type=\"text\"name=\"weatherUpdataInterval\"value=\"%s\"></label>" \
75+
"<label class=\"input\"><span>日期更新周期(分钟)</span><input type=\"text\"name=\"timeUpdataInterval\"value=\"%s\"></label>" \
7676
"<label class=\"input\"><span>自动获取位置信息</span><input class=\"radio\" type=\"radio\" value=\"1\" name=\"auto_get_location\" %s>开启(以下设置无效)<input class=\"radio\" type=\"radio\" value=\"0\" name=\"auto_get_location\" %s>关闭</label>" \
7777
"<label class=\"input\"><span>国家(缩写)</span><input type=\"text\"name=\"country\"value=\"%s\"></label>" \
7878
"<label class=\"input\"><span>省、直辖市</span><input type=\"text\"name=\"province\"value=\"%s\"></label>" \
7979
"<label class=\"input\"><span>地级市</span><input type=\"text\"name=\"city\"value=\"%s\"></label>" \
8080
"<label class=\"input\"><span>区、县、县级市</span><input type=\"text\"name=\"area\"value=\"%s\"></label>" \
81+
"<br>" \
82+
"<h3>和风天气免费订阅的KEY每日最多可请求1000次,而程序每次更新天气时需要请求5次</h3>" \
83+
"<h3>请在设置更新周期前提前计算理论的每日最少请数,否则当请求超过1000次后将会请求失败</h3>" \
84+
"<h3>以默认每10分钟更新一次为例,每日最少请求数=24×60÷10×5=720次</h3>" \
85+
"<br>" \
8186
"</label><input class=\"btn\" type=\"submit\" name=\"submit\" value=\"保存\"></form>"
8287

8388
#define WEATHER_OLD_SETTING "<form method=\"GET\" action=\"saveWeatherOldConf\">" \
@@ -310,7 +315,7 @@ void rgb_setting()
310315

311316
void weather_setting()
312317
{
313-
char buf[2048];
318+
char buf[4096];
314319
char key[64];
315320
char timeUpdataInterval[32];
316321
char weatherUpdataInterval[32];

0 commit comments

Comments
 (0)