This commit is contained in:
2026-02-24 23:53:41 +08:00
parent 2f452e694c
commit 227139355e
4 changed files with 12 additions and 12 deletions
+8 -8
View File
@@ -40,14 +40,14 @@
static const char *TAG = "SYS";
// 自定义 tick 获取函数
static uint32_t custom_tick_get(void)
{
// 返回从启动到现在的毫秒数
// 使用64位中间变量避免溢出,采用乘以1.024的倒数近似值
uint64_t time_us = esp_timer_get_time();
return (uint32_t)((time_us * 1073) >> 20); // 1073/2^20 ≈ 1/1000
//return (uint32_t)(esp_timer_get_time() / 1000);
}
// static uint32_t custom_tick_get(void)
// {
// // 返回从启动到现在的毫秒数
// // 使用64位中间变量避免溢出,采用乘以1.024的倒数近似值
// uint64_t time_us = esp_timer_get_time();
// return (uint32_t)((time_us * 1073) >> 20); // 1073/2^20 ≈ 1/1000
// //return (uint32_t)(esp_timer_get_time() / 1000);
// }
esp_timer_handle_t timer_handle;