完善运动曲线图的显示
This commit is contained in:
@@ -1216,3 +1216,28 @@ Init:Open device succeed .
|
|||||||
|
|
||||||
Destruct 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
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ void CDrawGraph::LoadGraphyXAxisData(DataBuff& dataShow)
|
|||||||
|
|
||||||
m_dataGraphX.SetAt(i, dbData);
|
m_dataGraphX.SetAt(i, dbData);
|
||||||
}
|
}
|
||||||
Invalidate();
|
//Invalidate();
|
||||||
}
|
}
|
||||||
//========================================================
|
//========================================================
|
||||||
void CDrawGraph::LoadGraphyYAxisData(DataBuff& dataShow)
|
void CDrawGraph::LoadGraphyYAxisData(DataBuff& dataShow)
|
||||||
@@ -178,6 +178,7 @@ void CDrawGraph::AddGraphyData(double _data)
|
|||||||
//=======================================================
|
//=======================================================
|
||||||
void CDrawGraph::RemoveGraphyData(BOOL bIsRedraw)
|
void CDrawGraph::RemoveGraphyData(BOOL bIsRedraw)
|
||||||
{
|
{
|
||||||
|
m_dataGraphX.RemoveAll();
|
||||||
m_dataGraphY.RemoveAll();
|
m_dataGraphY.RemoveAll();
|
||||||
if(bIsRedraw)
|
if(bIsRedraw)
|
||||||
Invalidate();
|
Invalidate();
|
||||||
@@ -252,18 +253,19 @@ void CDrawGraph::DrawActualCurve(CDC *pDC, CRect rectCoord)
|
|||||||
CRect rectView;
|
CRect rectView;
|
||||||
CRgn rgnTemp, rgnView;
|
CRgn rgnTemp, rgnView;
|
||||||
CPen penLine, *pOldPen;
|
CPen penLine, *pOldPen;
|
||||||
INT_PTR nCount = m_dataGraphY.GetCount();
|
INT_PTR nCountX = m_dataGraphX.GetCount();
|
||||||
|
INT_PTR nCountY = m_dataGraphY.GetCount();
|
||||||
|
|
||||||
if(nCount==0)
|
if(nCountX==0 || nCountY==0 || nCountX<nCountY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dbData(0.0);
|
double dbDataX(0.0),dbDataY(0.0);
|
||||||
int nOffsetX(0), nOffsetY(0),nOriginX(0),nOriginY(0);
|
int nOffsetX(0), nOffsetY(0),nOriginX(0),nOriginY(0);
|
||||||
dbData = m_dataGraphY.ElementAt(0);
|
dbDataY = m_dataGraphY.ElementAt(0);
|
||||||
nOriginX = rectCoord.left;
|
nOriginX = rectCoord.left;
|
||||||
nOriginY = rectCoord.bottom;;
|
nOriginY = rectCoord.bottom;;
|
||||||
nOffsetX = static_cast<int>(m_dbResolutionX*(rectCoord.Width()));
|
nOffsetX = static_cast<int>(m_dbResolutionX*(rectCoord.Width())*(dbDataX-m_dbStartX));
|
||||||
nOffsetY = static_cast<int>(m_dbResolutionY*(rectCoord.Height())*(dbData-m_dbStartY));
|
nOffsetY = static_cast<int>(m_dbResolutionY*(rectCoord.Height())*(dbDataY-m_dbStartY));
|
||||||
|
|
||||||
rgnTemp.CreateRectRgnIndirect(rectCoord);
|
rgnTemp.CreateRectRgnIndirect(rectCoord);
|
||||||
pDC->SelectObject(rgnTemp);
|
pDC->SelectObject(rgnTemp);
|
||||||
@@ -271,14 +273,15 @@ void CDrawGraph::DrawActualCurve(CDC *pDC, CRect rectCoord)
|
|||||||
pOldPen = pDC->SelectObject(&penLine);
|
pOldPen = pDC->SelectObject(&penLine);
|
||||||
|
|
||||||
|
|
||||||
pDC->MoveTo(nOriginX, nOriginY-nOffsetY);
|
pDC->MoveTo(nOriginX+nOffsetX, nOriginY-nOffsetY);
|
||||||
|
|
||||||
for(int i=1; i<nCount; i++)
|
for(int i=1; i<nCountY; i++)
|
||||||
{
|
{
|
||||||
dbData = m_dataGraphY.ElementAt(i);
|
dbDataX = m_dataGraphX.ElementAt(i);
|
||||||
nOffsetY = static_cast<int>(m_dbResolutionY*(rectCoord.Height())*(dbData-m_dbStartY));
|
dbDataY = m_dataGraphY.ElementAt(i);
|
||||||
|
nOffsetX = static_cast<int>(m_dbResolutionX*(rectCoord.Width())*(dbDataX-m_dbStartX));
|
||||||
pDC->LineTo(nOriginX+nOffsetX*i, nOriginY-nOffsetY);
|
nOffsetY = static_cast<int>(m_dbResolutionY*(rectCoord.Height())*(dbDataY-m_dbStartY));
|
||||||
|
pDC->LineTo(nOriginX+nOffsetX, nOriginY-nOffsetY);
|
||||||
}
|
}
|
||||||
pDC->SelectObject(pOldPen);
|
pDC->SelectObject(pOldPen);
|
||||||
GetClientRect(rectView);
|
GetClientRect(rectView);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ IMPLEMENT_DYNAMIC(CSO7_Send_Parameter, CDialog)
|
|||||||
m_duration=0.0;
|
m_duration=0.0;
|
||||||
m_TimerCnt=0;
|
m_TimerCnt=0;
|
||||||
m_MotionDir=true;
|
m_MotionDir=true;
|
||||||
|
m_DataXAxis=0.0;
|
||||||
}
|
}
|
||||||
//================================================================
|
//================================================================
|
||||||
CSO7_Send_Parameter::~CSO7_Send_Parameter()
|
CSO7_Send_Parameter::~CSO7_Send_Parameter()
|
||||||
@@ -527,17 +528,15 @@ void CSO7_Send_Parameter::OnEnKillfocusEditSampleTimeScurve()
|
|||||||
m_SampleTime = atof(cTempValue);
|
m_SampleTime = atof(cTempValue);
|
||||||
if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck())
|
if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck())
|
||||||
{
|
{
|
||||||
m_dbStartX=0;
|
m_dbEndX=m_SampleTime*1000.0;
|
||||||
m_dbEndX=m_SampleTime;
|
m_dbResolutionX=static_cast<double>(1.0/(m_dbEndX-m_dbStartX));
|
||||||
m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
|
||||||
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
||||||
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY,TRUE);
|
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())
|
else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck())
|
||||||
{
|
{
|
||||||
m_dbStartX=0;
|
m_dbEndX=m_SampleTime*1000.0;
|
||||||
m_dbEndX=m_SampleTime;
|
m_dbResolutionX=static_cast<double>(1.0/(m_dbEndX-m_dbStartX));
|
||||||
m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
|
||||||
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
||||||
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY,TRUE);
|
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY,TRUE);
|
||||||
}
|
}
|
||||||
@@ -570,35 +569,35 @@ void CSO7_Send_Parameter::OnBnClickedButtonStartSampleScurve()
|
|||||||
m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_;
|
m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dbStartX=0;
|
|
||||||
m_dbEndX=m_SampleTime;
|
|
||||||
if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck())
|
|
||||||
{
|
|
||||||
m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
|
||||||
m_nDivisionX=10;
|
m_nDivisionX=10;
|
||||||
m_nDivisionY=10;
|
m_nDivisionY=10;
|
||||||
m_DrawGraph.SetCoordinateLabel(_T("时间(s)"),_T("位置(mm)"));
|
if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_POSTION_TIME))->GetCheck())
|
||||||
|
{
|
||||||
|
//m_dbStartX=0;
|
||||||
|
//m_dbEndX=m_SampleTime;
|
||||||
|
//m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
||||||
|
m_DrawGraph.SetCoordinateLabel(_T("时间(ms)"),_T("位置(mm)"));
|
||||||
}
|
}
|
||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck())
|
else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck())
|
||||||
{
|
{
|
||||||
m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
//m_dbStartX=0;
|
||||||
m_nDivisionX=10;
|
//m_dbEndX=m_SampleTime;
|
||||||
m_nDivisionY=10;
|
//m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
||||||
m_DrawGraph.SetCoordinateLabel(_T("时间(s)"),_T("速度(mm/s)"));
|
m_DrawGraph.SetCoordinateLabel(_T("时间(ms)"),_T("速度(mm/s)"));
|
||||||
}
|
}
|
||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_POSTION))->GetCheck())
|
else if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_POSTION))->GetCheck())
|
||||||
{
|
{
|
||||||
//m_dbStartY=0;
|
//m_dbStartX=0;
|
||||||
//m_dbEndY=50;
|
//m_dbEndX=m_SampleTime;
|
||||||
m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
//m_dbResolutionX=static_cast<double>(m_TimerInterval/(m_dbEndX*1000.0));//每一次采样所需时间对应X坐标的长度
|
||||||
//m_dbResolutionY=static_cast<double>(1/m_dbEndY);
|
|
||||||
m_nDivisionX=10;
|
|
||||||
m_nDivisionY=10;
|
|
||||||
m_DrawGraph.SetCoordinateLabel(_T("位置(mm)"),_T("速度(mm/s)"));
|
m_DrawGraph.SetCoordinateLabel(_T("位置(mm)"),_T("速度(mm/s)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
nCount=0;
|
nCount=0;
|
||||||
|
m_DataXAxis=0.0;
|
||||||
|
m_dataGraphX.RemoveAll();
|
||||||
m_dataGraphY.RemoveAll();
|
m_dataGraphY.RemoveAll();
|
||||||
|
m_DrawGraph.RemoveGraphyData(FALSE);
|
||||||
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY);
|
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY);
|
||||||
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
||||||
m_TimerCnt=static_cast<int>((m_SampleTime*1000)/m_TimerInterval);
|
m_TimerCnt=static_cast<int>((m_SampleTime*1000)/m_TimerInterval);
|
||||||
@@ -615,24 +614,23 @@ void CSO7_Send_Parameter::OnBnClickedButtonStopSampleScurve()
|
|||||||
//================================================================================================
|
//================================================================================================
|
||||||
void CSO7_Send_Parameter::Sample_Speed_Time_Curve()
|
void CSO7_Send_Parameter::Sample_Speed_Time_Curve()
|
||||||
{
|
{
|
||||||
|
m_DataXAxis+=m_duration;
|
||||||
|
m_dataGraphX.Add(m_DataXAxis);
|
||||||
if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->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_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<double>(((1000.0*(fabs(m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)))/m_duration)));
|
m_dataGraphY.Add(static_cast<double>(((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_;
|
m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_;
|
||||||
}
|
}
|
||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck())
|
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_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<double>(1000.0*(fabs(m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)/m_duration)));
|
m_dataGraphY.Add(static_cast<double>(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_;
|
m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_;
|
||||||
}
|
}
|
||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck())
|
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_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<double>(1000.0*(fabs(m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)/m_duration)));
|
m_dataGraphY.Add(static_cast<double>(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_;
|
m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_;
|
||||||
}
|
}
|
||||||
@@ -641,10 +639,11 @@ void CSO7_Send_Parameter::Sample_Speed_Time_Curve()
|
|||||||
//================================================================================================
|
//================================================================================================
|
||||||
void CSO7_Send_Parameter::Sample_Position_Time_Curve()
|
void CSO7_Send_Parameter::Sample_Position_Time_Curve()
|
||||||
{
|
{
|
||||||
|
m_DataXAxis+=m_duration;
|
||||||
|
m_dataGraphX.Add(m_DataXAxis);
|
||||||
if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->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_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_);
|
m_dataGraphY.Add(m_pSO7_Proto->g_machine.x._d_cur_pos_);
|
||||||
if (m_MotionDir)
|
if (m_MotionDir)
|
||||||
{
|
{
|
||||||
@@ -677,7 +676,6 @@ void CSO7_Send_Parameter::Sample_Position_Time_Curve()
|
|||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck())
|
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_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_);
|
m_dataGraphY.Add(m_pSO7_Proto->g_machine.y._d_cur_pos_);
|
||||||
if (m_MotionDir)
|
if (m_MotionDir)
|
||||||
{
|
{
|
||||||
@@ -711,7 +709,6 @@ void CSO7_Send_Parameter::Sample_Position_Time_Curve()
|
|||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck())
|
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_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_);
|
m_dataGraphY.Add(m_pSO7_Proto->g_machine.z._d_cur_pos_);
|
||||||
if (m_MotionDir)
|
if (m_MotionDir)
|
||||||
{
|
{
|
||||||
@@ -749,24 +746,22 @@ void CSO7_Send_Parameter::Sample_Speed_Position_Curve()
|
|||||||
if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_X))->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_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<double>(((1000.0*(fabs(m_pSO7_Proto->g_machine.x._d_cur_pos_-m_dPos)))/m_duration)));
|
m_dataGraphY.Add(static_cast<double>(((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_;
|
m_dPos=m_pSO7_Proto->g_machine.x._d_cur_pos_;
|
||||||
}
|
}
|
||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Y))->GetCheck())
|
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_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<double>(1000.0*(fabs(m_pSO7_Proto->g_machine.y._d_cur_pos_-m_dPos)/m_duration)));
|
m_dataGraphY.Add(static_cast<double>(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_;
|
m_dPos=m_pSO7_Proto->g_machine.y._d_cur_pos_;
|
||||||
}
|
}
|
||||||
else if(((CButton *)GetDlgItem(IDC_RADIO_SAMPLE_Z))->GetCheck())
|
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_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<double>(1000.0*(fabs(m_pSO7_Proto->g_machine.z._d_cur_pos_-m_dPos)/m_duration)));
|
m_dataGraphY.Add(static_cast<double>(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_;
|
m_dPos=m_pSO7_Proto->g_machine.z._d_cur_pos_;
|
||||||
}
|
}
|
||||||
|
m_dataGraphX.Add(m_dPos);
|
||||||
};
|
};
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent)
|
void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent)
|
||||||
@@ -782,6 +777,7 @@ void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent)
|
|||||||
{
|
{
|
||||||
m_pSO7_Proto->_send_cmd_SO7_CMD_READ_AXIS_XYZ();
|
m_pSO7_Proto->_send_cmd_SO7_CMD_READ_AXIS_XYZ();
|
||||||
m_FinishTime=clock();
|
m_FinishTime=clock();
|
||||||
|
m_duration=m_FinishTime-m_StartTime;
|
||||||
if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck())
|
if(((CButton *)GetDlgItem(IDC_RADIO_CANVAS_SPEED_TIME))->GetCheck())
|
||||||
{
|
{
|
||||||
Sample_Speed_Time_Curve();
|
Sample_Speed_Time_Curve();
|
||||||
@@ -797,12 +793,26 @@ void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent)
|
|||||||
if (m_TimerCnt<=nCount)
|
if (m_TimerCnt<=nCount)
|
||||||
{
|
{
|
||||||
KillTimer(1);
|
KillTimer(1);
|
||||||
INT_PTR nTmpCount = m_dataGraphY.GetCount();
|
INT_PTR nTmpCount = m_dataGraphX.GetCount();
|
||||||
double dbData(0.0);
|
double dbData(0.0);
|
||||||
|
dbData = m_dataGraphX.ElementAt(0);
|
||||||
|
m_dbEndX=dbData;
|
||||||
|
m_dbStartX=dbData;
|
||||||
|
for(INT_PTR i=1; i<nTmpCount; i++)
|
||||||
|
{
|
||||||
|
dbData = m_dataGraphX.ElementAt(i);
|
||||||
|
if((dbData-m_dbEndX)>0.0 &&(dbData-m_dbEndX)<MAX_SAMPLE_DIFF_VALUE)
|
||||||
|
m_dbEndX=dbData;
|
||||||
|
if((m_dbStartX-dbData)>0.0 &&(m_dbStartX-dbData)<MAX_SAMPLE_DIFF_VALUE)
|
||||||
|
m_dbStartX=dbData;
|
||||||
|
}
|
||||||
|
m_dbResolutionX=static_cast<double>(1.0/(m_dbEndX-m_dbStartX));
|
||||||
|
|
||||||
|
nTmpCount = m_dataGraphY.GetCount();
|
||||||
dbData = m_dataGraphY.ElementAt(0);
|
dbData = m_dataGraphY.ElementAt(0);
|
||||||
m_dbEndY=dbData;
|
m_dbEndY=dbData;
|
||||||
m_dbStartY=dbData;
|
m_dbStartY=dbData;
|
||||||
for(INT_PTR i=10; i<nTmpCount; i++)
|
for(INT_PTR i=1; i<nTmpCount; i++)
|
||||||
{
|
{
|
||||||
dbData = m_dataGraphY.ElementAt(i);
|
dbData = m_dataGraphY.ElementAt(i);
|
||||||
if((dbData-m_dbEndY)>0.0 &&(dbData-m_dbEndY)<MAX_SAMPLE_DIFF_VALUE)
|
if((dbData-m_dbEndY)>0.0 &&(dbData-m_dbEndY)<MAX_SAMPLE_DIFF_VALUE)
|
||||||
@@ -812,8 +822,12 @@ void CSO7_Send_Parameter::OnTimer(UINT_PTR nIDEvent)
|
|||||||
}
|
}
|
||||||
m_dbEndY+=fabs((m_dbEndY-m_dbStartY)*0.05);
|
m_dbEndY+=fabs((m_dbEndY-m_dbStartY)*0.05);
|
||||||
m_dbResolutionY=static_cast<double>(1.0/(m_dbEndY-m_dbStartY));
|
m_dbResolutionY=static_cast<double>(1.0/(m_dbEndY-m_dbStartY));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY);
|
m_DrawGraph.SetGraphyView(m_dbStartX,m_dbEndX,m_dbStartY,m_dbEndY,m_nDivisionX,m_nDivisionY);
|
||||||
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
m_DrawGraph.SetResolution(m_dbResolutionX,m_dbResolutionY);
|
||||||
|
m_DrawGraph.LoadGraphyXAxisData(m_dataGraphX);
|
||||||
m_DrawGraph.LoadGraphyYAxisData(m_dataGraphY);
|
m_DrawGraph.LoadGraphyYAxisData(m_dataGraphY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public:
|
|||||||
double m_duration;
|
double m_duration;
|
||||||
CString m_csMSG;
|
CString m_csMSG;
|
||||||
CEdit m_edMSG;
|
CEdit m_edMSG;
|
||||||
|
double m_DataXAxis;
|
||||||
DataBuff m_dataGraphX;
|
DataBuff m_dataGraphX;
|
||||||
DataBuff m_dataGraphY;
|
DataBuff m_dataGraphY;
|
||||||
CDrawGraph m_DrawGraph;
|
CDrawGraph m_DrawGraph;
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user