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

📄 mastercontroldlg.h

📁 Source code for cnc controlling three dimentioal machine
💻 H
字号:
// MasterControlDlg.h : header file
//

#if !defined(AFX_MASTERCONTROLDLG_H__2BE332C7_60A4_11D4_80BF_0000E8DA28BE__INCLUDED_)
#define AFX_MASTERCONTROLDLG_H__2BE332C7_60A4_11D4_80BF_0000E8DA28BE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxtempl.h>  // array template
#include "Roundbutton.h"
#include "ledbutton.h"
#include "interpolate.h"
 

/////////////////////////////////////////////////////////////////////////////
// CMasterControlDlg dialog
class STRING 
 {
  public:
  LPSTR	pText;
  int  ccLen;
 };

class StringArray : public CArray <STRING, STRING &>
{
   public:
     StringArray() {}
     STRING& operator=(STRING & s)
          { m_pData->pText = s.pText;
            m_pData->ccLen = s.ccLen;
            return *m_pData; }
};

struct Line
{
	double xloc;
	double yloc;
	double zloc;
	double ival;
	double jval;
	double kval;
	double rval;
	double mval;
	int gmode;
	int tool;
};


class CMasterControlDlg : public CDialog
{
// Construction
public:
	void RouterOff();
	void RouterOn();
	void Emergency();
	void LimitsIn();
	void AuxOuts();
	void G023();
	void G022();
	void G033();
	void G032();
	void G02();
	void G03( );
	double CalcLatency();
	double GetTime();
	void EndSimulate();
	void DrawTo();
	void OnLoad();
	void BurstOut();
	void CalcRamp( );
	void GoToPos( double newx,double newy,double newz);
	void Delay( double delay );
	void DoPulse();
	void PulseZ( bool dir);
	void PulseY( bool dir );
	void PulseX( bool dir );
	void CallPage( int page);
	bool SetupVars();
	CMasterControlDlg(CWnd* pParent = NULL);	// standard constructor
	void BuildStringArray();
    void QuantifyVectors();
	Line DecodeLine(int current);
	void CalcAngle(double &radius, double &theta, double x, double y);
	void DoRun();
	 




// Dialog Data
	//{{AFX_DATA(CMasterControlDlg)
	enum { IDD = IDD_MASTERCONTROL_DIALOG };
	CButton	m_AutoButton;
	CButton	m_AllLimitButton;
	CButton	m_ZLimitButton;
	CButton	m_YLimitButton;
	CButton	m_XLimitButton;
	CButton	m_Router;
	CLedButton	m_EnableLed;
	CLedButton	m_AuxLed3;
	CLedButton	m_AuxLed2;
	CLedButton	m_AuxLed1;
	CEdit	m_LinearEd;
	CStatic	m_Display;
	CLedButton	m_Running;
	CLedButton	m_DispOnLed;
	CLedButton	m_DispOffLed;
	CSpinButtonCtrl	m_CurSpin;
	CEdit	m_CurLine;
	CStatic	m_PathName;
	CStatic	m_Remaining;
	CStatic	m_StartTime;
	CStatic	m_Units;
	CEdit	m_ZGoTo;
	CEdit	m_YGoTo;
	CEdit	m_XGoTo;
	CButton	m_Go;
	CEdit	m_JogEdit;
	CLedButton	m_LEDZHome;
	CLedButton	m_LEDYHome;
	CLedButton	m_LEDXHome;
	CLedButton	m_LEDRoute;
	CLedButton	m_LEDEmerg;
	CEdit	m_ZLoc;
	CEdit	m_YLoc;
	CEdit	m_XLoc;
	CButton	m_Down;
	CButton	m_Up;
	CButton	m_Cancel;
	CButton	m_YPlus;
	CButton	m_YMinus;
	CButton	m_XPlus;
	CButton	m_XMinus;
	double	m_JogDist;
	double	m_XGotoVar;
	double	m_YGotoVar;
	double	m_ZGotoVar;
	double	m_XLocVar;
	double	m_YLocVar;
	double	m_ZLocVar;
	int		m_CurLineInt;
	CString	m_Estimate;
	CString	m_TimeLeft;
	double	m_Linear;
	double	m_ZMin;
	double	m_ZMax;
	double	m_YMin;
	double	m_YMax;
	double	m_XMin;
	double	m_XMax;
	double	m_YLimit;
	double	m_XLimit;
	double	m_ZLimit;
	//}}AFX_DATA
	bool FileLoaded;
	bool LPT1,LPT2,LPT3,LPT4;
	bool IO48;
	double ToolChangeX,ToolChangeY,ToolChangeZ;
	bool SeekHome;
	bool ToolChange;
	bool Inches;
	double XOverLap,YOverLap,ZOverLap;
	double XWidth,YWidth,ZWidth;
	double XPpi,YPpi,ZPpi;
	double XAcc,YAcc,ZAcc;
	double XDec,YDec,ZDec;
	double XMaxIps,YMaxIps,ZMaxIps;
	double XMinIps,YMinIps,ZMinIps;
	double XMaxCut,YMaxCut,ZMaxCut;
	bool XRamp,YRamp,ZRamp;
	unsigned char XDirMask,YDirMask,ZDirMask;
	unsigned char XStepMask,YStepMask,ZStepMask;
	unsigned char SpindleMask,EmergMask;
	int Xplace,YPlace,ZPlace;
	DWORD IO48data;
	bool XDir,YDir,ZDir,XPulse,YPulse,ZPulse;
	LARGE_INTEGER  frequency;
	double XResmm,YResmm,ZResmm;
	double XResIn,YResIn,ZResIn;
	double XRes,YRes,ZRes;
	int XDigPos,YDigPos,ZDigPos;
	double XCurrent, YCurrent, ZCurrent;
	double XMinDelay,YMinDelay,ZMinDelay;
	double XMaxDelay,YMaxDelay,ZMaxDelay;
	double XMidDelay,YMidDelay,ZMidDelay;
	double XIncAccCut,YIncAccCut,ZIncAccCut;
	double XIncDecCut,YIncDecCut,ZIncDecCut;
	double XIncAcc,YIncAcc,ZIncAcc;
	double XIncDec,YIncDec,ZIncDec;
	int Axis;
	int Dwell;
	bool Limits;
	bool Automatic;

