增加导出DLL工程。
This commit is contained in:
@@ -35,3 +35,7 @@ PcDmis/Base/Interfac/Msi/Hsi/KeyenceTM065/LK-Gͨ
|
||||
*.ipch
|
||||
*.opensdf
|
||||
*.tmp
|
||||
PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/MachineInterfaceDll/Debug
|
||||
PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/MachineInterfaceDll/Release
|
||||
PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Win32TestDll/Debug
|
||||
PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/Win32TestDll/Release
|
||||
|
||||
@@ -277,7 +277,7 @@ usb_dev_handle* CKeyence_Proto::_open_usb_dev(void)
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_usb_reset(void)
|
||||
SSI_STATUS CKeyence_Proto::_usb_reset(void)
|
||||
{
|
||||
if (g_dev)
|
||||
{
|
||||
@@ -287,9 +287,9 @@ SSI_STATUS_MOTION CKeyence_Proto::_usb_reset(void)
|
||||
else
|
||||
{
|
||||
ASSERT(0);
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
return SSI_STATUS_TIMEOUT;
|
||||
}
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
return SSI_STATUS_TIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
@@ -298,12 +298,12 @@ SSI_STATUS_MOTION CKeyence_Proto::_usb_reset(void)
|
||||
// Send is direct and async.
|
||||
// The receive thread will receive data and interpret it.
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::Init_MvUsb()
|
||||
SSI_STATUS CKeyence_Proto::Init_MvUsb()
|
||||
{
|
||||
// Set initial state of the machine
|
||||
g_machine.s_status._machine_running = false;
|
||||
|
||||
SSI_STATUS_MOTION Status=SSI_STATUS_MOTION_NORMAL;
|
||||
SSI_STATUS Status=SSI_STATUS_NORMAL;
|
||||
UNREFERENCED_PARAMETER(Status);
|
||||
/*if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
g_pLogger->SendAndFlushPerMode(_T("Enter Initialize Mv Usb\n"));
|
||||
@@ -317,20 +317,20 @@ SSI_STATUS_MOTION CKeyence_Proto::Init_MvUsb()
|
||||
{
|
||||
MessageBox(NULL, _T("Unable to open device"), _T("Message"), MB_OK);
|
||||
g_pLogger->SendAndFlushPerMode(_T("Unable to open device %s"), usb_strerror());
|
||||
return SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
return SSI_STATUS_DATALINK_ERROR;
|
||||
}
|
||||
|
||||
if (usb_set_configuration(g_dev, MY_CONFIG) < 0)
|
||||
{
|
||||
MessageBox(NULL, _T("Unable to SET CONFIGURATION"), _T("Message"), MB_OK);
|
||||
return SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
return SSI_STATUS_DATALINK_ERROR;
|
||||
}
|
||||
|
||||
if (usb_claim_interface(g_dev, 0) < 0)
|
||||
{
|
||||
usb_close(g_dev);
|
||||
MessageBox(NULL, _T("Unable to CLAIM DEVICE"), _T("Message"), MB_OK);
|
||||
return SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
return SSI_STATUS_DATALINK_ERROR;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
@@ -413,13 +413,13 @@ SSI_STATUS_MOTION CKeyence_Proto::Init_MvUsb()
|
||||
|
||||
//if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
// g_pLogger->SendAndFlushPerMode(_T("Exit Initialize Usb\n"));
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::Exit_MvUsb()
|
||||
SSI_STATUS CKeyence_Proto::Exit_MvUsb()
|
||||
{
|
||||
SSI_STATUS_MOTION Status=SSI_STATUS_MOTION_NORMAL;
|
||||
SSI_STATUS Status=SSI_STATUS_NORMAL;
|
||||
//if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
// g_pLogger->SendAndFlushPerMode(_T("Enter Exit_MvUsb\n"));
|
||||
|
||||
@@ -500,7 +500,7 @@ SSI_STATUS_MOTION CKeyence_Proto::Exit_MvUsb()
|
||||
// Kick the g_hEP01_Thread_Event to get the g_EP01_Thread going.
|
||||
// iEP = EP_KEYENCE_01 or EP_KEYENCE_02 = 0x01 or 0x02
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_do_single_threaded_usb_comm(int iEP_Base)
|
||||
SSI_STATUS CKeyence_Proto::_do_single_threaded_usb_comm(int iEP_Base)
|
||||
{
|
||||
TRACE1("=====_do_single_threaded_usb_comm(iEP) g_hEP01_Thread_Event. %x\n", iEP_Base);
|
||||
while ((ep_buff[iEP_Base]._hProtoPending == TRUE) || (ep_buff[iEP_Base+1]._hProtoPending == TRUE))
|
||||
@@ -516,52 +516,52 @@ SSI_STATUS_MOTION CKeyence_Proto::_do_single_threaded_usb_comm(int iEP_Base)
|
||||
Sleep(3);
|
||||
}
|
||||
TRACE1("=====_do_single_threaded_usb_comm(iEP) g_hProtoDoneEvents. %x\n", iEP_Base);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
// This startup just kicks off the EP_KEYENCE_81 worker thread.
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_start_machine()
|
||||
SSI_STATUS CKeyence_Proto::_start_machine()
|
||||
{
|
||||
g_hEP81_Thread_State = THREAD_RUNNING;
|
||||
g_hEP82_Thread_State = THREAD_RUNNING;
|
||||
g_machine.s_status._machine_running = true;
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_shutdown_machine()
|
||||
SSI_STATUS CKeyence_Proto::_shutdown_machine()
|
||||
{
|
||||
g_machine.s_status._machine_running = false;
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
//===============================================================================
|
||||
// iEP = EP_KEYENCE_01 or EP_KEYENCE_02
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_submit_async_8x(int iEP_Base)
|
||||
SSI_STATUS CKeyence_Proto::_submit_async_8x(int iEP_Base)
|
||||
{
|
||||
int _ret;
|
||||
_ret = usb_bulk_setup_async(g_dev, &(ep_buff[iEP_Base]._async_context), (unsigned char)ep_buff[iEP_Base]._ep);
|
||||
if (_ret < 0)
|
||||
{
|
||||
return SSI_STATUS_MOTION_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
return SSI_STATUS_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
}
|
||||
_ret = usb_submit_async(ep_buff[iEP_Base]._async_context, ep_buff[iEP_Base]._buffer, ep_buff[iEP_Base]._size);
|
||||
if (_ret < 0)
|
||||
{
|
||||
printf("error usb_submit_async_ep_xx:\n%s\n", usb_strerror());
|
||||
return SSI_STATUS_MOTION_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
return SSI_STATUS_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
// iEP_Base : EP_81_DATA_IDX/EP_82_DATA_IDX
|
||||
//
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_reap_async_8x(int iEP_Base)
|
||||
SSI_STATUS CKeyence_Proto::_reap_async_8x(int iEP_Base)
|
||||
{
|
||||
int _ret;
|
||||
_ret = usb_reap_async(ep_buff[iEP_Base]._async_context, 1000);
|
||||
@@ -575,16 +575,16 @@ SSI_STATUS_MOTION CKeyence_Proto::_reap_async_8x(int iEP_Base)
|
||||
{
|
||||
usb_free_async(&(ep_buff[iEP_Base]._async_context));
|
||||
ASSERT(0);
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
return SSI_STATUS_TIMEOUT;
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
// _send_usb_data(iEP) sends data to the corresponding iEP channel.
|
||||
// iEP = EP_KEYENCE_01 / EP_KEYENCE_02 EP_KEYENCE_01 = 0x01; EP_KEYENCE_02 = 0x02;
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_send_usb_data(int iEP_Base)
|
||||
SSI_STATUS CKeyence_Proto::_send_usb_data(int iEP_Base)
|
||||
{
|
||||
int _ret;
|
||||
ep_buff[iEP_Base]._save_send_cmd = ep_buff[iEP_Base]._buffer[0];
|
||||
@@ -595,13 +595,13 @@ SSI_STATUS_MOTION CKeyence_Proto::_send_usb_data(int iEP_Base)
|
||||
_ret = usb_bulk_setup_async(g_dev, &(ep_buff[iEP_Base]._async_context), (unsigned char)ep_buff[iEP_Base]._ep);
|
||||
if (_ret < 0)
|
||||
{
|
||||
return SSI_STATUS_MOTION_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
return SSI_STATUS_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
}
|
||||
_ret = usb_submit_async(ep_buff[iEP_Base]._async_context, ep_buff[iEP_Base]._buffer, ep_buff[iEP_Base]._size);//send data
|
||||
if (_ret < 0)
|
||||
{
|
||||
printf("error usb_submit_async_ep_xx:\n%s\n", usb_strerror());
|
||||
return SSI_STATUS_MOTION_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
return SSI_STATUS_SETUP_ASYNC_CONTEXT_ERROR;
|
||||
}
|
||||
TRACE1("_submit_async_8x(EP:%X)\r\n", iEP_Base);
|
||||
//
|
||||
@@ -624,13 +624,13 @@ SSI_STATUS_MOTION CKeyence_Proto::_send_usb_data(int iEP_Base)
|
||||
{
|
||||
usb_free_async(&(ep_buff[iEP_Base]._async_context));
|
||||
ASSERT(0);
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
return SSI_STATUS_TIMEOUT;
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_send_cmd_KEYENCE_CMD_GET_LASER_DATA()
|
||||
SSI_STATUS CKeyence_Proto::_send_cmd_KEYENCE_CMD_GET_LASER_DATA()
|
||||
{
|
||||
WaitForSingleObject(g_hEP01_Serial_Mutex, INFINITE);
|
||||
memset(ep_buff[EP_01_CMD_IDX]._buffer, 0x00, MAX_BUFF_SIZE);
|
||||
@@ -648,13 +648,13 @@ SSI_STATUS_MOTION CKeyence_Proto::_send_usb_data(int iEP_Base)
|
||||
|
||||
_do_single_threaded_usb_comm(EP_01_CMD_IDX);
|
||||
ReleaseMutex(g_hEP01_Serial_Mutex);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
|
||||
//==============================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_process_KEYENCE_CMD_GET_LASER_DATA()
|
||||
SSI_STATUS CKeyence_Proto::_process_KEYENCE_CMD_GET_LASER_DATA()
|
||||
{
|
||||
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
return SSI_STATUS_NORMAL;
|
||||
};
|
||||
@@ -155,22 +155,22 @@ public:
|
||||
static CLogger* g_pLogger;
|
||||
static usb_dev_handle *g_dev;
|
||||
|
||||
SSI_STATUS_MOTION Init_MvUsb();
|
||||
SSI_STATUS_MOTION Exit_MvUsb();
|
||||
SSI_STATUS Init_MvUsb();
|
||||
SSI_STATUS Exit_MvUsb();
|
||||
static void Trace_EP_Buff(long lIndex);
|
||||
static void _process_rcv_transfer_data(int iEP);
|
||||
usb_dev_handle* _open_usb_dev(void);
|
||||
SSI_STATUS_MOTION _usb_reset(void);
|
||||
SSI_STATUS _usb_reset(void);
|
||||
|
||||
SSI_STATUS_MOTION _start_machine();
|
||||
SSI_STATUS_MOTION _shutdown_machine();
|
||||
SSI_STATUS_MOTION _do_single_threaded_usb_comm(int iEP);
|
||||
SSI_STATUS_MOTION _submit_async_8x(int iEP_Base);
|
||||
SSI_STATUS_MOTION _reap_async_8x(int iEP_Base);
|
||||
SSI_STATUS_MOTION _send_usb_data(int iEP_Base);
|
||||
SSI_STATUS _start_machine();
|
||||
SSI_STATUS _shutdown_machine();
|
||||
SSI_STATUS _do_single_threaded_usb_comm(int iEP);
|
||||
SSI_STATUS _submit_async_8x(int iEP_Base);
|
||||
SSI_STATUS _reap_async_8x(int iEP_Base);
|
||||
SSI_STATUS _send_usb_data(int iEP_Base);
|
||||
|
||||
SSI_STATUS_MOTION _send_cmd_KEYENCE_CMD_GET_LASER_DATA();
|
||||
static SSI_STATUS_MOTION _process_KEYENCE_CMD_GET_LASER_DATA();
|
||||
SSI_STATUS _send_cmd_KEYENCE_CMD_GET_LASER_DATA();
|
||||
static SSI_STATUS _process_KEYENCE_CMD_GET_LASER_DATA();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,20 +17,8 @@ enum SSI_STATUS {
|
||||
SSI_STATUS_REPLAY_FILE_ERROR,
|
||||
SSI_STATUS_MV_CONFIG_FILE_NOT_FOUND,
|
||||
SSI_STATUS_MV_HOMING_TIMEOUT,
|
||||
SSI_STATUS_ERROR
|
||||
};
|
||||
|
||||
enum SSI_STATUS_MOTION {
|
||||
SSI_STATUS_MOTION_NORMAL = 0,
|
||||
SSI_STATUS_MOTION_STALLED,
|
||||
SSI_STATUS_MOTION_LIMIT_REACHED,
|
||||
SSI_STATUS_MOTION_TIMEOUT,
|
||||
SSI_STATUS_MOTION_INVALID_PARAMETERS,
|
||||
SSI_STATUS_UNKNOWN_ERROR,
|
||||
SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND,
|
||||
SSI_STATUS_MOTION_SETUP_ASYNC_CONTEXT_ERROR,
|
||||
SSI_STATUS_MOTION_REPLAY_FILE_ERROR,
|
||||
SSI_STATUS_MOTION_DATALINK_ERROR
|
||||
SSI_STATUS_ERROR,
|
||||
SSI_STATUS_TIMEOUT
|
||||
};
|
||||
|
||||
enum SSI_STATUS_SMARTMOTOR {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define BAR_CODE_WIDTH 20
|
||||
#define BAR_CODE_HEIGHT 20
|
||||
|
||||
|
||||
#ifdef EF_IMAGE_DLL
|
||||
#define EXP __declspec(dllexport)
|
||||
#else
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "StdAfx.h"
|
||||
#include <WinDef.h>
|
||||
#include <WinBase.h>
|
||||
#include <math.h>
|
||||
#include "DLL.h"
|
||||
#include "EF8000_Interface.h "
|
||||
|
||||
|
||||
@@ -29,6 +28,32 @@ CEF8000_Interface::~CEF8000_Interface()
|
||||
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
void CEF8000_Interface::GetAppPath(CString &Path)
|
||||
{
|
||||
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;
|
||||
}
|
||||
};
|
||||
BOOL CEF8000_Interface::OpenMotorDat()
|
||||
{
|
||||
CString csAppPath;
|
||||
GetAppPath(csAppPath);
|
||||
CString csMotorDatFile =csAppPath+_T("\\motor.dat");
|
||||
return OpenSpeedParameter(csMotorDatFile);
|
||||
}
|
||||
|
||||
BOOL CEF8000_Interface::SaveSpeedParameter(CString _FileName)
|
||||
{
|
||||
FILE* iFileHandle=NULL;
|
||||
@@ -84,7 +109,8 @@ FILE* CEF8000_Interface::FileOpen(const CString filename,const int Mode)
|
||||
case fmOpenWrite: fileMode =_T("wb"); break;
|
||||
case fmOpenReadWrite:fileMode =_T("wb+"); break;
|
||||
}
|
||||
FILE *FileStream = _tfopen(filename, fileMode);
|
||||
FILE *FileStream = NULL;
|
||||
_tfopen_s(&FileStream,filename, fileMode);
|
||||
return FileStream;
|
||||
|
||||
};
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "DLL.h"
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(16)
|
||||
/*
|
||||
@@ -588,8 +585,10 @@ public:
|
||||
~CEF8000_Interface();
|
||||
BOOL SaveSpeedParameter(CString _FileName);
|
||||
BOOL OpenSpeedParameter(CString _FileName);
|
||||
BOOL OpenMotorDat();
|
||||
|
||||
protected:
|
||||
void GetAppPath(CString &Path);
|
||||
FILE* FileOpen(const CString filename,const int Mode);
|
||||
int FileSeek(FILE * _Handle, long _Offset, int _Origin);
|
||||
int FileRead(FILE * _Handle, void *_Buffer, int _Count);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <math.h>
|
||||
#include "SO7_Proto.h"
|
||||
#include "math.h"
|
||||
|
||||
|
||||
|
||||
#define MY_CONFIG 1
|
||||
#define MAX_DEVPATH_LENGTH 256
|
||||
#define ENDPOINT_TIMEOUT 500
|
||||
#define MAX_IN_BUFF_SIZE 1024
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
||||
const DOUBLE ROTARY_MMtoScale_RESOLUTION=0.0005;
|
||||
//***** Static Data *****
|
||||
static char *outBuff = NULL;
|
||||
struct_so7_ep_buff CSO7_Proto::ep_buff[lEPSIZE];
|
||||
@@ -2631,7 +2631,10 @@ SSI_STATUS_MOTION CSO7_Proto::Load_So7_Config()
|
||||
}
|
||||
fclose(hConfigFile);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND;
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
@@ -2684,7 +2687,7 @@ SSI_STATUS_MOTION CSO7_Proto::_replay_capture(CString s_replay_file)
|
||||
|
||||
_wfopen_s(&pInFile, s_replay_file, _T("r"));
|
||||
if (pInFile == NULL)
|
||||
return SSI_STATUS_MOTION_REPLAY_FILE_ERROR;
|
||||
return SSI_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
char *cData = (char *)malloc(MAX_BUFF_SIZE);
|
||||
char *inBuff = (char *)malloc(MAX_BUFF_SIZE);
|
||||
@@ -2819,81 +2822,81 @@ SSI_STATUS_MOTION CSO7_Proto::Init_SO7Usb()
|
||||
//Set initial state of the machine
|
||||
g_machine.s_status._machine_running = false;
|
||||
|
||||
|
||||
SSI_STATUS_MOTION rStatus=SSI_STATUS_MOTION_NORMAL;
|
||||
|
||||
g_machine.IsOffline=FALSE;
|
||||
|
||||
int usb_status = NULL;
|
||||
usb_init(); // initialize the library
|
||||
usb_status = usb_find_busses(); // find all busses
|
||||
usb_status = usb_find_devices(); // find all connected devices
|
||||
g_dev = _open_usb_dev();
|
||||
if (!g_dev)
|
||||
{
|
||||
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;
|
||||
rStatus= SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
g_machine.IsOffline=FALSE;
|
||||
|
||||
int usb_status = NULL;
|
||||
usb_init(); // initialize the library
|
||||
usb_status = usb_find_busses(); // find all busses
|
||||
usb_status = usb_find_devices(); // find all connected devices
|
||||
g_dev = _open_usb_dev();
|
||||
if (!g_dev)
|
||||
{
|
||||
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;
|
||||
rStatus= SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
}
|
||||
else if (usb_set_configuration(g_dev, MY_CONFIG) < 0)
|
||||
{
|
||||
MessageBox(NULL, _T("Unable to SET CONFIGURATION"), _T("Message"), MB_OK|MB_ICONERROR);
|
||||
g_machine.IsOffline=TRUE;
|
||||
rStatus=SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
}
|
||||
else if (usb_claim_interface(g_dev, 0) < 0)
|
||||
{
|
||||
usb_close(g_dev);
|
||||
MessageBox(NULL, _T("Unable to CLAIM DEVICE"), _T("Message"), MB_OK|MB_ICONERROR);
|
||||
g_machine.IsOffline=TRUE;
|
||||
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
|
||||
// is important because the underlying library is not thread-safe.
|
||||
//
|
||||
ep_buff[EP_02_CMD_IDX]._event = CreateEvent(NULL, // default security attributes
|
||||
FALSE, // manual reset event object
|
||||
NULL, // signaled
|
||||
NULL); // unamed object
|
||||
|
||||
g_hEP02_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP02_Thread,
|
||||
(LPVOID) this,
|
||||
0,
|
||||
NULL);
|
||||
g_hEP02_Thread_State = THREAD_RUNNING_STATE1;
|
||||
|
||||
// ********************************************************************
|
||||
// Prepare and start EP_S07_81 Thread - Use async commit.
|
||||
//
|
||||
ep_buff[EP_82_DATA_IDX]._event = CreateEvent(NULL, // default security attributes
|
||||
FALSE, // manual reset event object
|
||||
NULL, // signaled
|
||||
NULL); // unamed object
|
||||
g_hEP8x_Thread_State = THREAD_PAUSED;
|
||||
g_hEP8x_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP8x_Thread,
|
||||
(LPVOID) this,
|
||||
0,
|
||||
NULL);
|
||||
g_hEP02_Serial_Mutex = CreateMutex(NULL, // default security attributes
|
||||
FALSE, // initial owner
|
||||
NULL); // name
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
g_hHomedEvent = CreateEvent(NULL, // default security attributes
|
||||
TRUE, // manual reset event object
|
||||
FALSE, // initial state is signaled
|
||||
NULL); // unamed object
|
||||
}
|
||||
else if (usb_set_configuration(g_dev, MY_CONFIG) < 0)
|
||||
{
|
||||
MessageBox(NULL, _T("Unable to SET CONFIGURATION"), _T("Message"), MB_OK|MB_ICONERROR);
|
||||
g_machine.IsOffline=TRUE;
|
||||
rStatus=SSI_STATUS_MOTION_DATALINK_ERROR;
|
||||
}
|
||||
else if (usb_claim_interface(g_dev, 0) < 0)
|
||||
{
|
||||
usb_close(g_dev);
|
||||
MessageBox(NULL, _T("Unable to CLAIM DEVICE"), _T("Message"), MB_OK|MB_ICONERROR);
|
||||
g_machine.IsOffline=TRUE;
|
||||
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
|
||||
// is important because the underlying library is not thread-safe.
|
||||
//
|
||||
ep_buff[EP_02_CMD_IDX]._event = CreateEvent(NULL, // default security attributes
|
||||
FALSE, // manual reset event object
|
||||
NULL, // signaled
|
||||
NULL); // unamed object
|
||||
|
||||
g_hEP02_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP02_Thread,
|
||||
(LPVOID) this,
|
||||
0,
|
||||
NULL);
|
||||
g_hEP02_Thread_State = THREAD_RUNNING_STATE1;
|
||||
|
||||
// ********************************************************************
|
||||
// Prepare and start EP_S07_81 Thread - Use async commit.
|
||||
//
|
||||
ep_buff[EP_82_DATA_IDX]._event = CreateEvent(NULL, // default security attributes
|
||||
FALSE, // manual reset event object
|
||||
NULL, // signaled
|
||||
NULL); // unamed object
|
||||
g_hEP8x_Thread_State = THREAD_PAUSED;
|
||||
g_hEP8x_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP8x_Thread,
|
||||
(LPVOID) this,
|
||||
0,
|
||||
NULL);
|
||||
g_hEP02_Serial_Mutex = CreateMutex(NULL, // default security attributes
|
||||
FALSE, // initial owner
|
||||
NULL); // name
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
g_hHomedEvent = CreateEvent(NULL, // default security attributes
|
||||
TRUE, // manual reset event object
|
||||
FALSE, // initial state is signaled
|
||||
NULL); // unamed object
|
||||
|
||||
|
||||
return rStatus;
|
||||
}
|
||||
@@ -3250,6 +3253,264 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home()
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsHomed(bool &bHomed)
|
||||
{
|
||||
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||
if (g_machine.Sys_Reset_Flag == 1)
|
||||
{
|
||||
bHomed=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bHomed=false;
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_Dcc_Home_R()
|
||||
{
|
||||
//²éѯÊÇ·ñ¸´Î»
|
||||
_send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||
if (g_machine.Sys_Reset_Flag == 1)
|
||||
{
|
||||
SetEvent(g_hHomedEvent);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
m_bHomingActive = true; // Tell the world we need to home the stage
|
||||
|
||||
// Home r
|
||||
long lMoveToDis(0);
|
||||
g_machine.x._pos_fixed._long_=0;
|
||||
g_machine.y._pos_fixed._long_=0;
|
||||
g_machine.z._pos_fixed._long_=0;
|
||||
lMoveToDis=MMtoScale(2.0*g_machine.s_machine_config.motion.m_RotaryCircleDis,ROTARY_MMtoScale_RESOLUTION);
|
||||
if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_X)
|
||||
{
|
||||
g_machine.x._pos_fixed._long_=lMoveToDis;
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Y)
|
||||
{
|
||||
g_machine.y._pos_fixed._long_=lMoveToDis;
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Z)
|
||||
{
|
||||
g_machine.z._pos_fixed._long_=lMoveToDis;
|
||||
}
|
||||
_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;
|
||||
const long lMaxLoopCnt = 2000/lSleep;
|
||||
long lLoopCnt = 0;
|
||||
Sleep(lSleep);
|
||||
BOOL IsFinished(FALSE);
|
||||
do
|
||||
{
|
||||
so7_motion_is_finished(EMSG_STOPXYZ_1_MOVETOXYZ,IsFinished);
|
||||
Sleep(lSleep);
|
||||
++lLoopCnt;
|
||||
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
||||
m_bHomingActive = false;
|
||||
if (IsFinished)
|
||||
{
|
||||
_send_cmd_SO7_CMD_SET_RESET_FLAG();
|
||||
g_machine.cVerNumber = 3;
|
||||
_send_cmd_SO7_CMD_SET_VER_NUMBER();
|
||||
g_pLogger->SendAndFlushPerMode(_T("Home succeed.\n"));
|
||||
SetEvent(g_hHomedEvent);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
}
|
||||
}
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_get_position_R(double & dRad)
|
||||
{
|
||||
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
||||
|
||||
long lX=0, lY=0, lZ=0;
|
||||
long lX_Ref=0, lY_Ref=0, lZ_Ref=0;
|
||||
double dR(0.0);
|
||||
_send_cmd_SO7_CMD_READ_AXIS_XYZ();
|
||||
if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_X)
|
||||
{
|
||||
lX = g_machine.x._scale_pos._long_;
|
||||
_send_cmd_SO7_CMD_READ_ZSIGNAL_POS_X();
|
||||
lX_Ref=g_machine.x._ZSignal_pos._long_;
|
||||
dR=static_cast<double>(lX-lX_Ref);
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Y)
|
||||
{
|
||||
lY = g_machine.y._scale_pos._long_;
|
||||
_send_cmd_SO7_CMD_READ_ZSIGNAL_POS_Y();
|
||||
lY_Ref=g_machine.y._ZSignal_pos._long_;
|
||||
dR=static_cast<double>(lY-lY_Ref);
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Z)
|
||||
{
|
||||
lZ = g_machine.z._scale_pos._long_;
|
||||
_send_cmd_SO7_CMD_READ_ZSIGNAL_POS_Z();
|
||||
lZ_Ref=g_machine.z._ZSignal_pos._long_;
|
||||
dR=static_cast<double>(lZ-lZ_Ref);
|
||||
}
|
||||
bool bPlus(true);
|
||||
if (dR<-0.00001)
|
||||
{
|
||||
bPlus=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bPlus=false;
|
||||
}
|
||||
int iRetryCnts(0);
|
||||
g_machine.s_machine_config.motion.m_RotaryCirclePulse=g_machine.s_machine_config.motion.m_RotaryCircleDis/ROTARY_MMtoScale_RESOLUTION;
|
||||
if (fabs(dR)-fabs(2.0*g_machine.s_machine_config.motion.m_RotaryCirclePulse)>100)
|
||||
{
|
||||
do
|
||||
{
|
||||
iRetryCnts++;
|
||||
if (bPlus)
|
||||
{
|
||||
dR+=8388608;
|
||||
}
|
||||
else
|
||||
{
|
||||
dR-=8388608;
|
||||
}
|
||||
//m_csMessage.Format("[CONVERT RotaryY]CNTS:%d;PLUS:%d;ScaleYResult:%.4f.",iRetryCnts,bPlus,dR);
|
||||
} while ((iRetryCnts<5)&&
|
||||
(fabs(dR)-fabs(g_machine.s_machine_config.motion.m_RotaryCirclePulse)>100));
|
||||
}
|
||||
dRad = 2.0*M_PI*dR/(g_machine.s_machine_config.motion.m_RotaryCirclePulse);
|
||||
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
};
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_R(double dRad,bool bWait)
|
||||
{
|
||||
WaitForSingleObject(g_hHomedEvent, INFINITE);
|
||||
// get the current position
|
||||
double dRStart(0.0),dRMovetoDis(0.0);
|
||||
long lMoveToDis(0);
|
||||
so7_motion_get_position_R(dRStart);
|
||||
dRMovetoDis=dRad-dRStart;
|
||||
double dMod=dRMovetoDis/(2.0*M_PI);
|
||||
int iMod(0);
|
||||
if(dMod>=0.0001)
|
||||
{
|
||||
iMod=static_cast<int>(floor(dMod));
|
||||
}
|
||||
else
|
||||
{
|
||||
iMod=static_cast<int>(ceil(dMod));
|
||||
}
|
||||
dRMovetoDis=dRMovetoDis-2.0*M_PI*static_cast<double>(iMod);
|
||||
|
||||
if ((dRMovetoDis)<=-0.01)
|
||||
{
|
||||
dRMovetoDis=2.0*M_PI+dRMovetoDis;
|
||||
}
|
||||
else
|
||||
{
|
||||
dRMovetoDis=dRMovetoDis;
|
||||
}
|
||||
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.y._pos_fixed._long_=0;
|
||||
g_machine.z._pos_fixed._long_=0;
|
||||
if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_X)
|
||||
{
|
||||
g_machine.x._pos_fixed._long_=lMoveToDis;
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Y)
|
||||
{
|
||||
g_machine.y._pos_fixed._long_=lMoveToDis;
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Z)
|
||||
{
|
||||
g_machine.z._pos_fixed._long_=lMoveToDis;
|
||||
}
|
||||
_send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(CT_MOVETOXYZ);
|
||||
g_machine.MotionType=EMSG_STOPXYZ_1_MOVETOXYZ;
|
||||
|
||||
BOOL IsFinished(TRUE);
|
||||
if (bWait)
|
||||
{
|
||||
const long lSleep = 20;
|
||||
const long lMaxLoopCnt = 2000/lSleep; // use max homing time of 20 seconds
|
||||
long lLoopCnt = 0;
|
||||
Sleep(lSleep);
|
||||
do
|
||||
{
|
||||
so7_motion_is_finished(EMSG_STOPXYZ_1_MOVETOXYZ,IsFinished);
|
||||
Sleep(lSleep);
|
||||
++lLoopCnt;
|
||||
} while (!IsFinished && lLoopCnt < lMaxLoopCnt);
|
||||
}
|
||||
g_machine.MotionType=-1;
|
||||
if (IsFinished)
|
||||
{
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
}
|
||||
};
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_Motion_R_IsMotionFInished(bool &bFinished)
|
||||
{
|
||||
if (g_machine.MotionType<EMSG_STOPXYZ_1_MOVETOXYZ)
|
||||
{
|
||||
bFinished=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL IsFinished(TRUE);
|
||||
so7_motion_is_finished(g_machine.MotionType,IsFinished);
|
||||
if (IsFinished)
|
||||
{
|
||||
bFinished=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFinished=false;
|
||||
}
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_move_R(char _SpeedGear)
|
||||
{
|
||||
//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)
|
||||
{
|
||||
_send_cmd_SO7_CMD_MOVE_X(_SpeedGear);
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Y)
|
||||
{
|
||||
_send_cmd_SO7_CMD_MOVE_Y(_SpeedGear);
|
||||
}
|
||||
else if (g_machine.s_machine_config.motion.m_RotaryAxisNO==MACHINE_AXIS_Z)
|
||||
{
|
||||
_send_cmd_SO7_CMD_MOVE_Z(_SpeedGear);
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_startup(double dScaleResolutionX, double dScaleResolutionY, double dScaleResolutionZ)
|
||||
@@ -3303,7 +3564,7 @@ SSI_STATUS_MOTION CSO7_Proto::so7_motion_get_position_xyz(double & dX, double &
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION CSO7_Proto::so7_motion_set_position_xyz(double dX, double dY, double dZ, bool bWait)
|
||||
{
|
||||
//WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
||||
WaitForSingleObject(g_hHomedEvent, INFINITE); // machine start and homing is done
|
||||
|
||||
if (g_machine.IsOffline)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "..\Tools\UsbUtility\logger.h"
|
||||
#include "CMD_H.h"
|
||||
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
||||
#include "..\MicroVu\SsiStatus.h"
|
||||
#include "..\Tools\UsbUtility\MachineInterfaceDll\MachineInterfaceDll.h"
|
||||
|
||||
#define MAX_BUFF_SIZE 0x200
|
||||
|
||||
@@ -60,6 +60,16 @@
|
||||
const long MAX_INTENSITY = 0x3FF;
|
||||
#define MAXLIGHTVALUE 255
|
||||
#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
|
||||
{
|
||||
MACHINE_SO7_CONTROLLER,
|
||||
@@ -180,6 +190,9 @@ struct s_so7_machine_interface_config
|
||||
INT m_SV4000E_DenoisePara[4];
|
||||
INT m_MachineType;
|
||||
INT m_VideoCardType;
|
||||
INT m_RotaryAxisNO;
|
||||
double m_RotaryCircleDis;
|
||||
double m_RotaryCirclePulse;
|
||||
};
|
||||
|
||||
//======================
|
||||
@@ -219,7 +232,8 @@ struct struct_so7_machine
|
||||
bool _bZMMoving;
|
||||
char _bIsZMMotionFinished;
|
||||
bool _bZMHoming;
|
||||
bool _bXYZZMIdle;
|
||||
bool _bXYZZMIdle;
|
||||
bool _bRMovins;
|
||||
} s_status;
|
||||
union {
|
||||
struct s_lights_value
|
||||
@@ -250,6 +264,7 @@ struct struct_so7_machine
|
||||
BOOL IsSupportReadInterrputMsg;
|
||||
double dRotaryCirclDis;
|
||||
char SEQ_NUMBER;
|
||||
char MotionType;
|
||||
struct s_so7_axis x;
|
||||
struct s_so7_axis y;
|
||||
struct s_so7_axis z;
|
||||
@@ -381,6 +396,9 @@ public:
|
||||
SSI_STATUS_MOTION so7_motion_startup(double x_scale_resolution, double y_scale_resolution, double z_scale_resolution);
|
||||
bool so7_motion_is_homed();
|
||||
SSI_STATUS_MOTION so7_motion_Dcc_Home();
|
||||
SSI_STATUS_MOTION so7_motion_Dcc_Home_R();
|
||||
SSI_STATUS_MOTION so7_Motion_R_IsHomed(bool &bHomed);
|
||||
SSI_STATUS_MOTION so7_Motion_R_IsMotionFInished(bool &bFinished);
|
||||
SSI_STATUS_MOTION _start_machine();
|
||||
SSI_STATUS_MOTION _shutdown_machine();
|
||||
SSI_STATUS_MOTION so7_motion_probe_on_off_(bool _bOnOff);
|
||||
@@ -398,7 +416,11 @@ public:
|
||||
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_get_speed_xyz(double &dPercentSpeed);
|
||||
SSI_STATUS_MOTION so7_motion_get_3D_max_speed(double &dMaxSpeed);
|
||||
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_move_R(char _SpeedGear);
|
||||
|
||||
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 _calculate_straightline_motion(double dSpeedMM);
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#include "..\Tools\UsbUtility\logger.h"
|
||||
#include "CMD_H.h"
|
||||
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
||||
#include "..\MicroVu\SsiStatus.h"
|
||||
#include "..\Tools\UsbUtility\MachineInterfaceDll\MachineInterfaceDll.h"
|
||||
|
||||
|
||||
#define MAX_BUFF_SIZE 0x200
|
||||
#define USB_R_SEQ_NUMBER 1
|
||||
|
||||
@@ -4533,3 +4533,9 @@ _start_machine
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
// MachineInterfaceDll.cpp : 定义 DLL 应用程序的导出函数。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <BaseTsd.h>
|
||||
#include <WinBase.h>
|
||||
#include <WinDef.h>
|
||||
#include <atltypes.h>
|
||||
#include <tchar.h>
|
||||
#include <atlstr.h>
|
||||
#include "..\..\..\SevenOcean\DLL.h"
|
||||
#include "..\..\..\SevenOcean\EF8000_Interface.h"
|
||||
#include "..\..\..\SevenOcean\SO7_Proto.h"
|
||||
#include "MachineInterfaceDll.h"
|
||||
|
||||
CEF8000_Interface* m_pEF8000_Interface=NULL;
|
||||
CSO7_Proto* m_pSO7_Proto=NULL;
|
||||
bool g_bOfflineOnly(false);
|
||||
|
||||
//==================================================================
|
||||
SSI_STATUS_MOTION LoadMotionParameter()
|
||||
{
|
||||
BOOL rStatus(FALSE);
|
||||
if (!m_pEF8000_Interface)
|
||||
{
|
||||
m_pEF8000_Interface=new CEF8000_Interface();
|
||||
}
|
||||
rStatus=m_pEF8000_Interface->OpenMotorDat();
|
||||
if (rStatus)
|
||||
{
|
||||
for(int j=0;j<5;j++)
|
||||
{
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._speed_base[j]=m_pEF8000_Interface->Set_Speed[j][0];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._speed_max[j]=m_pEF8000_Interface->Set_Speed[j][1];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._speed_start[j]=m_pEF8000_Interface->Set_Speed[j][2];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._speed_fresh[j]=m_pEF8000_Interface->Set_Speed[j][3];
|
||||
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._speed_slow_dis[j]=m_pEF8000_Interface->slow_dis[j];
|
||||
}
|
||||
for(int j=0;j<5;j++)
|
||||
{
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._speed_base[j]=m_pEF8000_Interface->Set_Speed[j+5][0];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._speed_max[j]=m_pEF8000_Interface->Set_Speed[j+5][1];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._speed_start[j]=m_pEF8000_Interface->Set_Speed[j+5][2];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._speed_fresh[j]=m_pEF8000_Interface->Set_Speed[j+5][3];
|
||||
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._speed_slow_dis[j]=m_pEF8000_Interface->slow_dis[j+5];
|
||||
}
|
||||
for(int j=0;j<5;j++)
|
||||
{
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._speed_base[j]=m_pEF8000_Interface->Set_Speed[j+10][0];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._speed_max[j]=m_pEF8000_Interface->Set_Speed[j+10][1];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._speed_start[j]=m_pEF8000_Interface->Set_Speed[j+10][2];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._speed_fresh[j]=m_pEF8000_Interface->Set_Speed[j+10][3];
|
||||
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._speed_slow_dis[j]=m_pEF8000_Interface->slow_dis[j+10];
|
||||
}
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._motor_precision=m_pEF8000_Interface->g_precision[0];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._motor_precision=m_pEF8000_Interface->g_precision[1];
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._motor_precision= m_pEF8000_Interface->g_precision[2];
|
||||
|
||||
m_pSO7_Proto->g_machine.s_machine_config.x_axis._motor_wheelbase=m_pEF8000_Interface->Image_Info.m_Motor_Dx;
|
||||
m_pSO7_Proto->g_machine.s_machine_config.y_axis._motor_wheelbase=m_pEF8000_Interface->Image_Info.m_Motor_Dy;
|
||||
m_pSO7_Proto->g_machine.s_machine_config.z_axis._motor_wheelbase=m_pEF8000_Interface->Image_Info.m_Motor_Dz;
|
||||
m_pSO7_Proto->g_machine._motor_pulse_num= m_pEF8000_Interface->Image_Info.m_Motor_Plus_Num;
|
||||
}
|
||||
if (rStatus)
|
||||
{
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
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_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_MoveR(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;
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef MACHINEINTERFACEDLL_EXPORTS
|
||||
#define EXP_IMP __declspec(dllexport)
|
||||
#else
|
||||
#define EXP_IMP __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
enum SSI_STATUS_MOTION
|
||||
{
|
||||
SSI_STATUS_MOTION_NORMAL = 0,
|
||||
SSI_STATUS_MOTION_DATALINK_ERROR,
|
||||
SSI_STATUS_MOTION_LIMIT_REACHED,
|
||||
SSI_STATUS_MOTION_INVALID_PARAMETERS,
|
||||
SSI_STATUS_MOTION_TIMEOUT,
|
||||
SSI_STATUS_SO7_CONFIG_FILE_NOT_FOUND,
|
||||
SSI_STATUS_MOTOR_DAT_FILE_NOT_FOUND,
|
||||
SSI_STATUS_UNKNOWN_ERROR
|
||||
};
|
||||
|
||||
extern "C"
|
||||
{
|
||||
///////////////////////////////////////////////
|
||||
EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Startup(bool bOfflineOnly,bool bDCCHome);
|
||||
EXP_IMP SSI_STATUS_MOTION WINAPI Machine_Sutdown();
|
||||
//Units:Rad
|
||||
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_IsHomed(bool &bHomed);
|
||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_IsFinished(bool &bFinished);
|
||||
//SpeedGear:1,2,3,4(Faster)
|
||||
EXP_IMP SSI_STATUS_MOTION WINAPI Motion_MoveR(char cSpeedGear);
|
||||
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A945B062-6081-49F0-992D-D14769C4C7D4}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MachineInterfaceDll</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MACHINEINTERFACEDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>..\..\..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Lib\Msvc\libusb.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MACHINEINTERFACEDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>..\..\..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Lib\Msvc\libusb.lib</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\MicroVu\logger.h" />
|
||||
<ClInclude Include="..\..\..\SevenOcean\EF8000_Interface.h" />
|
||||
<ClInclude Include="..\..\..\SevenOcean\SO7_Proto.h" />
|
||||
<ClInclude Include="MachineInterfaceDll.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\MicroVu\LOGGER.CPP" />
|
||||
<ClCompile Include="..\..\..\SevenOcean\EF8000_Interface.cpp" />
|
||||
<ClCompile Include="..\..\..\SevenOcean\SO7_Proto.cpp" />
|
||||
<ClCompile Include="MachineInterfaceDll.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MachineInterfaceDll.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\SevenOcean\EF8000_Interface.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\SevenOcean\SO7_Proto.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\MicroVu\logger.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MachineInterfaceDll.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\SevenOcean\EF8000_Interface.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\SevenOcean\SO7_Proto.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\MicroVu\LOGGER.CPP">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommand>E:\Tony\MachineInterfaceUtility\PcDmis\Base\Interfac\Msi\Hsi\Tools\UsbUtility\Debug\Win32TestDll.exe</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// MachineInterfaceDll.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _SECURE_ATL
|
||||
#define _SECURE_ATL 1
|
||||
#endif
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
|
||||
// turns off MFC's hiding of some common and often safely ignored warning messages
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
|
||||
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcontrolbars.h> // MFC support for ribbons and control bars
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_IA64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CString GetAppPath(void);
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||
|
||||
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
@@ -143,3 +143,8 @@ Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <math.h>
|
||||
#include "afxpropertysheet.h"
|
||||
#include "resource.h"
|
||||
#include "..\..\..\SevenOcean\DLL.h"
|
||||
#include "..\..\..\SevenOcean\EF8000_Interface.h"
|
||||
#include "..\..\..\SevenOcean\SO7_Proto.h"
|
||||
#include "DrawGraph.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "afxpropertysheet.h"
|
||||
#include "resource.h"
|
||||
#include "..\..\..\SevenOcean\DLL.h"
|
||||
#include "..\..\..\SevenOcean\EF8000_Interface.h"
|
||||
#include "..\..\..\SevenOcean\SO7_Proto.h"
|
||||
#include "..\..\..\SevenOcean\CMMIO_SERIAL.H"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "resource.h"
|
||||
#include "AboutDlg.h"
|
||||
#include "..\..\..\SevenOcean\CMMIO_SERIAL.H"
|
||||
#include "..\..\..\SevenOcean\DLL.h"
|
||||
#include "..\..\..\SevenOcean\EF8000_Interface.h"
|
||||
#include "..\..\..\SevenOcean\SO7_Proto.h"
|
||||
#include "..\..\..\SevenOcean\SO7_Proto_Aux.h"
|
||||
|
||||
@@ -3,6 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Usb_Util", "UsbUtil\Usb_Util.vcxproj", "{50B21A79-C887-4F7E-8911-7E3A685BFA25}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MachineInterfaceDll", "MachineInterfaceDll\MachineInterfaceDll.vcxproj", "{A945B062-6081-49F0-992D-D14769C4C7D4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Win32TestDll", "Win32TestDll\Win32TestDll.vcxproj", "{BF02B850-BB32-4635-9E53-8583C474884D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -31,6 +35,30 @@ Global
|
||||
{50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|Win32.Build.0 = Template|Win32
|
||||
{50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|x64.ActiveCfg = Template|x64
|
||||
{50B21A79-C887-4F7E-8911-7E3A685BFA25}.Template|x64.Build.0 = Template|x64
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Release|Win32.Build.0 = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Release|x64.ActiveCfg = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|Win32.ActiveCfg = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|Win32.Build.0 = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.ReleaseSO7|x64.ActiveCfg = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Template|Win32.Build.0 = Release|Win32
|
||||
{A945B062-6081-49F0-992D-D14769C4C7D4}.Template|x64.ActiveCfg = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Release|Win32.Build.0 = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Release|x64.ActiveCfg = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|Win32.ActiveCfg = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|Win32.Build.0 = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.ReleaseSO7|x64.ActiveCfg = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Template|Win32.Build.0 = Release|Win32
|
||||
{BF02B850-BB32-4635-9E53-8583C474884D}.Template|x64.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
// TestDll.cpp : 定义控制台应用程序的入口点。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "..\MachineInterfaceDll\MachineInterfaceDll.h"
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
SSI_STATUS_MOTION status=Machine_Startup(false,false);
|
||||
double dPos(0.0);
|
||||
bool bb;
|
||||
status=Motion_GetPositionR(dPos);
|
||||
status=Motion_SetPositionR(dPos,true);
|
||||
status=Motion_IsHomed(bb);
|
||||
status=Motion_IsFinished(bb);
|
||||
status=Motion_MoveR(1);
|
||||
status=Machine_Sutdown();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BF02B850-BB32-4635-9E53-8583C474884D}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Win32TestDll</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>../Debug/MachineInterfaceDll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>../Release/MachineInterfaceDll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Win32TestDll.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Win32TestDll.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// Win32TestDll.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
||||
@@ -0,0 +1,15 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||
|
||||
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user