From e51c6d1360f9679dd8e4dd3379ce0db1886badbf Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:36:57 +0800
Subject: [PATCH] Merge branch 'EAPSimulator' into clh
---
SourceCode/Bond/Servo/CMaster.cpp | 197 +++++++++++-------------------------------------
1 files changed, 47 insertions(+), 150 deletions(-)
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 6c9a004..f1b3b26 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -52,6 +52,8 @@
m_pActiveRobotTask = nullptr;
m_nLastError = 0;
m_isCompareMapsBeforeProceeding = FALSE;
+ m_bEnableEventReport = true;
+ m_bEnableAlarmReport = true;
InitializeCriticalSection(&m_criticalSection);
}
@@ -563,157 +565,65 @@
}
PORT_PUT:
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
// Measurement NG -> LoadPort
// NG回原位
if (!rmd.armState[1]) {
m_pActiveRobotTask = createTransferTask_restore(pMeasurement, pLoadPorts);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建Measurement回退任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
-
-
// BakeCooling ->Measurement
if (!rmd.armState[0]) {
m_pActiveRobotTask = createTransferTask_bakecooling_to_measurement(pBakeCooling, pMeasurement);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
-
// BakeCooling内部
// Bake -> Cooling
if (!rmd.armState[0]) {
m_pActiveRobotTask = createTransferTask_bake_to_cooling(pBakeCooling);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
// Bonder -> BakeCooling
if (!rmd.armState[0]) {
m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder1, pBakeCooling);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
if (!rmd.armState[0]) {
m_pActiveRobotTask = createTransferTask_bonder_to_bakecooling(pBonder2, pBakeCooling);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
// Fliper(G2) -> Bonder
- // VacuumBake(G1) -> Bonder
- if (!rmd.armState[1] && !pBonder1->hasBondClass()) {
+ auto pSrcSlot = pVacuumBake->getProcessedSlot(primaryType);
+ if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder1->hasBondClass()) {
m_pActiveRobotTask = createTransferTask(pFliper, pBonder1, primaryType, secondaryType, 2);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
-
- if (!rmd.armState[1] && !pBonder2->hasBondClass()) {
+ if (pSrcSlot != nullptr && !rmd.armState[1] && !pBonder2->hasBondClass()) {
m_pActiveRobotTask = createTransferTask(pFliper, pBonder2, primaryType, secondaryType, 2);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
+
+ // VacuumBake(G1) -> Bonder
if (!rmd.armState[0] && !pBonder1->hasBondClass()) {
m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder1, primaryType, secondaryType);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
if (!rmd.armState[0] && !pBonder2->hasBondClass()) {
m_pActiveRobotTask = createTransferTask(pVacuumBake, pBonder2, primaryType, secondaryType);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
@@ -721,48 +631,20 @@
// Aligner -> VacuumBake(G1)
if (!rmd.armState[1]) {
m_pActiveRobotTask = createTransferTask(pAligner, pFliper, primaryType, secondaryType);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
if (!rmd.armState[0]) {
m_pActiveRobotTask = createTransferTask(pAligner, pVacuumBake, primaryType, secondaryType);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
+
// Aligner -> LoadPort
if (!rmd.armState[1]) {
m_pActiveRobotTask = createTransferTask_restore(pAligner, pLoadPorts);
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建Aligner回退任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
}
-
-
// LoadPort -> Aligner
@@ -779,19 +661,11 @@
}
PORT_GET:
- if (m_pActiveRobotTask != nullptr) {
- m_pActiveRobotTask->pick();
- std::string strDescription = m_pActiveRobotTask->getDescription();
- unlock();
- if (m_listener.onRobotTaskEvent != nullptr) {
- m_listener.onRobotTaskEvent(this, m_pActiveRobotTask, ROBOT_EVENT_CREATE);
- }
- LOGI("创建新任务<%s>...", strDescription.c_str());
- continue;
- }
+ CHECK_RUN_ACTIVE_ROBOT_TASK(m_pActiveRobotTask);
+
unlock();
-
+ continue;
}
unlock();
}
@@ -1631,4 +1505,27 @@
{
m_isCompareMapsBeforeProceeding = bCompare;
}
+
+ void CMaster::datetimeSync(SYSTEMTIME& time)
+ {
+ for (auto item : m_listEquipment) {
+ item->setDateTime(time.wYear, time.wMonth, time.wDay,
+ time.wHour, time.wMinute, time.wSecond);
+ }
+ }
+
+ void CMaster::enableEventReport(bool bEnable)
+ {
+ m_bEnableEventReport = bEnable;
+ }
+
+ void CMaster::enableAlarmReport(bool bEnable)
+ {
+ m_bEnableAlarmReport = bEnable;
+ }
+
+ bool CMaster::isAlarmReportEnable()
+ {
+ return m_bEnableAlarmReport;
+ }
}
--
Gitblit v1.9.3