From a79fcf6a937e1bfe57014d2c99f1bb9f98bfa892 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期二, 10 二月 2026 10:20:17 +0800
Subject: [PATCH] 1.完善日志; 2.背景图表配置 3.更改EAP通讯端口和设备名;
---
SourceCode/Bond/Servo/CPageGraph1.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPageGraph1.cpp b/SourceCode/Bond/Servo/CPageGraph1.cpp
index b2d932a..100771d 100644
--- a/SourceCode/Bond/Servo/CPageGraph1.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph1.cpp
@@ -229,9 +229,7 @@
m_slotTable.SetTitleHeight(m_slotTableTitleHeight);
m_slotTable.SetLineColor(lineColor);
m_slotTable.SetHeaderBgColor(headerBgColor);
- LOGI("[Graph1] SlotTable create ret=%d hwnd=%p err=%lu rc=(%d,%d)-(%d,%d)",
- created, m_slotTable.GetSafeHwnd(), GetLastError(),
- rcTable.left, rcTable.top, rcTable.right, rcTable.bottom);
+ (void)created;
}
else {
m_slotTable.MoveWindow(&rcTable);
@@ -241,20 +239,16 @@
m_slotTable.SetTitleHeight(m_slotTableTitleHeight);
m_slotTable.SetLineColor(lineColor);
m_slotTable.SetHeaderBgColor(headerBgColor);
- LOGI("[Graph1] SlotTable moved rc=(%d,%d)-(%d,%d)", rcTable.left, rcTable.top, rcTable.right, rcTable.bottom);
}
// 濡傛灉瓒呭嚭鍙鍖哄煙锛屽己鍒剁Щ鍒板乏涓婅浣滀负鍏滃簳
CRect rcWnd;
m_slotTable.GetWindowRect(&rcWnd);
ScreenToClient(&rcWnd);
- LOGI("[Graph1] SlotTable wnd rc=(%d,%d)-(%d,%d) client=(%d,%d)",
- rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, rcClient.right, rcClient.bottom);
if (rcWnd.right <= 0 || rcWnd.bottom <= 0 ||
rcWnd.left >= rcClient.right || rcWnd.top >= rcClient.bottom) {
CRect rcFallback(10, 10, 10 + cfgW, 10 + cfgH);
m_slotTable.MoveWindow(&rcFallback);
- LOGI("[Graph1] SlotTable fallback rc=(%d,%d)-(%d,%d)", rcFallback.left, rcFallback.top, rcFallback.right, rcFallback.bottom);
}
m_slotTable.SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
@@ -270,7 +264,6 @@
std::vector<CSlotTableCtrl::Row> rows;
if (pEquipment != nullptr) {
- LOGI("[Graph1] UpdateSlotTable eq=%s(%p)", pEquipment->getName().c_str(), pEquipment);
for (int i = 0; i < SLOT_MAX && rows.size() < 8; ++i) {
SERVO::CSlot* pSlot = pEquipment->getSlot(i);
if (pSlot == nullptr || !pSlot->isEnable()) continue;
@@ -291,7 +284,6 @@
rows.push_back(row);
}
}
- LOGI("[Graph1] SlotTable rows=%zu", rows.size());
m_slotTableRowCount = static_cast<int>(rows.size());
if (m_slotTableRowCount < 1) m_slotTableRowCount = 1;
@@ -359,6 +351,14 @@
}
}
}
+ else if (RX_CODE_EQ_DATA_CHANGED == code
+ || RX_CODE_LOADPORT_STATUS_CHANGED == code) {
+ // 璁惧鏁版嵁鍙樺寲鏃讹紝鍙婃椂鍒锋柊鏍煎瓙涓庡彸渚lot琛紝閬垮厤鍙湪鐐瑰嚮鏃舵洿鏂颁竴娆�
+ UpdateSlotBars();
+ if (m_pSelectedEquipment != nullptr) {
+ UpdateSlotTable(m_pSelectedEquipment);
+ }
+ }
pAny->release();
}, [&]() -> void {
@@ -386,8 +386,39 @@
if (auto* pGraphWnd = GetDlgItem(IDC_SERVO_GRAPH1)) {
pGraphWnd->ModifyStyle(0, WS_CLIPSIBLINGS);
}
+ std::string iniPath = GetConfigPath();
CString strPath;
- strPath.Format(_T("%s\\res\\Servo001.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+ auto resolveGraphImagePath = [&](const char* iniKey, const char* defaultName) -> CString {
+ char value[MAX_PATH] = { 0 };
+ GetPrivateProfileStringA("Graph1", iniKey, defaultName, value, (DWORD)sizeof(value), iniPath.c_str());
+ std::string file = value;
+ auto trim = [](std::string& s) {
+ while (!s.empty() && (s.front() == ' ' || s.front() == '\t' || s.front() == '\r' || s.front() == '\n')) s.erase(s.begin());
+ while (!s.empty() && (s.back() == ' ' || s.back() == '\t' || s.back() == '\r' || s.back() == '\n')) s.pop_back();
+ };
+ trim(file);
+ if (file.empty()) file = defaultName;
+
+ CString path;
+ const bool isAbs = (file.size() > 1 && file[1] == ':') || (!file.empty() && (file[0] == '\\' || file[0] == '/'));
+ if (isAbs) {
+ path = file.c_str();
+ }
+ else if (file.rfind("res\\", 0) == 0 || file.rfind("res/", 0) == 0) {
+ path.Format(_T("%s\\%s"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, CString(file.c_str()));
+ }
+ else {
+ path.Format(_T("%s\\res\\%s"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, CString(file.c_str()));
+ }
+
+ DWORD attr = GetFileAttributes(path);
+ if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) {
+ path.Format(_T("%s\\res\\%s"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir, CString(defaultName));
+ }
+ return path;
+ };
+
+ strPath = resolveGraphImagePath("BackgroundBmp", "Servo001.bmp");
m_pGraph->AddImage(1, (LPTSTR)(LPCTSTR)strPath, 0, 0);
strPath.Format(_T("%s\\res\\Robot001.bmp"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
@@ -403,7 +434,6 @@
// 娣诲姞鎸囩ず鍣�
// Bonder
// size config
- std::string iniPath = GetConfigPath();
int boxSize = GetPrivateProfileIntA("Graph1", "BoxSize", 56, iniPath.c_str());
if (boxSize < 40) boxSize = 40;
if (boxSize > 80) boxSize = 80;
@@ -1020,6 +1050,9 @@
SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.m_master.getEquipment(EQ_ID_EFEM);
if (!pEFEM || !pEFEM->isAlive()) {
UpdateSlotBars();
+ if (m_pSelectedEquipment != nullptr) {
+ UpdateSlotTable(m_pSelectedEquipment);
+ }
return;
}
@@ -1045,6 +1078,10 @@
}
UpdateSlotBars();
+ if (m_pSelectedEquipment != nullptr) {
+ // 瀹氭椂鍏滃簳锛氬嵆浣挎紡鎺変簨浠堕�氱煡锛屼篃纭繚鍙充晶Slot琛ㄦ寔缁埛鏂�
+ UpdateSlotTable(m_pSelectedEquipment);
+ }
}
else if (nIDEvent == TIMER_ID_ROBOT_ANIMATION) {
if (!m_bIsRobotMoving) {
--
Gitblit v1.9.3