LAPTOP-SNT8I5JK\Boounion
2024-12-07 80c5a369c116280921e8d5668e3fcde894668c7e
SourceCode/Bond/BondEq/View/AxisSettingsDlg.cpp
@@ -39,14 +39,14 @@
   m_bReady = FALSE;
   m_bBusy = FALSE;
   m_bErr = FALSE;
   for (int i = 0; i < 9; i++) {
   for (int i = 0; i < BTN_MAX; i++) {
      m_pBlBtns[i] = new CBlButton();
   }
   for (int i = 0; i < 6; i++) {
      m_pBlLabels[i] = new CBLLabel();
   }
   m_nBtnsFlashState6 = 0;
   m_nBtnsFlashState8 = 0;
}
CAxisSettingsDlg::~CAxisSettingsDlg()
@@ -59,7 +59,7 @@
   }
   m_mapFonts.clear();
   for (int i = 0; i < 9; i++) {
   for (int i = 0; i < BTN_MAX; i++) {
      delete m_pBlBtns[i];
   }
@@ -737,6 +737,19 @@
         m_bBusy = CToolUnits::getBit(pData[10 * 2 + 1], 0xB - 8);
         m_bErr = CToolUnits::getBit(pData[10 * 2 + 1], 0xF - 8);
         // 记录按钮刷新状态
         // 6,7,8,9为原点和25个点位状态和完成状态
         // ZR 06.0 和 08.0
         // 回原点运动中,ZR06.0在0和1中切换,回原点完成, 08.0为1
         // 定位1
         // ZR 06.1 和 08.1
         // ...
         int b = 6 * 2;
         m_nBtnsFlashState6 = ((BYTE)pData[b] | (BYTE)pData[b + 1] << 8);
         m_nBtnsFlashState6 |= ((BYTE)pData[b + 2] << 16 | (BYTE)pData[b + 3] << 24);
         m_nBtnsFlashState8 = ((BYTE)pData[b + 4] | (BYTE)pData[b + 5] << 8);
         m_nBtnsFlashState8 |= ((BYTE)pData[b + 6] << 16 | (BYTE)pData[b + 7] << 24);
         PostMessage(ID_MSG_UPDATA_DATA_TO_UI);
      }
   };
