新增导出XYZ工作台接口,新增导出灯光调节接口,完善debug信息输出。
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
#include "Logger.h"
|
|
||||||
|
|
||||||
void CLogger::Send(LPCTSTR format, ...)
|
|
||||||
{
|
|
||||||
if (!m_File)
|
|
||||||
{
|
|
||||||
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
|
||||||
}
|
|
||||||
int length = 0;
|
|
||||||
va_list list;
|
|
||||||
va_start(list, format);
|
|
||||||
length = vswprintf_s(m_Str,5000, format, list);
|
|
||||||
if(m_File)
|
|
||||||
{
|
|
||||||
_ftprintf(m_File, m_Str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void CLogger::SendAndFlush(LPCTSTR format, ...)
|
|
||||||
{
|
|
||||||
int length = 0;
|
|
||||||
va_list list;
|
|
||||||
|
|
||||||
va_start(list, format);
|
|
||||||
length = vswprintf_s(m_Str2,5000, format, list);
|
|
||||||
Send(m_Str2);
|
|
||||||
|
|
||||||
if(m_File)
|
|
||||||
{
|
|
||||||
fclose(m_File);
|
|
||||||
m_File = NULL;
|
|
||||||
if(m_FileName.GetLength() > 0)
|
|
||||||
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLogger::SendAndFlushPerMode(LPCTSTR format, ...)
|
|
||||||
{
|
|
||||||
int length = 0;
|
|
||||||
va_list list;
|
|
||||||
|
|
||||||
va_start(list, format);
|
|
||||||
length = vswprintf_s(m_Str2,5000, format, list);
|
|
||||||
Send(m_Str2);
|
|
||||||
|
|
||||||
if((m_lLogMask & LOGFLUSH) && m_File)
|
|
||||||
{
|
|
||||||
fclose(m_File);
|
|
||||||
m_File = NULL;
|
|
||||||
if(m_FileName.GetLength() > 0)
|
|
||||||
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Mv_Proto.h"
|
#include "Mv_Proto.h"
|
||||||
#include "SsiStatus.h"
|
#include "SsiStatus.h"
|
||||||
#include "Logger.h"
|
#include "..\Tools\UsbUtility\logger.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#define MY_CONFIG 1
|
#define MY_CONFIG 1
|
||||||
@@ -507,7 +507,7 @@ CMv_Proto::CMv_Proto()
|
|||||||
g_machine.s_machine_config._dXYZSpeed = 50;
|
g_machine.s_machine_config._dXYZSpeed = 50;
|
||||||
m_bHomingActive = false;
|
m_bHomingActive = false;
|
||||||
|
|
||||||
g_pLogger = new CLogger();
|
g_pLogger = new CLogger(_T("Mv_Proto.log"));
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif // _MSC_VER > 1000 /*ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h
|
#endif // _MSC_VER > 1000 /*ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h
|
||||||
|
|
||||||
#include "logger.h"
|
#include "..\Tools\UsbUtility\logger.h"
|
||||||
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
||||||
#include "SsiStatus.h"
|
#include "SsiStatus.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
#if !defined(LOGGER_H__5142BB38_5565_4124_88A4_56EA08298154__INCLUDED_)
|
|
||||||
#define LOGGER_H__5142BB38_5565_4124_88A4_56EA08298154__INCLUDED_
|
|
||||||
|
|
||||||
#include <afxwin.h>
|
|
||||||
#include <afxext.h>
|
|
||||||
#include <wincon.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <share.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
const long LOGINIT = 0x0001;
|
|
||||||
const long LOGACTIONS = 0x0002;
|
|
||||||
const long LOGCOMM = 0x0004;
|
|
||||||
const long LOGFLUSH = 0x0008;
|
|
||||||
|
|
||||||
class CLogger
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CLogger()
|
|
||||||
{
|
|
||||||
m_File = NULL;
|
|
||||||
CString Path=_T(""); // Speed optimization - noticed slow in GlowCode
|
|
||||||
if (Path.IsEmpty()) {
|
|
||||||
CString tmpPath;
|
|
||||||
GetModuleFileName(NULL,tmpPath.GetBuffer(255),255);
|
|
||||||
tmpPath.ReleaseBuffer();
|
|
||||||
tmpPath.TrimRight();
|
|
||||||
int nLastSlash = tmpPath.ReverseFind('\\');
|
|
||||||
if (nLastSlash >= 0)
|
|
||||||
tmpPath = tmpPath.Left(nLastSlash);
|
|
||||||
else
|
|
||||||
tmpPath.Empty();
|
|
||||||
Path=tmpPath;
|
|
||||||
}
|
|
||||||
m_FileName=Path + _T("\\Mv_SSILog.txt");
|
|
||||||
m_lLogMask=0;
|
|
||||||
};
|
|
||||||
~CLogger()
|
|
||||||
{
|
|
||||||
if (m_File)
|
|
||||||
fclose(m_File);
|
|
||||||
};
|
|
||||||
|
|
||||||
void Send(LPCTSTR, ...);
|
|
||||||
void SendAndFlush(LPCTSTR, ...);
|
|
||||||
void SendAndFlushPerMode(LPCTSTR, ...);
|
|
||||||
CString m_FileName;
|
|
||||||
long m_lLogMask;
|
|
||||||
FILE *m_File;
|
|
||||||
_TCHAR m_Str[20000];
|
|
||||||
_TCHAR m_Str2[20000];
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // !defined(LOGGER_H__5142BB38_5565_4124_88A4_56EA08298154__INCLUDED_)
|
|
||||||
@@ -10,6 +10,9 @@
|
|||||||
#define MAX_IN_BUFF_SIZE 1024
|
#define MAX_IN_BUFF_SIZE 1024
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
|
|
||||||
|
const INT HOME_TIMEOUT=300000;
|
||||||
|
const INT MOVETO_TIMEOUT=60000;
|
||||||
|
const INT MIN_SLEEP_TIME=20;
|
||||||
const DOUBLE ROTARY_MMtoScale_RESOLUTION=0.0005;
|
const DOUBLE ROTARY_MMtoScale_RESOLUTION=0.0005;
|
||||||
//***** Static Data *****
|
//***** Static Data *****
|
||||||
static char *outBuff = NULL;
|
static char *outBuff = NULL;
|
||||||
@@ -26,9 +29,8 @@ HANDLE CSO7_Proto::g_hEP02_Serial_Mutex;
|
|||||||
//================================================================
|
//================================================================
|
||||||
struct_so7_machine CSO7_Proto::g_machine;
|
struct_so7_machine CSO7_Proto::g_machine;
|
||||||
usb_dev_handle *CSO7_Proto::g_dev=NULL;
|
usb_dev_handle *CSO7_Proto::g_dev=NULL;
|
||||||
CLogger *CSO7_Proto::g_pLogger;
|
CLogger *CSO7_Proto::g_pLogger=NULL;
|
||||||
HANDLE CSO7_Proto::g_hHomedEvent = NULL;
|
HANDLE CSO7_Proto::g_hHomedEvent = NULL;
|
||||||
CLogger* g_pLog=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@@ -562,8 +564,7 @@ CSO7_Proto::CSO7_Proto()
|
|||||||
so7_motion_reset_controller_parameter();
|
so7_motion_reset_controller_parameter();
|
||||||
so7_config_para_set_default();
|
so7_config_para_set_default();
|
||||||
m_bHomingActive = false;
|
m_bHomingActive = false;
|
||||||
g_pLogger = new CLogger(_T("\\UtilityDebug.Log"));
|
g_pLogger = new CLogger(_T("\\MachineInterface.Log"));
|
||||||
g_pLogger->Send(_T("Construct Cso7_Proto.\r\n"));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
@@ -574,9 +575,10 @@ CSO7_Proto::~CSO7_Proto()
|
|||||||
free(ep_buff[i]._buffer);
|
free(ep_buff[i]._buffer);
|
||||||
};
|
};
|
||||||
if (g_pLogger)
|
if (g_pLogger)
|
||||||
g_pLogger->Send(_T("Destruct Cso7_Proto.\r\n"));
|
{
|
||||||
delete g_pLogger;
|
delete g_pLogger;
|
||||||
g_pLogger = NULL;
|
g_pLogger = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning(disable:4996)
|
#pragma warning(disable:4996)
|
||||||
@@ -2568,7 +2570,34 @@ SSI_STATUS_MOTION CSO7_Proto::Load_So7_Config()
|
|||||||
g_machine.s_machine_config.motion.m_DebugOutputEnable=atoi(cTemp);
|
g_machine.s_machine_config.motion.m_DebugOutputEnable=atoi(cTemp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//==================Motion=============================
|
||||||
|
else if(!_stricmp(token, "X_SCALE_RESOLUTION"))
|
||||||
|
{
|
||||||
|
token = strtok( NULL, seps);
|
||||||
|
if (token)
|
||||||
|
{
|
||||||
|
strcpy(cTemp,token);
|
||||||
|
g_machine.s_machine_config.x_axis._scale_resolution=atof(cTemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!_stricmp(token, "Y_SCALE_RESOLUTION"))
|
||||||
|
{
|
||||||
|
token = strtok( NULL, seps);
|
||||||
|
if (token)
|
||||||
|
{
|
||||||
|
strcpy(cTemp,token);
|
||||||
|
g_machine.s_machine_config.y_axis._scale_resolution=atof(cTemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!_stricmp(token, "Z_SCALE_RESOLUTION"))
|
||||||
|
{
|
||||||
|
token = strtok( NULL, seps);
|
||||||
|
if (token)
|
||||||
|
{
|
||||||
|
strcpy(cTemp,token);
|
||||||
|
g_machine.s_machine_config.z_axis._scale_resolution=atof(cTemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
//=================Rotary========================
|
//=================Rotary========================
|
||||||
else if (!_stricmp(token,"ROTARY_AXIS_NUMBER"))
|
else if (!_stricmp(token,"ROTARY_AXIS_NUMBER"))
|
||||||
{
|
{
|
||||||
@@ -2846,6 +2875,10 @@ int CSO7_Proto::Get_SeqNumber(usb_dev_handle *udev)
|
|||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
SSI_STATUS_MOTION CSO7_Proto::Init_SO7Usb()
|
SSI_STATUS_MOTION CSO7_Proto::Init_SO7Usb()
|
||||||
{
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("Enter Initialize Usb.\n"));
|
||||||
|
}
|
||||||
//Set initial state of the machine
|
//Set initial state of the machine
|
||||||
g_machine.s_status._machine_running = false;
|
g_machine.s_status._machine_running = false;
|
||||||
|
|
||||||
@@ -2862,7 +2895,6 @@ SSI_STATUS_MOTION CSO7_Proto::Init_SO7Usb()
|
|||||||
if (!g_dev)
|
if (!g_dev)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, _T("Unable to open device"), _T("Message"), MB_OK|MB_ICONERROR);
|
MessageBox(NULL, _T("Unable to open device"), _T("Message"), MB_OK|MB_ICONERROR);
|
||||||
g_pLogger->SendAndFlushPerMode(_T("Unable to open device %s \r\n"), usb_strerror());
|
|
||||||
g_machine.IsOffline=TRUE;
|
g_machine.IsOffline=TRUE;
|
||||||
rStatus= SSI_STATUS_MOTION_DATALINK_ERROR;
|
rStatus= SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||||
}
|
}
|
||||||
@@ -2880,7 +2912,6 @@ SSI_STATUS_MOTION CSO7_Proto::Init_SO7Usb()
|
|||||||
rStatus=SSI_STATUS_MOTION_DATALINK_ERROR;
|
rStatus=SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pLogger->SendAndFlushPerMode(_T("Init:Open device succeed .\r\n"));
|
|
||||||
// ********************************************************************
|
// ********************************************************************
|
||||||
// This event is used to kick the Serial Usb Command process. This threading model
|
// This event is used to kick the Serial Usb Command process. This threading model
|
||||||
// is important because the underlying library is not thread-safe.
|
// is important because the underlying library is not thread-safe.
|
||||||
@@ -2972,8 +3003,10 @@ SSI_STATUS_MOTION CSO7_Proto::Exit_SO7Usb()
|
|||||||
g_hEP02_Thread_State = THREAD_EXIT;
|
g_hEP02_Thread_State = THREAD_EXIT;
|
||||||
ReleaseMutex(g_hEP02_Serial_Mutex);
|
ReleaseMutex(g_hEP02_Serial_Mutex);
|
||||||
CloseHandle(g_hEP02_Serial_Mutex);
|
CloseHandle(g_hEP02_Serial_Mutex);
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
g_pLogger->SendAndFlushPerMode(_T("Exit: Exit_SO7Usb \r\n"));
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("Exit Exit_SO7Usb.\n"));
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3009,9 +3042,12 @@ SSI_STATUS_MOTION CSO7_Proto::_do_single_threaded_usb_comm(int iEP_Base)
|
|||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
SSI_STATUS_MOTION CSO7_Proto::_start_machine()
|
SSI_STATUS_MOTION CSO7_Proto::_start_machine()
|
||||||
{
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("_start_machine.\n"));
|
||||||
|
}
|
||||||
g_hEP8x_Thread_State = THREAD_RUNNING_STATE2;
|
g_hEP8x_Thread_State = THREAD_RUNNING_STATE2;
|
||||||
g_machine.s_status._machine_running = true;
|
g_machine.s_status._machine_running = true;
|
||||||
g_pLogger->SendAndFlushPerMode(_T("_start_machine\n"));
|
|
||||||
SetEvent(g_hHomedEvent);
|
SetEvent(g_hHomedEvent);
|
||||||
|
|
||||||
//so7_motion_probe_on_off_(false);
|
//so7_motion_probe_on_off_(false);
|
||||||
@@ -3023,6 +3059,10 @@ SSI_STATUS_MOTION CSO7_Proto::_start_machine()
|
|||||||
//===============================================================================
|
//===============================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::_shutdown_machine()
|
SSI_STATUS_MOTION CSO7_Proto::_shutdown_machine()
|
||||||
{
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("_shutdown_machine.\n"));
|
||||||
|
}
|
||||||
g_machine.s_status._machine_running = false;
|
g_machine.s_status._machine_running = false;
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
};
|
};
|
||||||
@@ -3216,25 +3256,74 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_laser_on_off(bool _bOnOff)
|
|||||||
//**********************************************************************//
|
//**********************************************************************//
|
||||||
//**********************************************************************//
|
//**********************************************************************//
|
||||||
|
|
||||||
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_init_firmware_para()
|
||||||
|
{
|
||||||
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
|
if(g_machine.IsSupportReadInterrputMsg)
|
||||||
|
{
|
||||||
|
_send_cmd_SO7_CMD_SET_GET_INTERRUPT_MSG_METHOD(g_machine.s_machine_config.motion.GetInterruptMsgMethod);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_READ_FIRMWARE_VERSION_INFO();
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
CStringA csAStr("");
|
||||||
|
csAStr.Format("FirmwareVersion:%s.\n",g_machine.FirmwareInfo);
|
||||||
|
CString csStr(csAStr);
|
||||||
|
g_pLogger->SendAndFlushWithTime(csStr);
|
||||||
|
}
|
||||||
|
if (g_machine.FirmwareVer==FirmwareVer_6_X)
|
||||||
|
{
|
||||||
|
_send_cmd_SO7_CMD_WRITE_DATA_TO_FPGA(E_AXIS_X,E_WRITE_ACCURA_ERR,static_cast<char>(g_machine.s_machine_config.motion.m_AccuraErrPulseX));
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_WRITE_DATA_TO_FPGA(E_AXIS_Y,E_WRITE_ACCURA_ERR,static_cast<char>(g_machine.s_machine_config.motion.m_AccuraErrPulseY));
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_WRITE_DATA_TO_FPGA(E_AXIS_Z,E_WRITE_ACCURA_ERR,static_cast<char>(g_machine.s_machine_config.motion.m_AccuraErrPulseZ));
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_WRITE_DATA_TO_FPGA(E_AXIS_X,E_WRITE_EQUIDISTANCE,static_cast<char>(g_machine.s_machine_config.motion.m_EQUIDIS_X));
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_WRITE_DATA_TO_FPGA(E_AXIS_Y,E_WRITE_EQUIDISTANCE,static_cast<char>(g_machine.s_machine_config.motion.m_EQUIDIS_Y));
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_WRITE_DATA_TO_FPGA(E_AXIS_Z,E_WRITE_EQUIDISTANCE,static_cast<char>(g_machine.s_machine_config.motion.m_EQUIDIS_Z));
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("FirmwareVersion:UNKNOWN.\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
bool CSO7_Proto::so7_motion_is_homed()
|
bool CSO7_Proto::so7_motion_is_homed()
|
||||||
{
|
{
|
||||||
if (g_machine.IsOffline)
|
//if (g_machine.IsOffline)
|
||||||
{
|
//{
|
||||||
g_machine.Sys_Reset_Flag =1;
|
// g_machine.Sys_Reset_Flag =1;
|
||||||
SetEvent(g_hHomedEvent);
|
// SetEvent(g_hHomedEvent);
|
||||||
}
|
//}
|
||||||
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
if (g_machine.Sys_Reset_Flag == 1)
|
if (g_machine.Sys_Reset_Flag == 1)
|
||||||
{
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("so7_motion_is_homed:true.\n"));
|
||||||
|
}
|
||||||
SetEvent(g_hHomedEvent);
|
SetEvent(g_hHomedEvent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("so7_motion_is_homed:false.\n"));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Move the stage left/right until the index location is non-zero
|
// Move the stage left/right until the index location is non-zero
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@@ -3260,7 +3349,6 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home()
|
|||||||
// Home
|
// Home
|
||||||
so7_motion_reset_worktable_lower_left(CT_HOME_XYZ);
|
so7_motion_reset_worktable_lower_left(CT_HOME_XYZ);
|
||||||
|
|
||||||
g_pLogger->SendAndFlushPerMode(_T("so7_motion_reset_worktable_lower_left.\n"));
|
|
||||||
TRACE0(" - waiting for X,Y,Zm to stop moving\n");
|
TRACE0(" - waiting for X,Y,Zm to stop moving\n");
|
||||||
//========================================
|
//========================================
|
||||||
// Wait until X-Y-Zm stopped moving
|
// Wait until X-Y-Zm stopped moving
|
||||||
@@ -3271,14 +3359,66 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home()
|
|||||||
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
iRetry++;
|
iRetry++;
|
||||||
}
|
}
|
||||||
g_pLogger->SendAndFlushPerMode(_T("[%d]waiting for X,Y,Zm to stop moving\n"),iRetry);
|
|
||||||
g_pLogger->SendAndFlushPerMode(_T("Home succeed.\n"));
|
|
||||||
//_get_xyz_index(g_machine.s_machine_config.x_axis._neg_working_limit,g_machine.s_machine_config.y_axis._neg_working_limit,g_machine.s_machine_config.z_axis._neg_working_limit);
|
//_get_xyz_index(g_machine.s_machine_config.x_axis._neg_working_limit,g_machine.s_machine_config.y_axis._neg_working_limit,g_machine.s_machine_config.z_axis._neg_working_limit);
|
||||||
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
||||||
m_bHomingActive = false;
|
m_bHomingActive = false;
|
||||||
SetEvent(g_hHomedEvent);
|
SetEvent(g_hHomedEvent);
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
}
|
}
|
||||||
|
//========================================================================
|
||||||
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_HomeXYZ(char cHomeMachineMode)
|
||||||
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("Enter so7_motion_Dcc_HomeXYZ(%d).\n"),cHomeMachineMode);
|
||||||
|
}
|
||||||
|
if (g_machine.IsOffline)
|
||||||
|
{
|
||||||
|
SetEvent(g_hHomedEvent);
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
//查询是否复位
|
||||||
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
|
g_machine.cVerNumber=3;
|
||||||
|
if (g_machine.Sys_Reset_Flag == 1)
|
||||||
|
{
|
||||||
|
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
||||||
|
SetEvent(g_hHomedEvent);
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bHomingActive = true; // Tell the world we need to home the stage
|
||||||
|
|
||||||
|
// Home
|
||||||
|
so7_motion_reset_worktable_lower_left(cHomeMachineMode);
|
||||||
|
|
||||||
|
TRACE0("Waiting for X,Y,Zm to stop moving\n");
|
||||||
|
//========================================
|
||||||
|
// Wait until X-Y-Zm stopped moving
|
||||||
|
//========================================
|
||||||
|
INT lSleep = 20;
|
||||||
|
INT lMaxLoopCnt = HOME_TIMEOUT/lSleep;
|
||||||
|
INT lLoopCnt = 0;
|
||||||
|
Sleep(lSleep);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Sleep(lSleep);
|
||||||
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
|
lLoopCnt++;
|
||||||
|
} while (g_machine.Sys_Reset_Flag != 1 && lLoopCnt < lMaxLoopCnt);
|
||||||
|
//_get_xyz_index(g_machine.s_machine_config.x_axis._neg_working_limit,g_machine.s_machine_config.y_axis._neg_working_limit,g_machine.s_machine_config.z_axis._neg_working_limit);
|
||||||
|
m_bHomingActive = false;
|
||||||
|
if (g_machine.Sys_Reset_Flag == 1)
|
||||||
|
{
|
||||||
|
SetEvent(g_hHomedEvent);
|
||||||
|
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_TIMEOUT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsHomed(bool &bHomed)
|
SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsHomed(bool &bHomed)
|
||||||
@@ -3286,6 +3426,7 @@ SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsHomed(bool &bHomed)
|
|||||||
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
if (g_machine.Sys_Reset_Flag == 1)
|
if (g_machine.Sys_Reset_Flag == 1)
|
||||||
{
|
{
|
||||||
|
SetEvent(g_hHomedEvent);
|
||||||
bHomed=true;
|
bHomed=true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3299,6 +3440,10 @@ SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsHomed(bool &bHomed)
|
|||||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home_R()
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home_R()
|
||||||
{
|
{
|
||||||
//查询是否复位
|
//查询是否复位
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("Enter so7_motion_Dcc_Home_R.\n"));
|
||||||
|
}
|
||||||
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||||
if (g_machine.Sys_Reset_Flag == 1)
|
if (g_machine.Sys_Reset_Flag == 1)
|
||||||
{
|
{
|
||||||
@@ -3326,17 +3471,15 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home_R()
|
|||||||
g_machine.z._pos_fixed._long_=lMoveToDis;
|
g_machine.z._pos_fixed._long_=lMoveToDis;
|
||||||
}
|
}
|
||||||
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
||||||
|
|
||||||
g_pLogger->SendAndFlushPerMode(_T("so7_motion_reset_worktable_lower_left.\n"));
|
|
||||||
//========================================
|
//========================================
|
||||||
const long lSleep = 20;
|
INT lSleep = 20;
|
||||||
const long lMaxLoopCnt = 2000/lSleep;
|
INT lMaxLoopCnt = MOVETO_TIMEOUT/lSleep;
|
||||||
long lLoopCnt = 0;
|
INT lLoopCnt = 0;
|
||||||
Sleep(lSleep);
|
Sleep(lSleep);
|
||||||
BOOL IsFinished(FALSE);
|
bool IsFinished(FALSE);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
so7_motion_is_finished(EMSG_STOPXYZ_1_MOVETOXYZ,IsFinished);
|
so7_Motion_R_IsMotionFInished(IsFinished);
|
||||||
Sleep(lSleep);
|
Sleep(lSleep);
|
||||||
++lLoopCnt;
|
++lLoopCnt;
|
||||||
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
||||||
@@ -3346,7 +3489,6 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home_R()
|
|||||||
_send_cmd_SO7_CMD_SET_RESET_FLAG();
|
_send_cmd_SO7_CMD_SET_RESET_FLAG();
|
||||||
g_machine.cVerNumber = 3;
|
g_machine.cVerNumber = 3;
|
||||||
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
||||||
g_pLogger->SendAndFlushPerMode(_T("Home succeed.\n"));
|
|
||||||
SetEvent(g_hHomedEvent);
|
SetEvent(g_hHomedEvent);
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
}
|
}
|
||||||
@@ -3445,6 +3587,11 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_R(double dRad,bool bWait)
|
|||||||
{
|
{
|
||||||
dRMovetoDis=dRMovetoDis;
|
dRMovetoDis=dRMovetoDis;
|
||||||
}
|
}
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("so7_motion_set_position_R:[From]%.4f;[To]%.4f;[Dis]%.4F.\n")
|
||||||
|
,dRStart,dRad,dRMovetoDis);
|
||||||
|
}
|
||||||
lMoveToDis=static_cast<long>(dRMovetoDis*(static_cast<double>(g_machine.s_machine_config.motion.m_RotaryCirclePulse))/(2.0*M_PI));
|
lMoveToDis=static_cast<long>(dRMovetoDis*(static_cast<double>(g_machine.s_machine_config.motion.m_RotaryCirclePulse))/(2.0*M_PI));
|
||||||
g_machine.x._pos_fixed._long_=0;
|
g_machine.x._pos_fixed._long_=0;
|
||||||
g_machine.y._pos_fixed._long_=0;
|
g_machine.y._pos_fixed._long_=0;
|
||||||
@@ -3464,23 +3611,23 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_R(double dRad,bool bWait)
|
|||||||
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
||||||
g_machine.MotionType=EMSG_STOPXYZ_1_MOVETOXYZ;
|
g_machine.MotionType=EMSG_STOPXYZ_1_MOVETOXYZ;
|
||||||
|
|
||||||
BOOL IsFinished(TRUE);
|
bool IsFinished(true);
|
||||||
if (bWait)
|
if (bWait)
|
||||||
{
|
{
|
||||||
const long lSleep = 20;
|
INT lSleep = 20;
|
||||||
const long lMaxLoopCnt = 2000/lSleep; // use max homing time of 20 seconds
|
INT lMaxLoopCnt = MOVETO_TIMEOUT/lSleep; // use max homing time of 20 seconds
|
||||||
long lLoopCnt = 0;
|
INT lLoopCnt = 0;
|
||||||
Sleep(lSleep);
|
Sleep(lSleep);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
so7_motion_is_finished(EMSG_STOPXYZ_1_MOVETOXYZ,IsFinished);
|
so7_Motion_R_IsMotionFInished(IsFinished);
|
||||||
Sleep(lSleep);
|
Sleep(lSleep);
|
||||||
++lLoopCnt;
|
++lLoopCnt;
|
||||||
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
||||||
}
|
}
|
||||||
g_machine.MotionType=-1;
|
|
||||||
if (IsFinished)
|
if (IsFinished)
|
||||||
{
|
{
|
||||||
|
g_machine.MotionType=-1;
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3502,10 +3649,19 @@ SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsMotionFInished(bool &bFinished)
|
|||||||
if (IsFinished)
|
if (IsFinished)
|
||||||
{
|
{
|
||||||
bFinished=true;
|
bFinished=true;
|
||||||
|
IsMotionFinishedManual(TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bFinished=false;
|
IsFinished=IsMotionFinishedManual();
|
||||||
|
if (IsFinished)
|
||||||
|
{
|
||||||
|
bFinished=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bFinished=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
@@ -3515,14 +3671,6 @@ SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsMotionFInished(bool &bFinished)
|
|||||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_move_R(char _SpeedGear)
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_move_R(char _SpeedGear)
|
||||||
{
|
{
|
||||||
//4-FASTER,1-SLOWER
|
//4-FASTER,1-SLOWER
|
||||||
if (_SpeedGear>4)
|
|
||||||
{
|
|
||||||
_SpeedGear=4;
|
|
||||||
}
|
|
||||||
if (_SpeedGear<1)
|
|
||||||
{
|
|
||||||
_SpeedGear=1;
|
|
||||||
}
|
|
||||||
if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_X)
|
if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_X)
|
||||||
{
|
{
|
||||||
_send_cmd_SO7_CMD_MOVE_X(_SpeedGear);
|
_send_cmd_SO7_CMD_MOVE_X(_SpeedGear);
|
||||||
@@ -3581,9 +3729,9 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_get_position_xyz(double & dX, double &
|
|||||||
dY = ScaleToMM(lY, g_machine.s_machine_config.y_axis._scale_resolution);
|
dY = ScaleToMM(lY, g_machine.s_machine_config.y_axis._scale_resolution);
|
||||||
dZ = ScaleToMM(lZ, g_machine.s_machine_config.z_axis._scale_resolution);
|
dZ = ScaleToMM(lZ, g_machine.s_machine_config.z_axis._scale_resolution);
|
||||||
|
|
||||||
dX -= g_machine.s_machine_config.x_axis._neg_working_limit;
|
//dX -= g_machine.s_machine_config.x_axis._neg_working_limit;
|
||||||
dY -= g_machine.s_machine_config.y_axis._neg_working_limit;
|
//dY -= g_machine.s_machine_config.y_axis._neg_working_limit;
|
||||||
dZ -= g_machine.s_machine_config.z_axis._neg_working_limit;
|
//dZ -= g_machine.s_machine_config.z_axis._neg_working_limit;
|
||||||
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
};
|
};
|
||||||
@@ -3618,7 +3766,11 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_xyz(double dX, double dY,
|
|||||||
Y.to = MMtoScale(dY, g_machine.s_machine_config.y_axis._scale_resolution);
|
Y.to = MMtoScale(dY, g_machine.s_machine_config.y_axis._scale_resolution);
|
||||||
Z.from = MMtoScale(dZStart, g_machine.s_machine_config.z_axis._scale_resolution);
|
Z.from = MMtoScale(dZStart, g_machine.s_machine_config.z_axis._scale_resolution);
|
||||||
Z.to = MMtoScale(dZ, g_machine.s_machine_config.z_axis._scale_resolution);
|
Z.to = MMtoScale(dZ, g_machine.s_machine_config.z_axis._scale_resolution);
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("so7_motion_set_position_xyz:[From]X:%.4f,Y:%.4f,Z:%.4f;[To]X:%.4f,Y:%.4f,Z:%.4f.\n")
|
||||||
|
,dXStart,dYStart,dZStart,dX,dY,dZ);
|
||||||
|
}
|
||||||
// move the position to make the -X, -Y, -Z position 0,0,0
|
// move the position to make the -X, -Y, -Z position 0,0,0
|
||||||
//X.to += g_machine.s_machine_config.x_axis._neg_working_limit;
|
//X.to += g_machine.s_machine_config.x_axis._neg_working_limit;
|
||||||
//Y.to += g_machine.s_machine_config.y_axis._neg_working_limit;
|
//Y.to += g_machine.s_machine_config.y_axis._neg_working_limit;
|
||||||
@@ -3634,32 +3786,114 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_xyz(double dX, double dY,
|
|||||||
|
|
||||||
// _calculate_straightline_motion(g_machine.s_machine_config._dXYZSpeed);
|
// _calculate_straightline_motion(g_machine.s_machine_config._dXYZSpeed);
|
||||||
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
||||||
|
g_machine.MotionType=EMSG_STOPXYZ_1_MOVETOXYZ;
|
||||||
|
|
||||||
#pragma message("Test settle wait comparing the status bit to the scale monitor")
|
#pragma message("Test settle wait comparing the status bit to the scale monitor")
|
||||||
|
TRACE1("Presettle Time: %lf\n", TimeInSecs());
|
||||||
if (bWait)
|
if (bWait)
|
||||||
{
|
{
|
||||||
const long lSleep = 20;
|
INT lSleep = 20;
|
||||||
const long lMaxLoopCnt = 5000/lSleep; // use max homing time of 20 seconds
|
INT lMaxLoopCnt = MOVETO_TIMEOUT/lSleep; // use max homing time of 20 seconds
|
||||||
long lLoopCnt = 0;
|
INT lLoopCnt = 0;
|
||||||
Sleep(lSleep);
|
Sleep(lSleep);
|
||||||
BOOL IsFinished(FALSE);
|
bool IsFinished(FALSE);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
so7_motion_is_finished(EMSG_STOPXYZ_1_MOVETOXYZ,IsFinished);
|
so7_Motion_XYZ_IsMotionFinished(IsFinished);
|
||||||
Sleep(lSleep);
|
Sleep(lSleep);
|
||||||
++lLoopCnt;
|
++lLoopCnt;
|
||||||
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
||||||
|
|
||||||
TRACE1("Presettle Time: %lf\n", TimeInSecs());
|
|
||||||
//WaitForSettleXYZZM();
|
|
||||||
TRACE1("Postsettle Time: %lf\n", TimeInSecs());
|
TRACE1("Postsettle Time: %lf\n", TimeInSecs());
|
||||||
|
if (IsFinished)
|
||||||
|
{
|
||||||
|
g_machine.MotionType=-1;
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
};
|
};
|
||||||
//==================================================================
|
//==================================================================
|
||||||
|
SSI_STATUS_MOTION CSO7_Proto::so7_Motion_XYZ_IsMotionFinished(bool &bFinished)
|
||||||
|
{
|
||||||
|
if (g_machine.MotionType<EMSG_STOPXYZ_1_MOVETOXYZ)
|
||||||
|
{
|
||||||
|
bFinished=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOL IsFinished(FALSE);
|
||||||
|
so7_motion_is_finished(g_machine.MotionType,IsFinished);
|
||||||
|
if (IsFinished)
|
||||||
|
{
|
||||||
|
g_machine.MotionType=-1;
|
||||||
|
bFinished=true;
|
||||||
|
IsMotionFinishedManual(TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsFinished=IsMotionFinishedManual();
|
||||||
|
if (IsFinished)
|
||||||
|
{
|
||||||
|
g_machine.MotionType=-1;
|
||||||
|
bFinished=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bFinished=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
//==================================
|
||||||
|
BOOL CSO7_Proto::IsMotionFinishedManual(BOOL _BResetCnts)
|
||||||
|
{
|
||||||
|
if (_BResetCnts)
|
||||||
|
{
|
||||||
|
g_machine.MotionFinished=FALSE;
|
||||||
|
g_machine.MotionFinishedCnts=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_CNC_Deadlock_Solution>=1)
|
||||||
|
{
|
||||||
|
double dPosX(0.0),dPosY(0.0),dPosZ(0.0);
|
||||||
|
so7_motion_get_position_xyz(dPosX,dPosY,dPosZ);
|
||||||
|
if ((fabs(dPosX-g_machine.x._ReCorded_Pos)<=g_machine.s_machine_config.x_axis._motor_precision)
|
||||||
|
&& (fabs(dPosY-g_machine.y._ReCorded_Pos)<=g_machine.s_machine_config.y_axis._motor_precision)
|
||||||
|
&& (fabs(dPosZ-g_machine.z._ReCorded_Pos)<=g_machine.s_machine_config.z_axis._motor_precision))
|
||||||
|
{
|
||||||
|
g_machine.MotionFinishedCnts++;
|
||||||
|
if (g_machine.MotionFinishedCnts>g_machine.s_machine_config.motion.m_CNC_Deadlock_JudgeMaxCnts)
|
||||||
|
{
|
||||||
|
g_machine.MotionFinished=TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_machine.MotionFinished=FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_machine.MotionFinishedCnts=0;
|
||||||
|
}
|
||||||
|
g_machine.x._ReCorded_Pos=dPosX;
|
||||||
|
g_machine.y._ReCorded_Pos=dPosY;
|
||||||
|
g_machine.z._ReCorded_Pos=dPosZ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_machine.MotionFinished=FALSE;
|
||||||
|
g_machine.MotionFinishedCnts=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return g_machine.MotionFinished;
|
||||||
|
};
|
||||||
|
//==================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_is_finished(char MotionType,BOOL& IsFinished)
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_is_finished(char MotionType,BOOL& IsFinished)
|
||||||
{
|
{
|
||||||
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
||||||
@@ -3693,9 +3927,97 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_is_finished(char MotionType,BOOL& IsFin
|
|||||||
// Full Speed -> dPercentSpeed = 100%
|
// Full Speed -> dPercentSpeed = 100%
|
||||||
// Slow Speed -> dPercentSpeed = 20%
|
// Slow Speed -> dPercentSpeed = 20%
|
||||||
//========================================================================
|
//========================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_speed_xyz(double dPercentSpeed)
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_speed_xyz(EMACHINE_AXIS cAxis,char cSpeedGear,char Acce,char cHoldSpeed,char cStartSpeed,char cRefreshCycle,double dBufferDis)
|
||||||
{
|
{
|
||||||
g_machine.s_machine_config._dXYZSpeed = dPercentSpeed;
|
char SetSpeedGear(0);
|
||||||
|
EMACHINE_AXIS SetAXIS(MACHINE_AXIS_NONE);
|
||||||
|
SetSpeedGear=static_cast<char>(abs(cSpeedGear));
|
||||||
|
if (SetSpeedGear>4)
|
||||||
|
{
|
||||||
|
SetSpeedGear=4;
|
||||||
|
}
|
||||||
|
else if (SetSpeedGear<1)
|
||||||
|
{
|
||||||
|
SetSpeedGear=1;
|
||||||
|
}
|
||||||
|
SetSpeedGear=4-SetSpeedGear;
|
||||||
|
if (cAxis==MACHINE_AXIS_R)
|
||||||
|
{
|
||||||
|
if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_X)
|
||||||
|
{
|
||||||
|
SetAXIS=MACHINE_AXIS_X;
|
||||||
|
}
|
||||||
|
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Y)
|
||||||
|
{
|
||||||
|
SetAXIS=MACHINE_AXIS_Y;
|
||||||
|
}
|
||||||
|
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Z)
|
||||||
|
{
|
||||||
|
SetAXIS=MACHINE_AXIS_Z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(cAxis)
|
||||||
|
{
|
||||||
|
case MACHINE_AXIS_X:
|
||||||
|
{
|
||||||
|
g_machine.s_machine_config.x_axis._speed_base[SetSpeedGear]=Acce;
|
||||||
|
g_machine.s_machine_config.x_axis._speed_max[SetSpeedGear]=cHoldSpeed;
|
||||||
|
g_machine.s_machine_config.x_axis._speed_start[SetSpeedGear]=cStartSpeed;
|
||||||
|
g_machine.s_machine_config.x_axis._speed_fresh[SetSpeedGear]=cRefreshCycle;
|
||||||
|
g_machine.s_machine_config.x_axis._speed_slow_dis[SetSpeedGear]=dBufferDis;
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(0,SetSpeedGear);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_Y:
|
||||||
|
{
|
||||||
|
g_machine.s_machine_config.y_axis._speed_base[SetSpeedGear]=Acce;
|
||||||
|
g_machine.s_machine_config.y_axis._speed_max[SetSpeedGear]=cHoldSpeed;
|
||||||
|
g_machine.s_machine_config.y_axis._speed_start[SetSpeedGear]=cStartSpeed;
|
||||||
|
g_machine.s_machine_config.y_axis._speed_fresh[SetSpeedGear]=cRefreshCycle;
|
||||||
|
g_machine.s_machine_config.y_axis._speed_slow_dis[SetSpeedGear]=dBufferDis;
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(1,SetSpeedGear);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_Z:
|
||||||
|
{
|
||||||
|
g_machine.s_machine_config.z_axis._speed_base[SetSpeedGear]=Acce;
|
||||||
|
g_machine.s_machine_config.z_axis._speed_max[SetSpeedGear]=cHoldSpeed;
|
||||||
|
g_machine.s_machine_config.z_axis._speed_start[SetSpeedGear]=cStartSpeed;
|
||||||
|
g_machine.s_machine_config.z_axis._speed_fresh[SetSpeedGear]=cRefreshCycle;
|
||||||
|
g_machine.s_machine_config.z_axis._speed_slow_dis[SetSpeedGear]=dBufferDis;
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(2,SetSpeedGear);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_ZOOM:
|
||||||
|
{
|
||||||
|
if (SetSpeedGear==4)
|
||||||
|
{
|
||||||
|
SetSpeedGear=0;
|
||||||
|
}
|
||||||
|
else if (SetSpeedGear==3)
|
||||||
|
{
|
||||||
|
SetSpeedGear=0;
|
||||||
|
}
|
||||||
|
else if (SetSpeedGear==2)
|
||||||
|
{
|
||||||
|
SetSpeedGear=1;
|
||||||
|
}
|
||||||
|
else if (SetSpeedGear==1)
|
||||||
|
{
|
||||||
|
SetSpeedGear=2;
|
||||||
|
}
|
||||||
|
g_machine.s_machine_config.zm_axis._speed._char_[0]=cStartSpeed;
|
||||||
|
g_machine.s_machine_config.zm_axis._speed._char_[1]=cHoldSpeed;
|
||||||
|
_send_cmd_SO7_CMD_SET_ZOOM_SPEED(SetSpeedGear);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3717,7 +4039,78 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_get_3D_max_speed(double &dMaxSpeed)
|
|||||||
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
}
|
}
|
||||||
|
//========================================================================
|
||||||
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_all_speed_para()
|
||||||
|
{
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(0,0);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(0,1);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(0,2);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(0,3);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(0,4);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(1,0);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(1,1);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(1,2);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(1,3);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(1,4);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(2,0);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(2,1);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(2,2);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(2,3);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PARAMETER(2,4);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PRECISION(0);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PRECISION(1);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_SPEED_PRECISION(2);
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
_send_cmd_SO7_CMD_SET_MOTOR_SPEED_WHEELBASE_PARAMETER();
|
||||||
|
Sleep(MIN_SLEEP_TIME);
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
//========================================================================
|
||||||
|
SSI_STATUS_MOTION CSO7_Proto::so7_motion_get_all_speed_para()
|
||||||
|
{
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 0, 0);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 0, 1);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 0, 2);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 0, 3);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 0, 4);
|
||||||
|
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 1, 0);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 1, 1);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 1, 2);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 1, 3);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 1, 4);
|
||||||
|
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 2, 0);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 2, 1);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 2, 2);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 2, 3);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PARAMETER( 2, 4);
|
||||||
|
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PRECISION(0);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PRECISION(1);
|
||||||
|
_send_cmd_SO7_CMD_READ_SPEED_PRECISION(2);
|
||||||
|
_send_cmd_SO7_CMD_READ_MOTOR_SPEED_WHEELBASE_PARAMETER();
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
//========================================================================
|
//========================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::_calculate_straightline_motion(double dSpeedMM)
|
SSI_STATUS_MOTION CSO7_Proto::_calculate_straightline_motion(double dSpeedMM)
|
||||||
{
|
{
|
||||||
@@ -3821,8 +4214,8 @@ SSI_STATUS_MOTION CSO7_Proto::so7_light_set_light_off()
|
|||||||
g_machine.s_lights_value._spare_light1=1;
|
g_machine.s_lights_value._spare_light1=1;
|
||||||
g_machine.s_lights_value.segment[0]=0;
|
g_machine.s_lights_value.segment[0]=0;
|
||||||
g_machine.s_lights_value.segment[1]=0;
|
g_machine.s_lights_value.segment[1]=0;
|
||||||
|
|
||||||
_send_cmd_SO7_CMD_SET_ALL_LIGHT_VALUE();
|
_send_cmd_SO7_CMD_SET_ALL_LIGHT_VALUE();
|
||||||
|
Sleep(3*MIN_SLEEP_TIME);
|
||||||
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
};
|
};
|
||||||
@@ -3833,36 +4226,41 @@ SSI_STATUS_MOTION CSO7_Proto::so7_light_set_light()
|
|||||||
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
||||||
|
|
||||||
_send_cmd_SO7_CMD_SET_ALL_LIGHT_VALUE();
|
_send_cmd_SO7_CMD_SET_ALL_LIGHT_VALUE();
|
||||||
|
Sleep(3*MIN_SLEEP_TIME);
|
||||||
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::so7_light_set_lamp_state(double dBottomPercent, double dTopPercent)
|
SSI_STATUS_MOTION CSO7_Proto::so7_light_set_lamp_state(double dTopLightPercent,double dBottomLightPercent,double dCoaxialLightPercent,double dReservedLightPercent,double dRingLightPercent,char cOuterRingLightSwitch,char cInnerRingLightSwitch)
|
||||||
{
|
{
|
||||||
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
WaitForSingleObject(g_hHomedEvent, INFINITE);
|
||||||
if(!g_pLog)
|
g_machine.s_lights_value._bottom_light = (static_cast<char>(dTopLightPercent* (MAXLIGHTVALUE-MINLIGHTVALUE)/100.0 ))+MINLIGHTVALUE;
|
||||||
g_pLog=new CLogger(_T("\\Lamp.Log"));
|
g_machine.s_lights_value._top_light = (static_cast<char>(dBottomLightPercent*(MAXLIGHTVALUE-MINLIGHTVALUE)/100.0))+MINLIGHTVALUE;
|
||||||
g_machine.s_lights_value._top_light = (static_cast<char>(dTopPercent* (MAXLIGHTVALUE)/100.0 ))+1;
|
g_machine.s_lights_value._ring_light = (static_cast<char>(dRingLightPercent*(MAXLIGHTVALUE-MINLIGHTVALUE)/100.0))+MINLIGHTVALUE;
|
||||||
g_machine.s_lights_value._bottom_light = (static_cast<char>(dBottomPercent*(MAXLIGHTVALUE)/100.0))+1;
|
g_machine.s_lights_value._coaxial_light = (static_cast<char>(dCoaxialLightPercent*(MAXLIGHTVALUE-MINLIGHTVALUE)/100.0))+MINLIGHTVALUE;
|
||||||
g_pLog->SendAndFlushPerMode(_T("dBottomPercent: %f dTopPercent: %f\n"),dBottomPercent,dTopPercent);
|
g_machine.s_lights_value._spare_light1 = (static_cast<char>(dReservedLightPercent*(MAXLIGHTVALUE-MINLIGHTVALUE)/100.0))+MINLIGHTVALUE;
|
||||||
g_pLog->SendAndFlushPerMode(_T("so7_light_set_lamp_state bottom: %d top: %d\n"), g_machine.s_lights_value._bottom_light,g_machine.s_lights_value._top_light);
|
g_machine.s_lights_value.segment[0] = cOuterRingLightSwitch;
|
||||||
TRACE2("so7_light_set_lamp_state bottom: %d top: %d\n",
|
g_machine.s_lights_value.segment[1] = cInnerRingLightSwitch;
|
||||||
g_machine.s_lights_value._bottom_light,g_machine.s_lights_value._top_light);
|
_send_cmd_SO7_CMD_SET_ALL_LIGHT_VALUE();
|
||||||
delete g_pLog;
|
Sleep(3*MIN_SLEEP_TIME);
|
||||||
g_pLog=NULL;
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("so7_light_set_lamp_state:TOP:%d,BOT:%d,COAXIAL:%d,RESERVED:%d,RING:%d,ORING:%d,IRING:%d.\n")
|
||||||
|
,(BYTE)g_machine.s_lights_value._bottom_light,(BYTE)g_machine.s_lights_value._top_light,(BYTE)g_machine.s_lights_value._coaxial_light
|
||||||
|
,(BYTE)g_machine.s_lights_value._spare_light1,(BYTE)g_machine.s_lights_value._ring_light,(BYTE)g_machine.s_lights_value.segment[0]
|
||||||
|
,(BYTE)g_machine.s_lights_value.segment[1]);
|
||||||
|
}
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//********************************************************************************//
|
||||||
|
//*******************************************************************************//
|
||||||
//**********************************************************************//
|
|
||||||
//**********************************************************************//
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================
|
//==================================================================================
|
||||||
//==============================================================
|
//==================================================================================
|
||||||
SSI_STATUS_MOTION CSO7_Proto::_send_cmd_SO7_CMD_MOVE_X(char SpeedGear)
|
SSI_STATUS_MOTION CSO7_Proto::_send_cmd_SO7_CMD_MOVE_X(char SpeedGear)
|
||||||
{
|
{
|
||||||
WaitForSingleObject(g_hEP02_Serial_Mutex, INFINITE);
|
WaitForSingleObject(g_hEP02_Serial_Mutex, INFINITE);
|
||||||
@@ -4539,6 +4937,12 @@ SSI_STATUS_MOTION CSO7_Proto::_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(char Cmd,cha
|
|||||||
WaitForSingleObject(g_hEP02_Serial_Mutex, INFINITE);
|
WaitForSingleObject(g_hEP02_Serial_Mutex, INFINITE);
|
||||||
memset(ep_buff[EP_02_CMD_IDX]._buffer, 0x00, MAX_BUFF_SIZE);
|
memset(ep_buff[EP_02_CMD_IDX]._buffer, 0x00, MAX_BUFF_SIZE);
|
||||||
|
|
||||||
|
if (g_machine.s_machine_config.motion.m_DebugOutputEnable>=1)
|
||||||
|
{
|
||||||
|
g_pLogger->SendAndFlushWithTime(_T("SEND_SYS_COMMAND:Cmd:%d,BOT:%d,SubCmd:%d,Type:%d,Data:%d.\n")
|
||||||
|
,Cmd,SubCmd,Type,Data);
|
||||||
|
}
|
||||||
|
|
||||||
*(ep_buff[EP_02_CMD_IDX]._buffer) = Cmd;
|
*(ep_buff[EP_02_CMD_IDX]._buffer) = Cmd;
|
||||||
*(ep_buff[EP_02_CMD_IDX]._buffer+1) = SubCmd;
|
*(ep_buff[EP_02_CMD_IDX]._buffer+1) = SubCmd;
|
||||||
*(ep_buff[EP_02_CMD_IDX]._buffer+2) = Type;
|
*(ep_buff[EP_02_CMD_IDX]._buffer+2) = Type;
|
||||||
|
|||||||
@@ -60,16 +60,6 @@
|
|||||||
const long MAX_INTENSITY = 0x3FF;
|
const long MAX_INTENSITY = 0x3FF;
|
||||||
#define MAXLIGHTVALUE 255
|
#define MAXLIGHTVALUE 255
|
||||||
#define MINLIGHTVALUE 1
|
#define MINLIGHTVALUE 1
|
||||||
enum MACHINE_AXIS
|
|
||||||
{
|
|
||||||
MACHINE_AXIS_NONE = 0,
|
|
||||||
MACHINE_AXIS_X,
|
|
||||||
MACHINE_AXIS_Y,
|
|
||||||
MACHINE_AXIS_Z,
|
|
||||||
MACHINE_AXIS_ZOOM,
|
|
||||||
MACHINE_AXIS_R,
|
|
||||||
MACHINE_AXIS_ALL = 5
|
|
||||||
};
|
|
||||||
enum EMACHINETYPE
|
enum EMACHINETYPE
|
||||||
{
|
{
|
||||||
MACHINE_SO7_CONTROLLER,
|
MACHINE_SO7_CONTROLLER,
|
||||||
@@ -82,6 +72,19 @@ enum EFirmwareVer
|
|||||||
FirmwareVer_6_X,
|
FirmwareVer_6_X,
|
||||||
FirmwareVer_Total
|
FirmwareVer_Total
|
||||||
};
|
};
|
||||||
|
enum ESO7_AXIS_TYPE
|
||||||
|
{
|
||||||
|
E_AXIS_Y=1,
|
||||||
|
E_AXIS_X=2,
|
||||||
|
E_AXIS_Z=3
|
||||||
|
};
|
||||||
|
enum ESO7_WRITE_FPGA_DATA_ADDR
|
||||||
|
{
|
||||||
|
E_WRITE_MOTOR_FLAG=9,
|
||||||
|
E_WRITE_EQUIDISTANCE=10,
|
||||||
|
E_WRITE_ACCURA_ERR=11,
|
||||||
|
E_WRITE_TOTAL=16
|
||||||
|
};
|
||||||
enum ESO7_CONTROLLER_IO_ADDR
|
enum ESO7_CONTROLLER_IO_ADDR
|
||||||
{
|
{
|
||||||
ESO7_CONTROLLER_INPUT_PORT_ADDR=5,
|
ESO7_CONTROLLER_INPUT_PORT_ADDR=5,
|
||||||
@@ -123,6 +126,7 @@ typedef struct s_so7_axis // axis parameters
|
|||||||
long _scale_probe;
|
long _scale_probe;
|
||||||
double _dSet_Zero_Pos;
|
double _dSet_Zero_Pos;
|
||||||
long _lSet_Zero_Pos;
|
long _lSet_Zero_Pos;
|
||||||
|
double _ReCorded_Pos;
|
||||||
} SO7AXIS;
|
} SO7AXIS;
|
||||||
struct s_so7_axis_config // axis configuration
|
struct s_so7_axis_config // axis configuration
|
||||||
{
|
{
|
||||||
@@ -265,6 +269,8 @@ struct struct_so7_machine
|
|||||||
double dRotaryCirclDis;
|
double dRotaryCirclDis;
|
||||||
char SEQ_NUMBER;
|
char SEQ_NUMBER;
|
||||||
char MotionType;
|
char MotionType;
|
||||||
|
int MotionFinishedCnts;
|
||||||
|
BOOL MotionFinished;
|
||||||
struct s_so7_axis x;
|
struct s_so7_axis x;
|
||||||
struct s_so7_axis y;
|
struct s_so7_axis y;
|
||||||
struct s_so7_axis z;
|
struct s_so7_axis z;
|
||||||
@@ -394,8 +400,11 @@ public:
|
|||||||
SSI_STATUS_MOTION ExtractAppPath(CString &Path);
|
SSI_STATUS_MOTION ExtractAppPath(CString &Path);
|
||||||
|
|
||||||
SSI_STATUS_MOTION so7_motion_startup(double x_scale_resolution, double y_scale_resolution, double z_scale_resolution);
|
SSI_STATUS_MOTION so7_motion_startup(double x_scale_resolution, double y_scale_resolution, double z_scale_resolution);
|
||||||
|
SSI_STATUS_MOTION so7_motion_init_firmware_para();
|
||||||
|
|
||||||
bool so7_motion_is_homed();
|
bool so7_motion_is_homed();
|
||||||
SSI_STATUS_MOTION so7_motion_Dcc_Home();
|
SSI_STATUS_MOTION so7_motion_Dcc_Home();
|
||||||
|
SSI_STATUS_MOTION so7_motion_Dcc_HomeXYZ(char cHomeMachineMode=1);
|
||||||
SSI_STATUS_MOTION so7_motion_Dcc_Home_R();
|
SSI_STATUS_MOTION so7_motion_Dcc_Home_R();
|
||||||
SSI_STATUS_MOTION so7_Motion_R_IsHomed(bool &bHomed);
|
SSI_STATUS_MOTION so7_Motion_R_IsHomed(bool &bHomed);
|
||||||
SSI_STATUS_MOTION so7_Motion_R_IsMotionFInished(bool &bFinished);
|
SSI_STATUS_MOTION so7_Motion_R_IsMotionFInished(bool &bFinished);
|
||||||
@@ -414,7 +423,10 @@ public:
|
|||||||
SSI_STATUS_MOTION _get_xyz_index(long & lX, long & lY, long & lZ);
|
SSI_STATUS_MOTION _get_xyz_index(long & lX, long & lY, long & lZ);
|
||||||
SSI_STATUS_MOTION so7_motion_get_position_xyz(double & dX, double & dY, double & dZ);
|
SSI_STATUS_MOTION so7_motion_get_position_xyz(double & dX, double & dY, double & dZ);
|
||||||
SSI_STATUS_MOTION so7_motion_set_position_xyz(double dX, double dY, double dZ, bool bWait);
|
SSI_STATUS_MOTION so7_motion_set_position_xyz(double dX, double dY, double dZ, bool bWait);
|
||||||
SSI_STATUS_MOTION so7_motion_set_speed_xyz(double dPercentSpeed);
|
SSI_STATUS_MOTION so7_Motion_XYZ_IsMotionFinished(bool &bFinished);
|
||||||
|
BOOL IsMotionFinishedManual(BOOL _BResetCnts=FALSE);
|
||||||
|
|
||||||
|
SSI_STATUS_MOTION so7_motion_set_speed_xyz(EMACHINE_AXIS cAxis,char cSpeedGear,char Acce,char cHoldSpeed,char cStartSpeed,char cRefreshCycle,double dBufferDis);
|
||||||
SSI_STATUS_MOTION so7_motion_get_speed_xyz(double &dPercentSpeed);
|
SSI_STATUS_MOTION so7_motion_get_speed_xyz(double &dPercentSpeed);
|
||||||
SSI_STATUS_MOTION so7_motion_set_position_R(double dR,bool bWait);
|
SSI_STATUS_MOTION so7_motion_set_position_R(double dR,bool bWait);
|
||||||
SSI_STATUS_MOTION so7_motion_get_position_R(double & dR);
|
SSI_STATUS_MOTION so7_motion_get_position_R(double & dR);
|
||||||
@@ -423,6 +435,10 @@ public:
|
|||||||
SSI_STATUS_MOTION so7_motion_get_3D_max_speed(double &dMaxSpeed);
|
SSI_STATUS_MOTION so7_motion_get_3D_max_speed(double &dMaxSpeed);
|
||||||
SSI_STATUS_MOTION so7_motion_is_finished(char MotionType,BOOL& IsFinished);
|
SSI_STATUS_MOTION so7_motion_is_finished(char MotionType,BOOL& IsFinished);
|
||||||
|
|
||||||
|
SSI_STATUS_MOTION so7_motion_set_all_speed_para();
|
||||||
|
SSI_STATUS_MOTION so7_motion_get_all_speed_para();
|
||||||
|
|
||||||
|
|
||||||
SSI_STATUS_MOTION _calculate_straightline_motion(double dSpeedMM);
|
SSI_STATUS_MOTION _calculate_straightline_motion(double dSpeedMM);
|
||||||
|
|
||||||
SSI_STATUS_MOTION so7_optics_set_scale_position(long lScale);
|
SSI_STATUS_MOTION so7_optics_set_scale_position(long lScale);
|
||||||
@@ -434,7 +450,7 @@ public:
|
|||||||
|
|
||||||
SSI_STATUS_MOTION so7_light_set_light_off();
|
SSI_STATUS_MOTION so7_light_set_light_off();
|
||||||
SSI_STATUS_MOTION so7_light_set_light();
|
SSI_STATUS_MOTION so7_light_set_light();
|
||||||
SSI_STATUS_MOTION so7_light_set_lamp_state(double dBottomPercent, double dTopPercent);
|
SSI_STATUS_MOTION so7_light_set_lamp_state(double dTopLightPercent,double dBottomLightPercent,double dCoaxialLightPercent,double dReservedLightPercent,double dRingLightPercent,char cOuterRingLightSwitch,char cInnerRingLightSwitch);
|
||||||
|
|
||||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_X(char SpeedGear);
|
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_X(char SpeedGear);
|
||||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_Y(char SpeedGear);
|
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_Y(char SpeedGear);
|
||||||
|
|||||||
@@ -4539,3 +4539,5 @@ _start_machine
|
|||||||
Construct Cso7_Proto.
|
Construct Cso7_Proto.
|
||||||
Init:Open device succeed .
|
Init:Open device succeed .
|
||||||
_start_machine
|
_start_machine
|
||||||
|
Usb Port Initialized.
|
||||||
|
Usb Port Initialized.
|
||||||
|
|||||||
@@ -1,23 +1,11 @@
|
|||||||
[7OCEANAUTOZOOM]
|
|
||||||
ZOOM_PRODUCT_ID=So7123456
|
|
||||||
ZOOM_COM_PORT=1
|
|
||||||
ZOOM_START_DEG=0.000000
|
|
||||||
ZOOM_END_DEG=0.000000
|
|
||||||
ZOOM_ORG_DEG=0.000000
|
|
||||||
ZOOM_DEADBAND_DEG=0.100000
|
|
||||||
ZOOM_PULSE_PER_DEG=25.134736064968621
|
|
||||||
ZOOM_READING_INTERVAL_TIME=60
|
|
||||||
ZOOM_MOTOR_SPEED_FAST=2000
|
|
||||||
ZOOM_MOTOR_SPEED_SLOW=800
|
|
||||||
;
|
|
||||||
[CONTROLLER]
|
[CONTROLLER]
|
||||||
CLOSE_LOOP_ENABLED=0
|
|
||||||
MOTION_RETRY_TIMES=0
|
|
||||||
SHIFT_POSITION_X=0.000000
|
|
||||||
SHIFT_POSITION_Y=0.000000
|
|
||||||
SHIFT_POSITION_Z=0.000000
|
|
||||||
GET_USB_MESSAGE_METHOD=1
|
GET_USB_MESSAGE_METHOD=1
|
||||||
WRITE_DATA_SLEEP_TIME=0
|
WRITE_DATA_SLEEP_TIME=0
|
||||||
|
TOUCH_PROBE_ENABLE=0
|
||||||
|
JOYSTICK_ENABLE=0
|
||||||
|
DEBUG_LOG_ENABLE=0
|
||||||
|
;
|
||||||
|
[Motion]
|
||||||
ACCURA_ERROR_PULSE_X=1
|
ACCURA_ERROR_PULSE_X=1
|
||||||
ACCURA_ERROR_PULSE_Y=1
|
ACCURA_ERROR_PULSE_Y=1
|
||||||
ACCURA_ERROR_PULSE_Z=1
|
ACCURA_ERROR_PULSE_Z=1
|
||||||
@@ -26,18 +14,8 @@ EQUIDISTANCE_PULSE_Y=0
|
|||||||
EQUIDISTANCE_PULSE_Z=0
|
EQUIDISTANCE_PULSE_Z=0
|
||||||
CNC_DEADLOCK_SOLUTION=1
|
CNC_DEADLOCK_SOLUTION=1
|
||||||
CNC_DEADLOCK_MAX_CNTS=6
|
CNC_DEADLOCK_MAX_CNTS=6
|
||||||
TOUCH_PROBE_ENABLE=0
|
X_SCALE_RESOLUTION=0.500
|
||||||
JOYSTICK_ENABLE=0
|
Y_SCALE_RESOLUTION=0.500
|
||||||
DEBUG_LOG_ENABLE=0
|
Z_SCALE_RESOLUTION=0.500
|
||||||
;
|
ROTARY_AXIS_NUMBER=2
|
||||||
[VIDEOCARD]
|
ROTARY_CIR_DIS=7.2
|
||||||
SDK3000_SLEEP_COUNT=550000
|
|
||||||
SV4000E_DENOISE_PARA_CHANNEL1=70
|
|
||||||
SV4000E_DENOISE_PARA_CHANNEL2=70
|
|
||||||
SV4000E_DENOISE_PARA_CHANNEL3=70
|
|
||||||
SV4000E_DENOISE_PARA_CHANNEL4=70
|
|
||||||
;
|
|
||||||
[HSI]
|
|
||||||
MACHINE_CONTROLLER_TYPE=0
|
|
||||||
MACHINE_VIDEOCARD_TYPE=0
|
|
||||||
;
|
|
||||||
@@ -48,7 +48,26 @@ void CLogger::SendAndFlush(LPCTSTR format, ...)
|
|||||||
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void CLogger::SendAndFlushWithTime(LPCTSTR format, ...)
|
||||||
|
{
|
||||||
|
if (!m_File)
|
||||||
|
{
|
||||||
|
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
||||||
|
}
|
||||||
|
if(m_File)
|
||||||
|
{
|
||||||
|
int length = 0;
|
||||||
|
va_list list;
|
||||||
|
va_start(list, format);
|
||||||
|
length = vswprintf_s(m_Str2,5000, format, list);
|
||||||
|
CTime _cTime=CTime::GetCurrentTime();
|
||||||
|
CString csTime=_cTime.Format("[%m/%d %H:%M:%S] ");
|
||||||
|
_ftprintf(m_File, _T("%s"), csTime);
|
||||||
|
_ftprintf(m_File, m_Str2);
|
||||||
|
fclose(m_File);
|
||||||
|
m_File = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
void CLogger::SendAndFlushPerMode(LPCTSTR format, ...)
|
void CLogger::SendAndFlushPerMode(LPCTSTR format, ...)
|
||||||
{
|
{
|
||||||
int length = 0;
|
int length = 0;
|
||||||
|
|||||||
+463
-170
@@ -16,6 +16,469 @@
|
|||||||
CEF8000_Interface* m_pEF8000_Interface=NULL;
|
CEF8000_Interface* m_pEF8000_Interface=NULL;
|
||||||
CSO7_Proto* m_pSO7_Proto=NULL;
|
CSO7_Proto* m_pSO7_Proto=NULL;
|
||||||
bool g_bOfflineOnly(false);
|
bool g_bOfflineOnly(false);
|
||||||
|
EMACHINE_AXIS ActiveAxis=MACHINE_AXIS_NONE;
|
||||||
|
SSI_STATUS_MOTION LoadMotionParameter();
|
||||||
|
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Startup(bool bOfflineOnly,EHOME_MACHINE_MODE cHomeMachineMode)
|
||||||
|
{
|
||||||
|
SSI_STATUS_MOTION rStatus=SSI_STATUS_MOTION_NORMAL;
|
||||||
|
g_bOfflineOnly=bOfflineOnly;
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (!m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
m_pSO7_Proto=new CSO7_Proto();
|
||||||
|
}
|
||||||
|
rStatus=m_pSO7_Proto->Load_So7_Config();
|
||||||
|
if (rStatus==SSI_STATUS_MOTION_NORMAL)
|
||||||
|
{
|
||||||
|
rStatus=m_pSO7_Proto->Init_SO7Usb();
|
||||||
|
if (rStatus==SSI_STATUS_MOTION_NORMAL)
|
||||||
|
{
|
||||||
|
m_pSO7_Proto->_start_machine();
|
||||||
|
rStatus=LoadMotionParameter();
|
||||||
|
if (rStatus==SSI_STATUS_MOTION_NORMAL)
|
||||||
|
{
|
||||||
|
m_pSO7_Proto->so7_motion_set_all_speed_para();
|
||||||
|
m_pSO7_Proto->so7_motion_init_firmware_para();
|
||||||
|
|
||||||
|
switch (cHomeMachineMode)
|
||||||
|
{
|
||||||
|
case HOME_R:
|
||||||
|
{
|
||||||
|
m_pSO7_Proto->so7_motion_Dcc_Home_R();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case HOME_XYZ:
|
||||||
|
case HOME_X:
|
||||||
|
case HOME_Y:
|
||||||
|
case HOME_Z:
|
||||||
|
case HOME_XY:
|
||||||
|
case HOME_XZ:
|
||||||
|
case HOME_YZ:
|
||||||
|
{
|
||||||
|
m_pSO7_Proto->so7_motion_Dcc_HomeXYZ(static_cast<char>(cHomeMachineMode));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rStatus;
|
||||||
|
}
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Shutdown()
|
||||||
|
{
|
||||||
|
if (m_pEF8000_Interface)
|
||||||
|
{
|
||||||
|
delete m_pEF8000_Interface;
|
||||||
|
m_pEF8000_Interface=nullptr;
|
||||||
|
}
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
m_pSO7_Proto->_send_cmd_SO7_CMD_STOP_MOVE_XYZ();
|
||||||
|
Sleep(10);
|
||||||
|
m_pSO7_Proto->so7_light_set_light_off();
|
||||||
|
if(m_pSO7_Proto->g_machine.IsSupportReadInterrputMsg)
|
||||||
|
{
|
||||||
|
m_pSO7_Proto->_send_cmd_SO7_CMD_SET_GET_INTERRUPT_MSG_METHOD(E_GET_INTERRUPT_MSG_INTERRUPT);
|
||||||
|
}
|
||||||
|
m_pSO7_Proto->_shutdown_machine();
|
||||||
|
m_pSO7_Proto->Exit_SO7Usb();
|
||||||
|
delete m_pSO7_Proto;
|
||||||
|
m_pSO7_Proto=nullptr;
|
||||||
|
}
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************Motion**********************************/
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_DCCHomeXYZ(EHOME_MACHINE_MODE cHomeMachineMode)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_Dcc_HomeXYZ(static_cast<char>(cHomeMachineMode));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsHomedXYZ(bool &bHomed)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
bHomed=m_pSO7_Proto->so7_motion_is_homed();
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_GetPositionXYZ(double &PositionX, double &PositionY, double &PositionZ)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_get_position_xyz(PositionX,PositionY,PositionZ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetPositionXYZ(double PositionX, double PositionY, double PositionZ,bool bWait)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_set_position_xyz(PositionX,PositionY,PositionZ,bWait);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinishedXYZ(bool &bFinished)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_Motion_XYZ_IsMotionFinished(bFinished);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetSpeedXYZ(EMACHINE_AXIS cAxis,char cSpeedGear,char Acce,char cHoldSpeed,char cStartSpeed,char cRefreshCycle,double dBufferDis)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_set_speed_xyz(cAxis,cSpeedGear,Acce,cRefreshCycle,cStartSpeed,cHoldSpeed,dBufferDis);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//SpeedGear:1,2,3,4(Faster)
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_Jog(EMACHINE_AXIS cAxis,char cSpeedGear)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
if (abs(cSpeedGear)>4)
|
||||||
|
{
|
||||||
|
if (cSpeedGear>0)
|
||||||
|
{
|
||||||
|
cSpeedGear=4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cSpeedGear=-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (abs(cSpeedGear)<1)
|
||||||
|
{
|
||||||
|
cSpeedGear=1;
|
||||||
|
}
|
||||||
|
ActiveAxis=cAxis;
|
||||||
|
switch (cAxis)
|
||||||
|
{
|
||||||
|
case MACHINE_AXIS_X:
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_X(cSpeedGear);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_Y:
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_Y(cSpeedGear);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_Z:
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_Z(cSpeedGear);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_ZOOM:
|
||||||
|
{
|
||||||
|
if (abs(cSpeedGear)==4)
|
||||||
|
{
|
||||||
|
if (cSpeedGear>0)
|
||||||
|
{
|
||||||
|
cSpeedGear=5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cSpeedGear=-5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (abs(cSpeedGear)==3)
|
||||||
|
{
|
||||||
|
if (cSpeedGear>0)
|
||||||
|
{
|
||||||
|
cSpeedGear=5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cSpeedGear=-5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (abs(cSpeedGear)==2)
|
||||||
|
{
|
||||||
|
if (cSpeedGear>0)
|
||||||
|
{
|
||||||
|
cSpeedGear=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cSpeedGear=-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (abs(cSpeedGear)==1)
|
||||||
|
{
|
||||||
|
if (cSpeedGear>0)
|
||||||
|
{
|
||||||
|
cSpeedGear=2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cSpeedGear=-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_MOVE_ZM(cSpeedGear);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MACHINE_AXIS_R:
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_move_R(cSpeedGear);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_INVALID_PARAMETERS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_Stop()
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
if (ActiveAxis==MACHINE_AXIS_ZOOM)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_STOP_V();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_STOP_MOVE_XYZ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************Rotary Table****************************/
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_GetPositionR(double& dPos)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_get_position_R(dPos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetPositionR(double dAbsolutePos,bool bWait)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_set_position_R(dAbsolutePos,bWait);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_DCCHomeR()
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_motion_Dcc_Home_R();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsHomedR(bool &bHomed)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_Motion_R_IsHomed(bHomed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//==================================================================
|
||||||
|
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinishedR(bool &bFinished)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_Motion_R_IsMotionFInished(bFinished);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*******************************************************************/
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Illumination_SetLampState(double dTopLightPercent,double dBottomLightPercent,double dCoaxialLightPercent,double dReservedLightPercent,double dRingLightPercent,char cOuterRingLightSwitch,char cInnerRingLightSwitch)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->so7_light_set_lamp_state(dTopLightPercent,dBottomLightPercent,dCoaxialLightPercent,dReservedLightPercent,dRingLightPercent,cOuterRingLightSwitch,cInnerRingLightSwitch);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data)
|
||||||
|
{
|
||||||
|
if (!g_bOfflineOnly)
|
||||||
|
{
|
||||||
|
if (m_pSO7_Proto)
|
||||||
|
{
|
||||||
|
return m_pSO7_Proto->_send_cmd_SO7_CMD_COMMON_COMMAND_DATA(Cmd,SubCmd,Type,Data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MACHINE_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SSI_STATUS_MOTION_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
SSI_STATUS_MOTION LoadMotionParameter()
|
SSI_STATUS_MOTION LoadMotionParameter()
|
||||||
@@ -73,173 +536,3 @@ SSI_STATUS_MOTION LoadMotionParameter()
|
|||||||
return SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND;
|
return SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Startup(bool bOfflineOnly,bool bDCCHome)
|
|
||||||
{
|
|
||||||
SSI_STATUS_MOTION rStatus=SSI_STATUS_MOTION_NORMAL;
|
|
||||||
g_bOfflineOnly=bOfflineOnly;
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
rStatus=m_pSO7_Proto->Init_SO7Usb();
|
|
||||||
if (rStatus==SSI_STATUS_MOTION_NORMAL)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto->_start_machine();
|
|
||||||
rStatus=m_pSO7_Proto->Load_So7_Config();
|
|
||||||
if (rStatus==SSI_STATUS_MOTION_NORMAL)
|
|
||||||
{
|
|
||||||
rStatus=LoadMotionParameter();
|
|
||||||
if (rStatus==SSI_STATUS_MOTION_NORMAL)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto->_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
|
||||||
if(m_pSO7_Proto->g_machine.IsSupportReadInterrputMsg)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto->_send_cmd_SO7_CMD_READ_FIRMWARE_VERSION_INFO();
|
|
||||||
}
|
|
||||||
if (bDCCHome)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto->so7_motion_Dcc_Home_R();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rStatus;
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Sutdown()
|
|
||||||
{
|
|
||||||
if (m_pEF8000_Interface)
|
|
||||||
{
|
|
||||||
delete m_pEF8000_Interface;
|
|
||||||
m_pEF8000_Interface=nullptr;
|
|
||||||
}
|
|
||||||
if (m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
if(m_pSO7_Proto->g_machine.IsSupportReadInterrputMsg)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto->_send_cmd_SO7_CMD_SET_GET_INTERRUPT_MSG_METHOD(E_GET_INTERRUPT_MSG_INTERRUPT);
|
|
||||||
}
|
|
||||||
m_pSO7_Proto->_shutdown_machine();
|
|
||||||
m_pSO7_Proto->Exit_SO7Usb();
|
|
||||||
delete m_pSO7_Proto;
|
|
||||||
m_pSO7_Proto=nullptr;
|
|
||||||
}
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_GetPositionR(double& dPos)
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->so7_motion_get_position_R(dPos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetPositionR(double dAbsolutePos,bool bWait)
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->so7_motion_set_position_R(dAbsolutePos,bWait);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_DCCHome()
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->so7_motion_Dcc_Home_R();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsHomed(bool &bHomed)
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->so7_Motion_R_IsHomed(bHomed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinished(bool &bFinished)
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->so7_Motion_R_IsMotionFInished(bFinished);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_JogR(char cSpeedGear)
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->so7_motion_move_R(cSpeedGear);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//==================================================================
|
|
||||||
extern "C" EXP_IMP SSI_STATUS_MOTION WINAPI Motion_StopR()
|
|
||||||
{
|
|
||||||
if (!g_bOfflineOnly)
|
|
||||||
{
|
|
||||||
if (!m_pSO7_Proto)
|
|
||||||
{
|
|
||||||
m_pSO7_Proto=new CSO7_Proto();
|
|
||||||
}
|
|
||||||
return m_pSO7_Proto->_send_cmd_SO7_CMD_STOP_MOVE_XYZ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return SSI_STATUS_MOTION_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+50
-10
@@ -6,6 +6,29 @@
|
|||||||
#define EXP_IMP __declspec(dllimport)
|
#define EXP_IMP __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum EMACHINE_AXIS
|
||||||
|
{
|
||||||
|
MACHINE_AXIS_NONE = 0,
|
||||||
|
MACHINE_AXIS_X,
|
||||||
|
MACHINE_AXIS_Y,
|
||||||
|
MACHINE_AXIS_Z,
|
||||||
|
MACHINE_AXIS_ZOOM,
|
||||||
|
MACHINE_AXIS_R,
|
||||||
|
MACHINE_AXIS_ALL = 5
|
||||||
|
};
|
||||||
|
enum EHOME_MACHINE_MODE
|
||||||
|
{
|
||||||
|
HOME_NONE,
|
||||||
|
HOME_XYZ=1,
|
||||||
|
HOME_X=10,
|
||||||
|
HOME_Y,
|
||||||
|
HOME_Z,
|
||||||
|
HOME_XY=20,
|
||||||
|
HOME_XZ,
|
||||||
|
HOME_YZ,
|
||||||
|
HOME_R=30,
|
||||||
|
HOME_TOATAL=255
|
||||||
|
};
|
||||||
enum SSI_STATUS_MOTION
|
enum SSI_STATUS_MOTION
|
||||||
{
|
{
|
||||||
SSI_STATUS_MOTION_NORMAL = 0,
|
SSI_STATUS_MOTION_NORMAL = 0,
|
||||||
@@ -15,23 +38,40 @@ enum SSI_STATUS_MOTION
|
|||||||
SSI_STATUS_MOTION_TIMEOUT,
|
SSI_STATUS_MOTION_TIMEOUT,
|
||||||
SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND,
|
SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND,
|
||||||
SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND,
|
SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND,
|
||||||
|
SSI_STATUS_MACHINE_UNINITIALIZED,
|
||||||
SSI_STATUS_UNKNOWN_ERROR
|
SSI_STATUS_UNKNOWN_ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Startup(bool bOfflineOnly,bool bDCCHome);
|
EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Startup(bool bOfflineOnly,EHOME_MACHINE_MODE cHomeMachineMode);
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Sutdown();
|
EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Shutdown();
|
||||||
|
//=================================================================================
|
||||||
|
//===============================Motion============================================
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_DCCHomeXYZ(EHOME_MACHINE_MODE cHomeMachineMode);
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsHomedXYZ(bool &bHomed);
|
||||||
|
//Units:mm
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_GetPositionXYZ(double &PositionX, double &PositionY, double &PositionZ);
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetPositionXYZ(double PositionX, double PositionY, double PositionZ,bool bWait);
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinishedXYZ(bool &bFinished);
|
||||||
|
//SpeedGear:1,2,3,4(Faster)
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetSpeedXYZ(EMACHINE_AXIS cAxis,char cSpeedGear,char Acce,char cHoldSpeed,char cStartSpeed,char cRefreshCycle,double dBufferDis);
|
||||||
|
|
||||||
|
//SpeedGear:1,2,3,4(Faster)
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_Jog(EMACHINE_AXIS cAxis,char cSpeedGear);
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_Stop();
|
||||||
|
//===================================Rotary Table==================================
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_DCCHomeR();
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsHomedR(bool &bHomed);
|
||||||
//Units:Rad
|
//Units:Rad
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_GetPositionR(double& dPos);
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_GetPositionR(double& dPos);
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetPositionR(double dAbsolutePos,bool bWait);
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_SetPositionR(double dAbsolutePos,bool bWait);
|
||||||
|
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinishedR(bool &bFinished);
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_DCCHome();
|
//==============================Illumination=======================================
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsHomed(bool &bHomed);
|
//Range value:0.0-100.0
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinished(bool &bFinished);
|
EXP_IMP SSI_STATUS_MOTION WINAPI Illumination_SetLampState(double dTopLightPercent,double dBottomLightPercent,double dCoaxialLightPercent,double dReservedLightPercent,double dRingLightPercent,char cOuterRingLightSwitch,char cInnerRingLightSwitch);
|
||||||
//SpeedGear:1,2,3,4(Faster)
|
//==============================CMD================================================
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_JogR(char cSpeedGear);
|
EXP_IMP SSI_STATUS_MOTION WINAPI SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data);
|
||||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_StopR();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
BIN
Binary file not shown.
+6
-2
@@ -80,23 +80,27 @@
|
|||||||
<None Include="ReadMe.txt" />
|
<None Include="ReadMe.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\MicroVu\logger.h" />
|
|
||||||
<ClInclude Include="..\..\..\SevenOcean\EF8000_Interface.h" />
|
<ClInclude Include="..\..\..\SevenOcean\EF8000_Interface.h" />
|
||||||
<ClInclude Include="..\..\..\SevenOcean\SO7_Proto.h" />
|
<ClInclude Include="..\..\..\SevenOcean\SO7_Proto.h" />
|
||||||
|
<ClInclude Include="..\logger.h" />
|
||||||
<ClInclude Include="MachineInterfaceDll.h" />
|
<ClInclude Include="MachineInterfaceDll.h" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="targetver.h" />
|
<ClInclude Include="targetver.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\MicroVu\LOGGER.CPP" />
|
|
||||||
<ClCompile Include="..\..\..\SevenOcean\EF8000_Interface.cpp" />
|
<ClCompile Include="..\..\..\SevenOcean\EF8000_Interface.cpp" />
|
||||||
<ClCompile Include="..\..\..\SevenOcean\SO7_Proto.cpp" />
|
<ClCompile Include="..\..\..\SevenOcean\SO7_Proto.cpp" />
|
||||||
|
<ClCompile Include="..\LOGGER.CPP" />
|
||||||
<ClCompile Include="MachineInterfaceDll.cpp" />
|
<ClCompile Include="MachineInterfaceDll.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="MachineInterfaceDll.rc" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|||||||
+10
-2
@@ -33,7 +33,10 @@
|
|||||||
<ClInclude Include="..\..\..\SevenOcean\SO7_Proto.h">
|
<ClInclude Include="..\..\..\SevenOcean\SO7_Proto.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\..\MicroVu\logger.h">
|
<ClInclude Include="..\logger.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="resource.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -50,8 +53,13 @@
|
|||||||
<ClCompile Include="..\..\..\SevenOcean\SO7_Proto.cpp">
|
<ClCompile Include="..\..\..\SevenOcean\SO7_Proto.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\..\MicroVu\LOGGER.CPP">
|
<ClCompile Include="..\LOGGER.CPP">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="MachineInterfaceDll.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
+2
-1
@@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LocalDebuggerCommand>E:\Tony\MachineInterfaceUtility\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\Debug\Win32TestDll.exe</LocalDebuggerCommand>
|
<LocalDebuggerCommand>
|
||||||
|
</LocalDebuggerCommand>
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by MachineInterfaceDll.rc
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Binary file not shown.
@@ -2,19 +2,169 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include <conio.h>
|
||||||
#include "..\MachineInterfaceDll\MachineInterfaceDll.h"
|
#include "..\MachineInterfaceDll\MachineInterfaceDll.h"
|
||||||
|
void ShowMessage(SSI_STATUS_MOTION status);
|
||||||
|
|
||||||
int _tmain(int argc, _TCHAR* argv[])
|
int _tmain(int argc, _TCHAR* argv[])
|
||||||
{
|
{
|
||||||
SSI_STATUS_MOTION status=Machine_Startup(false,false);
|
SSI_STATUS_MOTION status=Machine_Startup(false,HOME_NONE);
|
||||||
double dPos(0.0);
|
printf("Machine_Startup:");
|
||||||
bool bb;
|
ShowMessage(status);
|
||||||
status=Motion_GetPositionR(dPos);
|
//=================================================================================
|
||||||
status=Motion_SetPositionR(dPos,true);
|
//===============================Motion============================================
|
||||||
status=Motion_IsHomed(bb);
|
bool bHomed(false);
|
||||||
status=Motion_IsFinished(bb);
|
status=Motion_IsHomedXYZ(bHomed);
|
||||||
status=Motion_MoveR(1);
|
printf("Motion_IsHomedXYZ:");
|
||||||
status=Machine_Sutdown();
|
ShowMessage(status);
|
||||||
|
if (!bHomed)
|
||||||
|
{
|
||||||
|
status=Motion_DCCHomeXYZ(HOME_XYZ);
|
||||||
|
printf("Motion_IsHomedXYZ:");
|
||||||
|
ShowMessage(status);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Sleep(20);
|
||||||
|
status=Motion_IsHomedXYZ(bHomed);
|
||||||
|
printf("Motion_IsHomedXYZ:");
|
||||||
|
ShowMessage(status);
|
||||||
|
} while (!bHomed);
|
||||||
|
}
|
||||||
|
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||||
|
printf("Motion_Jog:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(3000);
|
||||||
|
status=Motion_Stop();
|
||||||
|
printf("Motion_Stop:");
|
||||||
|
ShowMessage(status);
|
||||||
|
|
||||||
|
status=Motion_Jog(MACHINE_AXIS_Y,3);
|
||||||
|
printf("Motion_Jog:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(3000);
|
||||||
|
status=Motion_Stop();
|
||||||
|
printf("Motion_Stop:");
|
||||||
|
ShowMessage(status);
|
||||||
|
|
||||||
|
status=Motion_Jog(MACHINE_AXIS_Z,-3);
|
||||||
|
printf("Motion_Jog:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(3000);
|
||||||
|
status=Motion_Stop();
|
||||||
|
printf("Motion_Stop:");
|
||||||
|
ShowMessage(status);
|
||||||
|
|
||||||
|
double PositionX,PositionY,PositionZ;
|
||||||
|
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||||
|
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||||
|
PositionX=0.0;
|
||||||
|
PositionY=0.0;
|
||||||
|
PositionZ=0.0;
|
||||||
|
printf("Motion_SetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionX,PositionY,PositionZ);
|
||||||
|
status=Motion_SetPositionXYZ(PositionX,PositionY,PositionZ,true);
|
||||||
|
|
||||||
|
status=Motion_GetPositionXYZ(PositionX,PositionY,PositionZ);
|
||||||
|
printf("Motion_GetPositionXYZ:%.4f,%.4f.%.4f;\r\n",PositionY,PositionX,PositionZ);
|
||||||
|
|
||||||
|
//status=Motion_IsFinishedXYZ(bool &bFinished);
|
||||||
|
status=Motion_Jog(MACHINE_AXIS_X,-3);
|
||||||
|
printf("Motion_Jog:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(3000);
|
||||||
|
status=Motion_Stop();
|
||||||
|
printf("Motion_Stop:");
|
||||||
|
ShowMessage(status);
|
||||||
|
status=Motion_SetSpeedXYZ(MACHINE_AXIS_X,3,20,20,20,3,0.01);
|
||||||
|
printf("Motion_SetSpeedXYZ:");
|
||||||
|
ShowMessage(status);
|
||||||
|
status=Motion_Jog(MACHINE_AXIS_X,3);
|
||||||
|
printf("Motion_Jog:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(3000);
|
||||||
|
status=Motion_Stop();
|
||||||
|
printf("Motion_Stop:");
|
||||||
|
ShowMessage(status);
|
||||||
|
|
||||||
|
//===================================Rotary Table==================================
|
||||||
|
//Motion_DCCHomeR();
|
||||||
|
//Motion_IsHomedR(bool &bHomed);
|
||||||
|
////Units:Rad
|
||||||
|
//Motion_GetPositionR(double& dPos);
|
||||||
|
//Motion_SetPositionR(double dAbsolutePos,bool bWait);
|
||||||
|
//Motion_IsFinishedR(bool &bFinished);
|
||||||
|
//==============================Illumination=======================================
|
||||||
|
//Range value:0.0-100.0
|
||||||
|
status=Illumination_SetLampState(0,100,0,0,0,0,0);
|
||||||
|
printf("Illumination_SetLampState:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(1000);
|
||||||
|
status=Illumination_SetLampState(100,0,0,0,0,0,0);
|
||||||
|
printf("Illumination_SetLampState:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(1000);
|
||||||
|
status=Illumination_SetLampState(100,100,0,0,0,0,0);
|
||||||
|
printf("Illumination_SetLampState:");
|
||||||
|
ShowMessage(status);
|
||||||
|
Sleep(1000);
|
||||||
|
|
||||||
|
//==============================CMD================================================
|
||||||
|
//SEND_SYS_COMMAND(char Cmd,char SubCmd,char Type,char Data);
|
||||||
|
status=Machine_Shutdown();
|
||||||
|
printf("Machine_Shutdown:");
|
||||||
|
ShowMessage(status);
|
||||||
|
printf("Press any key to exit\r\n");
|
||||||
|
_getch();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
void ShowMessage(SSI_STATUS_MOTION status)
|
||||||
|
{
|
||||||
|
switch(status)
|
||||||
|
{
|
||||||
|
case SSI_STATUS_MOTION_NORMAL:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MOTION_NORMAL.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_MOTION_DATALINK_ERROR:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MOTION_DATALINK_ERROR.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_MOTION_LIMIT_REACHED:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MOTION_LIMIT_REACHED.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_MOTION_INVALID_PARAMETERS:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MOTION_INVALID_PARAMETERS.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_MOTION_TIMEOUT:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MOTION_TIMEOUT.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_MACHINE_UNINITIALIZED:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_MACHINE_UNINITIALIZED.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SSI_STATUS_UNKNOWN_ERROR:
|
||||||
|
{
|
||||||
|
printf("SSI_STATUS_UNKNOWN_ERROR.\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
void Send(LPCTSTR, ...);
|
void Send(LPCTSTR, ...);
|
||||||
void SendAndFlush(LPCTSTR, ...);
|
void SendAndFlush(LPCTSTR, ...);
|
||||||
void SendAndFlushPerMode(LPCTSTR, ...);
|
void SendAndFlushPerMode(LPCTSTR, ...);
|
||||||
|
void SendAndFlushWithTime(LPCTSTR, ...);
|
||||||
CString m_FileName;
|
CString m_FileName;
|
||||||
long m_lLogMask;
|
long m_lLogMask;
|
||||||
FILE *m_File;
|
FILE *m_File;
|
||||||
|
|||||||
Reference in New Issue
Block a user