feat(vd960Loop): 0xC0 主动上报 — 4种杂项类型轮转 + 事件优先级
杂项类型轮转:
- 0b00 时间量: 进场=车间距, 离开=通过时间, 空闲=0
- 0b01 线圈断开次数
- 0b10 车流量累计
- 0b11 继电器动作次数
上报间隔:
- 空闲稳定: 600ms, 轮流上报 0→1→2→3
- 进场/离开事件: 150ms, 强制时间量, 最高优先级
TaskLoop.h: 新增 MISC_TYPE_* / REPORT_*_TICKS 宏
Loop154_Unit 新增 flow_count/relay_count/passtime_start/misc_value
Loop154_States 新增 report_misc_round
TaskLoop.c: 进场时记录时间戳+累计; 离开时计算通过时间
main.c: 重写 uart_report_packet_loop_acs
This commit is contained in:
@@ -518,6 +518,12 @@ void vd1_task_per_channel(Loop154_Unit *unit)
|
||||
unit->loop_entry_cnt = 0;
|
||||
unit->loop_freeze_cnt = 0;
|
||||
unit->loop_freeze_ref = 0;
|
||||
|
||||
/* 主动上报: 车流量+1, 继电器+1, 记录进场时间戳 */
|
||||
unit->flow_count++;
|
||||
unit->relay_count++;
|
||||
unit->passtime_start = g_loop_states.report_counter; // 5ms tick
|
||||
unit->misc_value = 0; // 车间距将在离开时计算
|
||||
if (unit->hold_time > 0) {
|
||||
unit->loop_VD_HOLD = 1;
|
||||
}
|
||||
@@ -597,6 +603,10 @@ void vd1_task_per_channel(Loop154_Unit *unit)
|
||||
unit->Hold_CNT = 0;
|
||||
unit->flat_ok_cnt = 0;
|
||||
unit->exit_state = 0;
|
||||
|
||||
/* 主动上报: 计算通过时间 = 当前-进场时间戳 (5ms单位) */
|
||||
unit->misc_value = g_loop_states.report_counter - unit->passtime_start;
|
||||
unit->relay_count++; // 离开时继电器翻转
|
||||
}
|
||||
} else {
|
||||
unit->flat_ok_cnt = 0;
|
||||
@@ -624,6 +634,10 @@ void vd1_task_per_channel(Loop154_Unit *unit)
|
||||
unit->loop_ORG_SUM = 0;
|
||||
unit->Hold_CNT = 0;
|
||||
unit->loop_cnt_release = 0;
|
||||
|
||||
/* 主动上报: 通过时间 + 继电器 */
|
||||
unit->misc_value = g_loop_states.report_counter - unit->passtime_start;
|
||||
unit->relay_count++;
|
||||
}
|
||||
} else {
|
||||
if (unit->loop_cnt_release > 0) unit->loop_cnt_release = 0;
|
||||
|
||||
Reference in New Issue
Block a user