@@ -816,39 +829,58 @@
   }
   
   // 按钮初始化
   m_pBlBtns[0]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP1, this);
   m_pBlBtns[1]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP2, this);
   m_pBlBtns[2]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP3, this);
   m_pBlBtns[3]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP4, this);
   m_pBlBtns[4]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP5, this);
   m_pBlBtns[5]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_JOG_ADD, this);
   m_pBlBtns[5]->SetFrameColor(BS_NORMAL, BTN_JOG_FRAME_NORMAL);
   m_pBlBtns[5]->SetFrameColor(BS_HOVER, BTN_JOG_FRAME_HOVER);
   m_pBlBtns[5]->SetFrameColor(BS_PRESS, BTN_JOG_FRAME_PRESS);
   m_pBlBtns[5]->SetBkgndColor(BS_NORMAL, BTN_JOG_BKGND_NORMAL);
   m_pBlBtns[5]->SetBkgndColor(BS_HOVER, BTN_JOG_BKGND_HOVER);
   m_pBlBtns[5]->SetBkgndColor(BS_PRESS, BTN_JOG_BKGND_PRESS);
   m_pBlBtns[6]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_JOG_SUB, this);
   m_pBlBtns[6]->SetFrameColor(BS_NORMAL, BTN_JOG_FRAME_NORMAL);
   m_pBlBtns[6]->SetFrameColor(BS_HOVER, BTN_JOG_FRAME_HOVER);
   m_pBlBtns[6]->SetFrameColor(BS_PRESS, BTN_JOG_FRAME_PRESS);
   m_pBlBtns[6]->SetBkgndColor(BS_NORMAL, BTN_JOG_BKGND_NORMAL);
   m_pBlBtns[6]->SetBkgndColor(BS_HOVER, BTN_JOG_BKGND_HOVER);
   m_pBlBtns[6]->SetBkgndColor(BS_PRESS, BTN_JOG_BKGND_PRESS);
   m_pBlBtns[7]->SubclassDlgItem(IDC_BUTTON_AXIS_SEV, this);
   m_pBlBtns[7]->SetFrameColor(BS_NORMAL, BTN_SEV_FRAME_NORMAL);
   m_pBlBtns[7]->SetFrameColor(BS_HOVER, BTN_SEV_FRAME_HOVER);
   m_pBlBtns[7]->SetFrameColor(BS_PRESS, BTN_SEV_FRAME_PRESS);
   m_pBlBtns[7]->SetBkgndColor(BS_NORMAL, BTN_SEV_BKGND_NORMAL);
   m_pBlBtns[7]->SetBkgndColor(BS_HOVER, BTN_SEV_BKGND_HOVER);
   m_pBlBtns[7]->SetBkgndColor(BS_PRESS, BTN_SEV_BKGND_PRESS);
   m_pBlBtns[8]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_STOP, this);
   m_pBlBtns[8]->SetFrameColor(BS_NORMAL, BTN_STOP_FRAME_NORMAL);
   m_pBlBtns[8]->SetFrameColor(BS_HOVER, BTN_STOP_FRAME_HOVER);
   m_pBlBtns[8]->SetFrameColor(BS_PRESS, BTN_STOP_FRAME_PRESS);
   m_pBlBtns[8]->SetBkgndColor(BS_NORMAL, BTN_STOP_BKGND_NORMAL);
   m_pBlBtns[8]->SetBkgndColor(BS_HOVER, BTN_STOP_BKGND_HOVER);
   m_pBlBtns[8]->SetBkgndColor(BS_PRESS, BTN_STOP_BKGND_PRESS);
   m_pBlBtns[BTN_PAGE1]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP1, this);
   m_pBlBtns[BTN_PAGE2]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP2, this);
   m_pBlBtns[BTN_PAGE3]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP3, this);
   m_pBlBtns[BTN_PAGE4]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP4, this);
   m_pBlBtns[BTN_PAGE5]->SubclassDlgItem(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP5, this);
   m_pBlBtns[BTN_JOG_ADD]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_JOG_ADD, this);
   m_pBlBtns[BTN_JOG_ADD]->SetFrameColor(BS_NORMAL, BTN_JOG_FRAME_NORMAL);
   m_pBlBtns[BTN_JOG_ADD]->SetFrameColor(BS_HOVER, BTN_JOG_FRAME_HOVER);
   m_pBlBtns[BTN_JOG_ADD]->SetFrameColor(BS_PRESS, BTN_JOG_FRAME_PRESS);
   m_pBlBtns[BTN_JOG_ADD]->SetBkgndColor(BS_NORMAL, BTN_JOG_BKGND_NORMAL);
   m_pBlBtns[BTN_JOG_ADD]->SetBkgndColor(BS_HOVER, BTN_JOG_BKGND_HOVER);
   m_pBlBtns[BTN_JOG_ADD]->SetBkgndColor(BS_PRESS, BTN_JOG_BKGND_PRESS);
   m_pBlBtns[BTN_JOG_SUB]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_JOG_SUB, this);
   m_pBlBtns[BTN_JOG_SUB]->SetFrameColor(BS_NORMAL, BTN_JOG_FRAME_NORMAL);
   m_pBlBtns[BTN_JOG_SUB]->SetFrameColor(BS_HOVER, BTN_JOG_FRAME_HOVER);
   m_pBlBtns[BTN_JOG_SUB]->SetFrameColor(BS_PRESS, BTN_JOG_FRAME_PRESS);
   m_pBlBtns[BTN_JOG_SUB]->SetBkgndColor(BS_NORMAL, BTN_JOG_BKGND_NORMAL);
   m_pBlBtns[BTN_JOG_SUB]->SetBkgndColor(BS_HOVER, BTN_JOG_BKGND_HOVER);
   m_pBlBtns[BTN_JOG_SUB]->SetBkgndColor(BS_PRESS, BTN_JOG_BKGND_PRESS);
   m_pBlBtns[BTN_JOG_SEV]->SubclassDlgItem(IDC_BUTTON_AXIS_SEV, this);
   m_pBlBtns[BTN_JOG_SEV]->SetFrameColor(BS_NORMAL, BTN_SEV_FRAME_NORMAL);
   m_pBlBtns[BTN_JOG_SEV]->SetFrameColor(BS_HOVER, BTN_SEV_FRAME_HOVER);
   m_pBlBtns[BTN_JOG_SEV]->SetFrameColor(BS_PRESS, BTN_SEV_FRAME_PRESS);
   m_pBlBtns[BTN_JOG_SEV]->SetBkgndColor(BS_NORMAL, BTN_SEV_BKGND_NORMAL);
   m_pBlBtns[BTN_JOG_SEV]->SetBkgndColor(BS_HOVER, BTN_SEV_BKGND_HOVER);
   m_pBlBtns[BTN_JOG_SEV]->SetBkgndColor(BS_PRESS, BTN_SEV_BKGND_PRESS);
   m_pBlBtns[BTN_JOG_STOP]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_STOP, this);
   m_pBlBtns[BTN_JOG_STOP]->SetFrameColor(BS_NORMAL, BTN_STOP_FRAME_NORMAL);
   m_pBlBtns[BTN_JOG_STOP]->SetFrameColor(BS_HOVER, BTN_STOP_FRAME_HOVER);
   m_pBlBtns[BTN_JOG_STOP]->SetFrameColor(BS_PRESS, BTN_STOP_FRAME_PRESS);
   m_pBlBtns[BTN_JOG_STOP]->SetBkgndColor(BS_NORMAL, BTN_STOP_BKGND_NORMAL);
   m_pBlBtns[BTN_JOG_STOP]->SetBkgndColor(BS_HOVER, BTN_STOP_BKGND_HOVER);
   m_pBlBtns[BTN_JOG_STOP]->SetBkgndColor(BS_PRESS, BTN_STOP_BKGND_PRESS);
   m_pBlBtns[BTN_JOG_OPR]->SubclassDlgItem(IDC_BUTTON_AXIS_TEST_OPR, this);
   m_pBlBtns[BTN_JOG_OPR]->SetFrameColor(BS_NORMAL, BTN_OPR_FRAME_NORMAL);
   m_pBlBtns[BTN_JOG_OPR]->SetFrameColor(BS_HOVER, BTN_OPR_FRAME_HOVER);
   m_pBlBtns[BTN_JOG_OPR]->SetFrameColor(BS_PRESS, BTN_OPR_FRAME_PRESS);
   m_pBlBtns[BTN_JOG_OPR]->SetBkgndColor(BS_NORMAL, BTN_OPR_BKGND_NORMAL);
   m_pBlBtns[BTN_JOG_OPR]->SetBkgndColor(BS_HOVER, BTN_OPR_BKGND_HOVER);
   m_pBlBtns[BTN_JOG_OPR]->SetBkgndColor(BS_PRESS, BTN_OPR_BKGND_PRESS);
   static UINT btnPointIds[] = { IDC_BUTTON_AXIS_ANCHOR_POINT1, IDC_BUTTON_AXIS_ANCHOR_POINT2,
      IDC_BUTTON_AXIS_ANCHOR_POINT3, IDC_BUTTON_AXIS_ANCHOR_POINT4, IDC_BUTTON_AXIS_ANCHOR_POINT5};
   for (int i = 0; i < 5; i++) {
      m_pBlBtns[BTN_POINT1 + i]->SubclassDlgItem(btnPointIds[i], this);
      m_pBlBtns[BTN_POINT1 + i]->SetFrameColor(BS_NORMAL, BTN_POINT_FRAME_NORMAL);
      m_pBlBtns[BTN_POINT1 + i]->SetFrameColor(BS_HOVER, BTN_POINT_FRAME_HOVER);
      m_pBlBtns[BTN_POINT1 + i]->SetFrameColor(BS_PRESS, BTN_POINT_FRAME_PRESS);
      m_pBlBtns[BTN_POINT1 + i]->SetBkgndColor(BS_NORMAL, BTN_POINT_BKGND_NORMAL);
      m_pBlBtns[BTN_POINT1 + i]->SetBkgndColor(BS_HOVER, BTN_POINT_BKGND_HOVER);
      m_pBlBtns[BTN_POINT1 + i]->SetBkgndColor(BS_PRESS, BTN_POINT_BKGND_PRESS);
   }
   // 初始化当前页面为第一页
   m_currentPage = 1;
