40 lines
957 B
C++
40 lines
957 B
C++
|
|
||
|
#include "common.hpp"
|
||
|
#include "HC-12.hpp"
|
||
|
#include "boot_time.hpp"
|
||
|
|
||
|
|
||
|
void BOOT_TIME(void *pvParameters)
|
||
|
{
|
||
|
(void)pvParameters;
|
||
|
|
||
|
_printTaskStackHighWaterMark("BOOT_TIME");
|
||
|
|
||
|
int _HC_12_SEND_NUM = 0;
|
||
|
char BOOT_TIME_TEMP[BUFER] = { 0 };
|
||
|
|
||
|
|
||
|
while (1) {
|
||
|
// 获取自开机以来的微秒数
|
||
|
uint64_t uptime_us = time_us_64();
|
||
|
uint64_t total_uptime_sec = uptime_us / 1000000;
|
||
|
|
||
|
// 打印开机秒数
|
||
|
printf("Boot Time: %llu seconds\n", total_uptime_sec);
|
||
|
|
||
|
{
|
||
|
_HC_12_SEND_NUM++;
|
||
|
if (_HC_12_SEND_NUM > 5) {
|
||
|
sprintf(BOOT_TIME_TEMP, "Boot Time: %llu seconds\n", total_uptime_sec);
|
||
|
_HC_12(BOOT_TIME_TEMP);
|
||
|
memset(BOOT_TIME_TEMP, 0, BUFER);
|
||
|
_HC_12_SEND_NUM = 0;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
_printTaskStackHighWaterMark("BOOT_TIME");
|
||
|
vTaskDelay(pdMS_TO_TICKS(1000)); // 每秒延迟
|
||
|
}
|
||
|
}
|