	double RampIncAcc, RampIncDec;
	int    RampLengthAcc, RampLengthDec, RampBetween;
	int    RampIndex;
	double delay;
	unsigned char *Movements;
	int Moves;
	double *Times;         // delay times for stepper movement burst
	bool   SwapX,SwapY,SwapZ;
	StringArray GLines;
	int FileLength;
    int cGLines;
	LPSTR   TextBuffer;
	int curline;     // current g-code line
	int lastline;    // last line of GCode
	CFile myFile;
    CFileException fileException;
	double m_LinearMM;
	int *vector;
	int *steps;
	double minX,maxX,minY,maxY,minZ,maxZ;
	double bitmapY,bitmapZ,bitmapX;
	bool DispOn;
	bool RUN;
	bool Simulate;
	double TimeEstimate, TimeCalc;
	double started,rightnow;
	DWORD hold;
	bool Simulated;
	double latency;
	interpolate   terp;
	int mode;
	double m_ILocVar,m_JLocVar,m_KLocVar;
	int GMode;
	bool Incremental;
	double MaxRes;
	bool Spindle;
	unsigned char EStopMask,LimitXMask,LimitYMask,LimitZMask;
	unsigned char Aux1Mask,Aux2Mask,Aux3Mask,EnableMask;
	bool Aux1,Aux2,Aux3;
	bool XLimit,YLimit,ZLimit;
	bool EStop,Enable;
	bool EStopFlash;

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMasterControlDlg)
	public:
	virtual BOOL DestroyWindow();
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMasterControlDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnPrefs();
	afx_msg void OnAbout();
	afx_msg void OnXplus();
	afx_msg void OnXminus();
	afx_msg void OnYminus();
	afx_msg void OnYplus();
	afx_msg void OnUp();
	afx_msg void OnDown();
	afx_msg void OnGo();
	afx_msg void OnHomeall();
	afx_msg void OnHomex();
	afx_msg void OnHomey();
	afx_msg void OnHomez();
	afx_msg void OnSethome();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnOpen();
	virtual void OnCancel();
	afx_msg void OnDeltaposCurspin(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDispoff();
	afx_msg void OnDispon();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnRun();
	afx_msg void OnPause();
	afx_msg void OnSimulate();
	afx_msg void OnReset();
	afx_msg void OnAux1();
	afx_msg void OnAux2();
	afx_msg void OnAux3();
	afx_msg void OnSafety();
	afx_msg void OnRouter();
	afx_msg void OnXlimit();
	afx_msg void OnYlimit();
	afx_msg void OnZlimit();
	afx_msg void OnAlllimit();
	afx_msg void OnAutoemerg();
	afx_msg void OnFeeds();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MASTERCONTROLDLG_H__2BE332C7_60A4_11D4_80BF_0000E8DA28BE__INCLUDED_)

⌨️ 快捷键说明

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