@@ -1138,6 +1170,7 @@
   handleAxisOperation(AxisOperationType::POSITION_1, true);
   Sleep(200);
   handleAxisOperation(AxisOperationType::POSITION_1, false);
   m_pBlBtns[BTN_POINT1]->Flash(1000);
}
void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint2()
@@ -1186,6 +1219,12 @@
   handleAxisOperation(AxisOperationType::STOP, true);
   Sleep(200);
   handleAxisOperation(AxisOperationType::STOP, false);
   m_pBlBtns[BTN_JOG_OPR]->StopFlash();
   m_pBlBtns[BTN_POINT1]->StopFlash();
   m_pBlBtns[BTN_POINT2]->StopFlash();
   m_pBlBtns[BTN_POINT3]->StopFlash();
   m_pBlBtns[BTN_POINT3]->StopFlash();
   m_pBlBtns[BTN_POINT4]->StopFlash();
}
void CAxisSettingsDlg::OnBnClickedButtonAxisSev()
@@ -1291,6 +1330,82 @@
      SetLabelColor(*m_pBlLabels[5], RGB(0, 180, 0));
   }
   // OPR按钮是否要闪烁或停止闪烁
   // 06.0和08.0
   TRACE("m_nBtnsFlashState6  %x %x\n", m_nBtnsFlashState6, m_nBtnsFlashState8);
   if (m_nBtnsFlashState6 & 0x01) {
      // 06.0
      if (!m_pBlBtns[BTN_JOG_OPR]->IsFlash()) {
         m_pBlBtns[BTN_JOG_OPR]->Flash(1000);
      }
   }
   else if (m_nBtnsFlashState8 & 0x01) {
      if (m_pBlBtns[BTN_JOG_OPR]->IsFlash()) {
         m_pBlBtns[BTN_JOG_OPR]->StopFlash();
      }
   }
   int v = 0x02;
   if (m_currentPage > 1) {
      v = v << (5 * (m_currentPage - 1));
   }
   if (m_nBtnsFlashState6 & v) {
      if (!m_pBlBtns[BTN_POINT1]->IsFlash()) {
         m_pBlBtns[BTN_POINT1]->Flash(1000);
      }
   }
   else if (m_nBtnsFlashState8 & v) {
      if (m_pBlBtns[BTN_POINT1]->IsFlash()) {
         m_pBlBtns[BTN_POINT1]->StopFlash();
      }
   }
   if (m_nBtnsFlashState6 & (v << 1)) {
      if (!m_pBlBtns[BTN_POINT2]->IsFlash()) {
         m_pBlBtns[BTN_POINT2]->Flash(1000);
      }
   }
   else if (m_nBtnsFlashState8 & (v << 1)) {
      if (m_pBlBtns[BTN_POINT2]->IsFlash()) {
         m_pBlBtns[BTN_POINT2]->StopFlash();
      }
   }
   if (m_nBtnsFlashState6 & (v << 2)) {
      if (!m_pBlBtns[BTN_POINT3]->IsFlash()) {
         m_pBlBtns[BTN_POINT3]->Flash(1000);
      }
   }
   else if (m_nBtnsFlashState8 & (v << 2)) {
      if (m_pBlBtns[BTN_POINT3]->IsFlash()) {
         m_pBlBtns[BTN_POINT3]->StopFlash();
      }
   }
   if (m_nBtnsFlashState6 & (v << 3)) {
      if (!m_pBlBtns[BTN_POINT4]->IsFlash()) {
         m_pBlBtns[BTN_POINT4]->Flash(1000);
      }
   }
   else if (m_nBtnsFlashState8 & (v << 3)) {
      if (m_pBlBtns[BTN_POINT4]->IsFlash()) {
         m_pBlBtns[BTN_POINT4]->StopFlash();
      }
   }
   if (m_nBtnsFlashState6 & (v << 4)) {
      if (!m_pBlBtns[BTN_POINT5]->IsFlash()) {
         m_pBlBtns[BTN_POINT5]->Flash(1000);
      }
   }
   else if (m_nBtnsFlashState8 & (v << 4)) {
      if (m_pBlBtns[BTN_POINT5]->IsFlash()) {
         m_pBlBtns[BTN_POINT5]->StopFlash();
      }
   }
   return 0;
}