From d011c14baf6b69d9f15b4f1d42d3e00156706f81 Mon Sep 17 00:00:00 2001 From: zogodo <742782908@qq.com> Date: Thu, 10 Oct 2019 16:48:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TC1/http_server/index.html | 2 +- TC1/user_power.c | 6 +----- TC1/user_power.h | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/TC1/http_server/index.html b/TC1/http_server/index.html index 045ec4e..2caa689 100644 --- a/TC1/http_server/index.html +++ b/TC1/http_server/index.html @@ -256,7 +256,7 @@ function GetPowerRecord() { var power = JSON.parse(re); var html = ""; for (var i = 0; i < power.powers.length; i++) { - html += "
"; + html += "
"; power_line.innerHTML = html; //滑动到最后 } diff --git a/TC1/user_power.c b/TC1/user_power.c index fa23689..3456c64 100644 --- a/TC1/user_power.c +++ b/TC1/user_power.c @@ -10,7 +10,7 @@ mico_timer_t power_timer; -PowerRecord power_record = { 0, NULL }; +PowerRecord power_record = { 0, { 50,55,60,65,70,75,80,85,90,95,90,85,80,75,70,65,60,65,70,75,80,85,90,95,90,85,80,75,70,65,60,65,70,75,80,85,90,95,90,85,80,75,70,65,60 } }; static uint32_t clock_count_last = 0; static uint32_t clock_count = 0; @@ -21,10 +21,6 @@ char power_record_str[1101] = { 0 }; void SetPowerRecord(PowerRecord* pr, uint32_t pw) { - if (pr->powers == NULL) - { - pr->powers = malloc(sizeof(uint32_t)*PW_NUM); - } if (pr->idx >= PW_NUM) { pr->idx = 0; diff --git a/TC1/user_power.h b/TC1/user_power.h index 52630c7..6be3209 100644 --- a/TC1/user_power.h +++ b/TC1/user_power.h @@ -5,7 +5,7 @@ typedef struct { int idx; - uint32_t* powers; + uint32_t powers[PW_NUM]; } PowerRecord; extern PowerRecord power_record;