mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 13:38:14 +08:00
Update main.c
尝试修复,日电量统计定时器不准确的问题
This commit is contained in:
@@ -64,7 +64,7 @@ void recordDailyPcount(){
|
||||
}
|
||||
|
||||
void schedule_p_count_task(mico_thread_arg_t arg){
|
||||
mico_rtos_thread_sleep(20);
|
||||
mico_thread_msleep(20000);
|
||||
tc1_log("WARNGIN: p_count timer thread created!");
|
||||
while (1) {
|
||||
// 获取当前时间
|
||||
@@ -87,14 +87,14 @@ void schedule_p_count_task(mico_thread_arg_t arg){
|
||||
if (seconds_until_next_run > 0) {
|
||||
// 休眠直到目标时间
|
||||
tc1_log("record p_count after %f seconds", seconds_until_next_run);
|
||||
mico_rtos_thread_sleep(seconds_until_next_run);
|
||||
mico_thread_msleep(seconds_until_next_run * 1000);
|
||||
}else{
|
||||
mico_rtos_thread_sleep(1);
|
||||
mico_thread_msleep(1000);
|
||||
continue;
|
||||
}
|
||||
// 执行任务
|
||||
recordDailyPcount();
|
||||
mico_rtos_thread_sleep(1);
|
||||
mico_thread_msleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user