LAPTOP-SNT8I5JK\Boounion
2025-06-18 96266d494fe227a0481c305f9c859e69421da6ae
1.CEqWriteStep, 写数据时,有时还要读取对方的返回值,增加获取返回数据的功能;
已修改9个文件
90 ■■■■ 文件已修改
SourceCode/Bond/Servo/CBonder.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEFEM.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEqWriteStep.cpp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEqWriteStep.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.cpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CEquipment.h 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CWriteStep.cpp 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CWriteStep.h 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Common.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CBonder.cpp
@@ -337,6 +337,18 @@
        }
        {
            // Indexer Operation Mode Change
            CEqWriteStep* pStep = new CEqWriteStep();
            pStep->setName(STEP_EQ_IN_OP_MODE_CHANGE);
            pStep->setWriteSignalDev(0x370);
            pStep->setDataDev(0x923);
            pStep->setRetDataDev(0xa00e, 2);
            if (addStep(STEP_ID_IN_OP_CMD_REPLY, pStep) != 0) {
                delete pStep;
            }
        }
        {
            // Panel Data Report
            CEqReadStep* pStep = new CEqReadStep(0xA17f, 386 * 2,
                [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
SourceCode/Bond/Servo/CEFEM.cpp
@@ -580,9 +580,10 @@
        {
            // Indexer Operation Mode Change
            CEqWriteStep* pStep = new CEqWriteStep();
            pStep->setName(STEP_EFEM_IN_OP_MODE_CHANGE);
            pStep->setName(STEP_EQ_IN_OP_MODE_CHANGE);
            pStep->setWriteSignalDev(0x070);
            pStep->setDataDev(0x023);
            pStep->setRetDataDev(0x600e, 2);
            if (addStep(STEP_ID_IN_OP_CMD_REPLY, pStep) != 0) {
                delete pStep;
            }
SourceCode/Bond/Servo/CEqWriteStep.cpp
@@ -64,4 +64,13 @@
        return 0;
    }
    int CEqWriteStep::onReadRetDataError()
    {
        if (m_onWritedBlock != nullptr) {
            m_onWritedBlock(WREAD_RET_ERR);
        }
        return 0;
    }
}
SourceCode/Bond/Servo/CEqWriteStep.h
@@ -5,6 +5,7 @@
#define WOK                0
#define WTIMEOUT        -1
#define WREAD_RET_ERR    -2
namespace SERVO {
    typedef std::function<int(int code)> ONWRITED;
@@ -23,6 +24,7 @@
        int writeDataEx(const char* pszData, int size, ONWRITED onWritedBlock = nullptr);
        virtual int onComplete();
        virtual int onTimeout();
        virtual int onReadRetDataError();
    private:
        int m_nDataDev;
SourceCode/Bond/Servo/CEquipment.cpp
@@ -1012,30 +1012,34 @@
        return 0;
    }
    int CEquipment::indexerOperationModeChange(IDNEXER_OPERATION_MODE mode, ONWRITED onWritedBlock/* = nullptr*/)
    int CEquipment::indexerOperationModeChange(IDNEXER_OPERATION_MODE mode, ONWRITEDRET onWritedRetBlock)
    {
        SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EFEM_IN_OP_MODE_CHANGE);
        SERVO::CEqWriteStep* pStep = (SERVO::CEqWriteStep*)getStepWithName(STEP_EQ_IN_OP_MODE_CHANGE);
        if (pStep == nullptr) {
            return -1;
        }
        unsigned short operationMode = (unsigned short)((unsigned short)mode + getIndexerOperationModeBaseValue());
        LOGI("<CEquipment-%s>准备设置indexerOperationMode<%d>", m_strName.c_str(), (int)mode);
        if (onWritedBlock != nullptr) {
            pStep->writeShort(operationMode, onWritedBlock);
        }
        else {
            pStep->writeShort(operationMode, [&, mode](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);
                }
                else {
                    LOGI("<CEquipment-%s>设置indexerOperationMode失败,code:%d", m_strName.c_str(), code);
                }
            if (onWritedRetBlock != nullptr) {
                onWritedRetBlock(code, retCode);
            }
                return 0;
                });
        }
        return 0;
    }
