feat: 更新红外传感器逻辑,优化状态判断及初始化

This commit is contained in:
2026-04-14 19:46:16 +08:00
parent a2328edbd7
commit 91151c250a
3 changed files with 22 additions and 15 deletions

View File

@@ -13,8 +13,9 @@
#define TRACK_IR_H4_BIT (1U << 3)
/*
* 红外模块有效电平:常见 TCRT5000 模块为低电平有效。
* 若你的模块是高电平有效,可在编译选项或此处改为 GPIO_PIN_SET。
* 红外模块有效电平:
* 根据用户描述:探测黑线输出低电平(GPIO_PIN_RESET),白线输出高电平
* 超出范围(丢线/悬空)也输出低电平。
*/
#ifndef TRACK_IR_ACTIVE_LEVEL
#define TRACK_IR_ACTIVE_LEVEL GPIO_PIN_RESET