From 0ec075ed33382a0fd69b680c42ab6ed537b1eca7 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 19 五月 2025 15:18:30 +0800
Subject: [PATCH] 1.实现RobotCmd的下发,待测;
---
SourceCode/Bond/Servo/CPageGraph2.cpp | 29 +++++++++
SourceCode/Bond/Servo/CEFEM.cpp | 79 ++++++++++++++++++++++++++
SourceCode/Bond/Servo/CEFEM.h | 2
SourceCode/Bond/Servo/CEquipment.h | 26 ++++++++
SourceCode/Bond/Servo/Common.h | 2
5 files changed, 138 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEFEM.cpp b/SourceCode/Bond/Servo/CEFEM.cpp
index 635cbc8..3a277f3 100644
--- a/SourceCode/Bond/Servo/CEFEM.cpp
+++ b/SourceCode/Bond/Servo/CEFEM.cpp
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "CEFEM.h"
+#include "Log.h"
#define ADD_EQ_CASSETTE_TRANSFER_STATE_STEP(name,ws,index,psd) { \
@@ -56,6 +57,73 @@
if (index < 2) {
m_pArmTray[index] = pArmTray;
}
+ }
+
+ int CEFEM::robotCmd(ROBOT_CMD_PARAM& robotCmdParam, ONWRITED onWritedBlock/* = nullptr*/)
+ {
+ SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EFEM_ROBOT_CMD);
+ if (pStep == nullptr) {
+ return -1;
+ }
+
+ LOGI("<CEFEM-%s>准备发送RobotCmd<%d>", m_strName.c_str(), (int)robotCmdParam.rcmd);
+ if (onWritedBlock != nullptr) {
+ pStep->writeDataEx((const char*)&robotCmdParam, ROBOT_CMD_PARAM_SIZE, onWritedBlock);
+ }
+ else {
+ pStep->writeDataEx((const char*)&robotCmdParam, ROBOT_CMD_PARAM_SIZE, [&](int code) -> int {
+ if (code == WOK) {
+ LOGI("<CEFEM-%s>发送RobotCmd成功.", m_strName.c_str());
+ }
+ else {
+ LOGI("<CEFEM-%s>发送RobotCmd失败,code:%d", m_strName.c_str(), code);
+ }
+
+ return 0;
+ });
+ }
+
+ return 0;
+ }
+
+ int CEFEM::robotCmds(ROBOT_CMD_PARAM* robotCmdParam, unsigned int count, ONWRITED onWritedBlock/* = nullptr*/)
+ {
+ SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EFEM_ROBOT_CMD);
+ if (pStep == nullptr) {
+ return -1;
+ }
+
+
+ // 平铺到内存中,如果ROBOT_CMD_PARAM不是4的整数倍,只能一个一个复制
+ std::string strLog = "准备发送RobotCmds<";
+ char szBuffer[ROBOT_CMD_PARAM_SIZE * 4];
+ for (int i = 0; i < min(4, count); i++) {
+ memcpy(&szBuffer[i * ROBOT_CMD_PARAM_SIZE], (robotCmdParam + i), ROBOT_CMD_PARAM_SIZE);
+ strLog += std::to_string((robotCmdParam + i)->rcmd);
+ strLog += ",";
+ LOGI("%d", (robotCmdParam + 1)->rcmd);
+ }
+ strLog += ">.";
+ LOGI("<CEFEM-%s>%s", m_strName.c_str(), strLog.c_str());
+
+
+ if (onWritedBlock != nullptr) {
+ pStep->writeDataEx(szBuffer, ROBOT_CMD_PARAM_SIZE * min(4, count), onWritedBlock);
+ }
+ else {
+ pStep->writeDataEx(szBuffer, ROBOT_CMD_PARAM_SIZE * min(4, count), [&](int code) -> int {
+ if (code == WOK) {
+ LOGI("<CEquipment-%s>发送RobotCmdS成功.", m_strName.c_str());
+ }
+ else {
+ LOGI("<CEquipment-%s>发送RobotCmds失败,code:%d", m_strName.c_str(), code);
+ }
+
+ return 0;
+ });
+ }
+
+ return 0;
}
void CEFEM::init()
@@ -375,6 +443,17 @@
delete pStep;
}
}
+
+ {
+ // Robot CMD
+ CEqWriteStep* pStep = new CEqWriteStep();
+ pStep->setName(STEP_EFEM_ROBOT_CMD);
+ pStep->setWriteSignalDev(0x14D);
+ pStep->setDataDev(0x90a);
+ if (addStep(STEP_ID_ROBOT_CMD_REPLY, pStep) != 0) {
+ delete pStep;
+ }
+ }
}
int CEFEM::onStepEvent(CStep* pStep, int code)
diff --git a/SourceCode/Bond/Servo/CEFEM.h b/SourceCode/Bond/Servo/CEFEM.h
index b2ce0aa..4a53122 100644
--- a/SourceCode/Bond/Servo/CEFEM.h
+++ b/SourceCode/Bond/Servo/CEFEM.h
@@ -37,6 +37,8 @@
void setAligner(CAligner* pAligner);
void setFliper(CFliper* pFliper);
void setArmTray(unsigned int index, CArmTray* pArmTray);
+ int robotCmd(ROBOT_CMD_PARAM& robotCmdParam, ONWRITED onWritedBlock = nullptr);
+ int robotCmds(ROBOT_CMD_PARAM* robotCmdParam, unsigned int count, ONWRITED onWritedBlock = nullptr);
private:
CLoadPort* m_pPort[4];
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index b62b420..4e8f6db 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -73,6 +73,32 @@
Local = 2
};
+ enum RCMD {
+ Robot_home = 1,
+ Transfer,
+ Move,
+ Get,
+ Put,
+ One_Action_Exchange,
+ Two_Action_Exchange,
+ Command_Clear,
+ Batch_get,
+ Batch_put
+ };
+
+ // Robot cmd param
+#define ROBOT_CMD_PARAM_SIZE 16 /* 防止以后修改ROBOT_CMD_PARAM为不是4的整数倍 */
+ typedef struct _ROBOT_CMD_PARAM {
+ short sequenceNo;
+ short rcmd;
+ short armNo;
+ short getPosition;
+ short putPosition;
+ short getSlotNo;
+ short putSlotNo;
+ short subCmd;
+ } ROBOT_CMD_PARAM;
+
class CEquipment
{
public:
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index 68cbbe8..83e917f 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -247,6 +247,35 @@
else if (nCmd == ID_EQSGRAPHITEM_TEST4) {
SERVO::CEquipment* pEquipment = (SERVO::CEquipment*)pItem->pData;
+ /* 娴嬭瘯 RobotCMD */
+ if (pEquipment->getID() == EQ_ID_EFEM) {
+ SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)pEquipment;
+
+
+
+ SERVO::ROBOT_CMD_PARAM cmds[4];
+ cmds[0].sequenceNo = 1;
+ cmds[0].rcmd = (short)SERVO::RCMD::Move;
+ cmds[0].armNo = 1;
+ cmds[0].getPosition = 1;
+ cmds[0].putPosition = 2;
+ cmds[0].getSlotNo = 3;
+ cmds[0].putSlotNo = 4;
+ cmds[0].subCmd = 5;
+ cmds[1].sequenceNo = 2;
+ cmds[1].rcmd = (short)SERVO::RCMD::Transfer;
+ cmds[1].armNo = 2;
+ cmds[1].getPosition = 6;
+ cmds[1].putPosition = 7;
+ cmds[1].getSlotNo = 8;
+ cmds[1].putSlotNo = 9;
+ cmds[1].subCmd = 10;
+ pEFEM->robotCmds(cmds, 2);
+ }
+
+
+
+
// 娴嬭瘯涓嬪彂Cim Message
/*
if (pEquipment->getID() == EQ_ID_Bonder1
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index 20a060e..cf7464a 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -208,6 +208,7 @@
#define STEP_EQ_STORED_JOB14 _T("EQStoredJobReport14")
#define STEP_EQ_STORED_JOB15 _T("EQStoredJobReport15")
#define STEP_EQ_DISPATCHINT_MODE_CHANGE _T("EQDispatchingModeChangeCommand")
+#define STEP_EFEM_ROBOT_CMD _T("EFEMRobotCmd")
@@ -330,6 +331,7 @@
#define STEP_ID_PORT4_CASSETTIE_INUSE 0x653
#define STEP_ID_PORT4_CASSETTIE_UNLOAD_READY 0x65b
#define STEP_ID_PORT4_CASSETTIE_BLOCKED 0x663
+#define STEP_ID_ROBOT_CMD_REPLY 0x6b0
/* base alarm */
--
Gitblit v1.9.3