fix(opt): 修正光耦 500ms 阈值 — mstick() 单位是 5ms/tick
mstick() = TimingDelayInc (TMR1 ISR 每 5ms++) 500 → 2.5s, 应为 100 → 500ms
This commit is contained in:
@@ -868,7 +868,7 @@ static void opt_input_poll(void)
|
|||||||
if (OPT_IN1 == 0) { // 干接点接通 → 低电平
|
if (OPT_IN1 == 0) { // 干接点接通 → 低电平
|
||||||
if (_opt_low_since == 0) {
|
if (_opt_low_since == 0) {
|
||||||
_opt_low_since = mstick();
|
_opt_low_since = mstick();
|
||||||
} else if (!_opt_armed && (mstick() - _opt_low_since >= 500)) {
|
} else if (!_opt_armed && (mstick() - _opt_low_since >= 100)) { // 100 tick × 5ms = 500ms
|
||||||
_opt_armed = 1; // 满足 500ms, 等待上升沿
|
_opt_armed = 1; // 满足 500ms, 等待上升沿
|
||||||
}
|
}
|
||||||
} else { // 干接点断开 → 高电平
|
} else { // 干接点断开 → 高电平
|
||||||
|
|||||||
Reference in New Issue
Block a user