mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 05:28:14 +08:00
总功耗
This commit is contained in:
@@ -118,8 +118,6 @@ static int HttpGetPowerInfo(httpd_request_t *req)
|
|||||||
sprintf(up_time, "%d:%02d:%02d", h, m, s);
|
sprintf(up_time, "%d:%02d:%02d", h, m, s);
|
||||||
|
|
||||||
char* powers = GetPowerRecord(idx);
|
char* powers = GetPowerRecord(idx);
|
||||||
static int p_count = 0;
|
|
||||||
p_count += 1;
|
|
||||||
sprintf(power_info_json, POWER_INFO_JSON, power_record.idx, PW_NUM, p_count, powers, up_time);
|
sprintf(power_info_json, POWER_INFO_JSON, power_record.idx, PW_NUM, p_count, powers, up_time);
|
||||||
send_http(power_info_json, strlen(power_info_json), exit, &err);
|
send_http(power_info_json, strlen(power_info_json), exit, &err);
|
||||||
exit:
|
exit:
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
'start_time':%ld\
|
'start_time':%ld\
|
||||||
}"
|
}"
|
||||||
|
|
||||||
#define POWER_INFO_JSON "{'idx':%d,'len':%d,'p_count':%d,'powers':[%s],'up_time':'%s'}"
|
#define POWER_INFO_JSON "{'idx':%d,'len':%d,'p_count':%ld,'powers':[%s],'up_time':'%s'}"
|
||||||
|
|
||||||
int AppHttpdStart(void);
|
int AppHttpdStart(void);
|
||||||
int AppHttpdStop();
|
int AppHttpdStop();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ static uint32_t clock_count_last = 0;
|
|||||||
static uint32_t clock_count = 0;
|
static uint32_t clock_count = 0;
|
||||||
static uint32_t timer_count = 0;
|
static uint32_t timer_count = 0;
|
||||||
static uint32_t timer_irq_count = 0;
|
static uint32_t timer_irq_count = 0;
|
||||||
|
uint32_t p_count = 0;
|
||||||
|
|
||||||
char power_record_str[1101] = { 0 };
|
char power_record_str[1101] = { 0 };
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ static void PowerIrqHandler(void* arg)
|
|||||||
clock_count = mico_nanosecond_clock_value();
|
clock_count = mico_nanosecond_clock_value();
|
||||||
if (timer_irq_count == 0) clock_count_last = clock_count;
|
if (timer_irq_count == 0) clock_count_last = clock_count;
|
||||||
timer_irq_count++;
|
timer_irq_count++;
|
||||||
|
p_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerInit(void)
|
void PowerInit(void)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ typedef struct
|
|||||||
} PowerRecord;
|
} PowerRecord;
|
||||||
|
|
||||||
extern PowerRecord power_record;
|
extern PowerRecord power_record;
|
||||||
|
extern uint32_t p_count;
|
||||||
|
|
||||||
char* GetPowerRecord(int idx);
|
char* GetPowerRecord(int idx);
|
||||||
void PowerInit(void);
|
void PowerInit(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user