SourceCode/Bond/Servo/CEquipment.h
@@ -43,6 +43,7 @@
#define SIGNAL_UPSTREAM_TROUBLE    1
#define SIGNAL_INTERLOCK        2
#define SIGNAL_SEND_ABLE        3
    typedef std::function<int(int writeCode, int retCode)> ONWRITEDRET;
    typedef std::function<void(void* pEiuipment, BOOL bAlive)> ONALIVE;
    typedef std::function<void(void* pEiuipment, int code)> ONDATACHANGED;
@@ -140,7 +141,7 @@
        int clearCimMessage(short id, short nTouchPanelNo);
        int setDateTime(short year, short month, short day, short hour, short minute, short second);
        int setDispatchingMode(DISPATCHING_MODE mode, ONWRITED onWritedBlock = nullptr);
        int indexerOperationModeChange(IDNEXER_OPERATION_MODE mode, ONWRITED onWritedBlock = nullptr);
        int indexerOperationModeChange(IDNEXER_OPERATION_MODE mode, ONWRITEDRET onWritedRetBlock);
SourceCode/Bond/Servo/CWriteStep.cpp
@@ -55,6 +55,18 @@
        m_nWriteSignalDev = dev;
    }
    void CWriteStep::setRetDataDev(int dev, int size)
    {
        m_nReturnDevNo = dev;
        m_nReturnDataSize = size;
    }
    int CWriteStep::getReturnData(const char*& pszData)
    {
        pszData = m_szReturnBuf;
        return m_nReturnDataSize;
    }
    void CWriteStep::onRecvSignal(BOOL bSignal)
    {
        Lock();
@@ -111,6 +123,18 @@
                    goto RESET;
                }
                ResetEvent(m_hRecvSignalOn);
                // 3.9读数据,如果有
                if (m_nReturnDataSize > 0) {
                    int nRet = m_pCclink->ReadData2(m_station, DeviceType::W, m_nReturnDevNo,
                        (long)min(READ_BUFFER_MAX, m_nReturnDataSize), m_szReturnBuf);
                    if (0 != nRet) {
                        LOGI("<CEqReadStep>Read return data error.");
                        onReadRetDataError();
                        return -1;
                    }
                }
                // 4.дOFF
@@ -196,4 +220,9 @@
    {
        return 0;
    }
    int CWriteStep::onReadRetDataError()
    {
        return 0;
    }
}
SourceCode/Bond/Servo/CWriteStep.h
@@ -19,8 +19,14 @@
        virtual void getAttributeVector(CAttributeVector& attrubutes);
        virtual int onComplete();
        virtual int onTimeout();
        virtual int onReadRetDataError();
        inline void nextStep();
        inline void resetStep();
        virtual void setRetDataDev(int dev, int size);
    public:
        int getReturnData(const char*& pszData);
    protected:
        HANDLE m_hWorkThreadHandle;
@@ -33,6 +39,12 @@
        char m_szBuffer[1024];
        int m_nWriteDataSize;
        int m_nWriteDevNo;
    protected:
        // return code or data
        char m_szReturnBuf[1024];
        int m_nReturnDataSize;
        int m_nReturnDevNo;
    };
}
SourceCode/Bond/Servo/Common.h
@@ -218,7 +218,7 @@
#define STEP_EQ_STORED_JOB15            _T("EQStoredJobReport15")
#define STEP_EQ_DISPATCHINT_MODE_CHANGE    _T("EQDispatchingModeChangeCommand")
#define STEP_EFEM_ROBOT_CMD                _T("EFEMRobotCmd")
#define STEP_EFEM_IN_OP_MODE_CHANGE        _T("EFEMIndexerOperationModeChangeCommand")
#define STEP_EQ_IN_OP_MODE_CHANGE        _T("EQIndexerOperationModeChangeCommand")
#define STEP_PORT1_TYPE_CHANGE            _T("Port1TypeChange")
#define STEP_PORT2_TYPE_CHANGE            _T("Port2TypeChange")
#define STEP_PORT3_TYPE_CHANGE            _T("Port3TypeChange")