1. 删除定时器无用信息

This commit is contained in:
coffee 2025-08-06 15:32:03 +08:00
parent cec303972c
commit 550f7b4aaa
2 changed files with 4 additions and 6 deletions

View File

@ -11,15 +11,12 @@
#include <stdint.h>
// 定时器最大数量
#ifndef HTIMER_MAX
#define HTIMER_MAX 10
#endif
// 定时器注册最大数量
#ifndef HTIMER_REGISTER_MAX
#define HTIMER_REGISTER_MAX (1)
#endif
// 无效值
#ifndef HTIMER_INVALID
#define HTIMER_INVALID -1
#endif
@ -38,6 +35,7 @@ typedef enum
typedef void (*HTimerCallType)();
///< 注册的定时器信息, 定义为数组, 数量由外部控制
typedef struct HTimerInfo {
uint32_t flags : 1; ///< 定时器标志, eTimerFlags
uint32_t enable : 1; ///< 定时器使能

View File

@ -175,7 +175,7 @@ void HTimerRemove(uint8_t id, int16_t index) {
return ;
}
if (index < 0 || index >= HTIMER_MAX) {
if (index < 0 || index >= sTimeRegisters[id].len) {
LogD("error index[%d]", index);
return ;
}