Skip to content

Commit 30a2e0e

Browse files
committed
1. Revise the timerSet function
1 parent 3d94e60 commit 30a2e0e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/M5PM1.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,9 +2833,9 @@ m5pm1_err_t M5PM1::timerSet(uint32_t seconds, m5pm1_tim_action_t action)
28332833
return M5PM1_ERR_NOT_INIT;
28342834
}
28352835

2836-
// 验证定时器计数值 (31-bit: 0-0x7FFFFFFF) / Validate timer count
2837-
if (seconds > 0x7FFFFFFF) {
2838-
M5PM1_LOG_E(TAG, "Invalid timer count: %lu (max 0x7FFFFFFF, ~68 years)", seconds);
2836+
// 验证定时器计数值 (最大 214748364 秒) / Validate timer count (max 214748364 seconds)
2837+
if (seconds > 214748364) {
2838+
M5PM1_LOG_E(TAG, "Invalid timer count: %lu (max 214748364, ~6.8 years)", seconds);
28392839
return M5PM1_ERR_INVALID_ARG;
28402840
}
28412841

src/M5PM1.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ typedef enum {
263263
#define M5PM1_REG_TIM_CNT_2 0x3A // R/W 定时器计数字节2 / Timer counter byte 2
264264
#define M5PM1_REG_TIM_CNT_3 \
265265
0x3B // R/W 定时器计数字节3(bit 6:0,最大31位) / Timer counter byte 3 (bit 6:0, max 31 bits)
266-
// 31位定时器,单位秒,最大约68年 / 31-bit timer in seconds, max ~68 years
266+
// 定时器,单位秒,最大214748364秒(约6.8年) / Timer in seconds, max 214748364 (~6.8 years)
267267
#define M5PM1_REG_TIM_CFG \
268268
0x3C // R/W 定时器配置 / Timer configuration
269269
// [7-4] 保留 / Reserved
@@ -1853,8 +1853,8 @@ class M5PM1 {
18531853
/**
18541854
* @brief 设置定时器
18551855
* Set timer
1856-
* @param seconds 定时时间(秒)
1857-
* Timer duration in seconds
1856+
* @param seconds 定时时间(秒,最大214748364
1857+
* Timer duration in seconds (max 214748364)
18581858
* @param action 定时器到期后的动作:
18591859
* Action after timer expires:
18601860
* - M5PM1_TIM_ACTION_STOP: 停止,无动作 / Stop, no action

0 commit comments

Comments
 (0)