1. 补充发送信号读取PLC信号
2. 补充结束发送信号给PLC
| | |
| | | |
| | | void CAttributeVector::addAttribute(CAttribute* pAttribute, BOOL bReplace/* = FALSE*/) |
| | | { |
| | | if (!pAttribute) { |
| | | return; |
| | | } |
| | | |
| | | const std::string& name = pAttribute->getName(); |
| | | if (name.empty()) { |
| | | return; |
| | | } |
| | | |
| | | if (bReplace) { |
| | | for (auto it = m_attributes.begin(); it != m_attributes.end(); ) { |
| | | if ((*it)->getName().compare(pAttribute->getName()) == 0) { |
| | | if (name.compare((*it)->getName()) == 0) { |
| | | delete (*it); |
| | | it = m_attributes.erase(it); |
| | | } |
| | |
| | | |
| | | // robot cmd reply |
| | | CHECK_WRITE_STEP_SIGNAL(STEP_ID_ROBOT_CMD_REPLY, pszData, size); |
| | | |
| | | |
| | | // Indexer Operation Mode Change |
| | | CHECK_WRITE_STEP_SIGNAL(STEP_ID_IN_OP_CMD_REPLY, pszData, size); |
| | | } |
| | | |
| | | BOOL CEquipment::isBitOn(const char* pszData, size_t size, int index) |
| | |
| | | |
| | | unsigned short operationMode = (unsigned short)((unsigned short)mode + getIndexerOperationModeBaseValue()); |
| | | LOGI("<CEquipment-%s>准备设置indexerOperationMode<%d>", m_strName.c_str(), (int)mode); |
| | | pStep->writeShort(operationMode, [&, mode, onWritedRetBlock](int code) -> int { |
| | | pStep->writeShort(operationMode, [&, pStep, mode, onWritedRetBlock](int code) -> int { |
| | | int retCode = 0; |
| | | if (code == WOK) { |
| | | LOGI("<CEquipment-%s>设置indexerOperationMode成功.", m_strName.c_str()); |
| | | const char* pszRetData = nullptr; |
| | | pStep->getReturnData(pszRetData); |
| | | ASSERT(pszRetData); |
| | | retCode = (unsigned int)CToolUnits::toInt16(pszRetData); |
| | | retCode = (unsigned int)CToolUnits::toInt16(pszRetData); |
| | | LOGI("<CEquipment-%s>返回值: %d", m_strName.c_str(), retCode); |
| | | } |
| | | else { |
| | | LOGI("<CEquipment-%s>设置indexerOperationMode失败,code:%d", m_strName.c_str(), code); |
| | |
| | | int nRet; |
| | | CEquipment* pEq[6] = { pEFEM, pBonder1, pBonder2, pBakeCooling, |
| | | pVacuumBake, pMeasurement}; |
| | | BOOL bIomcOk[7] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE}; |
| | | BOOL bIomcOk[7] = {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE}; |
| | | std::vector<std::promise<void>> promises(6); |
| | | std::vector<std::future<void>> futures; |
| | | |
| | |
| | | goto WAIT; |
| | | } |
| | | futures.push_back(promises[0].get_future()); |
| | | |
| | | /* |
| | | nRet = pEq[1]->indexerOperationModeChange(IDNEXER_OPERATION_MODE::Start, |
| | | [&](int writeCode, int retCode) -> void { |
| | | bIomcOk[1] = retCode == (int)RET::OK; |
| | |
| | | goto WAIT; |
| | | } |
| | | futures.push_back(promises[5].get_future()); |
| | | */ |
| | | |
| | | WAIT: |
| | | for (auto& f : futures) { |
| | |
| | | // 处理完成当前事务后,切换到停止或就绪状态 |
| | | else if (m_state == MASTERSTATE::STOPPING) { |
| | | unlock(); |
| | | Sleep(1000); |
| | | LOGI("<Master>开始切换各设备到 Stop 模式..."); |
| | | |
| | | std::vector<std::promise<void>> promises(6); |
| | | std::vector<std::future<void>> futures; |
| | | BOOL bIomcOk[7] = { FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }; |
| | | |
| | | int nRet; |
| | | CEquipment* pEq[6] = { pEFEM, pBonder1, pBonder2, pBakeCooling, |
| | | pVacuumBake, pMeasurement }; |
| | | |
| | | for (int i = 0; i < 1; ++i) { |
| | | nRet = pEq[i]->indexerOperationModeChange(IDNEXER_OPERATION_MODE::Stop, |
| | | [i, &promises, &bIomcOk](int writeCode, int retCode) -> void { |
| | | bIomcOk[i] = retCode == (int)RET::OK; |
| | | promises[i].set_value(); |
| | | TRACE("s000%d: ret=%d\n", i + 1, retCode); |
| | | }); |
| | | if (nRet != 0) { |
| | | LOGI("<Master>%s切换Stop状态发送失败", pEq[i]->getName().c_str()); |
| | | m_strLastError = pEq[i]->getName() + "切换Stop状态发送失败."; |
| | | bIomcOk[i] = FALSE; |
| | | promises[i].set_value(); // 避免 wait 阻塞 |
| | | } |
| | | futures.push_back(promises[i].get_future()); |
| | | } |
| | | |
| | | for (auto& f : futures) { |
| | | f.wait(); // 等待所有完成 |
| | | } |
| | | |
| | | for (int i = 0; i < 6; ++i) { |
| | | if (!bIomcOk[i]) { |
| | | bIomcOk[6] = FALSE; |
| | | LOGI("<Master>%s切换Stop状态失败", pEq[i]->getName().c_str()); |
| | | } |
| | | } |
| | | |
| | | if (!bIomcOk[6]) { |
| | | setState(MASTERSTATE::MSERROR); |
| | | continue; |
| | | } |
| | | |
| | | LOGI("<Master>所有设备成功切换到 Stop 模式"); |
| | | setState(MASTERSTATE::READY); |
| | | continue; |
| | | } |
| | |
| | | <RemoteDebuggerCommand>\\DESKTOP-IODBVIQ\Servo\Debug\Servo.exe</RemoteDebuggerCommand> |
| | | <RemoteDebuggerWorkingDirectory>\\DESKTOP-IODBVIQ\Servo\Debug\</RemoteDebuggerWorkingDirectory> |
| | | <RemoteDebuggerServerName>DESKTOP-IODBVIQ</RemoteDebuggerServerName> |
| | | <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> |
| | | <DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor> |
| | | </PropertyGroup> |
| | | </Project> |