From e8a27bb203fe2aff70390a5eca002d7438da9b0f Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期三, 22 十月 2025 14:24:34 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/CMeasurement.cpp | 213 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 178 insertions(+), 35 deletions(-)
diff --git a/SourceCode/Bond/Servo/CMeasurement.cpp b/SourceCode/Bond/Servo/CMeasurement.cpp
index dfc731f..67f9c9f 100644
--- a/SourceCode/Bond/Servo/CMeasurement.cpp
+++ b/SourceCode/Bond/Servo/CMeasurement.cpp
@@ -188,12 +188,13 @@
// master recipe list report
CEqReadStep* pStep = new CEqReadStep(0x1a955, 255 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+ CEqReadStep* pTmpStep = (CEqReadStep*)pFrom;
+ short ret = MRLRC_OK;
if (code == ROK && pszData != nullptr && size > 0) {
// 此处解释配方数据
- short ret = decodeRecipeListReport(pszData, size);
- pStep->setReturnCode(ret);
+ ret = decodeRecipeListReport(pszData, size);
}
- pStep->setReturnCode(MRLRC_OK);
+ pTmpStep->setReturnCode(ret);
return -1;
});
pStep->setName(STEP_EQ_MASTER_RECIPE_LIST);
@@ -206,40 +207,41 @@
{
// 请求配方参数
- //CEqWriteStep* pStep = new CEqWriteStep();
- //pStep->setName(STEP_EQ_RECIPE_PARAMETER_REQ);
- //pStep->setWriteSignalDev(0xf67);
- //pStep->setDataDev(0x379b);
- //if (addStep(STEP_ID_RECIPE_PARAMETER_CMD_REPLY, pStep) != 0) {
- // delete pStep;
- //}
+ CEqWriteStep* pStep = new CEqWriteStep();
+ pStep->setName(STEP_EQ_RECIPE_PARAMETER_REQ);
+ pStep->setWriteSignalDev(0xf67);
+ pStep->setDataDev(0x379b);
+ if (addStep(STEP_ID_RECIPE_PARAMETER_CMD_REPLY, pStep) != 0) {
+ delete pStep;
+ }
}
{
// recipe parameter report
- //CEqReadStep* pStep = new CEqReadStep(0x1aa54, 257 * 2,
- // [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
- // if (code == ROK && pszData != nullptr && size > 0) {
- // // 此处解释配方数据
- // short ret = decodeRecipeParameterReport(pszData, size);
- // pStep->setReturnCode(ret);
- // }
- // pStep->setReturnCode(MRLRC_OK);
- // return -1;
- // });
- //pStep->setName(STEP_EQ_RECIPE_PARAMETER);
- //pStep->setWriteSignalDev(0xf4c);
- //pStep->setReturnDev(m_nIndex == 0 ? 0x126c : 0x1bbc);
- //if (addStep(STEP_ID_RECIPE_PARAMETER_REPORT, pStep) != 0) {
- // delete pStep;
- //}
+ CEqReadStep* pStep = new CEqReadStep(0x1aa54, 257 * 2,
+ [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+ CEqReadStep* pTmpStep = (CEqReadStep*)pFrom;
+ if (code == ROK && pszData != nullptr && size > 0) {
+ // 此处解释配方数据
+ short ret = decodeRecipeParameterReport(pszData, size);
+ pTmpStep->setReturnCode(ret);
+ }
+ pTmpStep->setReturnCode(MRLRC_OK);
+ return -1;
+ });
+ pStep->setName(STEP_EQ_RECIPE_PARAMETER);
+ pStep->setWriteSignalDev(0xf4c);
+ pStep->setReturnDev(0x37ac);
+ if (addStep(STEP_ID_RECIPE_PARAMETER_REPORT, pStep) != 0) {
+ delete pStep;
+ }
}
// 使用CEqReadStep替换CEqJobEventStep
{
// Received Job Report Upstream #1~9
char szBuffer[256];
- for (int i = 0; i < 9; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep(0x18c90 + 320 * i, 320 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -263,13 +265,13 @@
{
// Sent Out Job Report Downstream #1~9
char szBuffer[256];
- for (int i = 0; i < 9; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep(0x18000 + 320 * i, 320 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
int port = (int)(__int64)((CEqReadStep*)pFrom)->getProp("Port");
if (port > 0) {
- decodeReceivedJobReport((CStep*)pFrom, port, pszData, size);
+ decodeSentOutJobReport((CStep*)pFrom, port, pszData, size);
}
}
return -1;
@@ -287,7 +289,7 @@
{
// Fetched Out Job Report #1~15
char szBuffer[256];
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep(0x19c31 + 18 * i, 18 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -311,7 +313,7 @@
{
// Stored Job Report #1~15
char szBuffer[256];
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep(0x19b23 + 18 * i, 18 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -331,6 +333,75 @@
}
}
}
+
+ // FAC Data Report
+ addFacDataReportStep(0x1a589, 0xf4d, 1);
+ /*
+ {
+ CEqReadStep* pStep = new CEqReadStep(0x1a589, 133 * 2,
+ [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+ if (code == ROK && pszData != nullptr && size > 0) {
+ decodeFacDataReport((CStep*)pFrom, pszData, size);
+ }
+ return -1;
+ });
+ pStep->setName(STEP_EQ_FAC_DATA_REPORT);
+ pStep->setProp("Port", (void*)1);
+ pStep->setWriteSignalDev(0xf4d);
+ if (addStep(STEP_ID_FAC_DATA_REPORT, pStep) != 0) {
+ delete pStep;
+ }
+ }
+ */
+
+ // process start/end report
+ {
+ CEqReadStep* pStep = new CEqReadStep(0x19D3F, 13 * 2,
+ [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+ if (code == ROK && pszData != nullptr && size > 0) {
+ decodeJobProcessStartReport((CStep*)pFrom, pszData, size);
+ }
+ return -1;
+ });
+ pStep->setName(STEP_EQ_JOB_PROCESS_START_REPORT);
+ pStep->setProp("Port", (void*)1);
+ pStep->setWriteSignalDev(0xf33);
+ if (addStep(STEP_ID_JOB_PROCESS_START_REPORT, pStep) != 0) {
+ delete pStep;
+ }
+ }
+ {
+ CEqReadStep* pStep = new CEqReadStep(0x19D4C, 13 * 2,
+ [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+ if (code == ROK && pszData != nullptr && size > 0) {
+ decodeJobProcessEndReport((CStep*)pFrom, pszData, size);
+ }
+ return -1;
+ });
+ pStep->setName(STEP_EQ_JOB_PROCESS_END_REPORT);
+ pStep->setProp("Port", (void*)1);
+ pStep->setWriteSignalDev(0xf34);
+ if (addStep(STEP_ID_JOB_PROCESS_END_REPORT, pStep) != 0) {
+ delete pStep;
+ }
+ }
+
+ {
+ // Panel Data Report
+ CEqReadStep* pStep = new CEqReadStep(0x1A17f, 386 * 2,
+ [&](void* pFrom, int code, const char* pszData, size_t size) -> int {
+ if (code == ROK && pszData != nullptr && size > 0) {
+ decodePanelDataReport((CStep*)pFrom, pszData, size);
+ }
+ return -1;
+ });
+ pStep->setName(STEP_EQ_PANEL_DATA_REPORT);
+ pStep->setProp("Port", (void*)1);
+ pStep->setWriteSignalDev(0x105e);
+ if (addStep(STEP_ID_PANEL_DATA_REPORT, pStep) != 0) {
+ delete pStep;
+ }
+ }
}
// 必须要实现的虚函数,在此初始化Slot信息
@@ -340,10 +411,6 @@
m_slot[0].setPosition(m_nID);
m_slot[0].setNo(1);
m_slot[0].setName("Slot 1");
- m_slot[1].enable();
- m_slot[1].setPosition(m_nID);
- m_slot[1].setNo(2);
- m_slot[1].setName("Slot 2");
}
void CMeasurement::onTimer(UINT nTimerid)
@@ -370,4 +437,80 @@
{
return 35000;
}
+
+ int CMeasurement::parsingParams(const char* pszData, size_t size, std::vector<CParam>& params)
+ {
+ ASSERT(pszData);
+ if (size < 250) return 0;
+ int i = 0, v;
+
+
+ // 1.检测功能启用/禁用
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+ params.push_back(CParam("检测功能启用/禁用", "", this->getName().c_str(), v));
+ i += 2;
+
+ // 2.检测速度
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+ params.push_back(CParam("检测速度", "", this->getName().c_str(), v * 0.001));
+ i += 4;
+
+ return (int)params.size();
+ }
+
+ int CMeasurement::parsingProcessData(const char* pszData, size_t size, std::vector<CParam>& params)
+ {
+ ASSERT(pszData);
+ if (size < 250) return 0;
+ int i = 0, v;
+
+
+ // 1.检测功能启用/禁用
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+ params.push_back(CParam("检测功能启用/禁用", "", this->getName().c_str(), v));
+ i += 2;
+
+ // 2.检测速度
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+ params.push_back(CParam("检测速度", "", this->getName().c_str(), v * 0.001));
+ i += 4;
+
+ // 3.检测1数据
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+ params.push_back(CParam("检测1数据", "", this->getName().c_str(), v * 0.001));
+ i += 4;
+
+ // 4.检测2数据
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+ params.push_back(CParam("检测2数据", "", this->getName().c_str(), v * 0.001));
+ i += 4;
+
+ return (int)params.size();
+ }
+
+ int CMeasurement::parsingSVData(const char* pszData, size_t size, std::vector<CParam>& params)
+ {
+ /*/
+ 1 工艺运行步骤 1Word 123456
+ 2 AOI检测速度 2Word 123.456
+ */
+
+ ASSERT(pszData);
+ if (size < 125) return 0;
+ int i = 0, v;
+
+
+ // 1.工艺运行步骤
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8;
+ params.push_back(CParam("工艺运行步骤", "", this->getName().c_str(), v));
+ i += 2;
+
+ // 2.检测速度
+ v = (pszData[i] & 0xff) | (pszData[i + 1] & 0xff) << 8 | (pszData[i + 2] & 0xff) << 16 | (pszData[i + 3] & 0xff) << 24;
+ params.push_back(CParam("A腔温控表1当前值", "", this->getName().c_str(), v * 0.001f));
+ i += 4;
+
+ return (int)params.size();
+ }
+
}
--
Gitblit v1.9.3