From 417d3825013cd1b9e8a8dafa72f51c755ee5d897 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期一, 23 六月 2025 15:20:32 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/CEFEM.cpp | 124 ++++++++++++++++++++++-------------------
1 files changed, 67 insertions(+), 57 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEFEM.cpp b/SourceCode/Bond/Servo/CEFEM.cpp
index 8b5ec2a..8a0e9cc 100644
--- a/SourceCode/Bond/Servo/CEFEM.cpp
+++ b/SourceCode/Bond/Servo/CEFEM.cpp
@@ -26,17 +26,30 @@
m_robotData.position = ROBOT_POSITION::Port1;
m_robotData.armState[0] = FALSE;
m_robotData.armState[1] = FALSE;
+ m_pActiveContext = nullptr;
}
CEFEM::~CEFEM()
{
-
+ if (m_pActiveContext != nullptr) {
+ m_pActiveContext->release();
+ m_pActiveContext = nullptr;
+ }
}
const char* CEFEM::getClassName()
{
static char* pszName = "CEFEM";
return pszName;
+ }
+
+ void CEFEM::setContext(CContext* pContext)
+ {
+ if (m_pActiveContext != nullptr) {
+ m_pActiveContext->release();
+ }
+ m_pActiveContext = pContext;
+ m_pActiveContext->addRef();
}
void CEFEM::setPort(unsigned int index, CLoadPort* pPort)
@@ -684,7 +697,7 @@
CEqReadStep* pStep = new CEqReadStep(0x6301, 108 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
- decodePanelDataRequest((CStep*)pFrom, pszData, size);
+ decodeFacDataReport((CStep*)pFrom, pszData, size);
}
return -1;
});
@@ -697,19 +710,37 @@
}
{
- // Panel Data Request
- CEqReadStep* pStep = new CEqReadStep(0x617d, 2 * 2,
+ // JOB Data Request
+ CEqReadStep* pStep = new CEqReadStep(0x0, 0,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
- if (code == ROK && pszData != nullptr && size > 0) {
- decodePanelDataRequest((CStep*)pFrom, pszData, size);
+ if (code == ROK /* && pszData != nullptr && size > 0*/) {
+ // 由于EFEM没有发送参数到master, 我们只需要返回数据
+ // Cassette Sequence No和Job Sequence No根据上一次调试缓存而来
+ // decodeJobDataRequest((CStep*)pFrom, pszData, size);
+
+ // 获取数据后返回给EFEM
+ // Job DataS 320W
+ // ACK 1W
+ // Reserved 15W
+ short ack = (short)JobDataRequestAck::NG; // 不存在jobData
+ char szBuffer[1024] = { 0 };
+ if (m_pActiveContext != nullptr) {
+ CJobDataS* pJobDataS = ((CGlass*)m_pActiveContext)->getJobDataS();
+ if (pJobDataS != nullptr) {
+ pJobDataS->serialize(szBuffer, 1024);
+ ack = (short)JobDataRequestAck::OK;
+ }
+ }
+ memcpy(&szBuffer[320 * 2], &ack, sizeof(short));
+ ((CEqReadStep*)pFrom)->setReturnData(szBuffer, 336 * 2);
}
return -1;
});
pStep->setName(STEP_EFEM_PANEL_DATA_REQUEST);
pStep->setProp("Port", (void*)1);
- pStep->setWriteSignalDev(0x15d);
- pStep->setReturnDev(0x73a);
- if (addStep(STEP_ID_PANEL_DATA_REQUEST, pStep) != 0) {
+ pStep->setWriteSignalDev(0x35);
+ pStep->setReturnDev(0x5EA);
+ if (addStep(STEP_ID_JOB_DATA_REQUEST, pStep) != 0) {
delete pStep;
}
}
@@ -812,66 +843,45 @@
int CEFEM::onFetchedOutJob(int port, CJobDataB* pJobDataB)
{
- if (port == 1) {
- return m_pPort[0]->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 2) {
- return m_pPort[1]->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 3) {
- return m_pPort[2]->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 4) {
- return m_pPort[3]->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 5) {
- return m_pArmTray[0]->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 6) {
- return m_pArmTray[1]->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 7) {
- return m_pAligner->onFetchedOutJob(port, pJobDataB);
- }
- if (port == 8) {
- return m_pFliper->onFetchedOutJob(port, pJobDataB);
+ // 转发到子单元设备
+ CEquipment* pEqs[] = { m_pPort[0], m_pPort[1], m_pPort[2], m_pPort[3], m_pArmTray[0], m_pArmTray[1],
+ m_pAligner, m_pFliper };
+ if (1 <= port && port <= 8) {
+ pEqs[port - 1]->onFetchedOutJob(port, pJobDataB);
}
- return -1;
+
+ return 0;
}
int CEFEM::onStoredJob(int port, CJobDataB* pJobDataB)
{
- if (port == 1) {
- return m_pPort[0]->onStoredJob(port, pJobDataB);
- }
- if (port == 2) {
- return m_pPort[1]->onStoredJob(port, pJobDataB);
- }
- if (port == 3) {
- return m_pPort[2]->onStoredJob(port, pJobDataB);
- }
- if (port == 4) {
- return m_pPort[3]->onStoredJob(port, pJobDataB);
- }
- if (port == 5) {
- return m_pArmTray[0]->onStoredJob(port, pJobDataB);
- }
- if (port == 6) {
- return m_pArmTray[1]->onStoredJob(port, pJobDataB);
- }
- if (port == 7) {
- return m_pAligner->onStoredJob(port, pJobDataB);
- }
- if (port == 8) {
- return m_pFliper->onStoredJob(port, pJobDataB);
+ // 转发到子单元设备
+ CEquipment* pEqs[] = { m_pPort[0], m_pPort[1], m_pPort[2], m_pPort[3], m_pArmTray[0], m_pArmTray[1],
+ m_pAligner, m_pFliper };
+ if (1 <= port && port <= 8) {
+ pEqs[port - 1]->onStoredJob(port, pJobDataB);
}
- return -1;
+
+ return 0;
}
int CEFEM::getIndexerOperationModeBaseValue()
{
return 10000;
}
+
+ void CEFEM::printDebugString001()
+ {
+ for (int i = 0; i < 8; i++) {
+ LOGI("<CEquipment-%s>%d, Signal:%s, %s, %s, %s",
+ m_strName.c_str(), i,
+ m_bLinkSignal[i][SIGNAL_UPSTREAM_INLINE] ? "ON" : "OFF",
+ m_bLinkSignal[i][SIGNAL_UPSTREAM_TROUBLE] ? "ON" : "OFF",
+ m_bLinkSignal[i][SIGNAL_INTERLOCK] ? "ON" : "OFF",
+ m_bLinkSignal[i][SIGNAL_SEND_ABLE] ? "ON" : "OFF"
+ );
+ }
+ }
}
--
Gitblit v1.9.3