| | |
| | | #include "pch.h" |
| | | #include "pch.h" |
| | | #include "PLCSignalListener.h" |
| | | |
| | | // === 日志打印类型 === |
| | |
| | | // 上升沿触发 |
| | | switch (i) { |
| | | case 0: |
| | | // Start 命令 |
| | | if (m_cbStart) { |
| | | m_cbStart(); |
| | | WriteOutValues(OutValuesArray{ 0.0, 0.0, 0.0, 0.0 }); |
| | | if (m_pPlc->SetBitDeviceEx(m_station, PLC_BIT_DEVICE_TYPE, PLC_ACK_BASE_BIT + i) == 0) { |
| | | m_vecAckSent[i] = true; |
| | | m_vecAckCounter[i] = 0; |
| | | } |
| | | |
| | | std::string strProductID; |
| | | if (ReadProductID(strProductID)) { |
| | |
| | | LOG_MSG(msg, LOG_TYPE_SUCCESS); |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case 1: |
| | | if (m_cbStop) { |
| | | m_cbStop(); |
| | | // 发送应答信号 |
| | | if (m_pPlc->SetBitDeviceEx(m_station, PLC_BIT_DEVICE_TYPE, PLC_ACK_BASE_BIT + i) == 0) { |
| | | m_vecAckSent[i] = true; |
| | | m_vecAckCounter[i] = 0; |
| | | } |
| | | break; |
| | | |
| | | case 1: |
| | | // Stop 命令 |
| | | if (m_cbStop) { |
| | | m_cbStop(); |
| | | } |
| | | |
| | | // Analyze 命令 |
| | | if (m_cbAnalyze) { |
| | | auto results = m_cbAnalyze(); |
| | | WriteOutValues(results); |
| | | } |
| | | |
| | | // 发送应答信号 |
| | | if (m_pPlc->SetBitDeviceEx(m_station, PLC_BIT_DEVICE_TYPE, PLC_ACK_BASE_BIT + i) == 0) { |
| | | m_vecAckSent[i] = true; |
| | | m_vecAckCounter[i] = 0; |
| | | } |
| | | break; |
| | | } |
| | | } |