diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log index c27ca05..6678e01 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Debug/UtilityDebug.Log @@ -1159,3 +1159,60 @@ Construct Cso7_Proto. Destruct Cso7_Proto. Construct Cso7_Proto. Destruct Cso7_Proto. +Construct Cso7_Proto. +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. +Construct Cso7_Proto. +Init:Open device succeed . +_start_machine +Exit: Exit_SO7Usb +Destruct Cso7_Proto. diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/DrawGraph.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/DrawGraph.cpp index 831bde3..01576ab 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/DrawGraph.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/DrawGraph.cpp @@ -2,6 +2,7 @@ // #include "stdafx.h" +#include #include "DrawGraph.h" @@ -87,6 +88,12 @@ void CDrawGraph::SetViewFont(const CString& strFont, int nPointSize, int nWeight Invalidate(); } //======================================================== +void CDrawGraph::SetCoordinateLabel(const CString& _XAxis,const CString& _YAxis) +{ + m_XAxisLabel=_XAxis; + m_YAxisLabel=_YAxis; +} +//======================================================== void CDrawGraph::SetMargin(int nLeft, int nTop, int nRight, int nBottom, BOOL bIsRedraw) { m_nMarginLeft = nLeft; @@ -125,7 +132,26 @@ void CDrawGraph::SetResolution(double dbResolutionX, double dbResolutionY, BOOL Invalidate(); } //======================================================== -void CDrawGraph::LoadGraphyData(DataBuff& dataShow) +void CDrawGraph::LoadGraphyXAxisData(DataBuff& dataShow) +{ + double dbData; + INT_PTR nCount = dataShow.GetCount(); + + if(nCount==0) + return; + + m_dataGraphX.RemoveAll(); + m_dataGraphX.SetSize(nCount); + for(int i=0; iSelectObject (&font); - pDC->TextOut(rectCoord.left-40,rectCoord.top+(rectCoord.Height()/2)+30,_T("速度(mm/s)"));//旋转90°输出 + pDC->TextOut(rectCoord.left-40,rectCoord.top+(rectCoord.Height()/2)+30,m_YAxisLabel);//旋转90°输出 pDC->SelectObject (pOldFont); - pDC->TextOut(rectCoord.left-20+(rectCoord.Width()/2),rectCoord.bottom+15,_T("时间(s)")); + pDC->TextOut(rectCoord.left-20+(rectCoord.Width()/2),rectCoord.bottom+15,m_XAxisLabel); nOffset = 4; rectTemp.SetRect(rectCoord.left+nOffset, rectCoord.top+1, rectCoord.right, rectCoord.bottom-nOffset); @@ -226,18 +252,18 @@ void CDrawGraph::DrawActualCurve(CDC *pDC, CRect rectCoord) CRect rectView; CRgn rgnTemp, rgnView; CPen penLine, *pOldPen; - INT_PTR nCount = m_dataGraph.GetCount(); + INT_PTR nCount = m_dataGraphY.GetCount(); if(nCount==0) return; double dbData(0.0); int nOffsetX(0), nOffsetY(0),nOriginX(0),nOriginY(0); - dbData = m_dataGraph.ElementAt(0); + dbData = m_dataGraphY.ElementAt(0); nOriginX = rectCoord.left; nOriginY = rectCoord.bottom;; nOffsetX = static_cast(m_dbResolutionX*(rectCoord.Width())); - nOffsetY = static_cast(m_dbResolutionY*(rectCoord.Height())*dbData); + nOffsetY = static_cast(m_dbResolutionY*(rectCoord.Height())*(dbData-m_dbStartY)); rgnTemp.CreateRectRgnIndirect(rectCoord); pDC->SelectObject(rgnTemp); @@ -249,8 +275,8 @@ void CDrawGraph::DrawActualCurve(CDC *pDC, CRect rectCoord) for(int i=1; i(m_dbResolutionY*(rectCoord.Height())*dbData); + dbData = m_dataGraphY.ElementAt(i); + nOffsetY = static_cast(m_dbResolutionY*(rectCoord.Height())*(dbData-m_dbStartY)); pDC->LineTo(nOriginX+nOffsetX*i, nOriginY-nOffsetY); } @@ -265,7 +291,7 @@ void CDrawGraph::DrawIdealCurve(CDC *pDC, CRect rectCoord) CRect rectView; CRgn rgnTemp, rgnView; CPen penLine, *pOldPen; - INT_PTR nCount = m_dataGraph.GetCount(); + INT_PTR nCount = m_dataGraphY.GetCount(); if(nCount==0) return; @@ -285,13 +311,13 @@ void CDrawGraph::DrawIdealCurve(CDC *pDC, CRect rectCoord) penLine.CreatePen(PS_SOLID, 1, m_clrWave); pOldPen = pDC->SelectObject(&penLine); - dbData = m_dataGraph.ElementAt(0); + dbData = m_dataGraphY.ElementAt(0); nOffsetY = int(nCoordHeight*dbData/nRangY); pDC->MoveTo(nOriginX, nOriginY-nOffsetY); for(int i=1; iGetWindowRect(&CanvasRect); + //CanvasRect.SetRect(550,50,1100,600);//L T R B + +}; +//================================================================================================ +BOOL CSO7_Send_Parameter::OnEraseBkgnd(CDC* pDC) +{ + //UNREFERENCED_PARAMETER(pDC); + //return TRUE; + return CDialog::OnEraseBkgnd(pDC); +} + //================================================================ void CSO7_Send_Parameter::OnBnClickedOk() { KillTimer(1); CDialog::OnOK(); } +#pragma region Send_Parameter + //================================================================ void CSO7_Send_Parameter::OnBnClickedButtonBrowse() { @@ -467,156 +488,9 @@ void CSO7_Send_Parameter::ShowParameterOnEdit() UpdateData(FALSE); } +#pragma endregion -//================================================================ -void CSO7_Send_Parameter::OnDraw(CDC* pDC) -{ - UNREFERENCED_PARAMETER(pDC); - //CWnd* m_p=(CWnd*)GetDlgItem(IDC_STATIC_CANVAS); - //m_p->GetWindowRect(&CanvasRect); - //CanvasRect.SetRect(550,50,1100,600);//L T R B - -}; - - -//================================================================================================ -void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent) -{ - USES_CONVERSION; - switch(nIDEvent) - { - case 1: - { - if (m_pSO7_Proto) - { - if (m_pSO7_Proto->g_machine.s_status._machine_running) - { - m_pSO7_Proto->_send_cmd_SO7_CMD_READ_AXIS_XYZ(); - - if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck()) - { - if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->GetCheck()) - { - m_pSO7_Proto->g_machine.x._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.x._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); - m_FinishTime=clock(); - m_duration=m_FinishTime-m_StartTime; - m_dataGraph.Add(m_pSO7_Proto->g_machine.x._d_cur_pos_); - if((abs(m_pSO7_Proto->g_machine.x._d_cur_pos_)-abs(m_dPos))<0.0) - { - m_csMSG.Format(_T("X Reverse;%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.x._d_cur_pos_); - OutputWithScroll(m_csMSG,m_edMSG); - } - else - { - m_csMSG.Format(_T("X Normal;%f->%f"),m_dPos,m_pSO7_Proto->g_machine.x._d_cur_pos_); - OutputWithScroll(m_csMSG,m_edMSG); - } - m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_; - } - else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck()) - { - m_pSO7_Proto->g_machine.y._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.y._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); - m_FinishTime=clock(); - m_duration=m_FinishTime-m_StartTime; - m_dataGraph.Add(m_pSO7_Proto->g_machine.y._d_cur_pos_); - if((abs(m_pSO7_Proto->g_machine.y._d_cur_pos_)-abs(m_dPos))<0.0) - { - m_csMSG.Format(_T("Y Reverse;%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.y._d_cur_pos_); - OutputWithScroll(m_csMSG,m_edMSG); - } - else - { - m_csMSG.Format(_T("Y Normal;%f->%f"),m_dPos,m_pSO7_Proto->g_machine.y._d_cur_pos_); - OutputWithScroll(m_csMSG,m_edMSG); - } - m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_; - } - else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck()) - { - m_pSO7_Proto->g_machine.z._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.z._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); - m_FinishTime=clock(); - m_duration=m_FinishTime-m_StartTime; - m_dataGraph.Add(m_pSO7_Proto->g_machine.z._d_cur_pos_); - if((abs(m_pSO7_Proto->g_machine.z._d_cur_pos_)-abs(m_dPos))<0.0) - { - m_csMSG.Format(_T("Z Reverse;%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.z._d_cur_pos_); - OutputWithScroll(m_csMSG,m_edMSG); - } - else - { - m_csMSG.Format(_T("Z Normal;%f->%f"),m_dPos,m_pSO7_Proto->g_machine.z._d_cur_pos_); - OutputWithScroll(m_csMSG,m_edMSG); - } - m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_; - } - - if(nCount!=0) - {if (abs(m_dataGraph.ElementAt(nCount)-m_dataGraph.ElementAt(nCount-1))<0.000001) - { - m_DrawGraph.LoadGraphyData(m_dataGraph); - KillTimer(1); - }} - } - else - { - if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->GetCheck()) - { - m_pSO7_Proto->g_machine.x._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.x._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); - m_FinishTime=clock(); - m_duration=m_FinishTime-m_StartTime; - m_dataGraph.Add(static_cast(((1000.0*(fabs(m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)))/m_duration))); - m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_; - } - else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck()) - { - m_pSO7_Proto->g_machine.y._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.y._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); - m_FinishTime=clock(); - m_duration=m_FinishTime-m_StartTime; - m_dataGraph.Add(static_cast(1000.0*(fabs(m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)/m_duration))); - m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_; - } - else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck()) - { - m_pSO7_Proto->g_machine.z._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.z._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); - m_FinishTime=clock(); - m_duration=m_FinishTime-m_StartTime; - m_dataGraph.Add(static_cast(1000.0*(fabs(m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)/m_duration))); - m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_; - } - - if (m_TimerCnt<=nCount) - { - KillTimer(1); - INT_PTR nTmpCount = m_dataGraph.GetCount(); - double dbData(0.0); - m_dbEndY=dbData; - m_dbStartY=dbData; - for(int i=0; im_dbEndY) - m_dbEndY=dbData; - if(dbData(1/(m_dbEndY-m_dbStartY)); - m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY); - m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY); - m_DrawGraph.LoadGraphyData(m_dataGraph); - } - - } - - nCount++; - m_StartTime=clock(); - } - } - break; - } - } - - CDialog::OnTimer(nIDEvent); -} +//#pragma region Sample_Motion_Curve //================================================================================================ void CSO7_Send_Parameter::OnEnKillfocusEditSampleScurveDis() @@ -629,6 +503,14 @@ void CSO7_Send_Parameter::OnEnKillfocusEditSampleScurveDis() const char* cTempValue=T2A(str); m_dMoveDis = atof(cTempValue); + if (m_dMoveDis<0) + { + m_MotionDir=false; + } + else + { + m_MotionDir=true; + } } @@ -643,11 +525,27 @@ void CSO7_Send_Parameter::OnEnKillfocusEditSampleTimeScurve() const char* cTempValue=T2A(str); m_SampleTime = atof(cTempValue); - m_dbStartX=0; - m_dbEndX=m_SampleTime; - m_dbResolutionX=static_cast(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度 - m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY); - m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY,TRUE); + if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck()) + { + m_dbStartX=0; + m_dbEndX=m_SampleTime; + m_dbResolutionX=static_cast(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度 + m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY); + m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY,TRUE); + } + else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck()) + { + m_dbStartX=0; + m_dbEndX=m_SampleTime; + m_dbResolutionX=static_cast(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度 + m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY); + m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY,TRUE); + } + else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_POSTION))->GetCheck()) + { + ; + } + } //================================================================================================ @@ -676,14 +574,19 @@ void CSO7_Send_Parameter::OnBnClickedButtonStartSampleScurve() m_dbEndX=m_SampleTime; if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck()) { - // m_dbStartY=0; - // m_dbEndY=50; m_dbResolutionX=static_cast(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度 - // m_dbResolutionY=static_cast(1/m_dbEndY); m_nDivisionX=10; m_nDivisionY=10; + m_DrawGraph.SetCoordinateLabel(_T("时间(s)"),_T("位置(mm)")); } - else + else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck()) + { + m_dbResolutionX=static_cast(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度 + m_nDivisionX=10; + m_nDivisionY=10; + m_DrawGraph.SetCoordinateLabel(_T("时间(s)"),_T("速度(mm/s)")); + } + else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_POSTION))->GetCheck()) { //m_dbStartY=0; //m_dbEndY=50; @@ -691,11 +594,11 @@ void CSO7_Send_Parameter::OnBnClickedButtonStartSampleScurve() //m_dbResolutionY=static_cast(1/m_dbEndY); m_nDivisionX=10; m_nDivisionY=10; + m_DrawGraph.SetCoordinateLabel(_T("位置(mm)"),_T("速度(mm/s)")); } - nCount=0; - m_dataGraph.RemoveAll(); + m_dataGraphY.RemoveAll(); m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY); m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY); m_TimerCnt=static_cast((m_SampleTime*1000)/m_TimerInterval); @@ -709,20 +612,225 @@ void CSO7_Send_Parameter::OnBnClickedButtonStopSampleScurve() { m_TimerCnt=0; } +//================================================================================================ +void CSO7_Send_Parameter::Sample_Speed_Time_Curve() +{ + if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->GetCheck()) + { + m_pSO7_Proto->g_machine.x._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.x._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(static_cast(((1000.0*(fabs(m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)))/m_duration))); + m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_; + } + else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck()) + { + m_pSO7_Proto->g_machine.y._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.y._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(static_cast(1000.0*(fabs(m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)/m_duration))); + m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_; + } + else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck()) + { + m_pSO7_Proto->g_machine.z._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.z._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(static_cast(1000.0*(fabs(m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)/m_duration))); + m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_; + } +}; //================================================================================================ -BOOL CSO7_Send_Parameter::OnEraseBkgnd(CDC* pDC) +void CSO7_Send_Parameter::Sample_Position_Time_Curve() { - //UNREFERENCED_PARAMETER(pDC); - //return TRUE; - return CDialog::OnEraseBkgnd(pDC); -} - -void CSO7_Send_Parameter::OnBnClickedRadioCanvasSpeedTime() -{ - // TODO: Add your control notification handler code here + if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->GetCheck()) + { + m_pSO7_Proto->g_machine.x._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.x._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(m_pSO7_Proto->g_machine.x._d_cur_pos_); + if (m_MotionDir) + { + if((m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)<0.0) + { + m_csMSG.Format(_T("X Reverse:%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.x._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + else + { + m_csMSG.Format(_T("X Normal:%f->%f"),m_dPos,m_pSO7_Proto->g_machine.x._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + } + else + { + if((m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)>0.0) + { + m_csMSG.Format(_T("X Reverse:%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.x._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + else + { + m_csMSG.Format(_T("X Normal:%f->%f"),m_dPos,m_pSO7_Proto->g_machine.x._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + } + m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_; + } + else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck()) + { + m_pSO7_Proto->g_machine.y._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.y._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(m_pSO7_Proto->g_machine.y._d_cur_pos_); + if (m_MotionDir) + { + if((m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)<0.0) + { + m_csMSG.Format(_T("Y Reverse:%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.y._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + else + { + m_csMSG.Format(_T("Y Normal:%f->%f"),m_dPos,m_pSO7_Proto->g_machine.y._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + } + else + { + if((m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)>0.0) + { + m_csMSG.Format(_T("Y Reverse:%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.y._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + else + { + m_csMSG.Format(_T("Y Normal:%f->%f"),m_dPos,m_pSO7_Proto->g_machine.y._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + } + + m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_; + } + else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck()) + { + m_pSO7_Proto->g_machine.z._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.z._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(m_pSO7_Proto->g_machine.z._d_cur_pos_); + if (m_MotionDir) + { + if((m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)<0.0) + { + m_csMSG.Format(_T("Z Reverse:%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.z._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + else + { + m_csMSG.Format(_T("Z Normal:%f->%f"),m_dPos,m_pSO7_Proto->g_machine.z._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + } + else + { + if((m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)>0.0) + { + m_csMSG.Format(_T("Z Reverse:%f->%f!!!"),m_dPos,m_pSO7_Proto->g_machine.z._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + else + { + m_csMSG.Format(_T("Z Normal:%f->%f"),m_dPos,m_pSO7_Proto->g_machine.z._d_cur_pos_); + OutputWithScroll(m_csMSG,m_edMSG); + } + } + m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_; + } + +}; +//================================================================================================ +void CSO7_Send_Parameter::Sample_Speed_Position_Curve() +{ + if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->GetCheck()) + { + m_pSO7_Proto->g_machine.x._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.x._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.x_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(static_cast(((1000.0*(fabs(m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)))/m_duration))); + m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_; + } + else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck()) + { + m_pSO7_Proto->g_machine.y._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.y._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.y_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(static_cast(1000.0*(fabs(m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)/m_duration))); + m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_; + } + else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck()) + { + m_pSO7_Proto->g_machine.z._d_cur_pos_ = m_pSO7_Proto->ScaleToMM(m_pSO7_Proto->g_machine.z._scale_pos._long_, m_pSO7_Proto->g_machine.s_machine_config.z_axis._scale_resolution); + m_duration=m_FinishTime-m_StartTime; + m_dataGraphY.Add(static_cast(1000.0*(fabs(m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)/m_duration))); + m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_; + } +}; +//================================================================================================ +void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent) +{ + USES_CONVERSION; + switch(nIDEvent) + { + case 1: + { + if (m_pSO7_Proto) + { + if (m_pSO7_Proto->g_machine.s_status._machine_running) + { + m_pSO7_Proto->_send_cmd_SO7_CMD_READ_AXIS_XYZ(); + m_FinishTime=clock(); + if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck()) + { + Sample_Speed_Time_Curve(); + } + else if (((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_POSTION))->GetCheck()) + { + Sample_Speed_Position_Curve(); + } + else if (((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck()) + { + Sample_Position_Time_Curve(); + } + if (m_TimerCnt<=nCount) + { + KillTimer(1); + INT_PTR nTmpCount = m_dataGraphY.GetCount(); + double dbData(0.0); + dbData = m_dataGraphY.ElementAt(0); + m_dbEndY=dbData; + m_dbStartY=dbData; + for(INT_PTR i=10; i0.0 &&(dbData-m_dbEndY)0.0 &&(m_dbStartY-dbData)(1.0/(m_dbEndY-m_dbStartY)); + m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY); + m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY); + m_DrawGraph.LoadGraphyYAxisData(m_dataGraphY); + } + + nCount++; + m_StartTime=clock(); + } + + + } + break; + } + } + + CDialog::OnTimer(nIDEvent); } +//#pragma endregion //===================================================================================== //Print message on edit control void CSO7_Send_Parameter::OutputWithScroll(const CString &strNewText,CEdit &edtOutput) diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Send_Parameter.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Send_Parameter.h index 59c5498..7f9d537 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Send_Parameter.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/SO7_Send_Parameter.h @@ -7,93 +7,98 @@ class CSO7_Send_Parameter : public CDialog { - DECLARE_DYNAMIC(CSO7_Send_Parameter) + DECLARE_DYNAMIC(CSO7_Send_Parameter) public: - CSO7_Send_Parameter(CWnd* pParent = NULL); // standard constructor - virtual ~CSO7_Send_Parameter(); + CSO7_Send_Parameter(CWnd* pParent = NULL); // standard constructor + virtual ~CSO7_Send_Parameter(); -// Dialog Data - enum { IDD = IDD_S07_UTIL_SEND_PARAMETER }; + // Dialog Data + enum { IDD = IDD_S07_UTIL_SEND_PARAMETER }; protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - virtual BOOL OnInitDialog(); + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnInitDialog(); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnPaint(); void OnDraw(CDC* pDC); afx_msg BOOL OnEraseBkgnd(CDC* pDC); - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() public: - clock_t m_StartTime, m_FinishTime; - double m_duration; - CString m_csMSG; - CEdit m_edMSG; - DataBuff m_dataGraph; - CDrawGraph m_DrawGraph; - double m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY; - int m_nDivisionX,m_nDivisionY; - int nCount; - double m_StartPos,m_dPos,m_dMoveDis; - double m_SampleTime; - int m_TimerInterval; - double m_dbResolutionX,m_dbResolutionY; - CRect CanvasRect; - int m_TimerCnt; + clock_t m_StartTime, m_FinishTime; + double m_duration; + CString m_csMSG; + CEdit m_edMSG; + DataBuff m_dataGraphX; + DataBuff m_dataGraphY; + CDrawGraph m_DrawGraph; + double m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY; + int m_nDivisionX,m_nDivisionY; + int nCount; + double m_StartPos,m_dPos,m_dMoveDis; + double m_SampleTime; + int m_TimerInterval; + double m_dbResolutionX,m_dbResolutionY; + CRect CanvasRect; + int m_TimerCnt; + bool m_MotionDir; public: - CString m_csBaseSpeedX[5]; - CString m_csMaxSpeedX[5]; - CString m_csStartSpeedX[5]; - CString m_csFreshSpeedX[5]; - CString m_csSlowDisX[5]; + CString m_csBaseSpeedX[5]; + CString m_csMaxSpeedX[5]; + CString m_csStartSpeedX[5]; + CString m_csFreshSpeedX[5]; + CString m_csSlowDisX[5]; - CString m_csBaseSpeedY[5]; - CString m_csMaxSpeedY[5]; - CString m_csStartSpeedY[5]; - CString m_csFreshSpeedY[5]; - CString m_csSlowDisY[5]; + CString m_csBaseSpeedY[5]; + CString m_csMaxSpeedY[5]; + CString m_csStartSpeedY[5]; + CString m_csFreshSpeedY[5]; + CString m_csSlowDisY[5]; - CString m_csBaseSpeedZ[5]; - CString m_csMaxSpeedZ[5]; - CString m_csStartSpeedZ[5]; - CString m_csFreshSpeedZ[5]; - CString m_csSlowDisZ[5]; + CString m_csBaseSpeedZ[5]; + CString m_csMaxSpeedZ[5]; + CString m_csStartSpeedZ[5]; + CString m_csFreshSpeedZ[5]; + CString m_csSlowDisZ[5]; - CString m_csWheelbaseX; - CString m_csWheelbaseY; - CString m_csWheelbaseZ; - CString m_csPulseNum; + CString m_csWheelbaseX; + CString m_csWheelbaseY; + CString m_csWheelbaseZ; + CString m_csPulseNum; - CString m_csPercisionX; - CString m_csPercisionY; - CString m_csPercisionZ; + CString m_csPercisionX; + CString m_csPercisionY; + CString m_csPercisionZ; - CString m_csNegWorkLimitX; - CString m_csNegWorkLimitY; - CString m_csNegWorkLimitZ; + CString m_csNegWorkLimitX; + CString m_csNegWorkLimitY; + CString m_csNegWorkLimitZ; - CString m_csPosWorkLimitX; - CString m_csPosWorkLimitY; - CString m_csPosWorkLimitZ; + CString m_csPosWorkLimitX; + CString m_csPosWorkLimitY; + CString m_csPosWorkLimitZ; - CStatusBarCtrl m_StatusBar; + CStatusBarCtrl m_StatusBar; - void ShowParameterOnEdit(); - void ChangeParameterOnEdit(); + void ShowParameterOnEdit(); + void ChangeParameterOnEdit(); - afx_msg void OnBnClickedOk(); - afx_msg void OnBnClickedButtonBrowse(); - CString m_csIniFile; - CString m_IniFile; - afx_msg void OnBnClickedButtonSaveParameter(); - afx_msg void OnBnClickedButtonSave(); - afx_msg void OnBnClickedButtonReadParameterFromController(); + afx_msg void OnBnClickedOk(); + afx_msg void OnBnClickedButtonBrowse(); + CString m_csIniFile; + CString m_IniFile; + afx_msg void OnBnClickedButtonSaveParameter(); + afx_msg void OnBnClickedButtonSave(); + afx_msg void OnBnClickedButtonReadParameterFromController(); afx_msg void OnEnKillfocusEditSampleScurveDis(); afx_msg void OnEnKillfocusEditSampleTimeScurve(); afx_msg void OnBnClickedButtonStartSampleScurve(); afx_msg void OnBnClickedButtonStopSampleScurve(); - afx_msg void OnBnClickedRadioCanvasSpeedTime(); + void Sample_Speed_Time_Curve(); + void Sample_Speed_Position_Curve(); + void Sample_Position_Time_Curve(); + void OutputWithScroll(const CString &strNewText,CEdit &edtOutput); }; diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Option.cpp b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Option.cpp index 3265655..199aebe 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Option.cpp +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/So7_Option.cpp @@ -37,7 +37,7 @@ #include "So7_Option.h" #include "afxdialogex.h" -//#define _RELEASE_ONLY_ONE_FUNCTION +#define _RELEASE_ONLY_ONE_FUNCTION //CSerial* m_pSO7_Serial=NULL; CPSerial* m_pSO7_PCDSerial=NULL; @@ -100,13 +100,13 @@ BOOL CSo7_Option::OnInitDialog() } } - ((CButton *)GetDlgItem(IDC_RADIO_CONTROLLER))->SetCheck(FALSE); + ((CButton *)GetDlgItem(IDC_RADIO_CONTROLLER))->SetCheck(TRUE); ((CButton *)GetDlgItem(IDC_RADIO_VIDEOCARD_SDK3000))->SetCheck(FALSE); ((CButton *)GetDlgItem(IDC_RADIO_VIDEOCARD_SV2000E))->SetCheck(FALSE); ((CButton *)GetDlgItem(IDC_RADIO_VIDEOCARD_TC4000))->SetCheck(FALSE); ((CButton *)GetDlgItem(IDC_RADIO_KEYENCE_LASER))->SetCheck(FALSE); ((CButton *)GetDlgItem(IDC_RADIO_SO7_IP_CAMERA))->SetCheck(FALSE); - ((CButton *)GetDlgItem(IDC_RADIO__SO7_RS232))->SetCheck(TRUE); + ((CButton *)GetDlgItem(IDC_RADIO__SO7_RS232))->SetCheck(FALSE); ((CButton *)GetDlgItem(IDC_RADIO_SO7_VERIFICATION_ALGORITHM))->SetCheck(FALSE); #ifdef _RELEASE_ONLY_ONE_FUNCTION diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h index 2142cb7..f0abb82 100644 --- a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h +++ b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/resource.h @@ -744,8 +744,9 @@ #define IDC_EDIT_TEST_KEYENCE_SETFOCUS 1650 #define IDC_RADIO_SO7_VERIFICATION_ALGORITHM 1651 #define IDC_BUTTON_SO7_MANUAL_MACHINEREAD_POS 1652 -#define IDC_RADIO1 1653 #define IDC_RADIO_SO7_MANUAL_MACHINE_COMMON_CMD4 1653 +#define IDC_RADIO1 1654 +#define IDC_RADIO_CANVAS_SPEED_POSTION 1654 // Next default values for new objects // @@ -753,7 +754,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 168 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1654 +#define _APS_NEXT_CONTROL_VALUE 1655 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo index 7d30dc7..98f93e1 100644 Binary files a/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo and b/PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil_VS2010.suo differ