完善Tesa star e测试功能。

This commit is contained in:
TAO Cheng
2013-12-05 23:17:46 +08:00
parent 4632da1b05
commit 70611fea3b
7 changed files with 484 additions and 176 deletions
@@ -8,6 +8,10 @@
#include "afxdialogex.h"
extern CTesaStarE* g_pTesaStarE;
char m_RecvData[MAX_RECIEVE_BUFFER_SIZE]={0};
double m_MoveToPos[2]={0.0};
int m_SendType=1;
// TestTesaStarEDialog dialog
IMPLEMENT_DYNAMIC(TestTesaStarEDialog, CDialog)
@@ -15,7 +19,7 @@ IMPLEMENT_DYNAMIC(TestTesaStarEDialog, CDialog)
TestTesaStarEDialog::TestTesaStarEDialog(CWnd* pParent /*=NULL*/)
: CDialog(TestTesaStarEDialog::IDD, pParent)
{
m_SendType=1;
m_OutMessage=L"";
}
TestTesaStarEDialog::~TestTesaStarEDialog()
@@ -38,6 +42,8 @@ BEGIN_MESSAGE_MAP(TestTesaStarEDialog, CDialog)
ON_BN_CLICKED(IDC_BUTTON_TESA_STAR_STOP_MACHINE, &TestTesaStarEDialog::OnBnClickedButtonTesaStarStopMachine)
ON_BN_CLICKED(IDC_BUTTON_TESA_STAR_SENDMSG, &TestTesaStarEDialog::OnBnClickedButtonTesaStarSendmsg)
ON_BN_CLICKED(IDC_BUTTON_TESA_STAR_CLEAR_LOG, &TestTesaStarEDialog::OnBnClickedButtonTesaStarClearLog)
ON_BN_CLICKED(IDC_BUTTONIDC_BUTTON_TESA_STAR_READ_POS, &TestTesaStarEDialog::OnBnClickedButtonidcButtonTesaStarReadPos)
ON_EN_KILLFOCUS(IDC_EDIT_MOVETO_DEGA, &TestTesaStarEDialog::OnEnKillfocusEditMovetoDega)
END_MESSAGE_MAP()
@@ -83,23 +89,10 @@ BOOL TestTesaStarEDialog::OnInitDialog()
void TestTesaStarEDialog::OnBnClickedCancel()
{
// TODO: Add your control notification handler code here
g_pTesaStarE->Unload();
CDialog::OnCancel();
}
void TestTesaStarEDialog::OnEnKillfocusEditMoveT_Deg()
{
// TODO: Add your control notification handler code here
}
void TestTesaStarEDialog::OnBnClickedButtonidcButtonTesaStarMoveto()
{
// TODO: Add your control notification handler code here
}
void TestTesaStarEDialog::OnBnClickedButtonTesaStarStartMachine()
{
g_pTesaStarE->Initialization();
@@ -245,6 +238,48 @@ void TestTesaStarEDialog::OnBnClickedButtonTesaStarClearLog()
GetDlgItem(IDC_EDIT_TESA_STAR_E_LOG)->SetWindowTextW(_T(""));
}
void TestTesaStarEDialog::OnEnKillfocusEditMoveT_Deg()
{
UpdateData(TRUE);
USES_CONVERSION;
CString csMoveToPos(L"");
GetDlgItem(IDC_EDIT_MOVETO_DEG)->GetWindowText(csMoveToPos);
const char* cMove_to_Pos=T2A(csMoveToPos);
m_MoveToPos[1]=atof(cMove_to_Pos);
}
void TestTesaStarEDialog::OnEnKillfocusEditMovetoDega()
{
UpdateData(TRUE);
USES_CONVERSION;
CString csMoveToPos(L"");
GetDlgItem(IDC_EDIT_MOVETO_DEGA)->GetWindowText(csMoveToPos);
const char* cMove_to_Pos=T2A(csMoveToPos);
m_MoveToPos[0]=atof(cMove_to_Pos);
}
void TestTesaStarEDialog::OnBnClickedButtonidcButtonTesaStarMoveto()
{
double dMovetoPos[2]={0.0};
dMovetoPos[0]=m_MoveToPos[0];
dMovetoPos[1]=m_MoveToPos[1];
g_pTesaStarE->SetTesaStarEAngle(2,dMovetoPos,true);
m_OutMessage.Format(_T("[Move Finished]A:%.4f;B:%.4f"),dMovetoPos[0],dMovetoPos[1]);
OutputWithScroll(m_OutMessage,m_edMSG);
}
void TestTesaStarEDialog::OnBnClickedButtonidcButtonTesaStarReadPos()
{
int iDataSize(0);
double dData[2]={0.0};
g_pTesaStarE->GetTesaStarEAngle(iDataSize,dData);
m_OutMessage.Format(_T("A:%.4f;B:%.4f"),dData[0],dData[1]);
OutputWithScroll(m_OutMessage,m_edMSG);
}
//=====================================================================================
//Print message on edit control
void TestTesaStarEDialog::OutputWithScroll(const CString &strNewText,CEdit &edtOutput)
@@ -266,3 +301,5 @@ void TestTesaStarEDialog::OutputWithScroll(const CString &strNewText,CEdit &edtO
edtOutput.SetSel(iCount, iCount);
edtOutput.SetRedraw(TRUE);
}