From e937700184e21d263b771921b269fbdda341dfc4 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 27 五月 2025 14:39:40 +0800
Subject: [PATCH] 1.master调试线程实现,状态,运行时间等;
---
SourceCode/Bond/Servo/ServoDlg.cpp | 46 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/SourceCode/Bond/Servo/ServoDlg.cpp b/SourceCode/Bond/Servo/ServoDlg.cpp
index 69a0d76..6ce2bf0 100644
--- a/SourceCode/Bond/Servo/ServoDlg.cpp
+++ b/SourceCode/Bond/Servo/ServoDlg.cpp
@@ -169,6 +169,22 @@
}
}
}
+ else if (RX_CODE_MASTER_STATE_CHANGED == code) {
+ SERVO::MASTERSTATE state = theApp.m_model.getMaster().getState();
+ if (state == SERVO::MASTERSTATE::READY) {
+ m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_NORMAL);
+ m_pMyStatusbar->setForegroundColor(RGB(0, 0, 0));
+ KillTimer(TIMER_ID_UPDATE_RUMTIME);
+ CString strText;
+ GetRuntimeFormatText(strText, "");
+ m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
+ }
+ else if (state == SERVO::MASTERSTATE::RUNNING) {
+ m_pMyStatusbar->setBackgroundColor(STATUSBAR_BK_RUNNING);
+ m_pMyStatusbar->setForegroundColor(RGB(255, 255, 255));
+ SetTimer(TIMER_ID_UPDATE_RUMTIME, 500, nullptr);
+ }
+ }
pAny->release();
}, [&]() -> void {
@@ -704,12 +720,8 @@
if (index >= 4) index = 0;
static char* status[] = {"|", "/", "--", "\\"};
- CTime time = CTime::GetCurrentTime();
CString strText;
- strText.Format(_T("已运行:%d-%02d-%02d %02d:%02d:%02d %s"),
- time.GetYear(), time.GetMonth(), time.GetDay(),
- time.GetHour(), time.GetMinute(), time.GetSecond(),
- status[index]);
+ GetRuntimeFormatText(strText, status[index]);
m_pMyStatusbar->setRunTimeText((LPTSTR)(LPCTSTR)strText);
}
@@ -750,16 +762,11 @@
theApp.m_model.getMaster().start();
m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(FALSE);
m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(TRUE);
- m_pMyStatusbar->setBkgnd(STATUSBAR_BK_RUNNING);
- SetTimer(TIMER_ID_UPDATE_RUMTIME, 1000, nullptr);
-
}
else if (id == IDC_BUTTON_STOP) {
theApp.m_model.getMaster().stop();
m_pTopToolbar->GetBtn(IDC_BUTTON_RUN)->EnableWindow(TRUE);
m_pTopToolbar->GetBtn(IDC_BUTTON_STOP)->EnableWindow(FALSE);
- m_pMyStatusbar->setBkgnd(STATUSBAR_BK_ALARM);
- KillTimer(TIMER_ID_UPDATE_RUMTIME);
}
else if (id == IDC_BUTTON_ROBOT) {
SERVO::CEFEM* pEFEM = (SERVO::CEFEM*)theApp.m_model.getMaster().getEquipment(EQ_ID_EFEM);
@@ -768,4 +775,23 @@
dlg.DoModal();
}
return 0;
+}
+
+CString& CServoDlg::GetRuntimeFormatText(CString& strText, const char* pszSuffix)
+{
+ ULONGLONG ullRunTime = (ULONGLONG)(theApp.m_model.getMaster().getRunTime() * 0.001);
+ int h, m, s;
+ h = int(ullRunTime / 3600);
+ m = int((ullRunTime % 3600) / 60);
+ s = int(ullRunTime % 60);
+
+ SERVO::MASTERSTATE state = theApp.m_model.getMaster().getState();
+ if (state == SERVO::MASTERSTATE::RUNNING) {
+ strText.Format(_T("正在运行:%02d:%02d:%02d %s"), h, m, s, pszSuffix);
+ }
+ else {
+ strText.Format(_T("已运行:%02d:%02d:%02d %s"), h, m, s, pszSuffix);
+ }
+
+ return strText;
}
\ No newline at end of file
--
Gitblit v1.9.3