From e1b7cbac477c8ea8400147fb45bc6b77e20f464a Mon Sep 17 00:00:00 2001 From: zogodo <742782908@qq.com> Date: Wed, 22 Apr 2020 10:21:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99=E6=97=A5?= =?UTF-8?q?=E5=BF=97,=20=E5=9B=BE=E8=A1=A8=E6=9C=80=E5=A4=A7=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=87=8F,=20=E6=97=A5=E5=BF=97=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TC1/http_server/app_httpd.c | 2 +- TC1/http_server/web/index.html | 11 +++++++---- TC1/main.c | 2 +- TC1/main.h | 2 +- TC1/user_wifi.c | 12 ++++++------ TODO.txt | 4 +--- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/TC1/http_server/app_httpd.c b/TC1/http_server/app_httpd.c index 684e453..e423e31 100644 --- a/TC1/http_server/app_httpd.c +++ b/TC1/http_server/app_httpd.c @@ -125,7 +125,7 @@ static int HttpGetAssets(httpd_request_t *req) http_log("HttpGetAssets url[%s] err", req->filename); return err; } - http_log("HttpGetAssets url[%s] file_name[%s]", req->filename, file_name); + //http_log("HttpGetAssets url[%s] file_name[%s]", req->filename, file_name); int total_sz = 0; const unsigned char* file_data = NULL; diff --git a/TC1/http_server/web/index.html b/TC1/http_server/web/index.html index 1fc2620..b95b069 100644 --- a/TC1/http_server/web/index.html +++ b/TC1/http_server/web/index.html @@ -741,8 +741,8 @@ $("#wifi_submit").on("click", function() { //Config-end //图表-start -var data = { series: [ [] ] }; -var t = new Chartist.Line('.ct-chart', data, {showArea: true, axisY: {position: 'end'}}); +var ct_data = { series: [ [] ] }; +var ct_chart = new Chartist.Line('.ct-chart', ct_data, {showArea: true, axisY: {position: 'end'}}); var power_idx = 0; var chart_wth = 0; function GetPowerRecord() { @@ -754,11 +754,14 @@ function GetPowerRecord() { var x = chart_par.scrollWidth - chart_par.offsetWidth - chart_par.scrollLeft; power.powers.forEach(element => { - data.series[0].push(element/10); + var len = ct_data.series[0].push(element/10); + if (len > 1000) { //最多1000条数据 + ct_data.series[0].shift(); + } }); chart_wth += power.powers.length; $("#ct-chart").width(chart_wth * 10); - t.update(data); + ct_chart.update(ct_data); if (power.powers.length != 0 && x < 100) { chart_par.scrollTo(chart_par.scrollWidth, 0); } diff --git a/TC1/main.c b/TC1/main.c index e8f6931..e534d01 100644 --- a/TC1/main.c +++ b/TC1/main.c @@ -97,7 +97,7 @@ int application_start(void) tc1_log("mqtt_ip:%s",user_config->mqtt_ip); tc1_log("mqtt_port:%d",user_config->mqtt_port); tc1_log("mqtt_user:%s",user_config->mqtt_user); - tc1_log("mqtt_password:%s",user_config->mqtt_password); + //tc1_log("mqtt_password:%s",user_config->mqtt_password); tc1_log("version:%d",user_config->version); WifiInit(); diff --git a/TC1/main.h b/TC1/main.h index 793cd78..1495269 100644 --- a/TC1/main.h +++ b/TC1/main.h @@ -15,7 +15,7 @@ #define wifi_log(M, ...) do { custom_log("WIFI", M, ##__VA_ARGS__); web_log("WIFI", M, ##__VA_ARGS__) } while(0) #define power_log(M, ...) do { custom_log("POWER", M, ##__VA_ARGS__); web_log("POWER", M, ##__VA_ARGS__) } while(0) -#define VERSION "v2.0.2" +#define VERSION "v2.0.3" #define TYPE 1 #define TYPE_NAME "zTC1" diff --git a/TC1/user_wifi.c b/TC1/user_wifi.c index 7fbb57f..490f7fe 100644 --- a/TC1/user_wifi.c +++ b/TC1/user_wifi.c @@ -78,8 +78,8 @@ void WifiScanCallback(ScanResult_adv* scan_ret, void* arg) { ApInfo* ap = (ApInfo*)&scan_ret->ApList[i]; uint8_t* mac = (uint8_t*)ap->bssid; - wifi_log("wifi_scan_callback ssid[%16s] bssid[%02X-%02X-%02X-%02X-%02X-%02X] security[%d]", - ap->ssid, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], ap->security); + //wifi_log("wifi_scan_callback ssid[%16s] bssid[%02X-%02X-%02X-%02X-%02X-%02X] security[%d]", + // ap->ssid, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], ap->security); char* ssid = scan_ret->ApList[i].ssid; //排除隐藏的wifi和SSID带'或"的我wifi if (ssid[0] == 0 || strstr(ssid, "'") || strstr(ssid, "\"")) continue; @@ -132,7 +132,7 @@ static void WifiLedTimerCallback(void* arg) void WifiConnect(char* wifi_ssid, char* wifi_key) { - wifi_log("WifiConnect wifi_ssid[%s] wifi_key[%s]", wifi_ssid, wifi_key); + wifi_log("WifiConnect wifi_ssid[%s] wifi_key[******]", wifi_ssid); //wifi配置初始化 network_InitTypeDef_st wNetConfig; @@ -172,7 +172,7 @@ void ApConfig(char* name, char* key) { strncpy(user_config->ap_name, name, 32); strncpy(user_config->ap_key, key, 32); - wifi_log("ApConfig ap_name[%s] ap_key[%s]", user_config->ap_name, user_config->ap_key); + wifi_log("ApConfig ap_name[%s] ap_key[******]", user_config->ap_name); micoWlanSuspendStation(); ApInit(false); mico_system_context_update(sys_config); @@ -184,7 +184,7 @@ void ApInit(bool use_defaul) { sprintf(user_config->ap_name, ZZ_AP_NAME, str_mac + 6); sprintf(user_config->ap_key, "%s", ZZ_AP_KEY); - wifi_log("ApInit ap_name[%s] ap_ke[%s]", user_config->ap_name, user_config->ap_key); + wifi_log("ApInit use_defaul[true] key[12345678]"); } network_InitTypeDef_st wNetConfig; @@ -199,6 +199,6 @@ void ApInit(bool use_defaul) strcpy((char *)wNetConfig.dnsServer_ip_addr, ZZ_AP_DNS_SERVER); micoWlanStart(&wNetConfig); - wifi_log("ApInit ssid[%s] key[%s]", wNetConfig.wifi_ssid, wNetConfig.wifi_key); + wifi_log("ApInit ssid[%s] key[******]", wNetConfig.wifi_ssid); } diff --git a/TODO.txt b/TODO.txt index d9dcaef..a906e73 100644 --- a/TODO.txt +++ b/TODO.txt @@ -6,9 +6,7 @@ 1. 功率显示 2. 每天定时任务 +3. 定时任务默认当前时间 3. 定时任务插座不对? -4. 图表最大数据量 5. 最近一个月每天功耗 6. 最近一周每小时功率 -7. 去除多余日志 -8. 日志隐藏密码