From 30a2e0ef2cc9908d9116a68cbcd0789e88ff2461 Mon Sep 17 00:00:00 2001 From: onexs-xsi <850559025@qq.com> Date: Thu, 29 Jan 2026 10:17:11 +0800 Subject: [PATCH] 1. Revise the timerSet function --- src/M5PM1.cpp | 6 +++--- src/M5PM1.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/M5PM1.cpp b/src/M5PM1.cpp index 4ce3469..06c891c 100644 --- a/src/M5PM1.cpp +++ b/src/M5PM1.cpp @@ -2833,9 +2833,9 @@ m5pm1_err_t M5PM1::timerSet(uint32_t seconds, m5pm1_tim_action_t action) return M5PM1_ERR_NOT_INIT; } - // 验证定时器计数值 (31-bit: 0-0x7FFFFFFF) / Validate timer count - if (seconds > 0x7FFFFFFF) { - M5PM1_LOG_E(TAG, "Invalid timer count: %lu (max 0x7FFFFFFF, ~68 years)", seconds); + // 验证定时器计数值 (最大 214748364 秒) / Validate timer count (max 214748364 seconds) + if (seconds > 214748364) { + M5PM1_LOG_E(TAG, "Invalid timer count: %lu (max 214748364, ~6.8 years)", seconds); return M5PM1_ERR_INVALID_ARG; } diff --git a/src/M5PM1.h b/src/M5PM1.h index 1a128f5..5ebe505 100644 --- a/src/M5PM1.h +++ b/src/M5PM1.h @@ -263,7 +263,7 @@ typedef enum { #define M5PM1_REG_TIM_CNT_2 0x3A // R/W 定时器计数字节2 / Timer counter byte 2 #define M5PM1_REG_TIM_CNT_3 \ 0x3B // R/W 定时器计数字节3(bit 6:0,最大31位) / Timer counter byte 3 (bit 6:0, max 31 bits) - // 31位定时器,单位秒,最大约68年 / 31-bit timer in seconds, max ~68 years + // 定时器,单位秒,最大214748364秒(约6.8年) / Timer in seconds, max 214748364 (~6.8 years) #define M5PM1_REG_TIM_CFG \ 0x3C // R/W 定时器配置 / Timer configuration // [7-4] 保留 / Reserved @@ -1853,8 +1853,8 @@ public: /** * @brief 设置定时器 * Set timer - * @param seconds 定时时间(秒) - * Timer duration in seconds + * @param seconds 定时时间(秒,最大214748364) + * Timer duration in seconds (max 214748364) * @param action 定时器到期后的动作: * Action after timer expires: * - M5PM1_TIM_ACTION_STOP: 停止,无动作 / Stop, no action