fix: report_counter 清零导致车间距/通过时间下溢 (0xFFFFFFxx)
根因: report_counter 清零后 last_exit_tick/passtime_start 存旧值,
再次进场时差值下溢 uint32_t → 0xFFFFFFF7
修复:
- Loop154_States 新增 last_report_tick, report_counter 自由运行不复位
- report_misc: 增量判断 (report_counter - last_report_tick) >= _interval
- TMR6 ISR: 用 last_report_tick 实现 UART 期间推迟上报, 不再清零
- 删掉所有 g_loop_states.report_counter = 0
This commit is contained in:
@@ -429,7 +429,7 @@ void uart_report_packet_loop_acs(uint8_t flag)
|
||||
} else {
|
||||
_interval = REPORT_IDLE_TICKS; // 12×50ms = 600ms
|
||||
}
|
||||
if (g_loop_states.report_counter < _interval) return;
|
||||
if ((g_loop_states.report_counter - g_loop_states.last_report_tick) < _interval) return;
|
||||
|
||||
/*--- 3. 确定本轮杂项类型 ---*/
|
||||
if (_flag_event) {
|
||||
@@ -526,7 +526,7 @@ void uart_report_packet_loop_acs(uint8_t flag)
|
||||
g_pkg_uart_report.pkg[i++] = _sum & 0xFF;
|
||||
|
||||
usart1_sendstring(g_pkg_uart_report.pkg, i);
|
||||
g_loop_states.report_counter = 0;
|
||||
g_loop_states.last_report_tick = g_loop_states.report_counter;
|
||||
}
|
||||
|
||||
|
||||
@@ -1062,7 +1062,7 @@ void TMR6_GLOBAL_IRQHandler(void)
|
||||
}
|
||||
}
|
||||
|
||||
g_loop_states.report_counter = 0;
|
||||
g_loop_states.last_report_tick = g_loop_states.report_counter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user