完善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
@@ -824,12 +824,19 @@ BEGIN
PUSHBUTTON "Exit",IDCANCEL,346,249,50,14
PUSHBUTTON "Start",IDC_BUTTON_TESA_STAR_START_MACHINE,27,30,50,14
PUSHBUTTON "Stop",IDC_BUTTON_TESA_STAR_STOP_MACHINE,27,59,50,14
EDITTEXT IDC_EDIT_MOVETO_DEG,209,31,40,14,ES_AUTOHSCROLL
PUSHBUTTON "MoveTo",IDC_BUTTONIDC_BUTTON_TESA_STAR_MOVETO,207,59,50,14
EDITTEXT IDC_EDIT_TESA_STAR_MESSAGE,119,31,40,14,ES_AUTOHSCROLL
PUSHBUTTON "Send Message",IDC_BUTTON_TESA_STAR_SENDMSG,113,59,50,14
EDITTEXT IDC_EDIT_MOVETO_DEG,184,55,40,14,ES_AUTOHSCROLL
PUSHBUTTON "MoveTo",IDC_BUTTONIDC_BUTTON_TESA_STAR_MOVETO,231,44,50,14
EDITTEXT IDC_EDIT_TESA_STAR_MESSAGE,105,31,40,14,ES_AUTOHSCROLL
PUSHBUTTON "Send Message",IDC_BUTTON_TESA_STAR_SENDMSG,102,59,50,14
EDITTEXT IDC_EDIT_TESA_STAR_E_LOG,20,88,326,161,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
PUSHBUTTON "Clear all",IDC_BUTTON_TESA_STAR_CLEAR_LOG,351,170,38,14
PUSHBUTTON "Read",IDC_BUTTONIDC_BUTTON_TESA_STAR_READ_POS,290,44,50,14
GROUPBOX "Machine",IDC_STATIC,20,15,67,65
GROUPBOX "CMD",IDC_STATIC,93,16,67,65
GROUPBOX "Motion",IDC_STATIC,167,16,180,65
LTEXT "A",IDC_STATIC,174,35,8,8
LTEXT "B",IDC_STATIC,174,57,8,8
EDITTEXT IDC_EDIT_MOVETO_DEGA,184,33,40,14,ES_AUTOHSCROLL
END
@@ -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);
}
@@ -22,9 +22,6 @@ protected:
CEdit m_edMSG;
CString m_OutMessage;
CStatusBarCtrl m_StatusBar;
int m_SendType;
char m_RecvData[MAX_RECIEVE_BUFFER_SIZE];
public:
void OutputWithScroll(const CString &strNewText,CEdit &edtOutput);
afx_msg void OnBnClickedCancel();
@@ -34,4 +31,6 @@ public:
afx_msg void OnBnClickedButtonTesaStarStopMachine();
afx_msg void OnBnClickedButtonTesaStarSendmsg();
afx_msg void OnBnClickedButtonTesaStarClearLog();
afx_msg void OnBnClickedButtonidcButtonTesaStarReadPos();
afx_msg void OnEnKillfocusEditMovetoDega();
};
@@ -866,10 +866,12 @@
#define IDC_RADIO_MACHINE_TESASTARE 1806
#define IDC_EDIT_MOVETO_DEG 1807
#define IDC_BUTTON_TESA_STAR_SENDMSG 1808
#define IDC_EDIT2 1809
#define IDC_EDIT_TESA_STAR_E_LOG 1809
#define IDC_BUTTON_TESA_STAR_CLEAR_LOG 1810
#define IDC_EDIT_TESA_STAR_MESSAGE 1811
#define IDC_BUTTONIDC_BUTTON_TESA_STAR_READ_POS 1812
#define IDC_EDIT_MOVETO_DEG2 1813
#define IDC_EDIT_MOVETO_DEGA 1813
// Next default values for new objects
//
@@ -877,7 +879,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 189
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1812
#define _APS_NEXT_CONTROL_VALUE 1813
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif