⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 850para.cpp

📁 850运动控制卡的详细开发资料
💻 CPP
字号:
// 850Para.cpp : implementation file
//

#include "stdafx.h"
#include "Demo_Inp_Move.h"
#include "850Para.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// C850Para dialog


C850Para::C850Para(CWnd* pParent /*=NULL*/)
	: CDialog(C850Para::IDD, pParent)
{
	//{{AFX_DATA_INIT(C850Para)
	m_nStartV_w = 0;
	m_nStartV_x = 0;
	m_nStartV_y = 0;
	m_nStartV_z = 0;
	m_nDriveSpeed_w = 0;
	m_nDriveSpeed_x = 0;
	m_nDriveSpeed_y = 0;
	m_nDriveSpeed_z = 0;
	m_nRatio_w = 0;
	m_nRatio_x = 0;
	m_nRatio_y = 0;
	m_nRatio_z = 0;
	m_nAccVelocity_w = 0;
	m_nAccVelocity_x = 0;
	m_nAccVelocity_y = 0;
	m_nAccVelocity_z = 0;
	m_nDecVelocity_w = 0;
	m_nDecVelocity_x = 0;
	m_nDecVelocity_y = 0;
	m_nDecVelocity_z = 0;
	m_fAccTime_w = 0.0f;
	m_fAccTime_x = 0.0f;
	m_fAccTime_y = 0.0f;
	m_fAccTime_z = 0.0f;
	//}}AFX_DATA_INIT
}

C850Para::C850Para(BOOL bEnableAcc, CWnd *pParent)
	: CDialog(C850Para::IDD, pParent)
{
	//{{AFX_DATA_INIT(C850Para)
	m_nStartV_w = 400;
	m_nStartV_x = 400;
	m_nStartV_y = 400;
	m_nStartV_z = 400;
	m_nDriveSpeed_w =4000;
	m_nDriveSpeed_x = 4000;
	m_nDriveSpeed_y = 4000;
	m_nDriveSpeed_z = 4000;
	m_nRatio_w = 5;
	m_nRatio_x = 5;
	m_nRatio_y = 5;
	m_nRatio_z = 5;
	m_nAccVelocity_w = 625;
	m_nAccVelocity_x = 625;
	m_nAccVelocity_y = 625;
	m_nAccVelocity_z = 625;
	m_nDecVelocity_w = 625;
	m_nDecVelocity_x = 625;
	m_nDecVelocity_y = 625;
	m_nDecVelocity_z = 625;


	m_fAccTime_w = 5.76f;
	m_fAccTime_x = 5.76f;
	m_fAccTime_y = 5.76f;
	m_fAccTime_z = 5.76f;
	//}}AFX_DATA_INIT

	m_bEnableAcc=bEnableAcc;

}


void C850Para::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(C850Para)
	DDX_Text(pDX, IDC_EDIT_SETTING_START_V_W, m_nStartV_w);
	DDX_Text(pDX, IDC_EDIT_SETTING_START_V_X, m_nStartV_x);
	DDX_Text(pDX, IDC_EDIT_SETTING_START_V_Y, m_nStartV_y);
	DDX_Text(pDX, IDC_EDIT_SETTING_START_V_Z, m_nStartV_z);
	DDX_Text(pDX, IDC_EDIT_SETTING_DRIVE_SPEED_W, m_nDriveSpeed_w);
	DDX_Text(pDX, IDC_EDIT_SETTING_DRIVE_SPEED_X, m_nDriveSpeed_x);
	DDX_Text(pDX, IDC_EDIT_SETTING_DRIVE_SPEED_Y, m_nDriveSpeed_y);
	DDX_Text(pDX, IDC_EDIT_SETTING_DRIVE_SPEED_Z, m_nDriveSpeed_z);
	DDX_Text(pDX, IDC_EDIT_SETTING_RATIO_W, m_nRatio_w);
	DDX_Text(pDX, IDC_EDIT_SETTING_RATIO_X, m_nRatio_x);
	DDX_Text(pDX, IDC_EDIT_SETTING_RATIO_Y, m_nRatio_y);
	DDX_Text(pDX, IDC_EDIT_SETTING_RATIO_Z, m_nRatio_z);
	DDX_Text(pDX, IDC_EDIT_SETTING_ACC_V_W, m_nAccVelocity_w);
	DDX_Text(pDX, IDC_EDIT_SETTING_ACC_V_X, m_nAccVelocity_x);
	DDX_Text(pDX, IDC_EDIT_SETTING_ACC_V_Y, m_nAccVelocity_y);
	DDX_Text(pDX, IDC_EDIT_SETTING_ACC_V_Z, m_nAccVelocity_z);
	DDX_Text(pDX, IDC_EDIT_SETTING_DEC_V_W, m_nDecVelocity_w);
	DDX_Text(pDX, IDC_EDIT_SETTING_DEC_V_X, m_nDecVelocity_x);
	DDX_Text(pDX, IDC_EDIT_SETTING_DEC_V_Y, m_nDecVelocity_y);
	DDX_Text(pDX, IDC_EDIT_SETTING_DEC_V_Z, m_nDecVelocity_z);
	DDX_Text(pDX, IDC_EDIT_ACC_TIME_W, m_fAccTime_w);
	DDX_Text(pDX, IDC_EDIT_ACC_TIME_X, m_fAccTime_x);
	DDX_Text(pDX, IDC_EDIT_ACC_TIME_Y, m_fAccTime_y);
	DDX_Text(pDX, IDC_EDIT_ACC_TIME_Z, m_fAccTime_z);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(C850Para, CDialog)
	//{{AFX_MSG_MAP(C850Para)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// C850Para message handlers

BOOL C850Para::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	if (NULL != m_pToolTip)            
      m_pToolTip->RelayEvent(pMsg);
	return CDialog::PreTranslateMessage(pMsg);
}



BOOL C850Para::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	EnableAccVelocityWnd(m_bEnableAcc);

	m_pToolTip=new CToolTipCtrl;
	m_pToolTip->Create(this);

	RECT rc;
	CEdit* pEdit;
	for(int i=IDC_EDIT_SETTING_START_V_X;i<IDC_EDIT_ACC_TIME_W+1;i++){

		pEdit=(CEdit*)GetDlgItem(i);
		

        
		
		if(pEdit){	

			pEdit->GetClientRect(&rc);

			if((i<=IDC_EDIT_SETTING_RATIO_W) && (i>=IDC_EDIT_SETTING_RATIO_X))
				m_pToolTip->AddTool(pEdit,"值的输入范围是:1----500",&rc,i);
			else
				m_pToolTip->AddTool(pEdit,"值的输入范围是:1----8000×倍率",&rc,i);
		}
	}

	m_pToolTip->SetDelayTime(500);
	m_pToolTip->Activate(TRUE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void C850Para::OnOK() 
{
	// TODO: Add extra validation here

	

	if(m_nRatio_x==0||m_nRatio_y==0||m_nRatio_z==0||m_nRatio_w==0)return;
	UpdateData();
	if(m_pToolTip) delete m_pToolTip;
	
	CDialog::OnOK();
}

void C850Para::EnableAccVelocityWnd(BOOL bIsEnable)
{
	CEdit* pEdit=NULL;

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_ACC_V_W);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_ACC_V_X);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_ACC_V_Y);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_ACC_V_Z);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_DEC_V_W);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_DEC_V_X);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_DEC_V_Y);
	pEdit->EnableWindow(bIsEnable);

	pEdit=(CEdit*)GetDlgItem(IDC_EDIT_SETTING_DEC_V_Z);
	pEdit->EnableWindow(bIsEnable);



	
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -