Machine Interface Utility:VER1.0
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
syntax: glob
|
||||
*.~h
|
||||
*.~CPP
|
||||
*.sdf
|
||||
*.dll
|
||||
*.aps
|
||||
*.pch
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.exe
|
||||
*.obj
|
||||
*.jpg
|
||||
*.~*
|
||||
*.orig
|
||||
PcDmis/Base/Interfac/Msi/Hsi/MicroVu/Win32/Release
|
||||
PcDmis/Base/Interfac/Msi/Hsi/MicroVu/Win32/Debug
|
||||
PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Debug
|
||||
PcDmis/Base/Interfac/Msi/Hsi/Tools/UsbUtility/UsbUtil/Release
|
||||
PcDmis/UsbSupport/libusb-win32-src-1.2.4.0/projects/Win32
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,249 @@
|
||||
// protocol for control SevenOcean's Machine
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef AFX_ANIMATICS_Proto_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
#define AFX_ANIMATICS_Proto_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "..\Tools\UsbUtility\logger.h"
|
||||
#include "..\MicroVu\SsiStatus.h"
|
||||
#include "SMIDefs.h"
|
||||
//#include "IntegMotorInterface.h"
|
||||
|
||||
|
||||
#import "IntegMotorInterface.tlb"
|
||||
using namespace INTEGMOTORINTERFACELib;
|
||||
|
||||
#define MAX_BUFF_SIZE 0x200
|
||||
|
||||
#define THREAD_RUNNING_STATE 0
|
||||
#define THREAD_PAUSED 1
|
||||
#define THREAD_EXIT -1
|
||||
#define HBIT0 0X0001
|
||||
#define HBIT1 0X0002
|
||||
#define HBIT2 0X0004
|
||||
#define HBIT3 0X0008
|
||||
#define HBIT4 0X0010
|
||||
#define HBIT5 0X0020
|
||||
#define HBIT6 0X0040
|
||||
#define HBIT7 0X0080
|
||||
#define HBIT8 0X0100
|
||||
#define HBIT9 0X0200
|
||||
#define HBIT10 0X0400
|
||||
#define HBIT11 0X0800
|
||||
#define HBIT12 0X1000
|
||||
#define HBIT13 0X2000
|
||||
#define HBIT14 0X4000
|
||||
#define HBIT15 0X8000
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
//====================================================================================================
|
||||
typedef struct s_smartmotor_axis // axis parameters
|
||||
{
|
||||
char _Move_Speed_Gear;
|
||||
long _l_move_dis;
|
||||
double _d_move_dis;
|
||||
long _l_cur_pos;
|
||||
double _d_cur_pos;
|
||||
double _dSet_Zero_Pos;
|
||||
long _lSet_Zero_Pos;
|
||||
long address;
|
||||
struct s_machine_status
|
||||
{
|
||||
int StatusWord[2];
|
||||
|
||||
BOOL DriverRdy;
|
||||
BOOL MotorOff;
|
||||
BOOL VoltageFault;
|
||||
BOOL PosErr;
|
||||
BOOL OverHeat;
|
||||
BOOL NegLimit;
|
||||
BOOL PosLimit;
|
||||
|
||||
|
||||
} s_machine_status;
|
||||
|
||||
} SMARTMOTORAXIS;
|
||||
//====================================================================================================
|
||||
struct s_smartmotor_axis_config // axis configuration
|
||||
{
|
||||
double _motor_precision;//set precision
|
||||
|
||||
int _speed_[5];
|
||||
int _accel_[5];
|
||||
int _decel_[5];
|
||||
|
||||
double _neg_working_limit;
|
||||
double _pos_working_limit;
|
||||
|
||||
double _scale_resolution;
|
||||
};
|
||||
//====================================================================================================
|
||||
typedef struct s_smartmotor_xyzzm
|
||||
{
|
||||
bool bFast;
|
||||
long from;
|
||||
long to;
|
||||
long speed;
|
||||
long acc;
|
||||
long dec;
|
||||
double dFromMM;
|
||||
double dToMM;
|
||||
} SMARTMOTORAXISMOVE;
|
||||
//====================================================================================================
|
||||
struct struct_smartmotor_machine
|
||||
{ // g_machine structure
|
||||
struct s_machine_config
|
||||
{
|
||||
struct s_smartmotor_axis_config x_axis;
|
||||
struct s_smartmotor_axis_config y_axis;
|
||||
struct s_smartmotor_axis_config z_axis;
|
||||
|
||||
} s_machine_config;
|
||||
struct s_status {
|
||||
BOOL _bXHomed;
|
||||
BOOL _bYHomed;
|
||||
BOOL _bZHomed;
|
||||
BOOL _bXYZHomed;
|
||||
|
||||
BOOL _machine_running;
|
||||
BOOL _bXMoving;
|
||||
BOOL _bYMoving;
|
||||
BOOL _bZMoving;
|
||||
BOOL _bXYZMoving;
|
||||
} s_status;
|
||||
|
||||
struct s_smartmotor_axis x;
|
||||
struct s_smartmotor_axis y;
|
||||
struct s_smartmotor_axis z;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
//====================================================================================================
|
||||
class SmartMotor_Proto
|
||||
{
|
||||
public:
|
||||
//=============Smart Motor===================
|
||||
//ISMICommPtr CommInterface;
|
||||
//ISMICMotionPtr CMotionInterface;
|
||||
//ISMIPathPtr PathInterface;
|
||||
|
||||
ISMICommPtr CommInterface;
|
||||
ISMICMotionPtr CMotionInterface;
|
||||
ISMIPathPtr PathInterface;
|
||||
|
||||
// machine threads.
|
||||
static int g_machine_Thread_State;
|
||||
static unsigned __stdcall g_machine_Thread(LPVOID pThis);
|
||||
static HANDLE g_machine_Thread_Id;
|
||||
static HANDLE g_machine_Serial_Mutex; // EP02
|
||||
|
||||
static HANDLE g_hHomedEvent;
|
||||
|
||||
//
|
||||
SmartMotor_Proto();
|
||||
virtual ~SmartMotor_Proto();
|
||||
|
||||
// Global Structures
|
||||
static struct_smartmotor_machine g_machine;
|
||||
|
||||
static double TimeInSecs(void);
|
||||
static CLogger* g_pLogger;
|
||||
|
||||
bool m_bHomingActive;
|
||||
|
||||
double ScaleToMM(long lCount, double dResolution);
|
||||
long MMtoScale(double lDistanceMM, double dResolution);
|
||||
static void _swap_byte(unsigned short &Val);
|
||||
static void _reverse_dword(DWORD *);
|
||||
static void _scale2inch(unsigned long scale, double &inch);
|
||||
static void _inch2scale(unsigned long &scale, double inch);
|
||||
static long _4char2long(unsigned char *cBuff);
|
||||
static long _3char2long(unsigned char *cBuff);
|
||||
static void _char2bin(unsigned char *cBuff, BYTE *cBytes, int len);
|
||||
|
||||
SSI_STATUS_SMARTMOTOR Create_thread();
|
||||
SSI_STATUS_SMARTMOTOR Exit_thread();
|
||||
|
||||
|
||||
|
||||
SSI_STATUS_SMARTMOTOR GetAppPath(CString &Path);
|
||||
SSI_STATUS_SMARTMOTOR ExtractAppPath(CString &Path);
|
||||
SSI_STATUS_SMARTMOTOR SaveSmartMotorConfig();
|
||||
SSI_STATUS_SMARTMOTOR LoadSmartMotorConfig();
|
||||
|
||||
BOOL InitSmartMotor();
|
||||
void StartSmartMotor();
|
||||
void StopSmartMotor();
|
||||
void _reset_config_parameter();
|
||||
|
||||
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_startup(double x_scale_resolution, double y_scale_resolution, double z_scale_resolution);
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_Dcc_Home();
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_IS_Homed();
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _start_machine();
|
||||
SSI_STATUS_SMARTMOTOR _shutdown_machine();
|
||||
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_get_position_xyz(double & dX, double & dY, double & dZ);
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_get_pos_pulse_xyz(long & lX, long & lY, long & lZ);
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_set_position_xyz(double dX, double dY, double dZ, bool bWait);
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_move_rel_dis_xyz(double dX, double dY, double dZ, bool bWait);
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_stop_xyz();
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_stop_xyz_S();
|
||||
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_get_home_status();
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_get_motion_status();
|
||||
SSI_STATUS_SMARTMOTOR smartmotor_motion_get_status_word();
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _calculate_straightline_motion(double dSpeedMM);
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_POS_XYZ();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVETOX_ABS(double dis);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVETOY_ABS(double dis);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVETOZ_ABS(double dis);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVETOX_REL(double dis);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVETOY_REL(double dis);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVETOZ_REL(double dis);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVEX(BOOL dir);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVEY(BOOL dir);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_MOVEZ(BOOL dir);
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_ABRUPT_STOPX();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_ABRUPT_STOPY();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_ABRUPT_STOPZ();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_DECEL_STOPX();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_DECEL_STOPY();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_DECEL_STOPZ();
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_COMM_CMDX(CString _command);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_COMM_CMDY(CString _command);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_COMM_CMDZ(CString _command);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_COMM_RESPONSEX(CString &_response);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_COMM_RESPONSEY(CString &_response);
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_COMM_RESPONSEZ(CString &_response);
|
||||
|
||||
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_MOVE_STATUS_X();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_MOVE_STATUS_Y();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_MOVE_STATUS_Z();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_HOME_STATUS_X();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_HOME_STATUS_Y();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_HOME_STATUS_Z();
|
||||
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_STATUS_WORD0();
|
||||
SSI_STATUS_SMARTMOTOR _send_cmd_SMARTMOTOR_GET_STATUS_WORD16();
|
||||
|
||||
static SSI_STATUS_SMARTMOTOR _process_SO7_CMD_MOVE_TO_POS_XYZ();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,289 @@
|
||||
// ************************************************************************************************
|
||||
// * File : SMIDefs.h
|
||||
// * Project : IntegMotorInterface
|
||||
// * Version : 2.201
|
||||
// * Last Update : 12/16/2009
|
||||
// * Copyright ?2000-2009 Animatics Corp.
|
||||
// * Author :
|
||||
// ************************************************************************************************
|
||||
#ifndef __SMIDEFS_H_
|
||||
#define __SMIDEFS_H_
|
||||
|
||||
#define MAX_STRLEN 256
|
||||
#define MAX_HOST_AXIS 6
|
||||
#define PI ((double)3.14159265358979323846)
|
||||
#define EPSILON 0.0000000001
|
||||
|
||||
#define MAX_PRG_LENGTH 0x00007FFF
|
||||
#define MAX_PRG_LENGTH9 0x0000FFFE
|
||||
#define MAX_PRG_LENGTH6 0x0000FA96
|
||||
|
||||
|
||||
// ************************************************************************************************
|
||||
// *** CommError and Motor Detection Return Values:
|
||||
// ************************************************************************************************
|
||||
#define CER_SUCCESS 0x00000001 // Motors Found (=CER_MOTORSFOUND)
|
||||
#define CER_MOTORSFOUND 0x00000001 // Motors Found (=CER_SUCCESS)
|
||||
#define CER_SOMEADDRESSED 0x00000002 // Some Motors are addressed
|
||||
#define CER_BIGADDRESS 0x00000004 // The address of some motors is bigger than the specified MaxAddress
|
||||
#define CER_DUPLICATEADDR 0x00000008 // Duplicate address
|
||||
#define CER_NOTADDRESSED 0x00000010 // No motor is addressed
|
||||
#define CER_COMMERROR 0x00000020 // Other communication problem
|
||||
#define CER_NOMOTOR 0x00000040 // Failed to find motors
|
||||
#define CER_NETERROR 0x00000080 // Network error
|
||||
#define CER_USBERROR 0x00000100 // USB error
|
||||
#define CER_CANOPENERROR 0x00000200 // CANOpen error
|
||||
#define CER_TRYHIGHBAUD 0x00000400 // no motors found at lower baud rates try higher rates
|
||||
|
||||
#define CER_PORTNOTOPEN 0x00010000 // Port Not Open
|
||||
#define CER_CANCELED 0x00040000 // Canceled
|
||||
|
||||
// CommError and Motor Detection Actions
|
||||
#define CMA_THROWX 0x00100000 // Throw exception if an error occurs
|
||||
#define CMA_READDRESS232 0x00400000 // Re-address RS232 chain if they are not addressed
|
||||
#define CMA_USECURRENTBAUD 0x00800000 // only try at current baud rate
|
||||
#define CMA_NOENDPRG 0x04000000 // Do not Stop the user program before addressing/detecting motors
|
||||
#define CMA_NOESTABLISH 0x08000000 // Do try to establish the communication (it is already established)
|
||||
|
||||
|
||||
//#define CER_CHANGED 0x00010000 // The pointers have been changed.
|
||||
//#define CER_CONTINUE 0x00020000 // The caller can continue
|
||||
//#define CER_CANCELED 0x00040000 // Canceled
|
||||
|
||||
|
||||
// ************************************************************************************************
|
||||
// *** Planes
|
||||
// ************************************************************************************************
|
||||
#define PLN_XY 0
|
||||
#define PLN_XZ 1
|
||||
#define PLN_YZ 2
|
||||
|
||||
// ************************************************************************************************
|
||||
// *** LogFlags
|
||||
// ************************************************************************************************
|
||||
#define LOG_COMM 0x00000001
|
||||
#define LOG_CMOTION 0x00000002
|
||||
#define LOG_PATH 0x00000004
|
||||
#define LOG_SCAN 0x00000008
|
||||
#define LOG_MOTOR 0x00000010
|
||||
#define LOG_ALL 0x0000001F
|
||||
#define LOG_APPEND 0x00010000
|
||||
#define LOG_NEW 0x00020000 // Do not set this flag. It is used internally
|
||||
|
||||
// ************************************************************************************************
|
||||
// *** Notification Codes:
|
||||
// ************************************************************************************************
|
||||
#define SMNOT_STARTDOWNLOAD 0x00000001
|
||||
#define SMNOT_PROGRESS 0x00000002
|
||||
#define SMNOT_END 0x00000003
|
||||
#define SMNOT_STARTUPLOAD 0x00000004
|
||||
#define SMNOT_STARTADDRESS 0x00000005
|
||||
#define SMNOT_STARTDETECT 0x00000006
|
||||
#define SMNOT_STARTCOLISION 0x00000007
|
||||
#define SMNOT_STARTGETINFO 0x00000008
|
||||
|
||||
// ************************************************************************************************
|
||||
// *** Motor Download Flags:
|
||||
// ************************************************************************************************
|
||||
#define MDF_TURNOFF 0x00000001 // Turn it off if it is on
|
||||
#define MDF_BLIND 0x00000010 // Blind Download
|
||||
#define MDF_CAL 0x00000080 // Download Calibration Program
|
||||
#define MDF_FORCEDOWNLOAD 0x00000100 // Download even if motor has no EEPROM
|
||||
|
||||
#define MDF_SKIPPRGINFO 0x00000200
|
||||
|
||||
// ************************************************************************************************
|
||||
// *** Error Codes for IntegMotorInterface exceptions match resourec numbers for SMI and IntegMotorInterface
|
||||
// ************************************************************************************************
|
||||
#define EID_NOERROR 4000
|
||||
#define EID_CX 4001
|
||||
#define EID_OPEN 4002
|
||||
#define EID_SETTIMEOUT 4003
|
||||
#define EID_CONNECTION 4004
|
||||
#define EID_TIMEOUT 4005
|
||||
#define EID_ECHOTIMEOUT 4006
|
||||
#define EID_BADECHO 4007
|
||||
#define EID_PORTNOTOPEN 4008
|
||||
#define EID_OVERRUN 4009
|
||||
#define EID_RXOVER 4010
|
||||
#define EID_RXPARITY 4011
|
||||
#define EID_FRAME 4012
|
||||
#define EID_BREAK 4013
|
||||
#define EID_IOE 4014
|
||||
#define EID_TXFULL 4015
|
||||
#define EID_COMMUNKNOWN 4016
|
||||
#define EID_READ 4017
|
||||
#define EID_WRITE 4018
|
||||
#define EID_INVALIDDATA 4019
|
||||
#define EID_INVALIDTIME 4020
|
||||
#define EID_INVALIDTIMEDELTA 4021
|
||||
#define EID_INVALIDPOSDELTA 4022
|
||||
#define EID_INTDATASPACE 4023
|
||||
#define EID_BUFFOVERFLOW 4024
|
||||
#define EID_BUFFUNDERFLOW 4025
|
||||
#define EID_HMFAILED 4026
|
||||
#define EID_GETSTATUS 4027
|
||||
#define EID_SAMPLERATES 4028
|
||||
#define EID_NOTSUPPORTED 4029
|
||||
#define EID_NOTINIT 4030
|
||||
#define EID_NOMEM 4031
|
||||
#define EID_GETALL 4032
|
||||
#define EID_NOMORE 4033
|
||||
#define EID_OPENFILE 4034
|
||||
#define EID_OPENFILEWRITE 4035
|
||||
#define EID_NOEEPROM 4036
|
||||
#define EID_INVALIDMODE 4037
|
||||
#define EID_RS485 4038
|
||||
#define EID_FILETOOLONG 4039
|
||||
#define EID_CORRUPTEEPROM 4040
|
||||
#define EID_DOWNLOADON 4041
|
||||
#define EID_VERSIONMISMATCH 4042
|
||||
#define EID_SOCKET 4043
|
||||
#define EID_DOWNLOADRCKS 4044
|
||||
#define EID_NETERROR 4045
|
||||
#define EID_USBERROR 4046
|
||||
#define EID_BIGADDRESS 4047
|
||||
#define EID_CALWARNING 4048
|
||||
#define EID_CANCELED 4049
|
||||
#define EID_SOMEADDRESSED 4050
|
||||
#define EID_COMMUNICATION 4051
|
||||
#define EID_DUPLICATEADDR 4052
|
||||
#define EID_COMMRESET 4053
|
||||
#define EID_STOP 4054
|
||||
#define EID_NOTFOUND 4055
|
||||
#define EID_LANGFILE 4056
|
||||
#define EID_INVALID_PROJ 4057
|
||||
#define EID_READFILE 4058
|
||||
#define EID_CHANGEBAUD 4059
|
||||
#define EID_CANERROR 4060
|
||||
#define EID_NOCANDWLD 4061
|
||||
#define EID_NOLEGOACK 4062
|
||||
#define EID_NOMODBUSDWLD 4063
|
||||
#define EID_INCORRECTMICRO 4064
|
||||
#define EID_FILEFORMAT 4065
|
||||
#define EID_DLD_BUFFEREXCEED 4066
|
||||
#define EID_DLD_HEXCHKSUM 4067
|
||||
#define EID_DLD_HEXADDRESS 4068
|
||||
#define EID_HEXTYPE 4069
|
||||
#define EID_DATAINSERT 4070
|
||||
#define EID_CMDNOSUPPORT 4071
|
||||
#define EID_NOTIMEDELTA 4072
|
||||
#define EID_CANINVTIMEDELTA 4073
|
||||
#define EID_CANVOLTAGEFAULT 4074
|
||||
#define EID_CANEXCESSTEMP 4075
|
||||
#define EID_CANEXCESSPOS 4076
|
||||
#define EID_CANVELOCITYLIMIT 4077
|
||||
#define EID_CANDEDTLIMIT 4078
|
||||
#define EID_CANHWPOSHWLIMIT 4079
|
||||
#define EID_CANHWNEGHWLIMIT 4080
|
||||
#define EID_CANSWPOSLIMIT 4081
|
||||
#define EID_CANSWNEGLIMIT 4082
|
||||
#define EID_FIRMVERMISSMATCH 4083
|
||||
#define EID_BADMODEL 4084
|
||||
|
||||
// scanner errors match the resource numbers in SMI and IntegMotorInterface
|
||||
#define ER_CANNOT_OPEN 8672
|
||||
#define ER_ERROR_CLINE 8673
|
||||
#define ER_LINE_TOKENS 8674
|
||||
#define ER_NOLANGFILE 8675
|
||||
#define ER_UNKNOWNERROR 8676
|
||||
|
||||
#define ER_2DEFAULTS 8700
|
||||
#define ER_2ELSE 8701
|
||||
#define ER_2MANYINCLUDES 8702
|
||||
#define ER_ABSEXPECTED 8703
|
||||
#define ER_ASSIGNECXPTD 8704
|
||||
#define ER_BADBREAK 8705
|
||||
#define ER_CASEAFTERDEFAULT 8706
|
||||
#define ER_CASEWOSWITCH 8707
|
||||
#define ER_CASEXPTD 8708
|
||||
#define ER_CBRACKETXPTD 8709
|
||||
#define ER_CLOSEPXPTD 8710
|
||||
#define ER_CMPWOIFX 8711
|
||||
#define ER_COMMAXPTD 8712
|
||||
#define ER_DEFAULTWOSWITCH 8713
|
||||
#define ER_DESTINATION 8714
|
||||
#define ER_DIRECTIVECLOSE 8715
|
||||
#define ER_DOTEXPTD 8716
|
||||
#define ER_DUPLICATELABELS 8717
|
||||
#define ER_ELSEIFAFTERELSE 8718
|
||||
#define ER_ELSEIFWOIF 8719
|
||||
#define ER_ELSEWOIF 8720
|
||||
#define ER_ENDIFWOIF 8721
|
||||
#define ER_ENDSWOSWITCH 8722
|
||||
#define ER_ENDXPTD 8723
|
||||
#define ER_IFFWOCMP 8724
|
||||
#define ER_IFTWOCMP 8725
|
||||
#define ER_IFWOENDIF 8726
|
||||
#define ER_IFXWOCMP 8727
|
||||
#define ER_INVALIDEOP 8728
|
||||
#define ER_INVALIDEXPTERM 8729
|
||||
#define ER_INVALIDNOPARAM 8730
|
||||
#define ER_INVALIDPARAM 8731
|
||||
#define ER_LANGFILE 8732
|
||||
#define ER_LOOPWOWHILE 8733
|
||||
#define ER_LVALUE 8734
|
||||
#define ER_NEWLINESTRING 8735
|
||||
#define ER_NOTINPROGRAM 8736
|
||||
#define ER_NUMSIGNXPTD 8737
|
||||
#define ER_NUMXPTD 8738
|
||||
#define ER_OBRACKETXPTD 8739
|
||||
#define ER_OPENINCLUDE 8740
|
||||
#define ER_OPENPXPTD 8741
|
||||
#define ER_QUOTXPTD 8742
|
||||
#define ER_REDEF 8743
|
||||
#define ER_RESERVED 8744
|
||||
#define ER_SPACEXPTD 8745
|
||||
#define ER_STRXPTD 8746
|
||||
#define ER_SWITCHWOENDS 8747
|
||||
#define ER_SYNTAX 8748
|
||||
#define ER_UNDEFINED 8749
|
||||
#define ER_UPARAMXPTD 8750
|
||||
#define ER_WHILEWOLOOP 8751
|
||||
#define ER_DIVIDEBYZERO 8752
|
||||
#define ER_FLT_NOTALLOW 8753
|
||||
#define ER_NOFLOATVARMATH 8754
|
||||
#define ER_PEERTOPEERTYPE 8755
|
||||
#define ER_MISSINGSEMI 8756
|
||||
#define ER_MISSINGCOLON 8757
|
||||
#define ER_INVALIDADDRESS 8758
|
||||
#define ER_INVALIDAXIS 8759
|
||||
#define ER_REPORTNOTALLOWED 8760
|
||||
|
||||
#define WR_BAUDRATE 8800
|
||||
#define WR_DATARANGE 8801
|
||||
#define WR_DEFAULTLANGUAGE 8802
|
||||
#define WR_MISSINGPOUND 8803
|
||||
#define WR_NUMRANGE 8804
|
||||
#define WR_NUMRANGEMM 8805
|
||||
#define WR_NUMRANGEN 8806
|
||||
#define WR_NUMRANGENN 8807
|
||||
#define WR_NUMRANGENP 8808
|
||||
#define WR_NUMRANGEP 8809
|
||||
#define WR_FLTDECIMALS 8810
|
||||
#define WR_FLTRANGE 8811
|
||||
#define WR_FLTOVERFLOW 8812
|
||||
#define WR_LONGOVERFLOW 8813
|
||||
#define WR_FLTDECIMALSPT 8814
|
||||
|
||||
#define FATAL_ER_2MANYERRORS 8900
|
||||
#define FATAL_ER_2MANYWARNINGS 8901
|
||||
#define FATAL_ER_NESTING 8902
|
||||
|
||||
// warning range
|
||||
#define IS_WARNING_ID(x) (((x) >= WR_BAUDRATE) && ((x) <= (WR_BAUDRATE + 99)))
|
||||
|
||||
// fatal error range (stop scanning)
|
||||
#define IS_FATAL_ID(x) (((x) >= FATAL_ER_2MANYERRORS) && ((x) <= (FATAL_ER_2MANYERRORS + 99)))
|
||||
|
||||
// ************************************************************************************************
|
||||
// used when warnings replaces errors for keywords (no strings associated) only used for ER_UNDEFINED
|
||||
#define ERRTOWARN_START (FATAL_ER_2MANYERRORS + 100) // set start area of converted errors 9000
|
||||
#define ERRTOWARN_END (ERRTOWARN_START + 99) // set start area of converted errors 9099
|
||||
#define IS_ERRTOWWARNING(x) (((x) >= ERRTOWARN_START) && ((x) <= ERRTOWARN_END))
|
||||
#define MAKEWE(x) ((Errors2Warnings)?(ERRTOWARN_START + (x) % 100):(x)) // convert error to warning if Errors2Warnings
|
||||
#define WE2E(x) (IS_ERRTOWWARNING(x)?(ER_2DEFAULTS + (x % 100)):(x)) // convert error to warning back to orignal error
|
||||
|
||||
|
||||
#endif //__SMIDEFS_H_
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
#include "StdAfx.h"
|
||||
#include <WinDef.h>
|
||||
#include <WinBase.h>
|
||||
#include "Keyence_Laser.h"
|
||||
|
||||
#define MAX_STORAGE_DATA_SIZE 65536
|
||||
|
||||
CKeyence_Laser::CKeyence_Laser()
|
||||
{
|
||||
m_bIsStorage=FALSE;
|
||||
m_iSetOutNo=0;
|
||||
m_StoredDataNumber=0;
|
||||
m_NeedStorageDataNumber=0;
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_100;
|
||||
}
|
||||
|
||||
CKeyence_Laser::~CKeyence_Laser()
|
||||
{
|
||||
FreeLibrary(m_hLkif);
|
||||
}
|
||||
//========================================
|
||||
void CKeyence_Laser::KeyenceLaserInit(void)
|
||||
{
|
||||
m_hLkif=LoadLibrary(_T("LkIF.dll"));
|
||||
if(m_hLkif)
|
||||
{
|
||||
m_pGetCalcData=(pLKIF_GetCalcData)GetProcAddress(m_hLkif,"LKIF_GetCalcData");
|
||||
m_pDataStorageStart=(pLKIF_DataStorageStart)GetProcAddress(m_hLkif,"LKIF_DataStorageStart");
|
||||
m_pDataStorageStop=(pLKIF_DataStorageStop)GetProcAddress(m_hLkif,"LKIF_DataStorageStop");
|
||||
m_pDataStorageInit=(pLKIF_DataStorageInit)GetProcAddress(m_hLkif,"LKIF_DataStorageInit");
|
||||
m_pDataStorageGetData=(pLKIF_DataStorageGetData)GetProcAddress(m_hLkif,"LKIF_DataStorageGetData");
|
||||
m_pDataStorageGetStatus=(pLKIF_DataStorageGetStatus)GetProcAddress(m_hLkif,"LKIF_DataStorageGetStatus");
|
||||
m_pSetDataStorage=(pLKIF_SetDataStorage)GetProcAddress(m_hLkif,"LKIF_SetDataStorage");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//==============================================
|
||||
void CKeyence_Laser::Get_KeyenceLaserData(float *LaserValue1,float *LaserValue2)
|
||||
{
|
||||
*LaserValue1=10;
|
||||
*LaserValue2=10;
|
||||
LKIF_FLOATVALUE GetVal1,GetVal2;
|
||||
if(m_pGetCalcData(&GetVal1,&GetVal2)!=1)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
switch(GetVal1.FloatResult)
|
||||
{
|
||||
case LKIF_FLOATRESULT_RANGEOVER_P:
|
||||
{
|
||||
*LaserValue1=50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_RANGEOVER_N:
|
||||
{
|
||||
*LaserValue1=-50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_WAITING:
|
||||
{
|
||||
*LaserValue1=0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*LaserValue1=GetVal1.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(GetVal2.FloatResult)
|
||||
{
|
||||
case LKIF_FLOATRESULT_RANGEOVER_P:
|
||||
{
|
||||
*LaserValue2=50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_RANGEOVER_N:
|
||||
{
|
||||
*LaserValue2=-50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_WAITING:
|
||||
{
|
||||
*LaserValue2=0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*LaserValue2=GetVal2.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser::StartStoreData(int _NeedStorageDataNumber,int _SampleTime)
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (!m_bIsStorage)
|
||||
{
|
||||
bStatus=m_pDataStorageInit();
|
||||
if (_NeedStorageDataNumber<1)
|
||||
{
|
||||
_NeedStorageDataNumber=1;
|
||||
}
|
||||
else if (_NeedStorageDataNumber>65536)
|
||||
{
|
||||
_NeedStorageDataNumber=65536;
|
||||
}
|
||||
m_NeedStorageDataNumber=_NeedStorageDataNumber;
|
||||
|
||||
if (_SampleTime<0.4)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_1;
|
||||
}
|
||||
else if (_SampleTime<1)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_2;
|
||||
}
|
||||
else if (_SampleTime<2)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_5;
|
||||
}
|
||||
else if (_SampleTime<4)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_10;
|
||||
}
|
||||
else if (_SampleTime<10)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_20;
|
||||
}
|
||||
else if (_SampleTime<20)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_50;
|
||||
}
|
||||
else if (_SampleTime<40)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_100;
|
||||
}
|
||||
else if (_SampleTime<100)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_200;
|
||||
}
|
||||
else if (_SampleTime<200)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_500;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_1000;
|
||||
}
|
||||
bStatus=m_pSetDataStorage(LKIF_TARGETOUT_OUT1,m_NeedStorageDataNumber,m_StorageCycle);
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
bStatus=m_pDataStorageStart();
|
||||
}
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser::StopStoreData()
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (m_bIsStorage)
|
||||
{
|
||||
bStatus=m_pDataStorageStop();
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser::PauseScanAndGetData(float *GetStorageData,int *GetStorageNumber)
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (m_bIsStorage)
|
||||
{
|
||||
bStatus=m_pDataStorageStop();
|
||||
bStatus=GetStoredData(GetStorageData,GetStorageNumber);
|
||||
bStatus=m_pDataStorageStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
bStatus=GetStoredData(GetStorageData,GetStorageNumber);
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser::GetStoredData(float *GetStorageData,int *GetStorageNumber)
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (!m_bIsStorage)
|
||||
{
|
||||
LKIF_FLOATVALUE GetStorageValue[MAX_STORAGE_DATA_SIZE];
|
||||
bStatus=m_pDataStorageGetData(m_iSetOutNo,m_StoredDataNumber,GetStorageValue,GetStorageNumber);
|
||||
for(int i=0;i<*GetStorageNumber;i++)
|
||||
{
|
||||
switch(GetStorageValue[i].FloatResult)
|
||||
{
|
||||
case LKIF_FLOATRESULT_RANGEOVER_P:
|
||||
{
|
||||
*GetStorageData++=50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_RANGEOVER_N:
|
||||
{
|
||||
*GetStorageData++=-50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_WAITING:
|
||||
{
|
||||
*GetStorageData++=0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*GetStorageData++=GetStorageValue[i].Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CKeyence_Laser::GetStoreDataStatus()
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
bStatus=m_pDataStorageGetStatus(m_iSetOutNo,&m_bIsStorage,&m_StoredDataNumber);
|
||||
return bStatus;
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
// protocol for control SevenOcean's Machine
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef AFX_KEYENCE__LASER_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
#define AFX_KEYENCE__LASER_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "LkIF.h"
|
||||
|
||||
typedef BOOL (WINAPI* pLKIF_GetCalcData)(OUT LKIF_FLOATVALUE *CalcData1,OUT LKIF_FLOATVALUE *CalcData2);
|
||||
// Starting the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageStart)(void);
|
||||
// Stopping the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageStop)(void);
|
||||
// Initializing the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageInit)(void);
|
||||
// Outputting the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageGetData)(IN int OutNo,IN int NumOutBuffer,OUT LKIF_FLOATVALUE *OutBuffer,OUT int *NumReceived);
|
||||
// Data Storage Accumulation Status Output
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageGetStatus)(IN int OutNo,OUT BOOL *IsStorage,OUT int *NumStorageData);
|
||||
// Set Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_SetDataStorage)(IN LKIF_TARGETOUT TargetOut,IN int NumStorage,IN LKIF_STORAGECYCLE StorageCycle);
|
||||
|
||||
//======================================================================================
|
||||
class CKeyence_Laser
|
||||
{
|
||||
protected:
|
||||
int m_iSetOutNo;
|
||||
int m_NeedStorageDataNumber;
|
||||
LKIF_STORAGECYCLE m_StorageCycle;
|
||||
HINSTANCE m_hLkif;
|
||||
public:
|
||||
|
||||
CKeyence_Laser();
|
||||
~CKeyence_Laser();
|
||||
|
||||
//»ñÈ¡Êý¾ÝµÄº¯ÊýÖ¸Õë
|
||||
pLKIF_GetCalcData m_pGetCalcData;
|
||||
pLKIF_DataStorageStart m_pDataStorageStart;
|
||||
pLKIF_DataStorageStop m_pDataStorageStop;
|
||||
pLKIF_DataStorageInit m_pDataStorageInit;
|
||||
pLKIF_DataStorageGetData m_pDataStorageGetData;
|
||||
pLKIF_DataStorageGetStatus m_pDataStorageGetStatus;
|
||||
pLKIF_SetDataStorage m_pSetDataStorage;
|
||||
|
||||
int m_StoredDataNumber;
|
||||
BOOL m_bIsStorage;
|
||||
void KeyenceLaserInit(void);
|
||||
void Get_KeyenceLaserData(float *LaserValue1,float *LaserValue2);
|
||||
BOOL StartStoreData(int _NeedStorageDataNumber,int _SampleTime);
|
||||
BOOL StopStoreData();
|
||||
BOOL GetStoreDataStatus();
|
||||
BOOL GetStoredData(float *GetStorageData,int *GetStorageNumber);
|
||||
BOOL PauseScanAndGetData(float *GetStorageData,int *GetStorageNumber);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,660 @@
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Keyence_Proto.h"
|
||||
#include "math.h"
|
||||
|
||||
|
||||
|
||||
#define MY_CONFIG 1
|
||||
#define MAX_DEVPATH_LENGTH 256
|
||||
#define ENDPOINT_TIMEOUT 500
|
||||
|
||||
//***** Static Data *****
|
||||
struct_Keyence_ep_buff CKeyence_Proto::ep_buff[lEPSIZE];
|
||||
|
||||
//================================================================
|
||||
int CKeyence_Proto::g_hEP81_Thread_State=THREAD_PAUSED;
|
||||
HANDLE CKeyence_Proto::g_hEP81_Thread_Id=NULL;
|
||||
|
||||
//================================================================
|
||||
int CKeyence_Proto::g_hEP82_Thread_State=THREAD_PAUSED;
|
||||
HANDLE CKeyence_Proto::g_hEP82_Thread_Id=NULL;
|
||||
|
||||
//================================================================
|
||||
int CKeyence_Proto::g_hEP01_Thread_State=THREAD_PAUSED;
|
||||
HANDLE CKeyence_Proto::g_hEP01_Thread_Id=NULL;
|
||||
HANDLE CKeyence_Proto::g_hEP01_Serial_Mutex;
|
||||
|
||||
//================================================================
|
||||
int CKeyence_Proto::g_hEP02_Thread_State=THREAD_PAUSED;
|
||||
HANDLE CKeyence_Proto::g_hEP02_Thread_Id=NULL;
|
||||
HANDLE CKeyence_Proto::g_hEP02_Serial_Mutex;
|
||||
|
||||
//================================================================
|
||||
struct_Keyence_machine CKeyence_Proto::g_machine;
|
||||
usb_dev_handle *CKeyence_Proto::g_dev=NULL;
|
||||
CLogger *CKeyence_Proto::g_pLogger;
|
||||
HANDLE CKeyence_Proto::g_hHomedEvent = NULL;
|
||||
|
||||
//===========================================================================
|
||||
// Worker Thread to serialize EP_KEYENCE_01 commands.
|
||||
//===========================================================================
|
||||
unsigned __stdcall CKeyence_Proto::g_EP01_Thread(LPVOID pThis)
|
||||
{
|
||||
CKeyence_Proto* _This = (CKeyence_Proto*)pThis;
|
||||
for (;;)
|
||||
{
|
||||
TRACE0("g_hSerialUsbThread in loop set.\n");
|
||||
if (g_hEP01_Thread_State == THREAD_EXIT)
|
||||
ExitThread(0);
|
||||
WaitForSingleObject(ep_buff[EP_01_CMD_IDX]._event,INFINITE);
|
||||
TRACE0("g_hSerialUsbThread obtained event.\n");
|
||||
switch (g_hEP01_Thread_State)
|
||||
{
|
||||
case THREAD_EXIT:
|
||||
{
|
||||
ExitThread(0);
|
||||
}
|
||||
case THREAD_PAUSED:
|
||||
break;
|
||||
case THREAD_RUNNING:
|
||||
{
|
||||
TRACE0("g_hSerialUsbThread processing _send_usb_data();\n");
|
||||
_This->_send_usb_data(EP_01_CMD_IDX);
|
||||
TRACE0("g_hSerialUsbThread return from _send_usb_data();\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ExitThread(0);
|
||||
}
|
||||
};
|
||||
g_hEP01_Thread_State = THREAD_EXIT;
|
||||
ExitThread(0);
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
// Worker Thread to serialize EP_KEYENCE_02 commands.
|
||||
//===========================================================================
|
||||
unsigned __stdcall CKeyence_Proto::g_EP02_Thread(LPVOID pThis)
|
||||
{
|
||||
CKeyence_Proto* _This = (CKeyence_Proto*)pThis;
|
||||
for (;;)
|
||||
{
|
||||
TRACE0("g_hEP02_Thread in loop set.\n");
|
||||
if (g_hEP02_Thread_State == THREAD_EXIT)
|
||||
ExitThread(0);
|
||||
WaitForSingleObject(ep_buff[EP_02_CMD_IDX]._event,INFINITE);
|
||||
TRACE0("g_hEP02_Thread obtained event.\n");
|
||||
switch (g_hEP02_Thread_State)
|
||||
{
|
||||
case THREAD_EXIT:
|
||||
{
|
||||
ExitThread(0);
|
||||
}
|
||||
case THREAD_PAUSED:
|
||||
break;
|
||||
case THREAD_RUNNING:
|
||||
{
|
||||
TRACE0("g_hEP02_Thread calling _send_usb_data. EP_KEYENCE_02; %x\n");
|
||||
_This->_send_usb_data(EP_02_CMD_IDX);
|
||||
TRACE0("g_hEP02_Thread return _send_usb_data. EP_KEYENCE_02; %x\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ExitThread(0);
|
||||
}
|
||||
};
|
||||
g_hEP02_Thread_State = THREAD_EXIT;
|
||||
ExitThread(0);
|
||||
};
|
||||
|
||||
//******************************************************************************
|
||||
// This is the worker thread to process USBD_TRANSFER_DIRECTION_IN
|
||||
//******************************************************************************
|
||||
unsigned __stdcall CKeyence_Proto::g_EP81_Thread(LPVOID pThis)
|
||||
{
|
||||
CKeyence_Proto* _This = (CKeyence_Proto*)pThis;
|
||||
for (;;)
|
||||
{
|
||||
WaitForSingleObject(ep_buff[EP_81_DATA_IDX]._event, INFINITE);
|
||||
switch (g_hEP81_Thread_State)
|
||||
{
|
||||
case THREAD_EXIT:
|
||||
{
|
||||
ExitThread(0);
|
||||
}
|
||||
case THREAD_PAUSED:
|
||||
break;
|
||||
case THREAD_RUNNING:
|
||||
{
|
||||
_This->_reap_async_8x(EP_81_DATA_IDX);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ExitThread(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
// This is the worker thread to process USBD_TRANSFER_DIRECTION_IN
|
||||
//******************************************************************************
|
||||
unsigned __stdcall CKeyence_Proto::g_EP82_Thread(LPVOID pThis)
|
||||
{
|
||||
CKeyence_Proto* _This = (CKeyence_Proto*)pThis;
|
||||
for (;;)
|
||||
{
|
||||
WaitForSingleObject(ep_buff[EP_82_DATA_IDX]._event, INFINITE);
|
||||
switch (g_hEP82_Thread_State)
|
||||
{
|
||||
case THREAD_EXIT:
|
||||
{
|
||||
ExitThread(0);
|
||||
}
|
||||
case THREAD_PAUSED:
|
||||
break;
|
||||
case THREAD_RUNNING:
|
||||
{
|
||||
_This->_reap_async_8x(EP_82_DATA_IDX);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ExitThread(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void CKeyence_Proto::Trace_EP_Buff(long lIndex)
|
||||
{
|
||||
UCHAR tmp[256];
|
||||
CString csTmp;
|
||||
memcpy(tmp, ep_buff[lIndex]._buffer, ep_buff[lIndex]._size);
|
||||
csTmp = _T("Trace_EP_Buff _59 ");
|
||||
for (int ii= 0 ; ii < ep_buff[lIndex]._size ; ++ii)
|
||||
{
|
||||
CString csTmpHex;
|
||||
csTmpHex.Format(_T("%2X"), tmp[ii] );
|
||||
csTmp += csTmpHex;
|
||||
}
|
||||
TRACE1("_process_KEYENCE_CMD_GET_INDEX_4E() Trace_EP_Buff %s \n", csTmp);
|
||||
}
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
// Parse the data received based on the index (which EP are we processing).
|
||||
// The CCmdObj should only have one CMD_STATUS_PROCESSING.
|
||||
// Update CCmdObj _ep_01_status and _ep_81_status.
|
||||
// Update _status to CMD_STATUS_COMPLETE when both _ep_01_status and _ep_81_status
|
||||
// are CMD_STATUS_COMPLETE.
|
||||
//
|
||||
//******************************************************************************
|
||||
void CKeyence_Proto::_process_rcv_transfer_data(int iEP)
|
||||
{
|
||||
static long lRcvCnt = 0;
|
||||
static long lRcvCnt2 = 0;
|
||||
switch (iEP)
|
||||
{
|
||||
case EP_01_CMD_IDX :
|
||||
TRACE0("_process_rcv_transfer_data() : Update EP_01_CMD_IDX.\r\n");
|
||||
++lRcvCnt;
|
||||
break;
|
||||
case EP_81_DATA_IDX : //
|
||||
++lRcvCnt;
|
||||
TRACE0("_process_rcv_transfer_data() : Update EP_81_DATA_IDX status.\r\n");
|
||||
break;
|
||||
case EP_02_CMD_IDX :
|
||||
TRACE0("_process_rcv_transfer_data() : Update EP_02_CMD_IDX.\r\n");
|
||||
++lRcvCnt2;
|
||||
break;
|
||||
case EP_82_DATA_IDX :
|
||||
// parse result and put into its proper place.
|
||||
_process_KEYENCE_CMD_GET_LASER_DATA();
|
||||
++lRcvCnt2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
lRcvCnt = (lRcvCnt == 2) ? 0:lRcvCnt;
|
||||
lRcvCnt2 = (lRcvCnt2 == 2) ? 0:lRcvCnt2;
|
||||
};
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
CKeyence_Proto::CKeyence_Proto()
|
||||
{
|
||||
ep_buff[EP_01_CMD_IDX]._ep = EP_KEYENCE_01;
|
||||
ep_buff[EP_81_DATA_IDX]._ep = EP_KEYENCE_81;
|
||||
ep_buff[EP_02_CMD_IDX]._ep = EP_KEYENCE_02;
|
||||
ep_buff[EP_82_DATA_IDX]._ep = EP_KEYENCE_82;
|
||||
|
||||
for (int i=0;i<lEPSIZE;i++)
|
||||
{
|
||||
ep_buff[i]._size = 0;
|
||||
ep_buff[i]._save_send_cmd = 99;
|
||||
ep_buff[i]._async_context = NULL;
|
||||
ep_buff[i]._buffer = (char *)malloc(MAX_BUFF_SIZE);
|
||||
ep_buff[i]._hProtoPending = false;
|
||||
ep_buff[i]._event = NULL;
|
||||
};
|
||||
|
||||
|
||||
g_pLogger = new CLogger(_T("UtilityDebug.Log"));
|
||||
};
|
||||
|
||||
//******************************************************************************
|
||||
CKeyence_Proto::~CKeyence_Proto()
|
||||
{
|
||||
for (int i=0;i<lEPSIZE;i++)
|
||||
{
|
||||
free(ep_buff[i]._buffer);
|
||||
};
|
||||
delete g_pLogger;
|
||||
g_pLogger = NULL;
|
||||
}
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
//******************************************************************************
|
||||
|
||||
//******************************************************************************
|
||||
usb_dev_handle* CKeyence_Proto::_open_usb_dev(void)
|
||||
{
|
||||
struct usb_bus *bus = NULL;
|
||||
struct usb_device *dev = NULL;
|
||||
|
||||
for (bus = usb_get_busses(); bus; bus = bus->next)
|
||||
{
|
||||
for (dev = bus->devices; dev; dev = dev->next)
|
||||
{
|
||||
if (dev->descriptor.idVendor == KEYENCE_VID && dev->descriptor.idProduct == KEYENCE_PID)
|
||||
{
|
||||
return usb_open(dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_usb_reset(void)
|
||||
{
|
||||
if (g_dev)
|
||||
{
|
||||
usb_reset(g_dev);
|
||||
g_dev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(0);
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
}
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
// Send is direct and async.
|
||||
// The receive thread will receive data and interpret it.
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION 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;
|
||||
UNREFERENCED_PARAMETER(Status);
|
||||
/*if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
g_pLogger->SendAndFlushPerMode(_T("Enter Initialize Mv Usb\n"));
|
||||
*/
|
||||
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);
|
||||
g_pLogger->SendAndFlushPerMode(_T("Unable to open device %s"), usb_strerror());
|
||||
return SSI_STATUS_MOTION_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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// 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_01_CMD_IDX]._event = CreateEvent(NULL, // default security attributes
|
||||
FALSE, // manual reset event object
|
||||
NULL, // signaled
|
||||
NULL); // unamed object
|
||||
|
||||
g_hEP01_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP01_Thread,
|
||||
(LPVOID) this,
|
||||
0,
|
||||
NULL);
|
||||
g_hEP01_Thread_State = THREAD_RUNNING;
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
// 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;
|
||||
|
||||
// ********************************************************************
|
||||
// Prepare and start EP_KEYENCE_81 Thread - Use async commit.
|
||||
//
|
||||
ep_buff[EP_81_DATA_IDX]._event = CreateEvent(NULL, // default security attributes
|
||||
FALSE, // manual reset event object
|
||||
NULL, // signaled
|
||||
NULL); // unamed object
|
||||
g_hEP81_Thread_State = THREAD_PAUSED;
|
||||
g_hEP81_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP81_Thread,
|
||||
(LPVOID) this,
|
||||
0,
|
||||
NULL);
|
||||
g_hEP01_Serial_Mutex = CreateMutex(NULL, // default security attributes
|
||||
FALSE, // initial owner
|
||||
NULL); // name
|
||||
|
||||
// ********************************************************************
|
||||
// Prepare and start EP_KEYENCE_82 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_hEP82_Thread_State = THREAD_PAUSED;
|
||||
g_hEP82_Thread_Id = CreateThread( (LPSECURITY_ATTRIBUTES) NULL,
|
||||
0,
|
||||
(LPTHREAD_START_ROUTINE) g_EP82_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
|
||||
|
||||
//if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
// g_pLogger->SendAndFlushPerMode(_T("Exit Initialize Usb\n"));
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION CKeyence_Proto::Exit_MvUsb()
|
||||
{
|
||||
SSI_STATUS_MOTION Status=SSI_STATUS_MOTION_NORMAL;
|
||||
//if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
// g_pLogger->SendAndFlushPerMode(_T("Enter Exit_MvUsb\n"));
|
||||
|
||||
g_hEP81_Thread_State = THREAD_EXIT;
|
||||
g_hEP82_Thread_State = THREAD_EXIT;
|
||||
g_hEP01_Thread_State = THREAD_EXIT;
|
||||
g_hEP02_Thread_State = THREAD_EXIT;
|
||||
|
||||
SetEvent(ep_buff[EP_81_DATA_IDX]._event);
|
||||
if (g_hEP81_Thread_Id)
|
||||
{
|
||||
DWORD dwCode = STILL_ACTIVE;
|
||||
while (dwCode == STILL_ACTIVE)
|
||||
{
|
||||
GetExitCodeThread(g_hEP81_Thread_Id,&dwCode);
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
SetEvent(ep_buff[EP_82_DATA_IDX]._event);
|
||||
if (g_hEP82_Thread_Id)
|
||||
{
|
||||
DWORD dwCode = STILL_ACTIVE;
|
||||
while (dwCode == STILL_ACTIVE)
|
||||
{
|
||||
GetExitCodeThread(g_hEP82_Thread_Id,&dwCode);
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
SetEvent(ep_buff[EP_01_CMD_IDX]._event);
|
||||
if (g_hEP01_Thread_Id)
|
||||
{
|
||||
DWORD dwCode = STILL_ACTIVE;
|
||||
while (dwCode == STILL_ACTIVE)
|
||||
{
|
||||
GetExitCodeThread(g_hEP01_Thread_Id,&dwCode);
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
SetEvent(ep_buff[EP_02_CMD_IDX]._event);
|
||||
if (g_hEP02_Thread_Id)
|
||||
{
|
||||
DWORD dwCode = STILL_ACTIVE;
|
||||
while (dwCode == STILL_ACTIVE)
|
||||
{
|
||||
GetExitCodeThread(g_hEP02_Thread_Id,&dwCode);
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_dev)
|
||||
{
|
||||
usb_release_interface(g_dev,0);
|
||||
usb_close(g_dev);
|
||||
g_dev = NULL;
|
||||
}
|
||||
SetEvent(ep_buff[EP_81_DATA_IDX]._event);
|
||||
CloseHandle(ep_buff[EP_81_DATA_IDX]._event);
|
||||
SetEvent(ep_buff[EP_82_DATA_IDX]._event);
|
||||
CloseHandle(ep_buff[EP_82_DATA_IDX]._event);
|
||||
g_hEP01_Thread_State = THREAD_EXIT;
|
||||
SetEvent(ep_buff[EP_01_CMD_IDX]._event);
|
||||
CloseHandle(ep_buff[EP_01_CMD_IDX]._event);
|
||||
g_hEP02_Thread_State = THREAD_EXIT;
|
||||
SetEvent(ep_buff[EP_02_CMD_IDX]._event);
|
||||
CloseHandle(ep_buff[EP_02_CMD_IDX]._event);
|
||||
ReleaseMutex(g_hEP01_Serial_Mutex);
|
||||
CloseHandle(g_hEP01_Serial_Mutex);
|
||||
ReleaseMutex(g_hEP02_Serial_Mutex);
|
||||
CloseHandle(g_hEP02_Serial_Mutex);
|
||||
|
||||
//if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
// g_pLogger->SendAndFlushPerMode(_T("Exit Exit_MvUsb\n"));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
// 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)
|
||||
{
|
||||
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))
|
||||
{
|
||||
ASSERT(0);
|
||||
Sleep(3);
|
||||
}
|
||||
ep_buff[iEP_Base]._hProtoPending = ep_buff[iEP_Base+1]._hProtoPending = TRUE;
|
||||
TRACE1("=====_do_single_threaded_usb_comm(iEP_Base) SetEvent(g_hEP01_Thread_Event): %X \r\n", ep_buff[iEP_Base]._save_send_cmd);
|
||||
SetEvent(ep_buff[iEP_Base]._event);
|
||||
while ((ep_buff[iEP_Base]._hProtoPending == TRUE) || (ep_buff[iEP_Base+1]._hProtoPending == TRUE))
|
||||
{
|
||||
Sleep(3);
|
||||
}
|
||||
TRACE1("=====_do_single_threaded_usb_comm(iEP) g_hProtoDoneEvents. %x\n", iEP_Base);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
// This startup just kicks off the EP_KEYENCE_81 worker thread.
|
||||
//******************************************************************************
|
||||
SSI_STATUS_MOTION 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;
|
||||
};
|
||||
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_shutdown_machine()
|
||||
{
|
||||
g_machine.s_status._machine_running = false;
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
};
|
||||
|
||||
//===============================================================================
|
||||
// iEP = EP_KEYENCE_01 or EP_KEYENCE_02
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION 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;
|
||||
}
|
||||
_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_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//===============================================================================
|
||||
// iEP_Base : EP_81_DATA_IDX/EP_82_DATA_IDX
|
||||
//
|
||||
//===============================================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_reap_async_8x(int iEP_Base)
|
||||
{
|
||||
int _ret;
|
||||
_ret = usb_reap_async(ep_buff[iEP_Base]._async_context, 1000);
|
||||
if (_ret > 0)
|
||||
{
|
||||
_process_rcv_transfer_data(iEP_Base);
|
||||
usb_free_async(&(ep_buff[iEP_Base]._async_context));
|
||||
ep_buff[iEP_Base]._hProtoPending = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
usb_free_async(&(ep_buff[iEP_Base]._async_context));
|
||||
ASSERT(0);
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
}
|
||||
return SSI_STATUS_MOTION_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)
|
||||
{
|
||||
int _ret;
|
||||
ep_buff[iEP_Base]._save_send_cmd = ep_buff[iEP_Base]._buffer[0];
|
||||
ep_buff[iEP_Base]._save_send_cmd0 = ep_buff[iEP_Base]._buffer[1];
|
||||
ep_buff[iEP_Base]._save_send_cmd1 = ep_buff[iEP_Base]._buffer[2];
|
||||
|
||||
TRACE3("_send_usb_data() iEP : %X - ep_buff[iEP]._save_send_cmd : %X ._buffer[0] : %X\r\n", iEP_Base, ep_buff[EP_01_CMD_IDX]._save_send_cmd, ep_buff[EP_81_DATA_IDX]._buffer[0]);
|
||||
_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;
|
||||
}
|
||||
_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;
|
||||
}
|
||||
TRACE1("_submit_async_8x(EP:%X)\r\n", iEP_Base);
|
||||
//
|
||||
ep_buff[iEP_Base+1]._save_send_cmd = ep_buff[iEP_Base+1]._buffer[0];
|
||||
ep_buff[iEP_Base+1]._save_send_cmd0 = ep_buff[iEP_Base+1]._buffer[1];
|
||||
ep_buff[iEP_Base+1]._save_send_cmd1 = ep_buff[iEP_Base+1]._buffer[2];
|
||||
//
|
||||
_submit_async_8x(iEP_Base+1); // Send EP_KEYENCE_81/EP_KEYENCE_82
|
||||
// Get ready to receive on EP_KEYENCE_81 or EP_KEYENCE_82
|
||||
SetEvent(ep_buff[iEP_Base+1]._event);
|
||||
// Get ready to receive on EP_KEYENCE_01 or EP_KEYENCE_02
|
||||
_ret = usb_reap_async(ep_buff[iEP_Base]._async_context, 10000);
|
||||
if (_ret > 0)
|
||||
{
|
||||
_process_rcv_transfer_data(iEP_Base);
|
||||
usb_free_async(&(ep_buff[iEP_Base]._async_context));
|
||||
ep_buff[iEP_Base]._hProtoPending = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
usb_free_async(&(ep_buff[iEP_Base]._async_context));
|
||||
ASSERT(0);
|
||||
return SSI_STATUS_MOTION_TIMEOUT;
|
||||
}
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
SSI_STATUS_MOTION 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);
|
||||
|
||||
ep_buff[EP_01_CMD_IDX]._buffer[0] = 0x00;
|
||||
ep_buff[EP_01_CMD_IDX]._buffer[1] = 0x01;
|
||||
ep_buff[EP_01_CMD_IDX]._buffer[2] = 0x01;
|
||||
ep_buff[EP_01_CMD_IDX]._buffer[3] = 0x01;
|
||||
ep_buff[EP_01_CMD_IDX]._buffer[4] = 0x01;
|
||||
ep_buff[EP_01_CMD_IDX]._buffer[5] = 0x01;
|
||||
|
||||
|
||||
ep_buff[EP_01_CMD_IDX]._size = 0x0C;
|
||||
ep_buff[EP_82_DATA_IDX]._size = 0x45;
|
||||
|
||||
_do_single_threaded_usb_comm(EP_01_CMD_IDX);
|
||||
ReleaseMutex(g_hEP01_Serial_Mutex);
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
};
|
||||
|
||||
|
||||
//==============================================================
|
||||
SSI_STATUS_MOTION CKeyence_Proto::_process_KEYENCE_CMD_GET_LASER_DATA()
|
||||
{
|
||||
|
||||
return SSI_STATUS_MOTION_NORMAL;
|
||||
};
|
||||
@@ -0,0 +1,180 @@
|
||||
// protocol for control SevenOcean's Machine
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef AFX_KEYENCE_Proto_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
#define AFX_KEYENCE_Proto_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#define KEYENCE_TRACE if ( g_pLogger && g_pLogger->m_lLogMask & LOGACTIONS ) g_pLogger->SendAndFlushPerMode
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "..\Tools\UsbUtility\logger.h"
|
||||
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
||||
#include "..\MicroVu\SsiStatus.h"
|
||||
|
||||
#define MAX_BUFF_SIZE 0x200
|
||||
|
||||
#define USB_ENDPOINT_TYPE_CONTROL 0
|
||||
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
|
||||
#define USB_ENDPOINT_TYPE_BULK 2
|
||||
#define USB_ENDPOINT_TYPE_INTERRUPT 3
|
||||
|
||||
#define USB_DEVICE_DESCRIPTOR_TYPE 1
|
||||
#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2
|
||||
|
||||
#define THREAD_RUNNING 0
|
||||
#define THREAD_PAUSED 1
|
||||
#define THREAD_EXIT -1
|
||||
|
||||
// Device configuration and interface id.
|
||||
#define KEYENCE_USB_CONFIG 1
|
||||
#define KEYENCE_USB_INTF 0
|
||||
|
||||
|
||||
#define EP_KEYENCE_01 0x01
|
||||
#define EP_KEYENCE_02 0x02
|
||||
#define EP_KEYENCE_03 0x03
|
||||
#define EP_KEYENCE_81 0x82
|
||||
#define EP_KEYENCE_82 0x81
|
||||
#define EP_KEYENCE_84 0x84
|
||||
|
||||
#define EP_01_CMD_IDX 0 // index to usb buffers
|
||||
#define EP_81_DATA_IDX 1 //
|
||||
#define EP_02_CMD_IDX 2 //
|
||||
#define EP_82_DATA_IDX 3 //
|
||||
#define EP_03_CMD_IDX 4 //
|
||||
#define EP_84_DATA_IDX 5 //
|
||||
|
||||
#define lEPSIZE 6
|
||||
#define MAXRINGS 5 // for MicroVu Vertex 220
|
||||
#define MAXSEGS 8
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
//****************************************************************************************************
|
||||
// Set the _status to Idle after reply data has been received.
|
||||
// How to recover? In order to send data, _status must be Idle. If the system is not available
|
||||
// for 1 second, assume something wrong and treat it as "TimeOut".
|
||||
// Another way to do this is to lock this structure is to use a mutex to ensure single-threaded
|
||||
// access.
|
||||
//****************************************************************************************************
|
||||
//====================================================================================================
|
||||
struct struct_Keyence_machine
|
||||
{ // g_machine structure
|
||||
struct s_status
|
||||
{
|
||||
bool _machine_running;
|
||||
} s_status;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define KEYENCE_VID 0x0720
|
||||
#define KEYENCE_PID 0x000A
|
||||
|
||||
//****************************************************************************************************
|
||||
// Binary SevenOcean command structure, out going
|
||||
//
|
||||
//****************************************************************************************************
|
||||
#define pKEYENCE_CMD_01 ((s_KEYENCE_CMD_BUFF_01 *) ep_buff[EP_01_CMD_IDX]._buffer)
|
||||
|
||||
struct s_KEYENCE_CMD_BUFF_01
|
||||
{
|
||||
UCHAR uCmdByte;
|
||||
//----------------------------------------------------------------------
|
||||
// [endpoint 0x00000001] 00000060 : 530001010100fffe1d89ffff4d37fffebeee000000000000c34e0000021a0000003200000000000f423b000029fb0000138800000000003d08ee00030d4000030d40000000000000000000000000000000000000000000000000000000000000
|
||||
// *Command : 53 Move To -- X Y Z ZM Scale-0123511 -0045769 -0082194 00000000
|
||||
// *Speed : 00049998 00000538 00000050 00000000
|
||||
// *Unk1 : 00999995 00010747 00005000 00000000
|
||||
// *Unk2 : 03999982 00200000 00200000 00000000
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
BYTE uSubCmdByte;
|
||||
char data[9];
|
||||
}S_KEYENCE_CMD_MOVE_XYZ;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
//======================
|
||||
struct struct_Keyence_ep_buff
|
||||
{
|
||||
int _ep;
|
||||
BYTE _save_send_cmd;
|
||||
BYTE _save_send_cmd0;
|
||||
BYTE _save_send_cmd1;
|
||||
char *_buffer; // MAX_BUFF_SIZE
|
||||
int _size;
|
||||
void *_async_context;
|
||||
BOOL _hProtoPending;
|
||||
HANDLE _event;
|
||||
};
|
||||
|
||||
|
||||
//======================================================================================
|
||||
class CKeyence_Proto
|
||||
{
|
||||
public:
|
||||
// EP 01/81 channel threads.
|
||||
static int g_hEP81_Thread_State;
|
||||
static unsigned __stdcall g_EP81_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP81_Thread_Id;
|
||||
|
||||
// EP 02/82 channel threads.
|
||||
static int g_hEP82_Thread_State;
|
||||
static unsigned __stdcall g_EP82_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP82_Thread_Id;
|
||||
//
|
||||
// g_hEP01_Thread_Event is used to kick a command
|
||||
//
|
||||
static int g_hEP01_Thread_State;
|
||||
static unsigned __stdcall g_EP01_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP01_Thread_Id;
|
||||
static HANDLE g_hEP01_Serial_Mutex; // EP01
|
||||
//
|
||||
static int g_hEP02_Thread_State;
|
||||
static unsigned __stdcall g_EP02_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP02_Thread_Id;
|
||||
static HANDLE g_hEP02_Serial_Mutex; // EP02
|
||||
|
||||
static HANDLE g_hHomedEvent;
|
||||
|
||||
//
|
||||
CKeyence_Proto();
|
||||
virtual ~CKeyence_Proto();
|
||||
|
||||
// Global Structures
|
||||
static struct_Keyence_ep_buff ep_buff[lEPSIZE];
|
||||
static struct_Keyence_machine g_machine;
|
||||
|
||||
static CLogger* g_pLogger;
|
||||
static usb_dev_handle *g_dev;
|
||||
|
||||
SSI_STATUS_MOTION Init_MvUsb();
|
||||
SSI_STATUS_MOTION 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_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_MOTION _send_cmd_KEYENCE_CMD_GET_LASER_DATA();
|
||||
static SSI_STATUS_MOTION _process_KEYENCE_CMD_GET_LASER_DATA();
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,320 @@
|
||||
#ifndef LKIF_INCLUDED
|
||||
#define LKIF_INCLUDED
|
||||
|
||||
#ifdef I_AM_LKIF
|
||||
#define EXP __declspec(dllexport)
|
||||
#else
|
||||
#define EXP __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// Measurement value structures
|
||||
typedef enum {
|
||||
LKIF_FLOATRESULT_VALID, // valid data
|
||||
LKIF_FLOATRESULT_RANGEOVER_P, // over range at positive (+) side
|
||||
LKIF_FLOATRESULT_RANGEOVER_N, // over range at negative (-) side
|
||||
LKIF_FLOATRESULT_WAITING, // comparator result
|
||||
} LKIF_FLOATRESULT;
|
||||
|
||||
typedef struct {
|
||||
LKIF_FLOATRESULT FloatResult; // valid or invalid data
|
||||
float Value; // measurement value during LKIF_FLOATRESULT_VALID.
|
||||
// Any other times will return an invalid value
|
||||
} LKIF_FLOATVALUE;
|
||||
///////////////////////////////////////////////
|
||||
// Measurement Control Command
|
||||
//
|
||||
// Measurement Value Output
|
||||
EXP BOOL WINAPI LKIF_GetCalcData(OUT LKIF_FLOATVALUE *CalcData1,OUT LKIF_FLOATVALUE *CalcData2);
|
||||
// Timing ON/OFF
|
||||
EXP BOOL WINAPI LKIF_SetTiming(IN int OutNo,IN BOOL IsOn);
|
||||
// Auto-zero ON/OFF
|
||||
EXP BOOL WINAPI LKIF_SetZero(IN int OutNo,IN BOOL IsOn);
|
||||
// Reset
|
||||
EXP BOOL WINAPI LKIF_SetReset(IN int OutNo);
|
||||
// Panel Lock
|
||||
EXP BOOL WINAPI LKIF_SetPanelLock(IN BOOL IsLock);
|
||||
// Program Change
|
||||
EXP BOOL WINAPI LKIF_SetProgramNo(IN int ProgramNo);
|
||||
// Program Check
|
||||
EXP BOOL WINAPI LKIF_GetProgramNo(OUT int *ProgramNo);
|
||||
// Statistical Results Output
|
||||
typedef struct {
|
||||
LKIF_FLOATVALUE ToleUpper; // tolerance upper limit
|
||||
LKIF_FLOATVALUE ToleLower; // tolerance lower limit
|
||||
LKIF_FLOATVALUE AverageValue; // average value
|
||||
LKIF_FLOATVALUE MaxValue; // maximum value
|
||||
LKIF_FLOATVALUE MinValue; // minimum value
|
||||
LKIF_FLOATVALUE DifValue; // maximum value - minimum value
|
||||
LKIF_FLOATVALUE SdValue; // standard deviation
|
||||
LONG DataCnt; // number of all data
|
||||
LONG HighDataCnt; // number of tolerance High data
|
||||
LONG GoDataCnt; // number of tolerance Go data
|
||||
LONG LowDataCnt; // number of tolerance Low data
|
||||
} LKIF_FIGUREDATA;
|
||||
EXP BOOL WINAPI LKIF_GetFigureData(IN int OutNo,OUT LKIF_FIGUREDATA *FigureData);
|
||||
// Clearing Statistics
|
||||
EXP BOOL WINAPI LKIF_ClearFigureData(void);
|
||||
// Starting the Data Storage
|
||||
EXP BOOL WINAPI LKIF_DataStorageStart(void);
|
||||
// Stopping the Data Storage
|
||||
EXP BOOL WINAPI LKIF_DataStorageStop(void);
|
||||
// Initializing the Data Storage
|
||||
EXP BOOL WINAPI LKIF_DataStorageInit(void);
|
||||
// Outputting the Data Storage
|
||||
EXP BOOL WINAPI LKIF_DataStorageGetData(IN int OutNo,IN int NumOutBuffer,OUT LKIF_FLOATVALUE *OutBuffer,OUT int *NumReceived);
|
||||
// Data Storage Accumulation Status Output
|
||||
EXP BOOL WINAPI LKIF_DataStorageGetStatus(IN int OutNo,OUT BOOL *IsStorage,OUT int *NumStorageData);
|
||||
// Receive Light Waveform
|
||||
EXP BOOL WINAPI LKIF_GetLight(IN int HeadNo,IN int PeekNo,OUT int *MeasurePosition,OUT int *NumReaded,OUT BYTE *Value);
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Change Parameter Command
|
||||
//
|
||||
// Display Panel Switch
|
||||
EXP BOOL WINAPI LKIF_SetPanel(IN int OutNo);
|
||||
// Set Tolerance
|
||||
EXP BOOL WINAPI LKIF_SetTolerance(IN int OutNo,IN int UpperLimit,IN int LowerLimit,IN int Hysteresis);
|
||||
// Set ABLE
|
||||
typedef enum {
|
||||
LKIF_ABLEMODE_AUTO, // automatic
|
||||
LKIF_ABLEMODE_MANUAL, // manual
|
||||
} LKIF_ABLEMODE;
|
||||
EXP BOOL WINAPI LKIF_SetAbleMode(IN int HeadNo,IN LKIF_ABLEMODE AbleMode);
|
||||
// Set ABLE Control Range
|
||||
EXP BOOL WINAPI LKIF_SetAbleMinMax(IN int HeadNo,IN int Min,IN int Max);
|
||||
// Set Measurement Mode
|
||||
typedef enum {
|
||||
LKIF_MEASUREMODE_NORMAL, // normal
|
||||
LKIF_MEASUREMODE_HALF_T, // translucent object
|
||||
LKIF_MEASUREMDOE_TRAN_1, // transparent object
|
||||
LKIF_MEASUREMODE_TRAN_2, // transparent object 2
|
||||
LKIF_MEASUREMODE_MRS, // multireflective object
|
||||
} LKIF_MEASUREMODE;
|
||||
EXP BOOL WINAPI LKIF_SetMeasureMode(IN int HeadNo,IN LKIF_MEASUREMODE MeasureMode);
|
||||
// Set Number of Times of Alarm Processing
|
||||
EXP BOOL WINAPI LKIF_SetNumAlarm(IN int HeadNo,IN int NumAlarm);
|
||||
// Set Alarm Level
|
||||
EXP BOOL WINAPI LKIF_SetAlarmLevel(IN int HeadNo,IN int AlarmLevel);
|
||||
// Starting the ABLE Calibration
|
||||
EXP BOOL WINAPI LKIF_AbleStart(IN int HeadNo);
|
||||
// Finishing the ABLE Calibration
|
||||
EXP BOOL WINAPI LKIF_AbleStop(void);
|
||||
// Stopping the ABLE Calibration
|
||||
EXP BOOL WINAPI LKIF_AbleCancel(void);
|
||||
// Set Mounting Mode
|
||||
typedef enum {
|
||||
LKIF_REFLECTIONMODE_DIFFUSION, // diffuse reflection
|
||||
LKIF_REFLECTIONMODE_MIRROR, // specular reflection
|
||||
} LKIF_REFLECTIONMODE;
|
||||
EXP BOOL WINAPI LKIF_SetReflectionMode(IN int HeadNo,IN LKIF_REFLECTIONMODE ReflectionMode);
|
||||
// Set Calculation Method
|
||||
typedef enum {
|
||||
LKIF_CALCMETHOD_HEADA, // head A
|
||||
LKIF_CALCMETHOD_HEADB, // head B
|
||||
LKIF_CALCMETHOD_HEAD_HEADA_PLUS_HEADB, // head A+head B
|
||||
LKIF_CALCMETHOD_HEAD_HEADA_MINUS_HEADB, // head A-head B
|
||||
LKIF_CALCMETHOD_HEAD_HEADA_TRANSPARENT, // head A transparent object
|
||||
LKIF_CALCMETHOD_HEAD_HEADB_TRANSPARENT, // head B transparent object
|
||||
} LKIF_CALCMETHOD;
|
||||
// Measurement target
|
||||
typedef enum {
|
||||
LKIF_CALCTARGET_PEAK_1, // peak 1
|
||||
LKIF_CALCTARGET_PEAK_2, // peak 2
|
||||
LKIF_CALCTARGET_PEAK_3, // peak 3
|
||||
LKIF_CALCTARGET_PEAK_4, // peak 4
|
||||
LKIF_CALCTARGET_PEAK_1_2, // peak 1-peak 2
|
||||
LKIF_CALCTARGET_PEAK_1_3, // peak 1-peak 3
|
||||
LKIF_CALCTARGET_PEAK_1_4, // peak 1-peak 4
|
||||
LKIF_CALCTARGET_PEAK_2_3, // peak 2-peak 3
|
||||
LKIF_CALCTARGET_PEAK_2_4, // peak 2-peak 4
|
||||
LKIF_CALCTARGET_PEAK_3_4, // peak 3-peak 4
|
||||
} LKIF_CALCTARGET;
|
||||
EXP BOOL WINAPI LKIF_SetCalcMethod(IN int OutNo,IN LKIF_CALCMETHOD CalcMethod,LKIF_CALCTARGET CalcTarget);
|
||||
// Set Scaling
|
||||
EXP BOOL WINAPI LKIF_SetScaling(IN int OutNo,IN int HeadNo,IN int InputValue1,IN int OutputValue1,IN int InputValue2,IN int OutputValue2);
|
||||
// Set Filter Mode
|
||||
typedef enum {
|
||||
LKIF_FILTERMODE_MOVING_AVERAGE, // moving average
|
||||
LKIF_FILTERMODE_LOWPASS, // low pass filter
|
||||
LKIF_FILTERMODE_HIGHPASS, // high pass filter
|
||||
} LKIF_FILTERMODE;
|
||||
EXP BOOL WINAPI LKIF_SetFilterMode(IN int OutNo,OUT LKIF_FILTERMODE FilterMode);
|
||||
// Set Number of Times for Averaging
|
||||
typedef enum {
|
||||
LKIF_AVERAGE_1, // 1 time
|
||||
LKIF_AVERAGE_4, //
|
||||
LKIF_AVERAGE_16, //
|
||||
LKIF_AVERAGE_64, //
|
||||
LKIF_AVERAGE_256, //
|
||||
LKIF_AVERAGE_1024, //
|
||||
LKIF_AVERAGE_4096, //
|
||||
LKIF_AVERAGE_16384, //
|
||||
LKIF_AVERAGE_65536, //
|
||||
LKIF_AVERAGE_262144, // 262144 times
|
||||
} LKIF_AVERAGE;
|
||||
EXP BOOL WINAPI LKIF_SetAverage(IN int OutNo,IN LKIF_AVERAGE Average);
|
||||
// Set Cutoff Frequency
|
||||
typedef enum {
|
||||
LKIF_CUTOFFFREQUENCY_1000, // 1000Hz
|
||||
LKIF_CUTOFFFREQUENCY_300, // 300Hz
|
||||
LKIF_CUTOFFFREQUENCY_100, // 100Hz
|
||||
LKIF_CUTOFFFREQUENCY_30, // 30Hz
|
||||
LKIF_CUTOFFFREQUENCY_10, // 10Hz
|
||||
LKIF_CUTOFFFREQUENCY_3, // 3Hz
|
||||
LKIF_CUTOFFFREQUENCY_1, // 1Hz
|
||||
LKIF_CUTOFFFREQUENCY_0_3, // 0.3Hz
|
||||
LKIF_CUTOFFFREQUENCY_0_1, // 0.1Hz
|
||||
} LKIF_CUTOFFFREQUENCY;
|
||||
EXP BOOL WINAPI LKIF_SetCutOffFrequency(IN int OutNo,IN LKIF_CUTOFFFREQUENCY CutOffFrequency);
|
||||
// Set Trigger Mode
|
||||
typedef enum {
|
||||
LKIF_TRIGGERMODE_EXT1, // external trigger 1
|
||||
LKIF_TRIGGERMODE_EXT2, // external trigger 2
|
||||
} LKIF_TRIGGERMODE;
|
||||
EXP BOOL WINAPI LKIF_SetTriggerMode(IN int OutNo,IN LKIF_TRIGGERMODE TriggerMode);
|
||||
// Set Offset
|
||||
EXP BOOL WINAPI LKIF_SetOffset(IN int OutNo,IN int Offset);
|
||||
// Set Analog Output Scaling
|
||||
EXP BOOL WINAPI LKIF_SetAnalogScaling(IN int OutNo,IN int InputValue1,IN int OutputVoltage1,IN int InputValue2,IN int OutputVoltage2);
|
||||
// Set Calculation Mode
|
||||
typedef enum {
|
||||
LKIF_CALCMODE_NORMAL, // normal
|
||||
LKIF_CALCMODE_PEAKHOLD, // peak hold
|
||||
LKIF_CALCMODE_BOTTOMHOLD, // bottom hold
|
||||
LKIF_CALCMODE_PEAKTOPEAKHOLD, // peak-to-peak hold
|
||||
LKIF_CALCMODE_SAMPLEHOLD, // sample hold
|
||||
LKIF_CALCMODE_AVERAGEHOLD, // average hold
|
||||
} LKIF_CALCMODE;
|
||||
EXP BOOL WINAPI LKIF_SetCalcMode(IN int OutNo,IN LKIF_CALCMODE CalcMode);
|
||||
// Set Minimum Display Unit
|
||||
typedef enum {
|
||||
LKIF_DISPLAYUNIT_0000_01MM, // 0.01mm
|
||||
LKIF_DISPLAYUNIT_000_001MM, // 0.001mm
|
||||
LKIF_DISPLAYUNIT_00_0001MM, // 0.0001mm
|
||||
LKIF_DISPLAYUNIT_0_00001MM, // 0.00001mm
|
||||
LKIF_DISPLAYUNIT_00000_1UM, // 0.1um
|
||||
LKIF_DISPLAYUNIT_0000_01UM, // 0.01um
|
||||
} LKIF_DISPLAYUNIT;
|
||||
EXP BOOL WINAPI LKIF_SetDisplayUnit(IN int OutNo,IN LKIF_DISPLAYUNIT DisplayUnit);
|
||||
// Set Analog-Through
|
||||
EXP BOOL WINAPI LKIF_SetAnalogThrough(IN int OutNo,IN BOOL IsOn);
|
||||
// Set Data Storage
|
||||
typedef enum {
|
||||
LKIF_TARGETOUT_NONE, // no target OUT
|
||||
LKIF_TARGETOUT_OUT1, // OUT1
|
||||
LKIF_TARGETOUT_OUT2, // OUT2
|
||||
LKIF_TARGETOUT_BOTH, // OUT1 and OUT2
|
||||
} LKIF_TARGETOUT;
|
||||
typedef enum {
|
||||
LKIF_STORAGECYCLE_1, // sampling rate x 1
|
||||
LKIF_STORAGECYCLE_2, // sampling rate x 2
|
||||
LKIF_STORAGECYCLE_5, // sampling rate x 5
|
||||
LKIF_STORAGECYCLE_10, // sampling rate x 10
|
||||
LKIF_STORAGECYCLE_20, // sampling rate x 20
|
||||
LKIF_STORAGECYCLE_50, // sampling rate x 50
|
||||
LKIF_STORAGECYCLE_100, // sampling rate x 100
|
||||
LKIF_STORAGECYCLE_200, // sampling rate x 200
|
||||
LKIF_STORAGECYCLE_500, // sampling rate x 500
|
||||
LKIF_STORAGECYCLE_1000, // sampling rate x 1000
|
||||
} LKIF_STORAGECYCLE;
|
||||
EXP BOOL WINAPI LKIF_SetDataStorage(IN LKIF_TARGETOUT TargetOut,IN int NumStorage,IN LKIF_STORAGECYCLE StorageCycle);
|
||||
// Set Sampling Rate
|
||||
typedef enum {
|
||||
LKIF_SAMPLINGCYCLE_20USEC, // 20us
|
||||
LKIF_SAMPLINGCYCLE_50USEC, // 50us
|
||||
LKIF_SAMPLINGCYCLE_100USEC, // 100us
|
||||
LKIF_SAMPLINGCYCLE_200USEC, // 200us
|
||||
LKIF_SAMPLINGCYCLE_500USEC, // 500us
|
||||
LKIF_SAMPLINGCYCLE_1MSEC, // 1ms
|
||||
} LKIF_SAMPLINGCYCLE;
|
||||
EXP BOOL WINAPI LKIF_SetSamplingCycle(IN LKIF_SAMPLINGCYCLE SamplingCycle);
|
||||
// Set Mutual Interference Prevention
|
||||
EXP BOOL WINAPI LKIF_SetMutualInterferencePrevention(IN BOOL IsOn);
|
||||
// Set Timing Synchronization
|
||||
typedef enum {
|
||||
LKIF_SYNCHRONIZATION_ASYNCHRONOUS, // asynchronous
|
||||
LKIF_SYNCHRONIZATION_SYNCHRONIZED, // synchronous
|
||||
} LKIF_SYNCHRONIZATION;
|
||||
EXP BOOL WINAPI LKIF_SetTimingSynchronization(IN LKIF_SYNCHRONIZATION Synchronization);
|
||||
// Set Comparator Output Format
|
||||
typedef enum {
|
||||
LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT_NORMAL, // normal
|
||||
LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT_HOLD, // hold
|
||||
LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT_OFF_DELAY, // off-delay
|
||||
} LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT;
|
||||
EXP BOOL WINAPI LKIF_SetToleranceComparatorOutputFormat(IN LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT ToleranceComparatorOutputFormat);
|
||||
// Set Strobe Time
|
||||
typedef enum {
|
||||
LKIF_STOROBETIME_2MS, // 2ms
|
||||
LKIF_STOROBETIME_5MS, // 5ms
|
||||
LKIF_STOROBETIME_10MS, // 10ms
|
||||
LKIF_STOROBETIME_20MS, // 20ms
|
||||
} LKIF_STOROBETIME;
|
||||
EXP BOOL WINAPI LKIF_SetStorobeTime(IN LKIF_STOROBETIME StorobeTime);
|
||||
///////////////////////////////////////////////
|
||||
// Check Parameter Command
|
||||
//
|
||||
// Display Panel Check
|
||||
EXP BOOL WINAPI LKIF_GetPanel(OUT int *OutNo);
|
||||
// Get Tolerance
|
||||
EXP BOOL WINAPI LKIF_GetTolerance(IN int OutNo,OUT int *UpperLimit,OUT int *LowerLimit,OUT int *Hysteresis);
|
||||
// Get ABLE
|
||||
EXP BOOL WINAPI LKIF_GetAbleMode(IN int HeadNo,OUT LKIF_ABLEMODE *AbleMode);
|
||||
// ABLE Control Range
|
||||
EXP BOOL WINAPI LKIF_GetAbleMinMax(IN int HeadNo,OUT int *Min,OUT int *Max);
|
||||
// Get Measurement Mode
|
||||
EXP BOOL WINAPI LKIF_GetMeasureMode(IN int HeadNo,OUT LKIF_MEASUREMODE *MeasureMode);
|
||||
// Get Number of Times of Alarm Processing
|
||||
EXP BOOL WINAPI LKIF_GetNumAlarm(IN int HeadNo,OUT int *NumAlarm);
|
||||
// Get Alarm Level
|
||||
EXP BOOL WINAPI LKIF_GetAlarmLevel(IN int HeadNo,OUT int *AlarmLevel);
|
||||
// Get Mounting Mode
|
||||
EXP BOOL WINAPI LKIF_GetReflectionMode(IN int HeadNo,OUT LKIF_REFLECTIONMODE *ReflectionMode);
|
||||
// Get Calculation Method
|
||||
EXP BOOL WINAPI LKIF_GetCalcMethod(IN int OutNo,OUT LKIF_CALCMETHOD *CalcMethod,LKIF_CALCTARGET *CalcTarget);
|
||||
// Get Scaling
|
||||
EXP BOOL WINAPI LKIF_GetScaling(IN int OutNo,IN int HeadNo,OUT int *InputValue1,OUT int *OutputValue1,OUT int *InputValue2,OUT int *OutputValue2);
|
||||
// Get Filter Mode
|
||||
EXP BOOL WINAPI LKIF_GetFilterMode(IN int OutNo,OUT LKIF_FILTERMODE *FilterMode);
|
||||
// Get Number of Times for Averaging
|
||||
EXP BOOL WINAPI LKIF_GetAverage(IN int OutNo,OUT LKIF_AVERAGE *Average);
|
||||
// Get Cutoff Frequency
|
||||
EXP BOOL WINAPI LKIF_GetCutOffFrequency(IN int OutNo,OUT LKIF_CUTOFFFREQUENCY *CutOffFrequency);
|
||||
// Get Trigger Mode
|
||||
EXP BOOL WINAPI LKIF_GetTriggerMode(IN int OutNo,OUT LKIF_TRIGGERMODE *TriggerMode);
|
||||
// Get Offset
|
||||
EXP BOOL WINAPI LKIF_GetOffset(IN int OutNo,IN int *Offset);
|
||||
// Get Analog Output Scaling
|
||||
EXP BOOL WINAPI LKIF_GetAnalogScaling(IN int OutNo,OUT int *InputValue1,OUT int *OutputVoltage1,OUT int *InputValue2,OUT int *OutputVoltage2);
|
||||
// Get Calculation Mode
|
||||
EXP BOOL WINAPI LKIF_GetCalcMode(IN int OutNo,OUT LKIF_CALCMODE *CalcMode);
|
||||
// Get Minimum Display Unit
|
||||
EXP BOOL WINAPI LKIF_GetDisplayUnit(IN int OutNo,OUT LKIF_DISPLAYUNIT *DisplayUnit);
|
||||
// Analog-Through
|
||||
EXP BOOL WINAPI LKIF_GetAnalogThrough(IN int OutNo,OUT BOOL *IsOn);
|
||||
// Get Data Storage
|
||||
EXP BOOL WINAPI LKIF_GetDataStorage(IN LKIF_TARGETOUT *TargetOut,OUT int *NumStorage,OUT LKIF_STORAGECYCLE *StorageCycle);
|
||||
// Get Sampling Rate
|
||||
EXP BOOL WINAPI LKIF_GetSamplingCycle(OUT LKIF_SAMPLINGCYCLE *SamplingCycle);
|
||||
// Get Mutual Interference Prevention
|
||||
EXP BOOL WINAPI LKIF_GetMutualInterferencePrevention(OUT BOOL *IsOn);
|
||||
// Get Timing Synchronization
|
||||
EXP BOOL WINAPI LKIF_GetTimingSynchronization(OUT LKIF_SYNCHRONIZATION *Synchronization);
|
||||
// Get Comparator Output Format
|
||||
EXP BOOL WINAPI LKIF_GetToleranceComparatorOutputFormat(OUT LKIF_TOLERANCE_COMPARATOR_OUTPUT_FORMAT *ToleranceComparatorOutputFormat);
|
||||
// Get Strobe Time
|
||||
EXP BOOL WINAPI LKIF_GetStorobeTime(OUT LKIF_STOROBETIME *StorobeTime);
|
||||
///////////////////////////////////////////////
|
||||
// Mode Change Command
|
||||
//
|
||||
// Mode Switch
|
||||
typedef enum {
|
||||
LKIF_MODE_NORMAL, // normal mode
|
||||
LKIF_MODE_COMMUNICATION, // setting mode
|
||||
} LKIF_MODE;
|
||||
EXP BOOL WINAPI LKIF_SetMode(IN LKIF_MODE Mode);
|
||||
} // extern "C"
|
||||
|
||||
#endif // LKIF_INCLUDED
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
// List of events which the driver can notify user code for
|
||||
enum AxisBoardEvent
|
||||
{
|
||||
AXBD_PROBED_POINT = 0,
|
||||
AXBD_PROBE_TIP_CHANGE,
|
||||
AXBD_INPUT_LINE,
|
||||
AXBD_OPTICAL_EDGE,
|
||||
AXBD_LOG_DOUBLES, // Debug message sent from DSP
|
||||
AXBD_FOLLOWING_ERROR,
|
||||
AXBD_CONTINUATION_ZONE,
|
||||
AXBD_ZOOM_MOVE_COMPLETED,
|
||||
AXBD_REF_MARK,
|
||||
AXBD_NULL_EVENT,
|
||||
AXBD_LOG_UNSIGNED_SHORTS, // Debug message sent from DSP
|
||||
AXBD_LAF_EDGE,
|
||||
AXBD_DSP_STARTED, // For internal use only - signals DSP code fully loaded
|
||||
AXBD_SOFTWARE_FENCE_HIT,
|
||||
AXBD_AUTO_TUNE_DATA,
|
||||
AXBD_AUTO_TUNE_RESULTS,
|
||||
AXBD_AUTO_TUNE_MOVING,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_EventHandler.h : interface for the event handler function
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//void ZoomEvent(bool bIn, bool bFineMode);
|
||||
//bool IsInputActive(int Input, unsigned short *Data);
|
||||
//bool IsInputLevelHigh(int Input, unsigned short *Data);
|
||||
//void EventHandler(AxisBoardEvent Event, unsigned long UserData, unsigned short *Data, int DataNum);
|
||||
//HAL_STATUS HAL_WaitMoveComplete(DWORD WaitTimeout, bool WaitOptics);
|
||||
//HAL_STATUS HAL_SetOutput(HAL_OUTPUT Output, bool State);
|
||||
@@ -0,0 +1,16 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Fixture.cpp : interface for the Fixture related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
HAL_STATUS HAL_Fixture_IsSupported(UINT &Type)
|
||||
{
|
||||
Type = 0;
|
||||
HAL_SendDebug(_T("HAL_Fixture_IsSupported %X\n"), Type);
|
||||
return HAL_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Fixture.h : interface for the Fixture related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_Fixture_IsSupported(UINT &Type);
|
||||
@@ -0,0 +1,602 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Illumination.cpp : interface for the Illumination related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "..\include\resource.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
double Intensity[HAL_ILLUMINATION_MAX_LAMPS][HAL_ILLUMINATION_MAX_BULBS];
|
||||
bool State[HAL_ILLUMINATION_MAX_LAMPS][HAL_ILLUMINATION_MAX_BULBS];
|
||||
//unsigned short LastLevelSent[HAL_ILLUMINATION_MAX_LAMPS][HAL_ILLUMINATION_MAX_BULBS];
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
extern CMv_Proto *g_pMv_Proto;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool IsTopLight(int nLamp)
|
||||
{
|
||||
switch(g_HSIExt.m_ActiveMachineType)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
default:
|
||||
if(nLamp == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool IsBottomLight(int nLamp)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(nLamp);
|
||||
switch(g_HSIExt.m_ActiveMachineType)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
default:
|
||||
if(nLamp == 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool IsRingLight(int nLamp)
|
||||
{
|
||||
switch(g_HSIExt.m_ActiveMachineType)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
default:
|
||||
if(nLamp == 2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Map a lamp from the PCDMIS ring light to the MicroVu ring light
|
||||
// MV start with the inner ring. The first or zero lamp is at 12 oclock and goes CCW
|
||||
// PCD starts with the outer ring. The first or zero lamp is at 12 oclock and goes CW
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int PCDRingBulbToMicroVu_8x5(int Lamp)
|
||||
{
|
||||
switch(Lamp)
|
||||
{
|
||||
case 0:
|
||||
return 32;
|
||||
case 1:
|
||||
return 39;
|
||||
case 2:
|
||||
return 38;
|
||||
case 3:
|
||||
return 37;
|
||||
case 4:
|
||||
return 36;
|
||||
case 5:
|
||||
return 35;
|
||||
case 6:
|
||||
return 34;
|
||||
case 7:
|
||||
return 33;
|
||||
|
||||
case 8:
|
||||
return 24;
|
||||
case 9:
|
||||
return 31;
|
||||
case 10:
|
||||
return 30;
|
||||
case 11:
|
||||
return 29;
|
||||
case 12:
|
||||
return 28;
|
||||
case 13:
|
||||
return 27;
|
||||
case 14:
|
||||
return 26;
|
||||
case 15:
|
||||
return 25;
|
||||
|
||||
case 16:
|
||||
return 16;
|
||||
case 17:
|
||||
return 23;
|
||||
case 18:
|
||||
return 22;
|
||||
case 19:
|
||||
return 21;
|
||||
case 20:
|
||||
return 20;
|
||||
case 21:
|
||||
return 19;
|
||||
case 22:
|
||||
return 18;
|
||||
case 23:
|
||||
return 17;
|
||||
|
||||
case 24:
|
||||
return 8;
|
||||
case 25:
|
||||
return 15;
|
||||
case 26:
|
||||
return 14;
|
||||
case 27:
|
||||
return 13;
|
||||
case 28:
|
||||
return 12;
|
||||
case 29:
|
||||
return 11;
|
||||
case 30:
|
||||
return 10;
|
||||
case 31:
|
||||
return 9;
|
||||
|
||||
case 32:
|
||||
return 0;
|
||||
case 33:
|
||||
return 7;
|
||||
case 34:
|
||||
return 6;
|
||||
case 35:
|
||||
return 5;
|
||||
case 36:
|
||||
return 4;
|
||||
case 37:
|
||||
return 3;
|
||||
case 38:
|
||||
return 2;
|
||||
case 39:
|
||||
return 1;
|
||||
}
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Map a lamp from the PCDMIS ring light to the MicroVu ring light
|
||||
// MV start with the inner ring. The first or zero lamp is at 12 oclock and goes CCW
|
||||
// PCD starts with the outer ring. The first or zero lamp is at 12 oclock and goes CW
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int PCDRingBulbToMicroVu_8x2(int Lamp)
|
||||
{
|
||||
switch(Lamp)
|
||||
{
|
||||
case 0:
|
||||
return 8;
|
||||
case 1:
|
||||
return 9;
|
||||
case 2:
|
||||
return 10;
|
||||
case 3:
|
||||
return 11;
|
||||
case 4:
|
||||
return 12;
|
||||
case 5:
|
||||
return 13;
|
||||
case 6:
|
||||
return 14;
|
||||
case 7:
|
||||
return 15;
|
||||
case 8:
|
||||
return 0;
|
||||
case 9:
|
||||
return 1;
|
||||
case 10:
|
||||
return 2;
|
||||
case 11:
|
||||
return 3;
|
||||
case 12:
|
||||
return 4;
|
||||
case 13:
|
||||
return 5;
|
||||
case 14:
|
||||
return 6;
|
||||
case 15:
|
||||
return 7;
|
||||
}
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Map a lamp from the PCDMIS ring light to the MicroVu ring light
|
||||
// MV start with the inner ring. The first or zero lamp is at 12 oclock and goes CCW
|
||||
// PCD starts with the outer ring. The first or zero lamp is at 12 oclock and goes CW
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int PCDRingBulbToMicroVu(int Lamp)
|
||||
{
|
||||
if ((g_HSIExt.m_NumRings == 2) && (g_HSIExt.m_NumSegs == 8))
|
||||
{
|
||||
PCDRingBulbToMicroVu_8x2(Lamp);
|
||||
}
|
||||
else
|
||||
if ((g_HSIExt.m_NumRings == 3) && (g_HSIExt.m_NumSegs == 8))
|
||||
{
|
||||
PCDRingBulbToMicroVu_8x5(Lamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
PCDRingBulbToMicroVu_8x5(Lamp);
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_IsSupported(UINT &Type)
|
||||
{
|
||||
Type = HAL_ILLUMINATION_SUPPORTS_DCC_CONTROL;
|
||||
|
||||
HAL_SendDebug(_T("HAL_Illumination_IsSupported %X\n"), Type);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_Startup( )
|
||||
{
|
||||
memset(Intensity, 0, sizeof(Intensity));
|
||||
memset(State, 1, sizeof(State));
|
||||
|
||||
switch(g_HSIExt.m_ActiveMachineType)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
g_pMv_Proto->mv_light_set_light_off();
|
||||
break;
|
||||
}
|
||||
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_GetLampCount( int &nLamps )
|
||||
{
|
||||
UINT NumLamps = 0;
|
||||
|
||||
switch(g_HSIExt.m_ActiveMachineType)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
NumLamps = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
ASSERT(NumLamps <= HAL_ILLUMINATION_MAX_LAMPS);
|
||||
|
||||
nLamps = NumLamps;
|
||||
|
||||
HAL_SendDebug(_T("HAL_Illumination_GetLampCount %d\n"), NumLamps);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_GetLampInfo( int nLamp, TCHAR LampName[HAL_MaxLampNameLength+1], TCHAR LampDescription[HAL_MaxLampDescriptionLength+1],
|
||||
enum HAL_ILLUMINATION_LAMP_LOCATION_TYPE &LocationType, int &LocationAngle,
|
||||
enum HAL_ILLUMINATION_BULB_TYPE &BulbType,
|
||||
enum HAL_ILLUMINATION_BULB_CONTROL_TYPE &BulbControlType,
|
||||
enum HAL_ILLUMINATION_INTENSITY_CONTROL_TYPE &IntensityControlType,
|
||||
int &NumColors, COLORREF *Colors,
|
||||
int &NumRings, int *NumSectors,
|
||||
double &MinAngle, double &MaxAngle,
|
||||
bool &bCanBeCalibrated)
|
||||
{
|
||||
if(IsTopLight(nLamp))
|
||||
{
|
||||
LocationType = HAL_ILLUMINATION_LAMP_LOCATION_TOP_ON_AXIS;
|
||||
BulbType = HAL_ILLUMINATION_BULB_ROUND;
|
||||
BulbControlType = HAL_ILLUMINATION_BULB_CONTROL_BY_LAMP;
|
||||
IntensityControlType = HAL_ILLUMINATION_INTENSITY_CONTROL_BY_LAMP;
|
||||
CString LampNameStr;
|
||||
LampNameStr.LoadString(IDS_ILLUMINATION_TOP);
|
||||
wcsncpy_s(LampName, HAL_MaxLampNameLength+1, LampNameStr, HAL_MaxLampNameLength);
|
||||
wcsncpy_s(LampDescription, HAL_MaxLampDescriptionLength+1, _T("MicroVu Coaxial Light"), HAL_MaxLampDescriptionLength);
|
||||
NumColors = 1;
|
||||
Colors[0] = RGB(255, 255, 255);
|
||||
NumRings = 0;
|
||||
NumSectors = 0;
|
||||
LocationAngle = 0;
|
||||
MinAngle = 0.0;
|
||||
MaxAngle = 0.0;
|
||||
bCanBeCalibrated = true;
|
||||
}
|
||||
|
||||
if(IsBottomLight(nLamp))
|
||||
{
|
||||
LocationType = HAL_ILLUMINATION_LAMP_LOCATION_BOTTOM;
|
||||
BulbType = HAL_ILLUMINATION_BULB_ROUND;
|
||||
BulbControlType = HAL_ILLUMINATION_BULB_CONTROL_BY_LAMP;
|
||||
IntensityControlType = HAL_ILLUMINATION_INTENSITY_CONTROL_BY_LAMP;
|
||||
CString LampNameStr;
|
||||
LampNameStr.LoadString(IDS_ILLUMINATION_BTM);
|
||||
wcsncpy_s(LampName,HAL_MaxLampNameLength+1,LampNameStr,HAL_MaxLampNameLength);
|
||||
wcsncpy_s(LampDescription,HAL_MaxLampDescriptionLength+1,_T("MicroVu Backlight (Green)"),HAL_MaxLampDescriptionLength);
|
||||
NumColors = 1;
|
||||
Colors[0] = RGB(255, 255, 255);
|
||||
NumRings = 0;
|
||||
NumSectors = 0;
|
||||
LocationAngle = 0;
|
||||
MinAngle = 0.0;
|
||||
MaxAngle = 0.0;
|
||||
bCanBeCalibrated = true;
|
||||
}
|
||||
|
||||
if(IsRingLight(nLamp))
|
||||
{
|
||||
LocationType = HAL_ILLUMINATION_LAMP_LOCATION_TOP_ANGLED;
|
||||
BulbType = HAL_ILLUMINATION_BULB_RING;
|
||||
BulbControlType = HAL_ILLUMINATION_BULB_CONTROL_BY_BULB;
|
||||
IntensityControlType = HAL_ILLUMINATION_INTENSITY_CONTROL_BY_BULB;
|
||||
|
||||
CString LampNameStr;
|
||||
LampNameStr.LoadString(IDS_ILLUMINATION_RNG);
|
||||
wcsncpy_s(LampName, HAL_MaxLampNameLength+1, LampNameStr, HAL_MaxLampNameLength);
|
||||
wcsncpy_s(LampDescription, HAL_MaxLampDescriptionLength+1, _T("MicroVu Ringlight"), HAL_MaxLampDescriptionLength);
|
||||
NumColors = 1;
|
||||
Colors[0] = RGB(255, 255, 255);
|
||||
|
||||
NumRings = g_HSIExt.m_NumRings;
|
||||
for(int i = 0 ; i < NumRings ; i++)
|
||||
NumSectors[i] = g_HSIExt.m_NumSegs;
|
||||
|
||||
LocationAngle = 0;
|
||||
|
||||
MinAngle = 0.0;
|
||||
MaxAngle = 0.0;
|
||||
|
||||
bCanBeCalibrated = true;
|
||||
}
|
||||
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
int GetLampNumberFromLocation(const enum HAL_ILLUMINATION_LAMP_LOCATION_TYPE SearchLocationType)
|
||||
{
|
||||
for(int nLamp=0;nLamp<HAL_ILLUMINATION_MAX_LAMPS;nLamp++)
|
||||
{
|
||||
TCHAR LampName[HAL_MaxLampNameLength+1], LampDescription[HAL_MaxLampDescriptionLength+1];
|
||||
enum HAL_ILLUMINATION_LAMP_LOCATION_TYPE LocationType=HAL_ILLUMINATION_LAMP_LOCATION_TOP_ON_AXIS;
|
||||
enum HAL_ILLUMINATION_BULB_TYPE BulbType=HAL_ILLUMINATION_BULB_ROUND;
|
||||
enum HAL_ILLUMINATION_BULB_CONTROL_TYPE BulbControlType=HAL_ILLUMINATION_BULB_CONTROL_BY_LAMP;
|
||||
enum HAL_ILLUMINATION_INTENSITY_CONTROL_TYPE IntensityControlType=HAL_ILLUMINATION_INTENSITY_CONTROL_BY_LAMP;
|
||||
int NumColors=1, NumRings=0,NumSectors[HAL_ILLUMINATION_MAX_SECTORS], LocationAngle=0;
|
||||
COLORREF Colors[HAL_ILLUMINATION_MAX_BULB_COLORS];
|
||||
Colors[0]=RGB(255,255,255);
|
||||
double MinAngle=0.0,MaxAngle=0.0;
|
||||
bool bCanBeCalibrated=true;
|
||||
|
||||
HAL_STATUS Status=HAL_Illumination_GetLampInfo(nLamp,LampName,LampDescription,LocationType,LocationAngle,BulbType,
|
||||
BulbControlType,IntensityControlType,NumColors,Colors,NumRings,
|
||||
NumSectors,MinAngle,MaxAngle,bCanBeCalibrated);
|
||||
|
||||
if((Status==HAL_STATUS_NORMAL) && (LocationType==SearchLocationType))
|
||||
return nLamp;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_GetLampState_2x8( int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int & Color, double & Angle )
|
||||
{
|
||||
if(IsTopLight(nLamp))
|
||||
{
|
||||
bBulbStates[0] = g_HSIExt.m_LampOutputState_2x8[nLamp][0];
|
||||
Intensities[0] = g_HSIExt.m_LampOutputLevel_2x8[nLamp][0];
|
||||
}
|
||||
|
||||
if(IsBottomLight(nLamp))
|
||||
{
|
||||
bBulbStates[0] = g_HSIExt.m_LampOutputState_2x8[nLamp][0];
|
||||
Intensities[0] = g_HSIExt.m_LampOutputLevel_2x8[nLamp][0];
|
||||
}
|
||||
|
||||
if(IsRingLight(nLamp))
|
||||
{
|
||||
for(int Bulb = 0 ; Bulb < TWO_RINGS * EIGHT_SEGS; Bulb++)
|
||||
{
|
||||
bBulbStates[Bulb] = g_HSIExt.m_LampOutputState_2x8[nLamp][Bulb];
|
||||
Intensities[Bulb] = g_HSIExt.m_LampOutputLevel_2x8[nLamp][Bulb];
|
||||
}
|
||||
}
|
||||
|
||||
Color=0;
|
||||
Angle=0.0;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_GetLampState_5x8( int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int & Color, double & Angle )
|
||||
{
|
||||
if(IsTopLight(nLamp))
|
||||
{
|
||||
bBulbStates[0] = g_HSIExt.m_LampOutputState_5x8[nLamp][0];
|
||||
Intensities[0] = g_HSIExt.m_LampOutputLevel_5x8[nLamp][0];
|
||||
}
|
||||
|
||||
if(IsBottomLight(nLamp))
|
||||
{
|
||||
bBulbStates[0] = g_HSIExt.m_LampOutputState_5x8[nLamp][0];
|
||||
Intensities[0] = g_HSIExt.m_LampOutputLevel_5x8[nLamp][0];
|
||||
}
|
||||
|
||||
if(IsRingLight(nLamp))
|
||||
{
|
||||
for(int Bulb = 0 ; Bulb < TWO_RINGS * EIGHT_SEGS; Bulb++)
|
||||
{
|
||||
bBulbStates[Bulb] = g_HSIExt.m_LampOutputState_5x8[nLamp][Bulb];
|
||||
Intensities[Bulb] = g_HSIExt.m_LampOutputLevel_5x8[nLamp][Bulb];
|
||||
}
|
||||
}
|
||||
|
||||
Color=0;
|
||||
Angle=0.0;
|
||||
|
||||
return HAL_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_GetLampState( int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int & Color, double & Angle )
|
||||
{
|
||||
if ((g_HSIExt.m_NumRings == 2) && (g_HSIExt.m_NumSegs == 8))
|
||||
{
|
||||
HAL_Illumination_GetLampState_2x8(nLamp, bBulbStates, Intensities, Color, Angle);
|
||||
}
|
||||
else
|
||||
if ((g_HSIExt.m_NumRings == 5) && (g_HSIExt.m_NumSegs == 8))
|
||||
{
|
||||
HAL_Illumination_GetLampState_5x8(nLamp, bBulbStates, Intensities, Color, Angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
HAL_Illumination_GetLampState_5x8(nLamp, bBulbStates, Intensities, Color, Angle);
|
||||
};
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_SetLampState_2x8( int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int /*Color*/, double /*Angle*/, bool bWait )
|
||||
{
|
||||
static unsigned short MaxLevelChange = 0;
|
||||
|
||||
if(IsTopLight(nLamp))
|
||||
{
|
||||
g_HSIExt.m_LampOutputState_2x8[nLamp][0] = bBulbStates[0];
|
||||
g_HSIExt.m_LampOutputLevel_2x8[nLamp][0] = Intensities[0];
|
||||
}
|
||||
|
||||
if(IsBottomLight(nLamp))
|
||||
{
|
||||
g_HSIExt.m_LampOutputState_2x8[nLamp][0] = bBulbStates[0];
|
||||
g_HSIExt.m_LampOutputLevel_2x8[nLamp][0] = Intensities[0];
|
||||
}
|
||||
|
||||
if(IsRingLight(nLamp))
|
||||
{
|
||||
for(int Bulb = 0 ; Bulb < TWO_RINGS*EIGHT_SEGS ; Bulb++)
|
||||
{
|
||||
g_HSIExt.m_LampOutputState_2x8[nLamp][Bulb] = bBulbStates[Bulb];
|
||||
g_HSIExt.m_LampOutputLevel_2x8[nLamp][Bulb] = Intensities[Bulb];
|
||||
g_HSIExt.m_LampOutputLevelForMVRing_2x8[PCDRingBulbToMicroVu(Bulb)] = bBulbStates[Bulb]?Intensities[Bulb]:0.0;
|
||||
}
|
||||
}
|
||||
g_pMv_Proto->mv_set_ringlight_data(TWO_RINGS * EIGHT_SEGS, g_HSIExt.m_LampOutputLevelForMVRing_2x8);
|
||||
|
||||
double dBottomIntensity = (g_HSIExt.m_LampOutputState_2x8[1][0])?g_HSIExt.m_LampOutputLevel_2x8[1][0]:0.0;
|
||||
double dTopIntensity = (g_HSIExt.m_LampOutputState_2x8[0][0])?g_HSIExt.m_LampOutputLevel_2x8[0][0]:0.0;
|
||||
g_pMv_Proto->mv_light_set_lamp_state(dBottomIntensity,dTopIntensity);
|
||||
g_pMv_Proto->mv_light_set_light();
|
||||
|
||||
#pragma message("We need to determine a good value for the wait")
|
||||
Sleep(60);
|
||||
|
||||
// Only wait if we've been asked to wait, and one of the lamps has changed in this set of changes,
|
||||
// and this is the last lamp
|
||||
if(bWait)
|
||||
{
|
||||
#pragma message("Testing needs to be done to find a good lighting delay, if any")
|
||||
int Time=(int)(g_HSIExt.m_IllumSettleTime * 1000.0);
|
||||
CString TimeStr;
|
||||
TimeStr.Format(_T("HAL_Illumination_SetLampState MaxLevelChange %d so sleeping for %fs\n"),MaxLevelChange,(double)Time/1000.0);
|
||||
HAL_SendDebug(TimeStr);
|
||||
Sleep(Time); // A totally off to totally on switch would give max of 500ms
|
||||
MaxLevelChange=0;
|
||||
}
|
||||
|
||||
return HAL_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_SetLampState_5x8( int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int /*Color*/, double /*Angle*/, bool bWait )
|
||||
{
|
||||
static unsigned short MaxLevelChange = 0;
|
||||
|
||||
if(IsTopLight(nLamp))
|
||||
{
|
||||
g_HSIExt.m_LampOutputState_5x8[nLamp][0] = bBulbStates[0];
|
||||
g_HSIExt.m_LampOutputLevel_5x8[nLamp][0] = Intensities[0];
|
||||
}
|
||||
|
||||
if(IsBottomLight(nLamp))
|
||||
{
|
||||
g_HSIExt.m_LampOutputState_5x8[nLamp][0] = bBulbStates[0];
|
||||
g_HSIExt.m_LampOutputLevel_5x8[nLamp][0] = Intensities[0];
|
||||
}
|
||||
|
||||
if(IsRingLight(nLamp))
|
||||
{
|
||||
for(int Bulb = 0 ; Bulb < TWO_RINGS*EIGHT_SEGS ; Bulb++)
|
||||
{
|
||||
g_HSIExt.m_LampOutputState_5x8[nLamp][Bulb] = bBulbStates[Bulb];
|
||||
g_HSIExt.m_LampOutputLevel_5x8[nLamp][Bulb] = Intensities[Bulb];
|
||||
g_HSIExt.m_LampOutputLevelForMVRing_5x8[PCDRingBulbToMicroVu(Bulb)] = bBulbStates[Bulb]?Intensities[Bulb]:0.0;
|
||||
}
|
||||
}
|
||||
g_pMv_Proto->mv_set_ringlight_data(FIVE_RINGS * EIGHT_SEGS, g_HSIExt.m_LampOutputLevelForMVRing_5x8);
|
||||
|
||||
double dBottomIntensity = (g_HSIExt.m_LampOutputState_5x8[1][0])?g_HSIExt.m_LampOutputLevel_5x8[1][0]:0.0;
|
||||
double dTopIntensity = (g_HSIExt.m_LampOutputState_5x8[0][0])?g_HSIExt.m_LampOutputLevel_5x8[0][0]:0.0;
|
||||
g_pMv_Proto->mv_light_set_lamp_state(dBottomIntensity,dTopIntensity);
|
||||
g_pMv_Proto->mv_light_set_light();
|
||||
|
||||
#pragma message("We need to determine a good value for the wait")
|
||||
Sleep(60);
|
||||
|
||||
// Only wait if we've been asked to wait, and one of the lamps has changed in this set of changes,
|
||||
// and this is the last lamp
|
||||
if(bWait)
|
||||
{
|
||||
#pragma message("Testing needs to be done to find a good lighting delay, if any")
|
||||
int Time=(int)(g_HSIExt.m_IllumSettleTime * 1000.0);
|
||||
CString TimeStr;
|
||||
TimeStr.Format(_T("HAL_Illumination_SetLampState MaxLevelChange %d so sleeping for %fs\n"),MaxLevelChange,(double)Time/1000.0);
|
||||
HAL_SendDebug(TimeStr);
|
||||
Sleep(Time); // A totally off to totally on switch would give max of 500ms
|
||||
MaxLevelChange=0;
|
||||
}
|
||||
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Illumination_SetLampState( int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int /*Color*/, double /*Angle*/, bool bWait )
|
||||
{
|
||||
if ((g_HSIExt.m_NumRings == 2) && (g_HSIExt.m_NumSegs == 8))
|
||||
{
|
||||
HAL_Illumination_SetLampState_2x8(nLamp, bBulbStates, Intensities, 0, 0.0, bWait);
|
||||
}
|
||||
else
|
||||
if ((g_HSIExt.m_NumRings == 5) && (g_HSIExt.m_NumSegs == 8))
|
||||
{
|
||||
HAL_Illumination_SetLampState_5x8(nLamp, bBulbStates, Intensities, 0, 0.0, bWait);
|
||||
}
|
||||
else
|
||||
{
|
||||
HAL_Illumination_SetLampState_5x8(nLamp, bBulbStates, Intensities, 0, 0.0, bWait);
|
||||
};
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_Illumination_Shutdown( )
|
||||
{
|
||||
g_pMv_Proto->mv_light_set_light_off();
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Illumination.h : interface for the Illumination related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool IsTopLight(int nLamp);
|
||||
bool IsBottomLight(int nLamp);
|
||||
bool IsRingLight(int nLamp);
|
||||
int PCDRingBulbToMicroVu(int Lamp);
|
||||
int PCDRingBulbToMicroVu_8x2(int Lamp);
|
||||
int PCDRingBulbToMicroVu_8x5(int Lamp);
|
||||
HAL_STATUS HAL_Illumination_IsSupported(UINT &Type);
|
||||
HAL_STATUS HAL_Illumination_Startup(void);
|
||||
HAL_STATUS HAL_Illumination_GetLampCount(int &nLamps);
|
||||
HAL_STATUS HAL_Illumination_GetLampInfo(int nLamp, TCHAR LampName[HAL_MaxLampNameLength+1],
|
||||
TCHAR LampDescription[HAL_MaxLampDescriptionLength+1],
|
||||
enum HAL_ILLUMINATION_LAMP_LOCATION_TYPE &LocationType,
|
||||
int &LocationAngle,
|
||||
enum HAL_ILLUMINATION_BULB_TYPE &BulbType,
|
||||
enum HAL_ILLUMINATION_BULB_CONTROL_TYPE &BulbControlType,
|
||||
enum HAL_ILLUMINATION_INTENSITY_CONTROL_TYPE &IntensityControlType,
|
||||
int &NumColors, COLORREF *Colors,
|
||||
int &NumRings, int *NumSectors,
|
||||
double &MinAngle, double &MaxAngle,
|
||||
bool &bCanBeCalibrated);
|
||||
HAL_STATUS HAL_Illumination_GetLampState(int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int & Color, double & Angle);
|
||||
HAL_STATUS HAL_Illumination_GetLampState_2x8(int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int & Color, double & Angle);
|
||||
HAL_STATUS HAL_Illumination_GetLampState_5x8(int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int & Color, double & Angle);
|
||||
HAL_STATUS HAL_Illumination_SetLampState(int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int Color, double Angle, bool bWait);
|
||||
HAL_STATUS HAL_Illumination_SetLampState_2x8(int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int Color, double Angle, bool bWait);
|
||||
HAL_STATUS HAL_Illumination_SetLampState_5x8(int nLamp, bool *bBulbStates, double *Intensities,
|
||||
int Color, double Angle, bool bWait);
|
||||
HAL_STATUS HAL_Illumination_Shutdown(void);
|
||||
@@ -0,0 +1,195 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_LaserProbe.cpp : interface for the Laser Probe related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
#include "HAL_Motion.h"
|
||||
#include "HAL_Pendant.h"
|
||||
#include "HAL_LaserProbe.h"
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_IsSupported(UINT &Type)
|
||||
{
|
||||
switch(g_HSIExt.m_ActiveMachineType)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
default:
|
||||
Type = HAL_LP_SUPPORTS_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_SendDebug(_T("HAL_LP_IsSupported %X\n"), Type);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_Startup()
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
UINT Supports = 0;
|
||||
HAL_LP_IsSupported(Supports);
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_LP_Enable(bool bEnable)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(bEnable);
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_IsEnabled(bool &bEnabled)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(bEnabled);
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void HAL_LP_SendQualityFeedback(int SignalQuality)
|
||||
{
|
||||
UINT eventCallbackID=0;
|
||||
TCHAR EventData[HAL_MaxStringLength+1];
|
||||
CString Quality;
|
||||
Quality.Format(_T("%d"), SignalQuality);
|
||||
wcsncpy_s(EventData, _countof(EventData), Quality, HAL_MaxStringLength);
|
||||
|
||||
g_pHSI->Event(HAL_EVENT_FUNCTION, HAL_EVENT_LP_QUALITY, EventData, eventCallbackID);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_GetActiveProbe(int & /*nProbe*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_SetActiveProbe(int nProbe)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
switch(nProbe)
|
||||
{
|
||||
case -1:
|
||||
Status = HAL_LP_Enable(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
if(g_HSIExt.m_OptimetInit)
|
||||
{
|
||||
g_HSIExt.m_ActiveProbe = APT_LASER;
|
||||
SetupPendantSpeeds();
|
||||
|
||||
HAL_LP_LoadLens();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void HAL_LP_LoadLens()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_SetupMeasurePoint(CHALLPMeasurePoint *pParams)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(IsBoardPresent())
|
||||
{
|
||||
if(pParams)
|
||||
{
|
||||
// Probe position
|
||||
g_HSIExt.m_ProbeMeasPointStart[0] = pParams->m_MeasPoint.m_X;
|
||||
g_HSIExt.m_ProbeMeasPointStart[1] = pParams->m_MeasPoint.m_Y;
|
||||
g_HSIExt.m_ProbeMeasPointStart[2] = pParams->m_MeasPoint.m_Z;
|
||||
|
||||
g_HSIExt.m_OptimetGain = pParams->m_Gain;
|
||||
g_HSIExt.m_OptimetFreq = pParams->m_Frequency;
|
||||
g_HSIExt.m_OptimetQualityThreshold = pParams->m_QualityThreshold;
|
||||
|
||||
if(g_HSIExt.m_OptimetMag != pParams->m_AuxLens)
|
||||
{
|
||||
g_HSIExt.m_OptimetMag = pParams->m_AuxLens;
|
||||
HAL_LP_LoadLens();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_DoMeasure(bool /*bWait*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
// Move to probe position
|
||||
Status = HAL_Motion_SetPositionXYZ(HAL_MOTION_AXIS_X|HAL_MOTION_AXIS_Y|HAL_MOTION_AXIS_Z,
|
||||
g_HSIExt.m_ProbeMeasPointStart[0],
|
||||
g_HSIExt.m_ProbeMeasPointStart[1],
|
||||
g_HSIExt.m_ProbeMeasPointStart[2],
|
||||
HAL_MOTION_MOVE_WAIT, 0.0);
|
||||
|
||||
if(g_HSIExt.m_OptimetInit && Status == HAL_STATUS_NORMAL)
|
||||
{
|
||||
// Make sure laser is enabled
|
||||
bool LaserEnabled;
|
||||
Status = HAL_LP_IsEnabled(LaserEnabled);
|
||||
if(!LaserEnabled)
|
||||
Status = HAL_LP_Enable(true);
|
||||
}
|
||||
// Measure single point
|
||||
// /*BOOL result = */FifoReadMeasurement(&g_HSIExt.m_OptimetMeasPt);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_GetMeasureData(CHALMeasPoint &LPData)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
// Return probed point
|
||||
// LPData.m_X = g_HSIExt.m_LaserMeasPoint.m_data[HAL_AXIS_X];
|
||||
// LPData.m_Y = g_HSIExt.m_LaserMeasPoint.m_data[HAL_AXIS_Y];
|
||||
// LPData.m_Z = g_HSIExt.m_LaserMeasPoint.m_data[HAL_AXIS_Z];
|
||||
LPData.m_I = 0;
|
||||
LPData.m_J = 0;
|
||||
LPData.m_K = 1;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_LP_Shutdown()
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(g_HSIExt.m_OptimetInit)
|
||||
{
|
||||
if(IsBoardPresent() && *g_pHSI->Ctrl[Ctrl_LaserProbe])
|
||||
HAL_LP_Enable(false);
|
||||
|
||||
// FifoTerminate();
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_LaserProbe.h : interface for the Laser Probe related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_LP_IsSupported(UINT &Type);
|
||||
HAL_STATUS HAL_LP_Startup(void);
|
||||
HAL_STATUS HAL_LP_Enable(bool bEnable);
|
||||
HAL_STATUS HAL_LP_IsEnabled(bool &bEnabled);
|
||||
void HAL_LP_SendQualityFeedback(int SignalQuality);
|
||||
HAL_STATUS HAL_LP_GetActiveProbe(int &nProbe);
|
||||
HAL_STATUS HAL_LP_SetActiveProbe(int nProbe);
|
||||
void HAL_LP_LoadLens(void);
|
||||
HAL_STATUS HAL_LP_SetupMeasurePoint(CHALLPMeasurePoint *pParams);
|
||||
HAL_STATUS HAL_LP_DoMeasure(bool bWait);
|
||||
HAL_STATUS HAL_LP_GetMeasureData(CHALMeasPoint &LPData);
|
||||
HAL_STATUS HAL_LP_Shutdown(void);
|
||||
@@ -0,0 +1,213 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Motion.cpp : interface for the Motion related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
extern CLogger *g_pLogger;
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
extern CMv_Proto *g_pMv_Proto;
|
||||
//extern HANDLE hEventEStop;
|
||||
|
||||
extern double TimeInMsecs(void);
|
||||
|
||||
//extern HANDLE hMotionInitDoneEvent;
|
||||
static double PositionSampleTime = 3.0;
|
||||
|
||||
//===========================================================================================================
|
||||
void HAL_Motion_HomeStatus(bool &bHomed)
|
||||
{
|
||||
bHomed = g_pMv_Proto->mv_motion_is_homed();
|
||||
return;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_IsSupported(UINT &Type)
|
||||
{
|
||||
static int isDCC = -1;
|
||||
Type = HAL_MOTION_SUPPORTS_MANUAL_CONTROL|HAL_MOTION_SUPPORTS_HOMING | HAL_MOTION_SUPPORTS_DCC_CONTROL;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_Startup( bool /*bHome*/ )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
// g_HSIExt.m_ActiveMachineType = HAL_MACHINE_TYPE_EXCEL;
|
||||
// If the machine type hasn't been selected then exit the initialisation
|
||||
#pragma message("what is the correct return status if no machine type selected")
|
||||
if(g_HSIExt.m_ActiveMachineType == -1)
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetAxisCount( enum HAL_MOTION_AXIS_TYPE AxisType, int &nAxis )
|
||||
{
|
||||
switch(AxisType)
|
||||
{
|
||||
case HAL_MOTION_AXIS_X:
|
||||
case HAL_MOTION_AXIS_Y:
|
||||
case HAL_MOTION_AXIS_Z:
|
||||
nAxis = 1;
|
||||
break;
|
||||
case HAL_MOTION_AXIS_R:
|
||||
default:
|
||||
nAxis = 0;
|
||||
break;
|
||||
}
|
||||
HAL_SendDebug(_T("HAL_Motion_GetAxisCount %d\n"), nAxis);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_SetSpeedXYZ( double dSpeed )
|
||||
{
|
||||
g_pMv_Proto->mv_motion_set_speed_xyz(dSpeed);
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetSpeedXYZ( double &dSpeed )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
g_pMv_Proto->mv_motion_get_speed_xyz(dSpeed);
|
||||
return Status;
|
||||
}
|
||||
|
||||
////===========================================================================================================
|
||||
//HAL_STATUS HAL_Motion_SetSpeedXYZ1( double SpeedX, double SpeedY, double SpeedZ )
|
||||
//{
|
||||
// HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
// long lSpeedX = (long) SpeedX;
|
||||
// long lSpeedY = (long) SpeedY;
|
||||
// long lSpeedZ = (long) SpeedZ;
|
||||
// g_pMv_Proto->mv_motion_set_speed_xyz(lSpeedX, lSpeedY, lSpeedZ);
|
||||
// return Status;
|
||||
//}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetSpeedR( double & /*Speed*/ )
|
||||
{
|
||||
return HAL_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_SetSpeedR( double /*Speed*/ )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetAccelerationXYZ( double &AccelX, double &AccelY, double &AccelZ )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_SetAccelerationXYZ( double AccelX, double AccelY, double AccelZ )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetAccelerationR( double & /*AccelR*/ )
|
||||
{
|
||||
return HAL_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_SetAccelerationR( double /*AccelQ*/ )
|
||||
{
|
||||
return HAL_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetPositionXYZ( UINT /*GetAxisTypes*/, double &PositionX, double &PositionY, double &PositionZ, double &Time)
|
||||
{
|
||||
SSI_STATUS Status = g_pMv_Proto->mv_motion_get_position_xyz(PositionX, PositionY, PositionZ);
|
||||
Time = TimeInMsecs();
|
||||
return (Status == SSI_STATUS_NORMAL)?HAL_STATUS_NORMAL:HAL_STATUS_FAILED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_SetPositionXYZ( UINT /*SetAxisType*/, double PositionX, double PositionY, double PositionZ, enum HAL_MOTION_MOVE_TYPE eType, double /*flyRadius*/)
|
||||
{
|
||||
bool bWait = (eType == HAL_MOTION_MOVE_WAIT)?true:false;
|
||||
SSI_STATUS Status = g_pMv_Proto->mv_motion_set_position_xyz(PositionX, PositionY, PositionZ, bWait);
|
||||
return (Status == SSI_STATUS_NORMAL)?HAL_STATUS_NORMAL:HAL_STATUS_FAILED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetPositionR( UINT /*GetAxisTypes*/, double & /*PositionR*/, double & /*Time*/ )
|
||||
{
|
||||
g_pMv_Proto->mv_motion_get_position_r();
|
||||
return HAL_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetSettleTime( double &SettleTime )
|
||||
{
|
||||
SettleTime=g_HSIExt.m_StageSettleTime;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
////===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetDeadband( double &DeadbandX, double &DeadbandY, double &DeadbandZ, double &DeadbandR )
|
||||
{
|
||||
HAL_STATUS retVal=HAL_STATUS_NOT_SUPPORTED;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
////===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetRefreshDeadband( double &Deadband )
|
||||
{ // not used because the controller will set this automatically
|
||||
HAL_STATUS retVal=HAL_STATUS_NOT_SUPPORTED;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_IsHomed( bool &bHomed )
|
||||
{
|
||||
bHomed = g_pMv_Proto->mv_motion_is_homed();
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetStageLimits(double *StageLimitsMax, double *StageLimitsMin)
|
||||
{
|
||||
// StageLimitsMax[HAL_AXIS_X] =
|
||||
// StageLimitsMin[HAL_AXIS_X] =
|
||||
// StageLimitsMax[HAL_AXIS_Y] = g_pMv_Proto
|
||||
// StageLimitsMin[HAL_AXIS_Y] =
|
||||
// StageLimitsMax[HAL_AXIS_Z] =
|
||||
// StageLimitsMin[HAL_AXIS_Z] =
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_GetMaxSpeed(double *MaxSpeed)
|
||||
{
|
||||
SSI_STATUS Status = SSI_STATUS_ERROR;
|
||||
if (MaxSpeed)
|
||||
Status = g_pMv_Proto->mv_motion_get_3D_max_speed(*MaxSpeed);
|
||||
return (Status == SSI_STATUS_NORMAL) ? HAL_STATUS_NORMAL : HAL_STATUS_FAILED;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
HAL_STATUS HAL_Motion_Shutdown( )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include "Hal.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Motion.h : interface for the Motion related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HAL_Motion_HomeStatus(bool &);
|
||||
HAL_STATUS HAL_Motion_IsSupported(UINT &Type);
|
||||
HAL_STATUS HAL_Motion_Startup(bool bHome);
|
||||
HAL_STATUS HAL_Motion_GetAxisCount(enum HAL_MOTION_AXIS_TYPE AxisType, int &nAxis);
|
||||
HAL_STATUS HAL_Motion_GetSpeedXYZ(double &Speed);
|
||||
HAL_STATUS HAL_Motion_SetSpeedXYZ(double Speed);
|
||||
//HAL_STATUS HAL_Motion_GetSpeedXYZ1(double &SpeedX,double &SpeedY,double &SpeedZ);
|
||||
//HAL_STATUS HAL_Motion_SetSpeedXYZ1(double SpeedX, double SpeedY, double SpeedZ);
|
||||
HAL_STATUS HAL_Motion_GetSpeedR(double &Speed);
|
||||
HAL_STATUS HAL_Motion_SetSpeedR(double Speed);
|
||||
HAL_STATUS HAL_Motion_GetAccelerationXYZ(double &AccelX, double &AccelY, double &AccelZ);
|
||||
HAL_STATUS HAL_Motion_SetAccelerationXYZ(double AccelX, double AccelY, double AccelZ);
|
||||
HAL_STATUS HAL_Motion_GetAccelerationR(double &AccelR);
|
||||
HAL_STATUS HAL_Motion_SetAccelerationR(double AccelQ);
|
||||
HAL_STATUS HAL_Motion_GetPositionXYZ(UINT GetAxisTypes, double &PositionX, double &PositionY,
|
||||
double &PositionZ, double &Time);
|
||||
HAL_STATUS HAL_Motion_SetPositionXYZ(UINT SetAxisType, double PositionX, double PositionY,
|
||||
double PositionZ, enum HAL_MOTION_MOVE_TYPE eType, double flyRadius);
|
||||
HAL_STATUS HAL_Motion_GetPositionR(UINT GetAxisTypes, double &PositionR, double &Time);
|
||||
HAL_STATUS HAL_Motion_SetPositionR(UINT SetAxisTypes, double PositionR,
|
||||
// enum HAL_MOTION_AXIS_R_MOVE_TYPE DirectionType, bool bWait);
|
||||
HAL_STATUS HAL_Motion_GetSettleTime(double &SettleTime);
|
||||
HAL_STATUS HAL_Motion_GetDeadband(double &DeadbandX, double &DeadbandY, double &DeadbandZ, double &DeadbandR);
|
||||
HAL_STATUS HAL_Motion_GetRefreshDeadband(double &Deadband);
|
||||
HAL_STATUS HAL_Motion_IsHomed(bool &bHomed);
|
||||
HAL_STATUS HAL_Motion_GetStageLimits(double *StageLimitsMax, double *StageLimitsMin);
|
||||
HAL_STATUS HAL_Motion_SetStageLimits(bool bStageLimitsEnabled, double *StageLimitsMax, double *StageLimitsMin);
|
||||
HAL_STATUS HAL_Motion_GetMaxSpeed(double *MaxSpeed);
|
||||
HAL_STATUS HAL_Motion_Shutdown(void);
|
||||
@@ -0,0 +1,262 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_MicroVu.cpp
|
||||
//
|
||||
// Copyrights 2004, Wilcox Associates, Inc.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
extern bool g_bOfflineOnly;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Registry entry definitions
|
||||
//
|
||||
|
||||
#define SECTION_HEADER _T("MicroVu")
|
||||
TCHAR SectionHeader[] = SECTION_HEADER;
|
||||
|
||||
INI_INTERFACE_INFO ini_vertex_dcc[] =
|
||||
{
|
||||
// Settle times
|
||||
#pragma message("these settle times are not supported in code")
|
||||
{_T("Illumination_SettleTime"), INI_DOUBLE, &g_HSIExt.m_IllumSettleTime, _T("0.05"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
{_T("Stage_SettleTime"), INI_DOUBLE, &g_HSIExt.m_StageSettleTime, _T("0.1"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
{_T("Zoom_SettleTime"), INI_DOUBLE, &g_HSIExt.m_ZoomSettleTime, _T("0.1"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
{_T("ScaleResolutionX"), INI_DOUBLE, &g_HSIExt.m_ScaleResolutionX, _T("0.0005"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
{_T("ScaleResolutionY"), INI_DOUBLE, &g_HSIExt.m_ScaleResolutionY, _T("0.0005"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
{_T("ScaleResolutionZ"), INI_DOUBLE, &g_HSIExt.m_ScaleResolutionZ, _T("0.0005"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
|
||||
// Probe
|
||||
// {_T("Probe_DebounceTime"), INI_DOUBLE, &g_HSIExt.m_ProbeDebounceTime, _T("0.05"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
// {_T("Probe_DirectionThreshold"), INI_DOUBLE, &g_HSIExt.m_ProbeDirectionThreshold, _T("0.01"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
{_T("Probe_DisableIfNotActive"), INI_BOOL, &g_HSIExt.m_ProbeDisableIfNotActive, _T("TRUE"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
// {_T("Probe_UsePI200"), INI_BOOL, &g_HSIExt.m_ProbeUsePI200, _T("FALSE"), NOFUNCTION, ADMINISTRATOR, ENABLED, ENABLED },
|
||||
|
||||
{NULL, INI_END, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
CHALMicroVuExt::CHALMicroVuExt()
|
||||
{
|
||||
unsigned short Axis = 0;
|
||||
|
||||
m_bIsInitialised = false;
|
||||
m_bIsHomingRequired = true;
|
||||
m_bExtBoardPresent = false;
|
||||
|
||||
g_bOfflineOnly = false;
|
||||
|
||||
m_HomingAxis = HAL_AXIS_NONE;
|
||||
|
||||
m_FineSpeedMode = false;
|
||||
m_ControlMode = HAL_CTRL_MODE_CNC;
|
||||
|
||||
m_ActiveMachineType = HAL_MACHINE_TYPE_UNSELECTED;
|
||||
|
||||
m_IsCalibrated = false;
|
||||
m_InhibitActiveHigh = false;
|
||||
|
||||
m_ActiveProbe = APT_VISION;
|
||||
|
||||
m_HomeManual = false;
|
||||
m_HomeToLimitSwitch = false;
|
||||
m_HomeToResetLine = false;
|
||||
m_HomeSpeedRestrict = true;
|
||||
|
||||
m_DSPLoopTime = 0;
|
||||
|
||||
m_CurrentSpeedXYZ = 0.0;
|
||||
m_CurrentSpeedR = 0.0;
|
||||
|
||||
m_DCCMoveInProgress = false;
|
||||
m_InitInProgress = false;
|
||||
|
||||
m_IllumSettleTime = 0.0;
|
||||
m_StageSettleTime = 0.0;
|
||||
m_ZoomSettleTime = 0.0;
|
||||
|
||||
m_LaserPositionalActiveHigh = true;
|
||||
m_LaserState = false;
|
||||
m_LaserPositionalOutput = HAL_OUTPUT_NONE;
|
||||
|
||||
m_OptimetInit = false;
|
||||
m_OptimetZFollow = false;
|
||||
m_OptimetNomDist = 0.0;
|
||||
m_OptimetScanDensity = 0.0;
|
||||
m_OptimetGain = 20;
|
||||
m_OptimetFreq = 800;
|
||||
m_OptimetQualityThreshold = 70;
|
||||
m_OptimetScanQuality = 0;
|
||||
m_OptimetMag = HAL_LP_AUX_LENS_1_0x;
|
||||
|
||||
m_OpticsGridActiveHigh = true;
|
||||
m_OpticsGridState = false;
|
||||
m_OpticsGridOutput = HAL_OUTPUT_NONE;
|
||||
|
||||
for(Axis = HAL_AXIS_X ; Axis <= HAL_AXIS_Q ; Axis++)
|
||||
{
|
||||
m_ProbePoint[Axis] = 0;
|
||||
m_ProbeDiff[Axis] = 0.0;
|
||||
}
|
||||
|
||||
m_ProbeDCCRetractDist = 0.0;
|
||||
m_ProbeManRetractDist = 0.0;
|
||||
m_ProbeHitExpected = false;
|
||||
m_ProbeDisableIfNotActive = true;
|
||||
m_ProbeEnabled = false;
|
||||
m_ProbeLoading = false;
|
||||
|
||||
m_LampUsePrototypeRing = false;
|
||||
|
||||
memset(m_LampOutputState_5x8, 0, sizeof(m_LampOutputState_5x8));
|
||||
memset(m_LampOutputState_2x8, 0, sizeof(m_LampOutputState_2x8));
|
||||
memset(m_LampOutputLevel_5x8, 0, sizeof(m_LampOutputLevel_5x8));
|
||||
memset(m_LampOutputLevel_2x8, 0, sizeof(m_LampOutputLevel_2x8));
|
||||
|
||||
for(Axis = HAL_AXIS_X ; Axis <= HAL_AXIS_ZOOM ; Axis++)
|
||||
{
|
||||
m_AxisEnabled[Axis] = false;
|
||||
m_AxisVelocity[Axis] = 0.0;
|
||||
m_AxisAcceleration[Axis] = 0.0;
|
||||
m_AxisResolution[Axis] = 0.001;
|
||||
}
|
||||
|
||||
m_Pendant_IsInitialised = false;
|
||||
m_Pendant_EStopInhibitsAmp = true;
|
||||
m_Pendant_FineSpeedFactor = 1.0;
|
||||
|
||||
m_Pendant_Input_EStop = -1;
|
||||
m_Pendant_Status_FineMode = HAL_OUTPUT_NONE;
|
||||
m_Pendant_Status_CtrlDCC = HAL_OUTPUT_NONE;
|
||||
m_Pendant_Status_CtrlTopLight = HAL_OUTPUT_NONE;
|
||||
m_Pendant_Status_CtrlRngLight = HAL_OUTPUT_NONE;
|
||||
m_Pendant_Status_CtrlBtmLight = HAL_OUTPUT_NONE;
|
||||
|
||||
for(Axis = HAL_AXIS_X ; Axis <= HAL_AXIS_Q ; Axis++)
|
||||
{
|
||||
m_Pendant_Enabled[Axis] = false;
|
||||
}
|
||||
|
||||
g_lpfnWAIOpticsStartup = NULL;
|
||||
g_lpfnWALOpticsShutdown = NULL;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
CHALMicroVuExt::~CHALMicroVuExt()
|
||||
{}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
HAL_STATUS CHALMicroVuExt::InitialiseMachineType(HAL_MACHINE_TYPE Type)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
// Set the active machine type and extra machine specific data
|
||||
m_ActiveMachineType=Type;
|
||||
|
||||
switch(Type)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
m_AxisEnabled[HAL_AXIS_X] = true;
|
||||
m_AxisResolution[HAL_AXIS_X] = -0.00005;
|
||||
m_AxisEnabled[HAL_AXIS_Y] = true;
|
||||
m_AxisResolution[HAL_AXIS_Y] = 0.00005;
|
||||
m_AxisEnabled[HAL_AXIS_Z] = true;
|
||||
m_AxisResolution[HAL_AXIS_Z] = -0.00005;
|
||||
|
||||
// Q axis settings
|
||||
m_AxisEnabled[HAL_AXIS_Q] = false;
|
||||
|
||||
// Zoom axis settings
|
||||
m_AxisEnabled[HAL_AXIS_ZOOM] = true;
|
||||
m_AxisVelocity[HAL_AXIS_ZOOM] = 6.0;
|
||||
m_AxisAcceleration[HAL_AXIS_ZOOM] = 45.0;
|
||||
m_AxisResolution[HAL_AXIS_ZOOM] = -0.001;
|
||||
break;
|
||||
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
// Read machine data from CNC.INI
|
||||
if(Status != HAL_STATUS_NORMAL)
|
||||
{
|
||||
if(!g_bOfflineOnly)
|
||||
return Status;
|
||||
else
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
// Global settings
|
||||
m_InhibitActiveHigh = true;
|
||||
|
||||
// Homing settings
|
||||
m_HomeManual = false;
|
||||
m_HomeToLimitSwitch = false;
|
||||
m_HomeToResetLine = true;
|
||||
|
||||
// Positional laser settings
|
||||
m_LaserPositionalActiveHigh = true;
|
||||
m_LaserPositionalOutput = HAL_OUTPUT_EXTIO_2;
|
||||
|
||||
// X axis settings
|
||||
m_AxisEnabled[HAL_AXIS_X] = true;
|
||||
|
||||
// Y axis settings
|
||||
m_AxisEnabled[HAL_AXIS_Y] = true;
|
||||
|
||||
// Z axis settings
|
||||
m_AxisEnabled[HAL_AXIS_Z] = true;
|
||||
|
||||
// Q axis settings
|
||||
m_AxisEnabled[HAL_AXIS_Q] = m_Pendant_Enabled[HAL_AXIS_Q];
|
||||
|
||||
// Zoom axis settings
|
||||
m_AxisEnabled[HAL_AXIS_ZOOM] = true;
|
||||
m_Pendant_Input_EStop = 3;
|
||||
|
||||
#pragma message("removed for lining ease")
|
||||
|
||||
// Check the pendant fine speed factor is valid
|
||||
if(m_Pendant_FineSpeedFactor < 0.01 || m_Pendant_FineSpeedFactor > 1.0)
|
||||
m_Pendant_FineSpeedFactor = 1.0;
|
||||
break;
|
||||
|
||||
case HAL_MACHINE_TYPE_CUSTOM:
|
||||
if(Status != HAL_STATUS_NORMAL)
|
||||
{
|
||||
if(!g_bOfflineOnly)
|
||||
return Status;
|
||||
else
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
// Check the pendant fine speed factor is valid
|
||||
if(m_Pendant_FineSpeedFactor < 0.01 || m_Pendant_FineSpeedFactor > 1.0)
|
||||
m_Pendant_FineSpeedFactor = 1.0;
|
||||
|
||||
break;
|
||||
|
||||
case HAL_MACHINE_TYPE_UNSELECTED:
|
||||
default:
|
||||
// Machine type has not been selected
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS CHALMicroVuExt::ReadConfigFile()
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
#pragma once
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_MicroVu.h
|
||||
//
|
||||
// Copyrights 2010, Wilcox Associates, Inc.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Mv_Proto.h"
|
||||
|
||||
#define _MAX_MV_CMD_STRING 256
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HALMicroVuExt
|
||||
class CHALMicroVuExt;
|
||||
|
||||
// Default timeout for moves - 60 seconds
|
||||
const int MOTION_TIMEOUT = 60000;
|
||||
|
||||
// Default timeout for moves - 10 minutes
|
||||
const int MANUAL_HOME_TIMEOUT = 600000;
|
||||
|
||||
enum HAL_MACHINE_TYPE
|
||||
{
|
||||
HAL_MACHINE_TYPE_UNSELECTED = -1,
|
||||
HAL_MACHINE_TYPE_CUSTOM,
|
||||
HAL_MACHINE_TYPE_EXCEL,
|
||||
HAL_MACHINE_TYPE_VECTRA,
|
||||
HAL_NUM_MACHINE_TYPES
|
||||
};
|
||||
|
||||
enum HAL_AXIS
|
||||
{
|
||||
HAL_AXIS_NONE = -1,
|
||||
HAL_AXIS_X = 0,
|
||||
HAL_AXIS_Y = 1,
|
||||
HAL_AXIS_Z = 2,
|
||||
HAL_AXIS_Q = 3,
|
||||
HAL_AXIS_ZOOM = 4,
|
||||
HAL_AXIS_ALL = 5
|
||||
};
|
||||
|
||||
enum HAL_OUTPUT
|
||||
{
|
||||
HAL_OUTPUT_NONE = -1,
|
||||
HAL_OUTPUT_EXTIO_2,
|
||||
HAL_OUTPUT_EXTIO_3,
|
||||
HAL_OUTPUT_EXTIO_4,
|
||||
HAL_OUTPUT_EXTIO_5,
|
||||
HAL_OUTPUT_EXTIO_6,
|
||||
HAL_OUTPUT_EXTIO_7,
|
||||
HAL_OUTPUT_EXTIO_8,
|
||||
HAL_OUTPUT_EXTIO_9,
|
||||
HAL_OUTPUT_PCIZOOM_0,
|
||||
HAL_OUTPUT_PCIZOOM_1,
|
||||
HAL_OUTPUT_PCIZOOM_2,
|
||||
HAL_OUTPUT_PCIZOOM_3,
|
||||
HAL_OUTPUT_PCIZOOM_4,
|
||||
HAL_OUTPUT_PCIZOOM_5,
|
||||
HAL_OUTPUT_PCIZOOM_6,
|
||||
HAL_OUTPUT_PCIZOOM_7,
|
||||
HAL_OUTPUT_EXPBOARD_0,
|
||||
HAL_OUTPUT_EXPBOARD_1,
|
||||
HAL_OUTPUT_EXPBOARD_2,
|
||||
HAL_OUTPUT_EXPBOARD_3
|
||||
};
|
||||
|
||||
enum HAL_CTRL_MODE
|
||||
{
|
||||
HAL_CTRL_MODE_CNC = 0,
|
||||
HAL_CTRL_MODE_TOPLIGHT = 1,
|
||||
HAL_CTRL_MODE_RNGLIGHT = 2,
|
||||
HAL_CTRL_MODE_BTMLIGHT = 3
|
||||
};
|
||||
|
||||
enum HAL_HOME_STATUS
|
||||
{
|
||||
HAL_HOME_NOT_FOUND = 0,
|
||||
HAL_HOME_FOUND = 1,
|
||||
HAL_HOME_FOUND_WRONG_DIR = 2,
|
||||
HAL_HOME_TOO_FAST = 3
|
||||
};
|
||||
|
||||
enum HAL_HOME_DIRECTION
|
||||
{
|
||||
HAL_HOME_DIR_EITHER = 0,
|
||||
HAL_HOME_DIR_NEG = 1,
|
||||
HAL_HOME_DIR_POS = 2
|
||||
};
|
||||
|
||||
enum HAL_DISPLAY_HOME_MESSAGE_TYPE
|
||||
{
|
||||
HAL_DISPLAY_HOME_MESSAGE_REFMARK = 1,
|
||||
HAL_DISPLAY_HOME_MESSAGE_LIMIT = 2
|
||||
};
|
||||
|
||||
enum ACTIVE_PROBE_TYPE
|
||||
{
|
||||
APT_VISION = 0,
|
||||
APT_CONTACT = 1,
|
||||
APT_LASER = 2
|
||||
};
|
||||
|
||||
const int HAL_OPTICS_HOME_OFFSET = 500;
|
||||
|
||||
bool IsBoardPresent(void);
|
||||
bool IsControllerPresent(void);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HALMicroVuExt Class
|
||||
|
||||
class CHALMicroVuExt
|
||||
{
|
||||
public:
|
||||
|
||||
CHALMicroVuExt();
|
||||
virtual ~CHALMicroVuExt();
|
||||
|
||||
HAL_STATUS InitialiseMachineType(HAL_MACHINE_TYPE Type = HAL_MACHINE_TYPE_EXCEL);
|
||||
HAL_STATUS ReadConfigFile(void);
|
||||
|
||||
public:
|
||||
|
||||
bool m_bIsInitialised;
|
||||
bool m_bIsHomingRequired;
|
||||
bool m_bExtBoardPresent;
|
||||
bool g_bOfflineOnly;
|
||||
|
||||
int m_HomingAxis;
|
||||
|
||||
bool m_FineSpeedMode;
|
||||
enum HAL_CTRL_MODE m_ControlMode;
|
||||
|
||||
// Global flags
|
||||
HAL_MACHINE_TYPE m_ActiveMachineType;
|
||||
bool m_IsCalibrated;
|
||||
bool m_InhibitActiveHigh;
|
||||
bool m_HomeManual;
|
||||
bool m_HomeToLimitSwitch;
|
||||
bool m_HomeToResetLine;
|
||||
bool m_HomeSpeedRestrict;
|
||||
bool m_DCCMoveInProgress;
|
||||
bool m_InitInProgress;
|
||||
unsigned short m_DSPLoopTime;
|
||||
unsigned short m_ErrorState;
|
||||
double m_CurrentSpeedXYZ;
|
||||
double m_CurrentSpeedR;
|
||||
double m_StageSettleTime;
|
||||
double m_ZoomSettleTime;
|
||||
double m_IllumSettleTime;
|
||||
unsigned short m_NumSegs;
|
||||
unsigned short m_NumRings;
|
||||
double m_ScaleResolutionX;
|
||||
double m_ScaleResolutionY;
|
||||
double m_ScaleResolutionZ;
|
||||
|
||||
// Project Grid
|
||||
bool m_OpticsGridActiveHigh;
|
||||
bool m_OpticsGridState;
|
||||
HAL_OUTPUT m_OpticsGridOutput;
|
||||
|
||||
// LaserProbe
|
||||
bool m_LaserPositionalActiveHigh;
|
||||
bool m_LaserState;
|
||||
HAL_OUTPUT m_LaserPositionalOutput;
|
||||
|
||||
bool m_OptimetInit;
|
||||
bool m_OptimetZFollow;
|
||||
// TMeasurement m_OptimetMeasPt;
|
||||
double m_OptimetNomDist;
|
||||
double m_OptimetScanDensity;
|
||||
int m_OptimetGain;
|
||||
int m_OptimetFreq;
|
||||
int m_OptimetMag;
|
||||
int m_OptimetQualityThreshold;
|
||||
int m_OptimetScanQuality;
|
||||
int m_OptimetScanQualityPts;
|
||||
unsigned long m_OptimetNumPts;
|
||||
unsigned long m_OptimetLaserMissedPts;
|
||||
unsigned long m_OptimetAxisMissedPts;
|
||||
|
||||
// TouchProbe
|
||||
bool m_ProbeEnabled;
|
||||
bool m_ProbeLoading;
|
||||
bool m_ProbeDisableIfNotActive;
|
||||
bool m_ProbeHitExpected;
|
||||
// bool m_ProbeUsePI200;
|
||||
long m_ProbePoint[4];
|
||||
double m_ProbeDiff[4];
|
||||
double m_ProbeDCCRetractDist;
|
||||
double m_ProbeManRetractDist;
|
||||
double m_ProbeMeasPointTSpeed;
|
||||
double m_ProbeMeasPointSSpeed;
|
||||
// double m_ProbeDebounceTime;
|
||||
// double m_ProbeDirectionThreshold;
|
||||
double m_ProbeMeasPointStart[3];
|
||||
double m_ProbeMeasPointEnd[3];
|
||||
|
||||
// Lamps
|
||||
bool m_LampUsePrototypeRing;
|
||||
bool m_LampOutputState_2x8[6][TWO_RINGS * EIGHT_SEGS];
|
||||
double m_LampOutputLevel_2x8[6][TWO_RINGS * EIGHT_SEGS];
|
||||
double m_LampOutputLevelForMVRing_2x8[TWO_RINGS * EIGHT_SEGS];
|
||||
bool m_LampOutputState_5x8[6][FIVE_RINGS * EIGHT_SEGS];
|
||||
double m_LampOutputLevel_5x8[6][FIVE_RINGS * EIGHT_SEGS];
|
||||
double m_LampOutputLevelForMVRing_5x8[FIVE_RINGS * EIGHT_SEGS];
|
||||
|
||||
// Axis
|
||||
bool m_AxisEnabled[5];
|
||||
// bool m_AxisStepper[5];
|
||||
// bool m_AxisTTLscale[5];
|
||||
// bool m_AxisReversed[5];
|
||||
// bool m_AxisDigitalPositioner[5];
|
||||
// bool m_AxisLimitActiveHigh[5];
|
||||
// bool m_AxisHomeEnabled[5];
|
||||
// bool m_AxisHomeActiveHigh[5];
|
||||
// bool m_AxisHomeTTL[5];
|
||||
// HAL_HOME_STATUS m_AxisHomeStatus[5];
|
||||
// bool m_AxisSWFenceActive[5];
|
||||
// long m_AxisHomeDirection[5];
|
||||
// long m_AxisRefMarkOffset[5];
|
||||
double m_AxisVelocity[5];
|
||||
double m_AxisAcceleration[5];
|
||||
// double m_AxisJerk[5];
|
||||
// double m_AxisPFactor[5];
|
||||
// double m_AxisDFactor[5];
|
||||
// double m_AxisIFactor[5];
|
||||
// double m_AxisILimit[5];
|
||||
/// double m_AxisContThreshold[5];
|
||||
// long m_AxisMaxCount[5];
|
||||
// long m_AxisMinCount[5];
|
||||
// unsigned short m_AxisGain0[5];
|
||||
// unsigned short m_AxisGain90[5];
|
||||
// unsigned short m_AxisOffset0[5];
|
||||
// unsigned short m_AxisOffset90[5];
|
||||
// unsigned short m_AxisImpedance[5];
|
||||
// unsigned short m_AxisInterpolation[5];
|
||||
double m_AxisResolution[5];
|
||||
// double m_AxisFollowingLimit[5];
|
||||
// double m_AxisDriftVoltage[5];
|
||||
// double m_AxisSWFenceMax[5];
|
||||
// double m_AxisSWFenceMin[5];
|
||||
// int m_AxisBacklashCorrection[5];
|
||||
// double m_AxisHomeVelocity[5];
|
||||
// double m_AxisHomeVelocityFactor[5];
|
||||
// double m_AxisHomeFollowingLimit[5];
|
||||
// double m_AxisHomeFollowingLimitFactor[5];
|
||||
// double m_AxisNearPFactor[5];
|
||||
// double m_AxisNearDFactor[5];
|
||||
// double m_AxisNearIFactor[5];
|
||||
// double m_AxisNearILimit[5];
|
||||
// double m_AxisNearDistance[5];
|
||||
|
||||
ACTIVE_PROBE_TYPE m_ActiveProbe;
|
||||
|
||||
// Pendant
|
||||
bool m_Pendant_IsInitialised;
|
||||
bool m_Pendant_EStopInhibitsAmp;
|
||||
int m_Pendant_Input_EStop;
|
||||
// int m_Pendant_Input_MovePt;
|
||||
// int m_Pendant_Input_ErasePt;
|
||||
// int m_Pendant_Input_Done;
|
||||
// int m_Pendant_Input_CtrlMode;
|
||||
// int m_Pendant_Input_FineMode;
|
||||
// int m_Pendant_Input_ZoomMin;
|
||||
// int m_Pendant_Input_ZoomMax;
|
||||
HAL_OUTPUT m_Pendant_Status_FineMode;
|
||||
HAL_OUTPUT m_Pendant_Status_CtrlDCC;
|
||||
HAL_OUTPUT m_Pendant_Status_CtrlTopLight;
|
||||
HAL_OUTPUT m_Pendant_Status_CtrlRngLight;
|
||||
HAL_OUTPUT m_Pendant_Status_CtrlBtmLight;
|
||||
double m_Pendant_FineSpeedFactor;
|
||||
|
||||
bool m_Pendant_Enabled[4];
|
||||
// bool m_Pendant_Reversed[4];
|
||||
// long m_Pendant_Mirror[4];
|
||||
// long m_Pendant_Centre[4];
|
||||
// long m_Pendant_Max[4];
|
||||
// long m_Pendant_Min[4];
|
||||
// double m_Pendant_Deadband[4];
|
||||
// double m_Pendant_Speed[4];
|
||||
// double m_Pendant_FineSpeed[4][3];
|
||||
// double m_Pendant_Exponential[4];
|
||||
// double m_Pendant_PFactor[4];
|
||||
// double m_Pendant_DFactor[4];
|
||||
// double m_Pendant_IFactor[4];
|
||||
// double m_Pendant_ILimit[4];
|
||||
|
||||
HAL_OPTICS_STARTUP g_lpfnWAIOpticsStartup;
|
||||
HAL_OPTICS_SHUTDOWN g_lpfnWALOpticsShutdown;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "Hal.h"
|
||||
#include "HSI.h"
|
||||
|
||||
extern CMv_Proto *g_pMv_Proto;
|
||||
extern CHALMicroVuExt g_HSIExt; // basic configuration data
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
|
||||
bool IsZoomCell(void)
|
||||
{
|
||||
return ((g_pHSI->Optics.GetSupported() & HAL_OPTICS_SUPPORTS_FIXED_LENS)==0);
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_Startup ( COpticalCalibrationData *OptCalData)
|
||||
{
|
||||
HAL_STATUS retVal=HAL_STATUS_NORMAL;
|
||||
|
||||
//call startup in WAI_OPTICS.DLL
|
||||
if(g_HSIExt.g_lpfnWAIOpticsStartup)
|
||||
retVal=g_HSIExt.g_lpfnWAIOpticsStartup(OptCalData);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_Shutdown ( )
|
||||
{
|
||||
HAL_STATUS retVal=HAL_STATUS_NORMAL;
|
||||
|
||||
//call shutdown in WAI_OPTICS.DLL
|
||||
if(g_HSIExt.g_lpfnWALOpticsShutdown)
|
||||
retVal=g_HSIExt.g_lpfnWALOpticsShutdown();
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_IsLaserEnabled(bool &)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_EnableLaser(bool)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_IsGridEnabled(bool &)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_EnableGrid(bool)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_SetScalePosition(long lScale, bool bWait)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(bWait);
|
||||
|
||||
g_pMv_Proto->mv_optics_set_scale_position(lScale);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_GetScalePosition(long &lScale)
|
||||
{
|
||||
g_pMv_Proto->mv_optics_get_scale_position(lScale);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_GetScaleRange(long &lMaxMagScale,long &lMinMagScale)
|
||||
{
|
||||
g_pMv_Proto->mv_optics_get_scale_range(lMaxMagScale, lMinMagScale);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Optics_IsSupported(unsigned int &IsSupported)
|
||||
{
|
||||
IsSupported = true;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Optics.h : interface for the Optics related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_Optics_IsSupported(UINT &Type);
|
||||
HAL_STATUS HAL_Optics_Startup( COpticalCalibrationData *OptCalData);
|
||||
HAL_STATUS HAL_Optics_GetScalePosition(long &Actual);
|
||||
HAL_STATUS HAL_Optics_SetScalePosition(long TargetScalePosition, bool bWait);
|
||||
HAL_STATUS HAL_Optics_GetScaleRange(long &ScaleMin, long &ScaleMax);
|
||||
HAL_STATUS HAL_Optics_EnableGrid(bool bEnable);
|
||||
HAL_STATUS HAL_Optics_IsGridEnabled(bool &bEnabled);
|
||||
HAL_STATUS HAL_Optics_EnableLaser(bool bEnable);
|
||||
HAL_STATUS HAL_Optics_IsLaserEnabled(bool &bEnabled);
|
||||
HAL_STATUS HAL_Optics_Shutdown(void);
|
||||
@@ -0,0 +1,84 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Pendant.cpp : interface for the Pendant related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
|
||||
extern int GetLampNumberFromLocation(const enum HAL_ILLUMINATION_LAMP_LOCATION_TYPE SearchLocationType);
|
||||
|
||||
|
||||
HAL_STATUS HAL_Pendant_IsSupported(UINT &Type)
|
||||
{
|
||||
Type = HAL_PENDANT_SUPPORTS_JOYSTICK;
|
||||
HAL_SendDebug(_T("HAL_Pendant_IsSupported %X\n"), Type);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
void SetupPendantSpeeds()
|
||||
{
|
||||
if(g_HSIExt.m_ActiveProbe==APT_VISION)
|
||||
{
|
||||
// Now we've changed mag, update the pendant settings so our fine speed is good for current optics
|
||||
double PixelX=-1.0,PixelY=-1.0;
|
||||
if(g_HSIExt.m_IsCalibrated && g_pHSI->Optics.GetMagnification(PixelX,PixelY)==HAL_STATUS_NORMAL)
|
||||
{
|
||||
// Optics calibrated so base XYZ fine speed on pixel/fov size
|
||||
int FOVSizeX, FOVSizeY;
|
||||
g_pHSI->FrameGrabber.GetImageSize(FOVSizeX, FOVSizeY);
|
||||
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_X][APT_VISION] = fabs((PixelX * FOVSizeX) / g_HSIExt.m_AxisVelocity[HAL_AXIS_X]) * g_HSIExt.m_Pendant_FineSpeedFactor;
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Y][APT_VISION] = fabs((PixelX * FOVSizeX) / g_HSIExt.m_AxisVelocity[HAL_AXIS_Y]) * g_HSIExt.m_Pendant_FineSpeedFactor;
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Z][APT_VISION] = fabs((PixelX * FOVSizeX/2) / g_HSIExt.m_AxisVelocity[HAL_AXIS_Z]) * g_HSIExt.m_Pendant_FineSpeedFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Optics not calibrated so use default XYZ fine speed
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_X][APT_VISION] = g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_X][APT_CONTACT] * g_HSIExt.m_Pendant_FineSpeedFactor;
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Y][APT_VISION] = g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Y][APT_CONTACT] * g_HSIExt.m_Pendant_FineSpeedFactor;
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Z][APT_VISION] = g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Z][APT_CONTACT] * g_HSIExt.m_Pendant_FineSpeedFactor;
|
||||
}
|
||||
|
||||
// Use default Q fine speed
|
||||
// g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Q][APT_VISION] = g_HSIExt.m_Pendant_FineSpeed[HAL_AXIS_Q][APT_CONTACT];
|
||||
}
|
||||
}
|
||||
|
||||
HAL_STATUS SetPendantControlMode(enum HAL_CTRL_MODE /*ControlMode*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS CheckPendantLightControl()
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_Pendant_Startup( )
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_Pendant_Enable( bool bEnable )
|
||||
{
|
||||
UNREFERENCED_PARAMETER(bEnable);
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_Pendant_Shutdown( )
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_Pendant.h : interface for the Pendant related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_Pendant_IsSupported(UINT &Type);
|
||||
HAL_STATUS HAL_Pendant_Startup(void);
|
||||
HAL_STATUS HAL_Pendant_Enable(bool bEnable);
|
||||
HAL_STATUS HAL_Pendant_Shutdown(void);
|
||||
HAL_STATUS SetPendantControlMode(enum HAL_CTRL_MODE ControlMode);
|
||||
HAL_STATUS CheckPendantLightControl(void);
|
||||
void SetupPendantSpeeds(void);
|
||||
@@ -0,0 +1,18 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_ToolChanger.cpp : interface for the Tool Changer related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
HAL_STATUS HAL_TC_IsSupported(UINT &Type)
|
||||
{
|
||||
Type = 0;
|
||||
|
||||
HAL_SendDebug(_T("HAL_TC_IsSupported %X\n"), Type);
|
||||
return HAL_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_ToolChanger.h : interface for the Tool Changer related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_TC_IsSupported(UINT &Type);
|
||||
@@ -0,0 +1,257 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_TouchProbe.h : interface for the Touch Probe related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
#include "HAL_Motion.h"
|
||||
#include "HAL_Pendant.h"
|
||||
|
||||
extern CHAL *g_pHSI;
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
|
||||
|
||||
HAL_STATUS HAL_TP_IsSupported(UINT &Type)
|
||||
{
|
||||
Type = HAL_TP_SUPPORTS_TOUCH_TRIGGER;
|
||||
|
||||
HAL_SendDebug(_T("HAL_TP_IsSupported %X\n"), Type);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_Enable(bool bProbeEnable)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(IsBoardPresent())
|
||||
{
|
||||
switch(bProbeEnable)
|
||||
{
|
||||
case true:
|
||||
{
|
||||
// Sometimes we get false hits when enabling, this flag will cause us to ignore them
|
||||
g_HSIExt.m_ProbeLoading = true;
|
||||
|
||||
g_HSIExt.m_ProbeEnabled = true;
|
||||
|
||||
// Sleeping for the debounce time will ensure any false hits are caught before we leave here
|
||||
//Sleep(DWORD(2*g_HSIExt.m_ProbeDebounceTime*1000));
|
||||
|
||||
// Reset the hit expectecd flag
|
||||
g_HSIExt.m_ProbeLoading = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case false:
|
||||
{
|
||||
g_HSIExt.m_ProbeEnabled = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_Startup()
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(IsBoardPresent())
|
||||
{
|
||||
Status = HAL_TP_Enable(true);
|
||||
}
|
||||
else
|
||||
Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_GetActiveProbe(int & /*nProbe*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_SetActiveProbe(int nProbe)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
switch(nProbe)
|
||||
{
|
||||
case -1:
|
||||
if(g_HSIExt.m_ProbeDisableIfNotActive && g_HSIExt.m_ProbeEnabled)
|
||||
Status = HAL_TP_Enable(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_HSIExt.m_ActiveProbe = APT_CONTACT;
|
||||
SetupPendantSpeeds();
|
||||
|
||||
if(!g_HSIExt.m_ProbeEnabled)
|
||||
Status = HAL_TP_Enable(true);
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_SetManualTouchData(CHALTPManualConfig *pParams)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
// Store manual touch probe data
|
||||
if(pParams)
|
||||
g_HSIExt.m_ProbeManRetractDist = pParams->m_Retract;
|
||||
|
||||
// MicroVu only accepts 1 retract distance for all axes and this is in encoder counts
|
||||
// Basing this value on the X axis resolution but this could be better
|
||||
double RetractDist = fabs(g_HSIExt.m_ProbeManRetractDist / g_HSIExt.m_AxisResolution[HAL_AXIS_X]);
|
||||
UNREFERENCED_PARAMETER(RetractDist);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_SetTipOffset(double /*OffsetX*/, double /*OffsetY*/, double /*OffsetZ*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_GetTipOffset(double & /*OffsetX*/, double & /*OffsetY*/, double & /*OffsetZ*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_SetupMeasurePoint(CHALTPMeasurePoint *pParams)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(IsBoardPresent())
|
||||
{
|
||||
if(pParams)
|
||||
{
|
||||
// Probe seek start position
|
||||
g_HSIExt.m_ProbeMeasPointStart[0] = pParams->m_MeasPoint.m_X+pParams->m_MeasPoint.m_I*pParams->m_Approach;
|
||||
g_HSIExt.m_ProbeMeasPointStart[1] = pParams->m_MeasPoint.m_Y+pParams->m_MeasPoint.m_J*pParams->m_Approach;
|
||||
g_HSIExt.m_ProbeMeasPointStart[2] = pParams->m_MeasPoint.m_Z+pParams->m_MeasPoint.m_K*pParams->m_Approach;
|
||||
|
||||
// Probe seek end position
|
||||
g_HSIExt.m_ProbeMeasPointEnd[0] = pParams->m_MeasPoint.m_X-pParams->m_MeasPoint.m_I*pParams->m_Overshoot;
|
||||
g_HSIExt.m_ProbeMeasPointEnd[1] = pParams->m_MeasPoint.m_Y-pParams->m_MeasPoint.m_J*pParams->m_Overshoot;
|
||||
g_HSIExt.m_ProbeMeasPointEnd[2] = pParams->m_MeasPoint.m_Z-pParams->m_MeasPoint.m_K*pParams->m_Overshoot;
|
||||
|
||||
// Probe travel speed
|
||||
g_HSIExt.m_ProbeMeasPointTSpeed = pParams->m_TravelSpeed;
|
||||
|
||||
// Probe seek speed
|
||||
g_HSIExt.m_ProbeMeasPointSSpeed = pParams->m_SeekSpeed;
|
||||
|
||||
// Retract distance
|
||||
g_HSIExt.m_ProbeDCCRetractDist = pParams->m_Retract;
|
||||
}
|
||||
}
|
||||
else
|
||||
Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_DoMeasure(bool /*bWait*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
// Set the probe travel speed
|
||||
HAL_Motion_SetSpeedXYZ(g_HSIExt.m_ProbeMeasPointTSpeed);
|
||||
|
||||
// Set the retract distance
|
||||
double RetractDist = fabs(g_HSIExt.m_ProbeDCCRetractDist / g_HSIExt.m_AxisResolution[HAL_AXIS_X]);
|
||||
UNREFERENCED_PARAMETER(RetractDist);
|
||||
|
||||
// Move to start position
|
||||
Status = HAL_Motion_SetPositionXYZ(HAL_MOTION_AXIS_X|HAL_MOTION_AXIS_Y|HAL_MOTION_AXIS_Z,
|
||||
g_HSIExt.m_ProbeMeasPointStart[0],
|
||||
g_HSIExt.m_ProbeMeasPointStart[1],
|
||||
g_HSIExt.m_ProbeMeasPointStart[2],
|
||||
HAL_MOTION_MOVE_WAIT, 0.0);
|
||||
|
||||
if(Status == HAL_STATUS_NORMAL)
|
||||
{
|
||||
// Set the probe seek speed
|
||||
HAL_Motion_SetSpeedXYZ(g_HSIExt.m_ProbeMeasPointSSpeed);
|
||||
|
||||
// Flag we are expecting a DCC probe hit
|
||||
g_HSIExt.m_ProbeHitExpected = true;
|
||||
|
||||
// Seek move
|
||||
Status = HAL_Motion_SetPositionXYZ(HAL_MOTION_AXIS_X|HAL_MOTION_AXIS_Y|HAL_MOTION_AXIS_Z,
|
||||
g_HSIExt.m_ProbeMeasPointEnd[0],
|
||||
g_HSIExt.m_ProbeMeasPointEnd[1],
|
||||
g_HSIExt.m_ProbeMeasPointEnd[2],
|
||||
HAL_MOTION_MOVE_WAIT, 0.0);
|
||||
|
||||
// Flag we are no longer expecting a DCC probe hit
|
||||
g_HSIExt.m_ProbeHitExpected = false;
|
||||
}
|
||||
|
||||
// Reset to the manual retract distance
|
||||
RetractDist = fabs(g_HSIExt.m_ProbeManRetractDist / g_HSIExt.m_AxisResolution[HAL_AXIS_X]);
|
||||
UNREFERENCED_PARAMETER(RetractDist);
|
||||
|
||||
// Reset the original speed
|
||||
HAL_Motion_SetSpeedXYZ(0.0);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_IsMeasuring(bool & /*bMeasuring*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_GetMeasureData(CHALMeasPoint &TPData)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
double Position[] = {0.0, 0.0, 0.0};
|
||||
double Vector[] = {0.0, 0.0, 0.0};
|
||||
|
||||
// Return probed point
|
||||
TPData.m_X = Position[0];
|
||||
TPData.m_Y = Position[1];
|
||||
TPData.m_Z = Position[2];
|
||||
TPData.m_I = Vector[0];
|
||||
TPData.m_J = Vector[1];
|
||||
TPData.m_K = Vector[2];
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_TP_Shutdown()
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(IsBoardPresent())
|
||||
{
|
||||
// Unregister event callbacks
|
||||
}
|
||||
else
|
||||
Status = HAL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_TouchProbe.h : interface for the Touch Probe related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_TP_IsSupported(UINT &Type);
|
||||
HAL_STATUS HAL_TP_Enable(bool bProbeEnable);
|
||||
HAL_STATUS HAL_TP_Startup(void);
|
||||
HAL_STATUS HAL_TP_GetActiveProbe(int &nProbe);
|
||||
HAL_STATUS HAL_TP_SetActiveProbe(int nProbe);
|
||||
HAL_STATUS HAL_TP_SetManualTouchData(CHALTPManualConfig *pParams);
|
||||
HAL_STATUS HAL_TP_SetTipOffset(double OffsetX, double OffsetY, double OffsetZ);
|
||||
HAL_STATUS HAL_TP_GetTipOffset(double &OffsetX, double &OffsetY, double &OffsetZ);
|
||||
HAL_STATUS HAL_TP_SetupMeasurePoint(CHALTPMeasurePoint *pParams);
|
||||
HAL_STATUS HAL_TP_DoMeasure(bool bWait);
|
||||
HAL_STATUS HAL_TP_IsMeasuring(bool &bMeasuring);
|
||||
HAL_STATUS HAL_TP_GetMeasureData(CHALMeasPoint &TPData);
|
||||
HAL_STATUS HAL_TP_Shutdown(void);
|
||||
@@ -0,0 +1,39 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_VideoProbe.cpp : interface for the Video Probe related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
#include "HAL_Pendant.h"
|
||||
|
||||
extern CHALMicroVuExt g_HSIExt;
|
||||
|
||||
|
||||
HAL_STATUS HAL_VP_GetActiveProbe(int &/*nProbe*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
HAL_STATUS HAL_VP_SetActiveProbe(int nProbe)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
switch(nProbe)
|
||||
{
|
||||
case -1:
|
||||
break;
|
||||
|
||||
default:
|
||||
g_HSIExt.m_ActiveProbe = APT_VISION;
|
||||
SetupPendantSpeeds();
|
||||
break;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HAL_VideoProbe.h : interface for the Video Probe related functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
HAL_STATUS HAL_VP_GetActiveProbe(int &nProbe);
|
||||
HAL_STATUS HAL_VP_SetActiveProbe(int nProbe);
|
||||
@@ -0,0 +1,764 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HSI.cpp : Implementation of the MicroVu HSI supporting:
|
||||
// - MicroVu based systems
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "..\include\resource.h"
|
||||
|
||||
#include "HAL.h"
|
||||
#include "HSI.h"
|
||||
|
||||
#include "FGLoad.h"
|
||||
|
||||
#include "HAL_EventHandler.H"
|
||||
#include "HAL_Fixture.H"
|
||||
#include "HAL_Illumination.H"
|
||||
#include "HAL_LaserProbe.H"
|
||||
#include "HAL_Motion.H"
|
||||
#include "HAL_Optics.H"
|
||||
#include "HAL_Pendant.H"
|
||||
#include "HAL_ToolChanger.H"
|
||||
#include "HAL_TouchProbe.H"
|
||||
#include "HAL_VideoProbe.H"
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
// #define _TEST_MOTION_ONLY
|
||||
|
||||
#ifdef _MERGE_PROXYSTUB
|
||||
extern "C" HINSTANCE hProxyDll;
|
||||
#endif
|
||||
|
||||
extern TCHAR SectionHeader[];
|
||||
|
||||
//extern CMachineInterface *m_pMachine;
|
||||
//HANDLE hEventEStop = NULL;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Interface version used in GetVersion()
|
||||
//
|
||||
#define VERSION _T("1.0")
|
||||
//CMachineInterface *m_pMachine = NULL;
|
||||
//CPCDpart_program *m_pPartProgram = NULL;
|
||||
CWnd *pMessageBox;
|
||||
CHAL *g_pHSI = NULL;
|
||||
HINSTANCE VPlib = NULL;
|
||||
HINSTANCE FGlib = NULL;
|
||||
CHALMicroVuExt g_HSIExt; // basic configuration data
|
||||
CMv_Proto *g_pMv_Proto = NULL;
|
||||
CLogger *pLogger;
|
||||
|
||||
long g_lFramegrabberType = -1l;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define MACHINE_ID_STRING (m_pMachine ? m_pMachine->m_id : _T("<undefined>"))
|
||||
static AFX_EXTENSION_MODULE HSIDLL = { NULL, NULL };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
TRACE0("Hsi_MicroVu.DLL Initializing!\n");
|
||||
|
||||
// Extension DLL one-time initialization
|
||||
AfxInitExtensionModule(HSIDLL, hInstance);
|
||||
|
||||
// Insert this DLL into the resource chain
|
||||
new CDynLinkLibrary(HSIDLL);
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
TRACE0("Hsi_MicroVu.DLL Terminating!\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// All required hardware objects
|
||||
extern "C" __declspec(dllexport) HAL_STATUS HAL_GetVersion(TCHAR *Version)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
CString VersionStr;
|
||||
#ifdef _DEBUG
|
||||
|
||||
VersionStr= _T("HSI_MicroVu.dll ") _T(__DATE__) _T(" debug version ") VERSION;
|
||||
#else
|
||||
VersionStr= _T("HSI_MicroVu.dll ") _T(__DATE__) _T(" release version ") VERSION;
|
||||
#endif
|
||||
|
||||
wcsncpy_s(Version, HAL_MaxStringLength+1, VersionStr, HAL_MaxStringLength);
|
||||
HAL_SendDebug(_T("HAL_GetVersion %s\n"), VersionStr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//extern "C" __declspec(dllexport) HSI_STATUS HAL_Shutdown()
|
||||
HAL_STATUS HAL_Shutdown()
|
||||
{
|
||||
if (g_pMv_Proto)
|
||||
{
|
||||
g_pMv_Proto->Exit_MvUsb();
|
||||
delete g_pMv_Proto;
|
||||
g_pMv_Proto = NULL;
|
||||
};
|
||||
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
extern "C" __declspec(dllexport) HAL_STATUS HAL_GetInterfaceVersion(long &APIVersionMajor, long &APIVersionMinor)
|
||||
{
|
||||
APIVersionMajor=HAL_APIVersionMajor;
|
||||
APIVersionMinor=HAL_APIVersionMinor;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Start up checks if the m_TestMotion is ON. We will load the needed only.
|
||||
//
|
||||
extern "C" __declspec(dllexport) HAL_STATUS HAL_Startup(HWND hWnd, CHAL *pHAL, bool bOfflineOnly, long lFrameGrabberType)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
g_HSIExt.g_bOfflineOnly = bOfflineOnly;
|
||||
|
||||
// m_pMachine = global_machine_active;
|
||||
// m_pPartProgram = m_pMachine->m_pPartProgram;
|
||||
|
||||
// If no HAL then quit
|
||||
if(!pHAL)
|
||||
return HAL_STATUS_FAILED;
|
||||
|
||||
// Set global HAL object
|
||||
g_pHSI = pHAL;
|
||||
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
g_HSIExt.m_bIsInitialised = false;
|
||||
|
||||
g_pMv_Proto = new CMv_Proto(); // Create the MicroVu object
|
||||
SSI_STATUS Status = g_pMv_Proto->Init_MvUsb();
|
||||
if (Status != SSI_STATUS_NORMAL)
|
||||
{
|
||||
#pragma message("Add USB specific HAL event message here")
|
||||
return HAL_STATUS_FAILED;
|
||||
}
|
||||
|
||||
Status = g_pMv_Proto->mv_motion_startup(g_HSIExt.m_ScaleResolutionX, g_HSIExt.m_ScaleResolutionY, g_HSIExt.m_ScaleResolutionZ);
|
||||
if (Status != SSI_STATUS_NORMAL)
|
||||
{
|
||||
#pragma message("Add USB specific HAL event message here")
|
||||
return HAL_STATUS_FAILED;
|
||||
}
|
||||
|
||||
g_HSIExt.m_bIsInitialised = true;
|
||||
}
|
||||
|
||||
// Initialise the HAL function addresses
|
||||
if(g_pHSI)
|
||||
{
|
||||
// Set exported HAL function addresses
|
||||
g_pHSI->Shutdown = (HAL_SHUTDOWN) HAL_Shutdown;
|
||||
g_pHSI->GetVersion = (HAL_GET_VERSION) ((HAL_GET_VERSION) HAL_GetVersion);
|
||||
g_pHSI->GetInterfaceVersion = (HAL_GET_INTERFACE_VERSION) HAL_GetInterfaceVersion;
|
||||
g_pHSI->GetMachineCount = (HAL_GET_MACHINE_COUNT) HAL_GetMachineCount;
|
||||
g_pHSI->GetMachineInfo = (HAL_GET_MACHINE_INFO) HAL_GetMachineInfo;
|
||||
g_pHSI->SetActiveMachine = (HAL_SET_ACTIVE_MACHINE) HAL_SetActiveMachine;
|
||||
g_pHSI->GetActiveMachine = (HAL_GET_ACTIVE_MACHINE) HAL_GetActiveMachine;
|
||||
g_pHSI->SetLocale = (HAL_SET_LOCALE) HAL_SetLocale;
|
||||
g_pHSI->SetRegistryRootKey = (HAL_SET_REGISTRY_ROOT_KEY) HAL_SetRegistryRootKey;
|
||||
g_pHSI->PreSetupDialog = (HAL_PRE_SETUP_DIALOG) HAL_PreSetupDialog;
|
||||
g_pHSI->PostSetupDialog = (HAL_POST_SETUP_DIALOG) HAL_PostSetupDialog;
|
||||
g_pHSI->EventResponse = (HAL_EVENT_RESPONSE) HAL_EventResponse;
|
||||
g_pHSI->GetCustomMessage = (HAL_GET_CUSTOM_MESSAGE) HAL_GetCustomMessage;
|
||||
//g_pHSI->GetTemperatureSensor = (HAL_GET_TEMPERATURE_SENSOR) HAL_GetTemperatureSensor;
|
||||
//g_pHSI->GetTemperatureSensorCount = (HAL_GET_TEMPERATURE_SENSOR_COUNT) HAL_GetTemperatureSensorCount;
|
||||
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
g_pHSI->Calibrate = (HAL_CALIBRATE) HAL_Calibrate;
|
||||
g_pHSI->Notify = (HAL_NOTIFY) HAL_Notify;
|
||||
g_pHSI->GetCustomCalibrationTypeInfo = (HAL_GET_CUSTOM_CALIBRATION_TYPE_INFO) HAL_GetCustomCalibrationTypeInfo;
|
||||
}
|
||||
|
||||
// Map the supported function addresses for the MSI
|
||||
HAL_MapSupportedFunctions(pHAL, hWnd, bOfflineOnly);
|
||||
|
||||
// #ifndef _TEST_MOTION_ONLY
|
||||
|
||||
HAL_SendDebug(_T("Load VideoProbe library\n"));
|
||||
VPlib = ::AfxLoadLibrary(_T("WAI_VideoProbe.dll"));
|
||||
if(VPlib)
|
||||
{
|
||||
g_pHSI->VideoProbe.IsSupported = (HAL_VP_IS_SUPPORTED) ::GetProcAddress(VPlib, "HAL_VP_IsSupported");
|
||||
g_pHSI->VideoProbe.IsToolSupported = (HAL_VP_IS_TOOL_SUPPORTED) ::GetProcAddress(VPlib, "HAL_VP_IsToolSupported");
|
||||
g_pHSI->VideoProbe.GetProbeCount = (HAL_VP_GET_PROBE_COUNT) ::GetProcAddress(VPlib, "HAL_VP_GetProbeCount");
|
||||
|
||||
g_pHSI->VideoProbe.GetActiveProbe = (HAL_VP_GET_ACTIVE_PROBE) HAL_VP_GetActiveProbe;
|
||||
g_pHSI->VideoProbe.SetActiveProbe = (HAL_VP_SET_ACTIVE_PROBE) HAL_VP_SetActiveProbe;
|
||||
|
||||
if(g_pHSI->VideoProbe.IsActive())
|
||||
{
|
||||
if(!bOfflineOnly)
|
||||
{
|
||||
g_pHSI->VideoProbe.DoMeasure = (HAL_VP_DO_MEASURE) ::GetProcAddress(VPlib, "HAL_VP_DoMeasure");
|
||||
g_pHSI->VideoProbe.Enable = (HAL_VP_ENABLE) ::GetProcAddress(VPlib, "HAL_VP_Enable");
|
||||
g_pHSI->VideoProbe.IsEnabled = (HAL_VP_IS_ENABLED) ::GetProcAddress(VPlib, "HAL_VP_IsEnabled");
|
||||
g_pHSI->VideoProbe.GetToolCustomTypeInfo = (HAL_VP_GET_TOOL_CUSTOM_TYPE_INFO) ::GetProcAddress(VPlib, "HAL_VP_GetToolCustomTypeInfo");
|
||||
g_pHSI->VideoProbe.GetMeasureData = (HAL_VP_GET_MEASURE_DATA) ::GetProcAddress(VPlib, "HAL_VP_GetMeasureData");
|
||||
g_pHSI->VideoProbe.GetParameterCount = (HAL_VP_GET_PARAMETER_COUNT) ::GetProcAddress(VPlib, "HAL_VP_GetParameterCount");
|
||||
g_pHSI->VideoProbe.GetParameterInfo = (HAL_VP_GET_PARAMETER_INFO) ::GetProcAddress(VPlib, "HAL_VP_GetParameterInfo");
|
||||
g_pHSI->VideoProbe.GetTipOffset = (HAL_VP_GET_TIP_OFFSET) ::GetProcAddress(VPlib, "HAL_VP_GetTipOffset");
|
||||
g_pHSI->VideoProbe.IsMeasuring = (HAL_VP_IS_MEASURING) ::GetProcAddress(VPlib, "HAL_VP_IsMeasuring");
|
||||
g_pHSI->VideoProbe.SetTipOffset = (HAL_VP_SET_TIP_OFFSET) ::GetProcAddress(VPlib, "HAL_VP_SetTipOffset");
|
||||
g_pHSI->VideoProbe.SetupMeasureEdgeArc = (HAL_VP_SETUP_MEASURE_EDGE_ARC) ::GetProcAddress(VPlib, "HAL_VP_SetupMeasureEdgeArc");
|
||||
g_pHSI->VideoProbe.SetupMeasureEdgeBlob = (HAL_VP_SETUP_MEASURE_EDGE_BLOB) ::GetProcAddress(VPlib, "HAL_VP_SetupMeasureEdgeBlob");
|
||||
g_pHSI->VideoProbe.SetupMeasureEdgeLine = (HAL_VP_SETUP_MEASURE_EDGE_LINE) ::GetProcAddress(VPlib, "HAL_VP_SetupMeasureEdgeLine");
|
||||
g_pHSI->VideoProbe.SetupMeasureEdgePoint = (HAL_VP_SETUP_MEASURE_EDGE_POINT) ::GetProcAddress(VPlib, "HAL_VP_SetupMeasureEdgePoint");
|
||||
g_pHSI->VideoProbe.SetupMeasureEdgeTracer = (HAL_VP_SETUP_MEASURE_EDGE_TRACER) ::GetProcAddress(VPlib, "HAL_VP_SetupMeasureEdgeTrace");
|
||||
g_pHSI->VideoProbe.SetupMeasureSurfacePoint = (HAL_VP_SETUP_MEASURE_SURFACE_POINT) ::GetProcAddress(VPlib, "HAL_VP_SetupMeasureSurfacePoint");
|
||||
g_pHSI->VideoProbe.SetupImage = (HAL_VP_SETUP_IMAGE) ::GetProcAddress(VPlib, "HAL_VP_SetupImage"); //Task104403-- 501919 - 2 - Measure features and pass back points, putting them in the appropriate auto feature—Subtask: MSI grabs the image and pass it to the videoprobe
|
||||
g_pHSI->VideoProbe.Shutdown = (HAL_VP_SHUTDOWN) ::GetProcAddress(VPlib, "HAL_VP_ShutDown");
|
||||
g_pHSI->VideoProbe.Startup = (HAL_VP_STARTUP) ::GetProcAddress(VPlib, "HAL_VP_Startup");
|
||||
|
||||
//PVD-29: Remove MSIGlobal from the VideoProbe.dll.
|
||||
g_pHSI->VideoProbe.HelperSetupFocusData = (HAL_VP_HELPER_SETUP_FOCUS_DATA) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetupFocusData");
|
||||
g_pHSI->VideoProbe.HelperSetupOpticsSupports = (HAL_VP_HELPER_SETUP_OPTICS_SUPPORTS) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetupOpticsSupports");
|
||||
g_pHSI->VideoProbe.HelperSetupFrameGrabberData = (HAL_VP_HELPER_SETUP_FRAME_GRABBER_DATA) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetupFrameGrabberData");
|
||||
g_pHSI->VideoProbe.HelperSetupProbeData = (HAL_VP_HELPER_SETUP_PROBE_DATA) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetupProbeData");
|
||||
g_pHSI->VideoProbe.HelperSetCameraRotationalAngle = (HAL_VP_HELPER_SET_CAMERA_ROTATIONAL_ANGLE) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetCameraRotationalAngle");
|
||||
g_pHSI->VideoProbe.HelperSetOpticalFocalCenter = (HAL_VP_HELPER_SET_OPTICAL_FOCAL_CENTER) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetOpticalFocalCenter");
|
||||
g_pHSI->VideoProbe.HelperSetOpticsCurrPixelSize = (HAL_VP_HELPER_SET_OPTICS_CURR_PIXEL_SIZE) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetOpticsCurrPixelSize");
|
||||
g_pHSI->VideoProbe.HelperSetGlobalUnitInMM = (HAL_VP_HELPER_SET_GLOBAL_UNIT_IN_MM) ::GetProcAddress(VPlib, "HAL_VP_Helper_SetGlobalUnitInMM");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HAL_SendDebug(_T("Load VideoProbe library failed\n"));
|
||||
CString Message;
|
||||
Message.LoadString(IDS_NC_FILE_NOT_FOUND);
|
||||
Message = _T("WAI_VideoProbe.dll - ") + Message;
|
||||
TCHAR Msg[HAL_MaxStringLength+1];
|
||||
wcsncpy_s(Msg, HAL_MaxStringLength+1, Message, HAL_MaxStringLength);
|
||||
UINT EventCallbackID = 0;
|
||||
g_pHSI->Event(HAL_EVENT_ERROR, 0, Msg, EventCallbackID);
|
||||
return HAL_STATUS_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
// Set exported HAL FRAME GRABBER function addresses
|
||||
if(g_pHSI->FrameGrabber.m_bEnabled)
|
||||
{
|
||||
// Load FrameGrabber library
|
||||
HAL_SendDebug(_T("Load FrameGrabber library\n"));
|
||||
CString DLLsFoundWithFailedLoad;
|
||||
CString DefFileName;
|
||||
BOOL bDefWAIFGFileFound=FALSE;
|
||||
BOOL bWAIVenderFGFileFound=FALSE;
|
||||
CString LoadingStatus;
|
||||
bool bLoadedAndProbed = LoadFramegrabberDLL(lFrameGrabberType, FGlib, DLLsFoundWithFailedLoad, bDefWAIFGFileFound, bWAIVenderFGFileFound, LoadingStatus);
|
||||
LoadingStatus += _T("\n");
|
||||
// debug.Send(LoadingStatus);
|
||||
|
||||
if(bLoadedAndProbed)
|
||||
{
|
||||
// Get startup address and call startup routine
|
||||
g_pHSI->FrameGrabber.IsSupported = (HAL_FG_IS_SUPPORTED) ::GetProcAddress(FGlib, "HAL_FG_IsSupported");
|
||||
|
||||
if (g_pHSI->FrameGrabber.IsActive())
|
||||
{
|
||||
// HAL FRAMEGRABBER is supported
|
||||
g_pHSI->FrameGrabber.GetCameraCount = (HAL_FG_GET_CAMERA_COUNT) ::GetProcAddress(FGlib, "HAL_FG_GetCameraCount");
|
||||
g_pHSI->FrameGrabber.GetImageSize = (HAL_FG_GET_IMAGE_SIZE) ::GetProcAddress(FGlib, "HAL_FG_GetImageSize");
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
g_pHSI->FrameGrabber.Startup = (HAL_FG_STARTUP) ::GetProcAddress(FGlib, "HAL_FG_Startup");
|
||||
g_pHSI->FrameGrabber.ProbeDevice = (HAL_FG_PROBE_DEVICE) ::GetProcAddress(FGlib, "HAL_FG_ProbeDevice");
|
||||
g_pHSI->FrameGrabber.IsCameraPresent = (HAL_FG_IS_CAMERA_PRESENT) ::GetProcAddress(FGlib, "HAL_FG_IsCameraPresent");
|
||||
g_pHSI->FrameGrabber.SetActiveCamera = (HAL_FG_SET_ACTIVE_CAMERA) ::GetProcAddress(FGlib, "HAL_FG_SetActiveCamera");
|
||||
g_pHSI->FrameGrabber.StartLiveVideo = (HAL_FG_START_LIVE_VIDEO) ::GetProcAddress(FGlib, "HAL_FG_StartLiveVideo");
|
||||
g_pHSI->FrameGrabber.StopLiveVideo = (HAL_FG_STOP_LIVE_VIDEO) ::GetProcAddress(FGlib, "HAL_FG_StopLiveVideo");
|
||||
g_pHSI->FrameGrabber.DoGreyscaleSnapshot = (HAL_FG_DO_GREYSCALE_SNAPSHOT) ::GetProcAddress(FGlib, "HAL_FG_DoGreyscaleSnapshot");
|
||||
g_pHSI->FrameGrabber.GetGreyscaleSnapshotImage = (HAL_FG_GET_GREYSCALE_SNAPSHOT_IMAGE) ::GetProcAddress(FGlib, "HAL_FG_GetGreyscaleSnapshotImage");
|
||||
g_pHSI->FrameGrabber.DoColorSnapshot = (HAL_FG_DO_COLOR_SNAPSHOT) ::GetProcAddress(FGlib, "HAL_FG_DoColorSnapshot");
|
||||
g_pHSI->FrameGrabber.GetColorSnapshotPixel = (HAL_FG_GET_COLOR_SNAPSHOT_PIXEL) ::GetProcAddress(FGlib, "HAL_FG_GetColorSnapshotPixel");
|
||||
g_pHSI->FrameGrabber.StartUpdateOverlay = (HAL_FG_START_UPDATE_OVERLAY) ::GetProcAddress(FGlib, "HAL_FG_StartUpdateOverlay");
|
||||
g_pHSI->FrameGrabber.GetOverlayDC = (HAL_FG_GET_OVERLAY_DC) ::GetProcAddress(FGlib, "HAL_FG_GetOverlayDC");
|
||||
g_pHSI->FrameGrabber.DrawOverlayDot = (HAL_FG_DRAW_OVERLAY_DOT) ::GetProcAddress(FGlib, "HAL_FG_DrawOverlayDot");
|
||||
g_pHSI->FrameGrabber.ClearOverlay = (HAL_FG_CLEAR_OVERLAY) ::GetProcAddress(FGlib, "HAL_FG_ClearOverlay");
|
||||
g_pHSI->FrameGrabber.EndUpdateOverlay = (HAL_FG_END_UPDATE_OVERLAY) ::GetProcAddress(FGlib, "HAL_FG_EndUpdateOverlay");
|
||||
g_pHSI->FrameGrabber.GetTransparentColor = (HAL_FG_GET_TRANSPARENT_COLOR) ::GetProcAddress(FGlib, "HAL_FG_GetTransparentColor");
|
||||
g_pHSI->FrameGrabber.GetFieldonetime = (HAL_FG_GET_FIELDONETIME) ::GetProcAddress(FGlib, "HAL_FG_GetFieldonetime");
|
||||
g_pHSI->FrameGrabber.GetFieldtwotime = (HAL_FG_GET_FIELDTWOTIME) ::GetProcAddress(FGlib, "HAL_FG_GetFieldtwotime");
|
||||
g_pHSI->FrameGrabber.SetGrabHook = (HAL_FG_SET_GRAB_HOOK) ::GetProcAddress(FGlib, "HAL_FG_SetGrabHook");
|
||||
g_pHSI->FrameGrabber.ClearGrabHook = (HAL_FG_CLEAR_GRAB_HOOK) ::GetProcAddress(FGlib, "HAL_FG_ClearGrabHook");
|
||||
g_pHSI->FrameGrabber.Shutdown = (HAL_FG_SHUTDOWN) ::GetProcAddress(FGlib, "HAL_FG_Shutdown");
|
||||
g_pHSI->FrameGrabber.StartOfFocus = (HAL_FG_STARTOFFOCUS) ::GetProcAddress(FGlib, "HAL_FG_StartOfFocus");
|
||||
g_pHSI->FrameGrabber.EndOfFocus = (HAL_FG_ENDOFFOCUS) ::GetProcAddress(FGlib, "HAL_FG_EndOfFocus");
|
||||
g_pHSI->FrameGrabber.GreyscaleRGB = (HAL_FG_GREYSCALE_RGB) ::GetProcAddress(FGlib, "HAL_FG_GreyscaleRGB");
|
||||
g_pHSI->FrameGrabber.IsCameraColor = (HAL_FG_IS_CAMERA_COLOR) ::GetProcAddress(FGlib, "HAL_FG_IsCameraColor"); //109287
|
||||
g_pHSI->FrameGrabber.SetTransparency = (HAL_FG_SET_TRANSPARENCY) ::GetProcAddress(FGlib, "HAL_FG_SetTransparency");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!bOfflineOnly)
|
||||
{
|
||||
CString Message;
|
||||
if(bDefWAIFGFileFound == TRUE || bWAIVenderFGFileFound == TRUE)
|
||||
{
|
||||
Message.LoadString(IDS_FRAME_GRABBER_MISSING_DEPENDENT_DLL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message.LoadString(IDS_NC_FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
Message = DLLsFoundWithFailedLoad + _T(" - ") + Message;
|
||||
TCHAR Msg[HAL_MaxStringLength+1];
|
||||
wcsncpy_s(Msg, HAL_MaxStringLength+1, Message, HAL_MaxStringLength);
|
||||
UINT EventCallbackID = 0;
|
||||
g_pHSI->Event(HAL_EVENT_FUNCTION, HAL_EVENT_DISPLAY_OK_MESSAGE, Msg, EventCallbackID);
|
||||
return HAL_STATUS_FILE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// debug.Send(_T("Framegrabber not active - Load FrameGrabber library skipped\n"));
|
||||
}
|
||||
|
||||
// #endif
|
||||
|
||||
}
|
||||
else
|
||||
return HAL_STATUS_FAILED;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_MapSupportedFunctions(CHAL *pHAL, HWND hWnd, bool bOfflineOnly)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
pHAL->Illumination.IsSupported = (HAL_ILLUMINATION_IS_SUPPORTED) HAL_Illumination_IsSupported;
|
||||
if(pHAL->Illumination.IsActive(true))
|
||||
{
|
||||
pHAL->Illumination.GetLampCount = (HAL_ILLUMINATION_GET_LAMP_COUNT) HAL_Illumination_GetLampCount;
|
||||
pHAL->Illumination.GetLampInfo = (HAL_ILLUMINATION_GET_LAMP_INFO) HAL_Illumination_GetLampInfo;
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
pHAL->Illumination.Startup = (HAL_ILLUMINATION_STARTUP) HAL_Illumination_Startup;
|
||||
pHAL->Illumination.GetLampState = (HAL_ILLUMINATION_GET_LAMP_STATE) HAL_Illumination_GetLampState;
|
||||
pHAL->Illumination.SetLampState = (HAL_ILLUMINATION_SET_LAMP_STATE) HAL_Illumination_SetLampState;
|
||||
pHAL->Illumination.Shutdown = (HAL_ILLUMINATION_SHUTDOWN) HAL_Illumination_Shutdown;
|
||||
}
|
||||
}
|
||||
pHAL->Motion.IsSupported = (HAL_MOTION_IS_SUPPORTED) HAL_Motion_IsSupported;
|
||||
if(pHAL->Motion.IsActive(true))
|
||||
{
|
||||
pHAL->Motion.GetAxisCount = (HAL_MOTION_GET_AXIS_COUNT) HAL_Motion_GetAxisCount;
|
||||
pHAL->Motion.GetSpeedXYZ = (HAL_MOTION_GET_SPEED_XYZ) HAL_Motion_GetSpeedXYZ;
|
||||
pHAL->Motion.GetSpeedR = (HAL_MOTION_GET_SPEED_R) HAL_Motion_GetSpeedR;
|
||||
pHAL->Motion.GetSettleTime = (HAL_MOTION_GET_SETTLE_TIME) HAL_Motion_GetSettleTime;
|
||||
pHAL->Motion.GetDeadband = (HAL_MOTION_GET_DEADBAND) HAL_Motion_GetDeadband;
|
||||
pHAL->Motion.GetRefreshDeadband = (HAL_MOTION_GET_REFRESH_DEADBAND) HAL_Motion_GetRefreshDeadband;
|
||||
pHAL->Motion.GetStageLimits = (HAL_MOTION_GET_STAGE_LIMITS) HAL_Motion_GetStageLimits;
|
||||
pHAL->Motion.SetStageLimits = (HAL_MOTION_SET_STAGE_LIMITS) HAL_Motion_SetStageLimits;
|
||||
pHAL->Motion.GetMaxSpeed = (HAL_MOTION_GET_MAX_SPEED) HAL_Motion_GetMaxSpeed;
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
pHAL->Motion.Startup = (HAL_MOTION_STARTUP) HAL_Motion_Startup;
|
||||
pHAL->Motion.SetSpeedXYZ = (HAL_MOTION_SET_SPEED_XYZ) HAL_Motion_SetSpeedXYZ;
|
||||
pHAL->Motion.SetSpeedR = (HAL_MOTION_SET_SPEED_R) HAL_Motion_SetSpeedR;
|
||||
pHAL->Motion.SetAccelerationXYZ = (HAL_MOTION_SET_ACCELERATION_XYZ) HAL_Motion_SetAccelerationXYZ;
|
||||
pHAL->Motion.SetAccelerationR = (HAL_MOTION_SET_ACCELERATION_R) HAL_Motion_SetAccelerationR;
|
||||
pHAL->Motion.GetAccelerationXYZ = (HAL_MOTION_GET_ACCELERATION_XYZ) HAL_Motion_GetAccelerationXYZ;
|
||||
pHAL->Motion.GetAccelerationR = (HAL_MOTION_GET_ACCELERATION_R) HAL_Motion_GetAccelerationR;
|
||||
pHAL->Motion.GetPositionXYZ = (HAL_MOTION_GET_POSITION_XYZ) HAL_Motion_GetPositionXYZ;
|
||||
pHAL->Motion.SetPositionXYZ = (HAL_MOTION_SET_POSITION_XYZ) HAL_Motion_SetPositionXYZ;
|
||||
pHAL->Motion.GetPositionR = (HAL_MOTION_GET_POSITION_R) HAL_Motion_GetPositionR;
|
||||
pHAL->Motion.SetPositionR = (HAL_MOTION_SET_POSITION_R) HAL_Motion_SetPositionR;
|
||||
pHAL->Motion.IsHomed = (HAL_MOTION_IS_HOMED) HAL_Motion_IsHomed;
|
||||
pHAL->Motion.Shutdown = (HAL_MOTION_SHUTDOWN) HAL_Motion_Shutdown;
|
||||
}
|
||||
}
|
||||
pHAL->Pendant.IsSupported = (HAL_PENDANT_IS_SUPPORTED) HAL_Pendant_IsSupported;
|
||||
if(pHAL->Pendant.IsActive(true))
|
||||
{
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
pHAL->Pendant.Startup = (HAL_PENDANT_STARTUP) HAL_Pendant_Startup;
|
||||
pHAL->Pendant.Enable = (HAL_PENDANT_ENABLE) HAL_Pendant_Enable;
|
||||
pHAL->Pendant.Shutdown = (HAL_PENDANT_SHUTDOWN) HAL_Pendant_Shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
pHAL->Optics.IsSupported = (HAL_OPTICS_IS_SUPPORTED) HAL_Optics_IsSupported;
|
||||
if(pHAL->Optics.IsActive(true))
|
||||
{
|
||||
// pHAL->Optics.GetMagnificationSteps = (HAL_OPTICS_GET_MAGNIFICATION_STEPS) HAL_Optics_GetMagnificationSteps;
|
||||
// pHAL->Optics.GetDeadband = (HAL_OPTICS_GET_DEADBAND) HAL_Optics_GetDeadband;
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
pHAL->Optics.Startup = (HAL_OPTICS_STARTUP) HAL_Optics_Startup;
|
||||
pHAL->Optics.GetScaleRange = (HAL_OPTICS_GET_SCALE_RANGE) HAL_Optics_GetScaleRange;
|
||||
pHAL->Optics.GetScalePosition = (HAL_OPTICS_GET_SCALE_POSITION) HAL_Optics_GetScalePosition;
|
||||
pHAL->Optics.SetScalePosition = (HAL_OPTICS_SET_SCALE_POSITION) HAL_Optics_SetScalePosition;
|
||||
pHAL->Optics.EnableGrid = (HAL_OPTICS_ENABLE_GRID) HAL_Optics_EnableGrid;
|
||||
pHAL->Optics.IsGridEnabled = (HAL_OPTICS_IS_GRID_ENABLED) HAL_Optics_IsGridEnabled;
|
||||
pHAL->Optics.EnableLaser = (HAL_OPTICS_ENABLE_LASER) HAL_Optics_EnableLaser;
|
||||
pHAL->Optics.IsLaserEnabled = (HAL_OPTICS_IS_LASER_ENABLED) HAL_Optics_IsLaserEnabled;
|
||||
pHAL->Optics.Shutdown = (HAL_OPTICS_SHUTDOWN) HAL_Optics_Shutdown;
|
||||
|
||||
// Load HSI library
|
||||
HINSTANCE OpticsLib = ::AfxLoadLibrary(_T("WAI_Optics.dll"));
|
||||
if(OpticsLib)
|
||||
{
|
||||
//Get startup address and call startup routine
|
||||
HAL_STARTUP Startup = (HAL_STARTUP) ::GetProcAddress(OpticsLib, "HAL_Startup");
|
||||
if(Startup)
|
||||
{
|
||||
//store these function pointers (WAI_Optics.dll will change these)
|
||||
HAL_SHUTDOWN pOrginalShutdown = pHAL->Shutdown;
|
||||
HAL_GET_VERSION pOrginalGetVersion = pHAL->GetVersion;
|
||||
|
||||
//TKr/100924: Adaption on V1.84 (new g_lFramegrabberType)
|
||||
//if(Startup(hWnd, pHAL, bOfflineOnly, g_lFramegrabberType) == HAL_STATUS_NORMAL)
|
||||
#pragma message("do we need a real framegrabber type here")
|
||||
if(Startup(hWnd, pHAL, bOfflineOnly, 0) == HAL_STATUS_NORMAL)
|
||||
{
|
||||
//restore the original function pointers
|
||||
pHAL->Shutdown = pOrginalShutdown;
|
||||
pHAL->GetVersion = pOrginalGetVersion;
|
||||
|
||||
//store the function pointers from the WAI_Optics.dll
|
||||
//(will be used in HMV-Startup and -Shutdown)
|
||||
g_HSIExt.g_lpfnWAIOpticsStartup = pHAL->Optics.Startup;
|
||||
g_HSIExt.g_lpfnWALOpticsShutdown = pHAL->Optics.Shutdown;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = HAL_STATUS_FAILED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = HAL_STATUS_FAILED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox(_T("Failed Startup"));
|
||||
Status = HAL_STATUS_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set exported HAL LASERPROBE function addresses
|
||||
pHAL->LaserProbe.IsSupported = (HAL_LP_IS_SUPPORTED) HAL_LP_IsSupported;
|
||||
|
||||
if(pHAL->LaserProbe.IsActive(true))
|
||||
{
|
||||
// HAL LASERPROBE is supported
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
pHAL->LaserProbe.Startup = (HAL_LP_STARTUP) HAL_LP_Startup;
|
||||
pHAL->LaserProbe.Enable = (HAL_LP_ENABLE) HAL_LP_Enable;
|
||||
pHAL->LaserProbe.IsEnabled = (HAL_LP_IS_ENABLED) HAL_LP_IsEnabled;
|
||||
pHAL->LaserProbe.GetActiveProbe = (HAL_LP_GET_ACTIVE_PROBE) HAL_LP_GetActiveProbe;
|
||||
pHAL->LaserProbe.SetActiveProbe = (HAL_LP_SET_ACTIVE_PROBE) HAL_LP_SetActiveProbe;
|
||||
pHAL->LaserProbe.SetupMeasurePoint = (HAL_LP_SETUP_MEASURE_POINT) HAL_LP_SetupMeasurePoint;
|
||||
pHAL->LaserProbe.DoMeasure = (HAL_LP_DO_MEASURE) HAL_LP_DoMeasure;
|
||||
pHAL->LaserProbe.GetMeasureData = (HAL_LP_GET_MEASURE_DATA) HAL_LP_GetMeasureData;
|
||||
pHAL->LaserProbe.Shutdown = (HAL_LP_SHUTDOWN) HAL_LP_Shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
// Set exported HAL TOUCHPROBE function addresses
|
||||
pHAL->TouchProbe.IsSupported = (HAL_TP_IS_SUPPORTED) HAL_TP_IsSupported;
|
||||
|
||||
if(pHAL->TouchProbe.IsActive(true))
|
||||
{
|
||||
// HAL TOUCHPROBE is supported
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
pHAL->TouchProbe.Startup = (HAL_TP_STARTUP) HAL_TP_Startup;
|
||||
pHAL->TouchProbe.Enable = (HAL_TP_ENABLE) HAL_TP_Enable;
|
||||
pHAL->TouchProbe.GetActiveProbe = (HAL_TP_GET_ACTIVE_PROBE) HAL_TP_GetActiveProbe;
|
||||
pHAL->TouchProbe.SetActiveProbe = (HAL_TP_SET_ACTIVE_PROBE) HAL_TP_SetActiveProbe;
|
||||
pHAL->TouchProbe.SetManualTouchData = (HAL_TP_SET_MANUAL_TOUCH_DATA) HAL_TP_SetManualTouchData;
|
||||
pHAL->TouchProbe.GetTipOffset = (HAL_TP_GET_TIP_OFFSET) HAL_TP_GetTipOffset;
|
||||
pHAL->TouchProbe.SetTipOffset = (HAL_TP_SET_TIP_OFFSET) HAL_TP_SetTipOffset;
|
||||
pHAL->TouchProbe.SetupMeasurePoint = (HAL_TP_SETUP_MEASURE_POINT) HAL_TP_SetupMeasurePoint;
|
||||
pHAL->TouchProbe.DoMeasure = (HAL_TP_DO_MEASURE) HAL_TP_DoMeasure;
|
||||
pHAL->TouchProbe.IsMeasuring = (HAL_TP_IS_MEASURING) HAL_TP_IsMeasuring;
|
||||
pHAL->TouchProbe.GetMeasureData = (HAL_TP_GET_MEASURE_DATA) HAL_TP_GetMeasureData;
|
||||
pHAL->TouchProbe.Shutdown = (HAL_TP_SHUTDOWN) HAL_TP_Shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
// Set exported HAL FIXTURE function addresses
|
||||
pHAL->Fixture.IsSupported = (HAL_FIXTURE_IS_SUPPORTED) HAL_Fixture_IsSupported;
|
||||
|
||||
if(pHAL->Fixture.IsActive(true))
|
||||
{
|
||||
// HAL FIXTURE is supported
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
//pHAL->Fixture.Startup = (HAL_FIXTURE_STARTUP) HAL_Fixture_Startup;
|
||||
//pHAL->Fixture.Shutdown = (HAL_FIXTURE_SHUTDOWN) HAL_Fixture_Shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
// Set exported HAL TOOLCHANGER function addresses
|
||||
pHAL->ToolChanger.IsSupported = (HAL_TC_IS_SUPPORTED) HAL_TC_IsSupported;
|
||||
|
||||
if(pHAL->ToolChanger.IsActive(true))
|
||||
{
|
||||
// HAL TOOLCHANGER is supported
|
||||
if(!g_HSIExt.g_bOfflineOnly)
|
||||
{
|
||||
//pHAL->ToolChanger.Startup = (HAL_TC_STARTUP) HAL_TC_Startup;
|
||||
//pHAL->ToolChanger.Shutdown = (HAL_TC_SHUTDOWN) HAL_TC_Shutdown;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_GetMachineCount(int &NumMachines)
|
||||
{
|
||||
NumMachines=HAL_NUM_MACHINE_TYPES;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_GetMachineInfo(int Machine, TCHAR *MachineName, TCHAR *FirmwareVersion)
|
||||
{
|
||||
switch(Machine)
|
||||
{
|
||||
case HAL_MACHINE_TYPE_EXCEL:
|
||||
wcsncpy_s(MachineName, HAL_MaxStringLength+1, _T("MicroVu Excel"), HAL_MaxStringLength);
|
||||
wcsncpy_s(FirmwareVersion, HAL_MaxStringLength+1, _T(""), HAL_MaxStringLength);
|
||||
break;
|
||||
|
||||
case HAL_MACHINE_TYPE_VECTRA:
|
||||
wcsncpy_s(MachineName, HAL_MaxStringLength+1, _T("MicroVu Vectra"), HAL_MaxStringLength);
|
||||
wcsncpy_s(FirmwareVersion, HAL_MaxStringLength+1, _T(""), HAL_MaxStringLength);
|
||||
break;
|
||||
|
||||
case HAL_MACHINE_TYPE_UNSELECTED:
|
||||
default:
|
||||
wcsncpy_s(MachineName, HAL_MaxStringLength+1, _T("Not selected"), HAL_MaxStringLength);
|
||||
wcsncpy_s(FirmwareVersion, HAL_MaxStringLength+1, _T(""), HAL_MaxStringLength);
|
||||
break;
|
||||
}
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_GetActiveMachine(int &Machine)
|
||||
{
|
||||
Machine=g_HSIExt.m_ActiveMachineType;
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_SetActiveMachine(int Machine)
|
||||
{
|
||||
g_HSIExt.InitialiseMachineType((HAL_MACHINE_TYPE)Machine);
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_SetLocale(UINT /*LCID*/)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_SetRegistryRootKey(TCHAR * /*RegistryKey*/)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_PreSetupDialog(CPropertySheet * /*SetupDlg*/, bool /*bOfflineSetup*/)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_PostSetupDialog(CPropertySheet * /*SetupDlg*/)
|
||||
{
|
||||
return HAL_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_Calibrate(HAL_CALIBRATE_TYPE /*Type*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
//
|
||||
//***********************************************************************************************
|
||||
HAL_STATUS HAL_Notify (HAL_NOTIFY_TYPE Type)
|
||||
{
|
||||
HAL_STATUS retVal=HAL_STATUS_NORMAL;
|
||||
|
||||
if(Type==HAL_NOTIFY_PROGRAM_EXECUTION_START)
|
||||
{
|
||||
TCHAR Msg[HAL_MaxStringLength+1];
|
||||
CString MsgStr;
|
||||
MsgStr.LoadString(IDS_ALIGN_ROTARY);
|
||||
wcsncpy_s(Msg, HAL_MaxStringLength+1, MsgStr, HAL_MaxStringLength);
|
||||
|
||||
// Do the below event call ONLY if rotary table enabled.
|
||||
if(g_HSIExt.m_AxisEnabled[HAL_AXIS_Q] && IsRotaryEnabled())
|
||||
{
|
||||
// xxxx g_pHSI->Event(HAL_EVENT_FUNCTION, HAL_EVENT_DISPLAY_OK_MESSAGE, Msg, EventCallbackID);
|
||||
|
||||
// OK - lets store the rotary offset position at this point
|
||||
if(IsBoardPresent())
|
||||
{
|
||||
// Read current position
|
||||
//long Position[4] = {0,0,0,0};
|
||||
//long Direction[4];
|
||||
// UNREFERENCED_PARAMETER(Direction);
|
||||
// bool Error[4];
|
||||
// gCncBd->getAxisInfo(Position, Direction, Error);
|
||||
//g_HSIExt.m_AxisRefMarkOffset[HAL_AXIS_Q] = Position[HAL_AXIS_Q];
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_GetCustomCalibrationTypeInfo(HAL_CALIBRATE_TYPE /*Type*/, TCHAR * /*Name*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_EventResponse(UINT /*EventCallbackID*/, HAL_EVENT_RESPONSE_TYPE /*ResponseType*/)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
HAL_STATUS HAL_GetCustomMessage(HAL_CUSTOM_MESSAGE_TYPE Msg,TCHAR *Message)
|
||||
{
|
||||
HAL_STATUS Status = HAL_STATUS_NORMAL;
|
||||
|
||||
if(g_HSIExt.m_HomeManual)
|
||||
{
|
||||
CString MessageStr;
|
||||
switch(Msg)
|
||||
{
|
||||
case HAL_CUSTOM_MESSAGE_HOME_MACHINE:
|
||||
if(g_HSIExt.m_HomeToLimitSwitch)
|
||||
MessageStr.LoadString(IDS_HOME_MANUAL_MACHINE_LIMIT);
|
||||
else
|
||||
MessageStr.LoadString(IDS_HOME_MANUAL_MACHINE_REF);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
wcsncpy_s(Message, HAL_MaxStringLength+1, MessageStr, HAL_MaxStringLength);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// For USB, we will initialize this
|
||||
// If it is not initialized, we will initialize the Mv_USB.
|
||||
// If it is already initialized, we reply with true;
|
||||
bool IsBoardPresent()
|
||||
{
|
||||
return (g_pMv_Proto?true:false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool IsControllerPresent()
|
||||
{
|
||||
// return (IsBoardPresent() && gCncBd && gCncBd->isCncAllowed());
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool IsZoomMoving(void)
|
||||
{
|
||||
long Zoom1=0,Zoom2=-1;
|
||||
|
||||
g_pHSI->Optics.GetScalePosition(Zoom1);
|
||||
Sleep(50);
|
||||
g_pHSI->Optics.GetScalePosition(Zoom2);
|
||||
|
||||
if(labs(Zoom1-Zoom2)>2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
bool IsRotaryEnabled(void)
|
||||
{
|
||||
ASSERT(g_pHSI->Event);
|
||||
|
||||
UINT EventCallbackID;
|
||||
TCHAR EventData[HAL_MaxStringLength+1];
|
||||
wcsncpy_s(EventData,HAL_MaxStringLength+1, _T(""), HAL_MaxStringLength);
|
||||
HAL_EVENT_RESPONSE_TYPE EventResponse=g_pHSI->Event(HAL_EVENT_FUNCTION, HAL_EVENT_IS_ROTAB_ENABLED, EventData, EventCallbackID);
|
||||
return EventResponse==HAL_EVENT_RESPONSE_YES;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void HAL_SendDebug(LPCTSTR format, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
// debug.SendAndFlush(format, list);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
double TimeInMsecs(void)
|
||||
{
|
||||
double Msecs;
|
||||
|
||||
LARGE_INTEGER HPCounterTicksPerSecond;
|
||||
BOOL HasHPCounter = QueryPerformanceFrequency(&HPCounterTicksPerSecond);
|
||||
|
||||
if (HasHPCounter == TRUE)
|
||||
{
|
||||
// Use high resolution clock.
|
||||
double HPCounterTicksPerMsec = (DWORD)((double) HPCounterTicksPerSecond.QuadPart / 1000.0);
|
||||
LARGE_INTEGER HPTicks;
|
||||
QueryPerformanceCounter(&HPTicks);
|
||||
Msecs = ((double)HPTicks.QuadPart / HPCounterTicksPerMsec);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use clock with less resolution.
|
||||
Msecs = GetTickCount();
|
||||
}
|
||||
return Msecs;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "Hal_MicroVu.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HSI.h : Implementation of the MicroVu HSI supporting:
|
||||
// - MicroVu based systems
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Entry points declarations
|
||||
|
||||
HAL_STATUS HAL_Shutdown();
|
||||
HAL_STATUS HAL_GetMachineCount(int &NumMachines);
|
||||
HAL_STATUS HAL_GetMachineInfo(int Machine, TCHAR *MachineName, TCHAR *FirmareVersion);
|
||||
HAL_STATUS HAL_SetActiveMachine(int Machine);
|
||||
HAL_STATUS HAL_GetActiveMachine(int &Machine);
|
||||
HAL_STATUS HAL_GetStageLimits(double *StageLimitMax, double *StageLimitMin);
|
||||
//HAL_STATUS HAL_SetStageLimits(bool bStageLimitEnabled, double *StageLimitMax, double *StageLimitMin);
|
||||
HAL_STATUS HAL_GetCustomMessage(HAL_CUSTOM_MESSAGE_TYPE Msg, TCHAR *Message);
|
||||
HAL_STATUS HAL_SetLocale(UINT LCID);
|
||||
HAL_STATUS HAL_SetRegistryRootKey(TCHAR *RegistryKey);
|
||||
HAL_STATUS HAL_Calibrate(HAL_CALIBRATE_TYPE Type);
|
||||
HAL_STATUS HAL_Notify(HAL_NOTIFY_TYPE Type);
|
||||
HAL_STATUS HAL_GetCustomCalibrationTypeInfo(HAL_CALIBRATE_TYPE Type, TCHAR *Name);
|
||||
HAL_STATUS HAL_EventResponse(UINT EventCallbackID, HAL_EVENT_RESPONSE_TYPE ResponseType);
|
||||
HAL_STATUS HAL_PreSetupDialog(CPropertySheet *SetupDlg, bool bOfflineSetup);
|
||||
HAL_STATUS HAL_PostSetupDialog(CPropertySheet *SetupDlg);
|
||||
//HAL_STATUS HAL_GetTemperatureSensor(int Sensor, double &Temperature);
|
||||
//HAL_STATUS HAL_GetTemperatureSensorCount(int &NumSensors);
|
||||
|
||||
//void HAL_WaitMoveCompleteSetup(DWORD WaitTimeout = MOTION_TIMEOUT, bool WaitOptics = false);
|
||||
//HAL_STATUS HAL_WaitMoveCompleteResult(void);
|
||||
//unsigned __stdcall WatchMoveThread(LPVOID /*pThis*/);
|
||||
HAL_STATUS HAL_MapSupportedFunctions(CHAL *pHAL, HWND hWnd, bool bOfflineOnly);
|
||||
|
||||
bool IsRotaryEnabled(void);
|
||||
//unsigned __stdcall JoystickLightingThread(LPVOID /*pThis*/);
|
||||
|
||||
void HAL_SendDebug(LPCTSTR format, ...);
|
||||
|
||||
const long UNINITIALIZED = 1;
|
||||
const long RUNNING = 2;
|
||||
const long ERRORBLOCKING = 3;
|
||||
const long SHUTDOWN = 4;
|
||||
const long RUNNINGPREONLINE = 5;
|
||||
@@ -0,0 +1,7 @@
|
||||
; HSI_MicroVu.def : Declares the module parameters for the DLL.
|
||||
|
||||
LIBRARY "HSI_MicroVu.DLL"
|
||||
; DESCRIPTION 'HSI_MicroVu Windows Dynamic Link Library' // rk 040809
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
@@ -0,0 +1,150 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
#include "VersionInfo.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION FILEVERSIONMACRO
|
||||
PRODUCTVERSION PRODUCTVERSIONMACRO
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Wilcox Associates, Inc.\0"
|
||||
VALUE "FileDescription", "HSI_MicroVu DLL"
|
||||
VALUE "FileVersion", FILEVERSIONMACROQT
|
||||
VALUE "InternalName", "HSI_MicroVu"
|
||||
VALUE "LegalCopyright", LEGALCOPYRIGHTMACRO
|
||||
VALUE "OriginalFilename", "HSI_MicroVu.DLL"
|
||||
VALUE "ProductName", "PC-DMIS EMS\0"
|
||||
VALUE "ProductVersion", PRODUCTVERSIONMACROQT
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONFIG_DLG DIALOG 0, 0, 294, 185
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "MicroVu Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,237,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,237,24,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "HSI_MicroVu"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}</ProjectGuid>
|
||||
<RootNamespace>HSI_MicroVu</RootNamespace>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
<Import Project="..\..\..\..\ProjectStandards.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
<Import Project="..\..\..\..\ProjectStandards.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
<Import Project="..\..\..\..\ProjectStandards.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
<Import Project="..\..\..\..\ProjectStandards.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\UnicodeRelease/HSI_MICROVU.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\include;..\..\WAI_Framegrabber;..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\include</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;CLEAN_STDAFX;_AFXEXT;INTERFACE_CPP;_MBCS;_WIN32_DCOM;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\PcdUtilities;..\..\..\..\ExtractedModules\PcdUtilitiesLib</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>version.lib;libusb.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ModuleDefinitionFile>.\HSI_MicroVu.DEF</ModuleDefinitionFile>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\lib\Msvc</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy “$(OutDir)\*.dll” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y
|
||||
xcopy “$(OutDir)\*.lib” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\UnicodeRelease/HSI_METRONICS.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\include;..\..\WAI_Framegrabber;..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\include</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_MBCS;_WIN32_DCOM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\PcdUtilities;..\..\..\..\ExtractedModules\PcdUtilitiesLib</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>version.lib;libusb.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ModuleDefinitionFile>.\HSI_MicroVu.DEF</ModuleDefinitionFile>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\lib\Msvc_x64</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy “$(OutDir)\*.dll” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y
|
||||
xcopy “$(OutDir)\*.lib” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\UnicodeDebug/HSI_METRONICS.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\include;..\..\WAI_Framegrabber;..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\include</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_MBCS;_WIN32_DCOM;_CRT_SECURE_NO_WARNINGS;CLEAN_STDAFX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\PcdUtilities;..\..\..\..\ExtractedModules\PcdUtilitiesLib</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>version.lib;libusb.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ModuleDefinitionFile>HSI_MicroVu.DEF</ModuleDefinitionFile>
|
||||
<ProgramDatabaseFile>NetDebug/HSI_MicroVu.pdb</ProgramDatabaseFile>
|
||||
<MapFileName>NetDebug/HSI_MicroVu.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<MapExports>false</MapExports>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\lib\Msvc</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy “$(OutDir)\*.dll” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y
|
||||
xcopy “$(OutDir)\*.lib” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\UnicodeDebug/HSI_METRONICS.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\include;..\..\WAI_Framegrabber;..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\include</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_MBCS;_WIN32_DCOM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\PcdUtilities;..\..\..\..\ExtractedModules\PcdUtilitiesLib</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>version.lib;libusb.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ModuleDefinitionFile>HSI_MicroVu.DEF</ModuleDefinitionFile>
|
||||
<ProgramDatabaseFile>NetDebug/HSI_MicroVu.pdb</ProgramDatabaseFile>
|
||||
<MapFileName>NetDebug/HSI_MicroVu.map</MapFileName>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\..\ThirdParty\SourceForge\LibUsb_Win\lib\Msvc_x64</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy “$(OutDir)\*.dll” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y
|
||||
xcopy “$(OutDir)\*.lib” ..\..\..\..\..\bin\$(PlatformName)\$(ConfigurationName)\*.* /D /F /Y</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="HAL_Fixture.cpp" />
|
||||
<ClCompile Include="HAL_Illumination.cpp" />
|
||||
<ClCompile Include="HAL_LaserProbe.cpp" />
|
||||
<ClCompile Include="HAL_MicroVu.cpp" />
|
||||
<ClCompile Include="HAL_Motion.cpp" />
|
||||
<ClCompile Include="HAL_Optics.cpp" />
|
||||
<ClCompile Include="HAL_Pendant.cpp" />
|
||||
<ClCompile Include="HAL_ToolChanger.cpp" />
|
||||
<ClCompile Include="HAL_TouchProbe.cpp" />
|
||||
<ClCompile Include="HAL_VideoProbe.cpp" />
|
||||
<ClCompile Include="HSI.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_DEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_DEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NDEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NDEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LOGGER.CPP" />
|
||||
<ClCompile Include="Mv_Proto.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_DEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">_DEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NDEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NDEBUG;WIN32;_WINDOWS;_AFXEXT;INTERFACE_CPP;_WINDLL;_AFXDLL;_MBCS;_UNICODE;_WIN32_DCOM</PreprocessorDefinitions>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="SsiStatus.h" />
|
||||
<ClInclude Include="..\..\WAI_FRAMEGRABBER\FGLOAD.H" />
|
||||
<ClInclude Include="..\..\..\..\INCLUDE\HAL.h" />
|
||||
<ClInclude Include="HAL_EventHandler.h" />
|
||||
<ClInclude Include="HAL_Fixture.h" />
|
||||
<ClInclude Include="HAL_Illumination.h" />
|
||||
<ClInclude Include="HAL_LaserProbe.h" />
|
||||
<ClInclude Include="HAL_MicroVu.h" />
|
||||
<ClInclude Include="HAL_Motion.h" />
|
||||
<ClInclude Include="HAL_OPTICS.H" />
|
||||
<ClInclude Include="HAL_Pendant.h" />
|
||||
<ClInclude Include="HAL_ToolChanger.h" />
|
||||
<ClInclude Include="HAL_TouchProbe.h" />
|
||||
<ClInclude Include="HAL_VideoProbe.h" />
|
||||
<ClInclude Include="HSI.h" />
|
||||
<ClInclude Include="logger.h" />
|
||||
<ClInclude Include="Mv_Proto.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\WAI_CALIBRATION\WAI_OPTICS\WAI_OPTICS.vcxproj">
|
||||
<Project>{c570156d-3729-40f7-be6d-5bf411de128a}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="HSI_MicroVu.RC" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="HSI_MicroVu.DEF" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{b5f61841-f52e-4495-b363-ecda19f0cb6a}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{109e2ac6-d7af-46ef-9bb8-751479f9f725}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{6c1f5117-7c39-468d-9f23-02f738f3d6a4}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Library Files">
|
||||
<UniqueIdentifier>{a15e73e5-34df-469c-83f1-70b27f888ff1}</UniqueIdentifier>
|
||||
<Extensions>lib</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="HAL_Fixture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_Illumination.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_LaserProbe.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_Motion.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_Optics.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_Pendant.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_ToolChanger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_TouchProbe.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_VideoProbe.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HSI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HAL_MicroVu.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Mv_Proto.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LOGGER.CPP">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\WAI_FRAMEGRABBER\FGLOAD.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\INCLUDE\HAL.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_EventHandler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_Fixture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_Illumination.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_LaserProbe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_Motion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_Optics.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_Pendant.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_ToolChanger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_TouchProbe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_VideoProbe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HSI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HAL_MicroVu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mv_Proto.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="logger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SsiStatus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="HSI_MicroVu.RC">
|
||||
<Filter>Source Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="HSI_MicroVu.DEF">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</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,191 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_OPTICS", "..\..\WAI_CALIBRATION\WAI_OPTICS\WAI_OPTICS.vcxproj", "{C570156D-3729-40F7-BE6D-5BF411DE128A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698} = {BA27142D-4833-49CC-9D57-5B926FCB2698}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSI", "..\..\MSI\MSI.vcxproj", "{10A99A1A-F837-4176-9803-CAD29E1626EB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698} = {BA27142D-4833-49CC-9D57-5B926FCB2698}
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A} = {C570156D-3729-40F7-BE6D-5BF411DE128A}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235} = {4615AD84-2342-4235-B117-0EFA3367D235}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236} = {4615AD84-2342-4235-B117-0EFA3367D236}
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D} = {9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5} = {FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2} = {5F821CE7-2FAA-4E64-B501-8833D19BC4E2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_VideoProbe", "..\..\WAI_VIDEOPROBE\WAI_VIDEOPROBE.vcxproj", "{BA27142D-4833-49CC-9D57-5B926FCB2698}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698} = {BA27142D-4833-49CC-9D57-5B926FCB2698}
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A} = {C570156D-3729-40F7-BE6D-5BF411DE128A}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235} = {4615AD84-2342-4235-B117-0EFA3367D235}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236} = {4615AD84-2342-4235-B117-0EFA3367D236}
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D} = {9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2} = {5F821CE7-2FAA-4E64-B501-8833D19BC4E2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FrameGrabber_IDS_4_51", "..\..\WAI_FRAMEGRABBER\IDS\WAI_FRAMEGRABBER_IDS_45\WAI_FRAMEGRABBER_IDS_4_51.vcxproj", "{4615AD84-2342-4235-B117-0EFA3367D235}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_IDS_4_60", "..\..\WAI_FRAMEGRABBER\IDS\WAI_FRAMEGRABBER_IDS_46\WAI_FRAMEGRABBER_IDS_4_60.vcxproj", "{4615AD84-2342-4235-B117-0EFA3367D236}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_MATROX_MIL_7_50", "..\..\WAI_FRAMEGRABBER\MATROX\MIL75\WAI_FRAMEGRABBER_MATROX_MIL_7_50.vcxproj", "{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_MATROX_MIL_9_20", "..\..\WAI_FRAMEGRABBER\MATROX\MIL92\WAI_FRAMEGRABBER_MATROX_MIL_9_20.vcxproj", "{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HSI_MicroVu", "HSI_MicroVu.vcxproj", "{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB} = {10A99A1A-F837-4176-9803-CAD29E1626EB}
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698} = {BA27142D-4833-49CC-9D57-5B926FCB2698}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FrameDisplay", "..\..\WAI_FrameDisplay\WAI_FrameDisplay.vcxproj", "{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_IDS_4_61", "..\..\WAI_FRAMEGRABBER\IDS\WAI_FRAMEGRABBER_IDS_461\WAI_FRAMEGRABBER_IDS_4_61.vcxproj", "{4615AD84-2342-4235-B117-0EFA3367D237}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_IDS_UEYE_3_60", "..\..\WAI_FRAMEGRABBER\IDS\WAI_FRAMEGRABBER_IDS_UEYE_36\WAI_FRAMEGRABBER_IDS_UEYE_3_60.vcxproj", "{4615AD84-2342-4235-B117-0EFA3367D239}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_IDS_UEYE_3_82", "..\..\WAI_FRAMEGRABBER\IDS\WAI_FRAMEGRABBER_IDS_UEYE_38\WAI_FRAMEGRABBER_IDS_UEYE_3_82.vcxproj", "{2DBD0F9C-0815-479B-B476-D6D694678FC5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_MATROX_MIL_8_0", "..\..\WAI_FRAMEGRABBER\MATROX\MIL8\WAI_FRAMEGRABBER_MATROX_MIL_8_0.vcxproj", "{7F06782C-7CE2-4DF0-8A74-5E4151310782}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_MATROX_MIL_9_0", "..\..\WAI_FRAMEGRABBER\MATROX\MIL9\WAI_FRAMEGRABBER_MATROX_MIL_9_0.vcxproj", "{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WAI_FRAMEGRABBER_NI_4_4", "..\..\WAI_FRAMEGRABBER\NationalInstruments\WAI_FRAMEGRABBER_NI_44\WAI_FRAMEGRABBER_NI_4_4.vcxproj", "{0ACDD27D-746F-4229-BEBC-28D0CD189846}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FrameGrabber", "FrameGrabber", "{8B0594E3-9D71-4D64-9897-1223A5892DEF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Debug|x64.Build.0 = Debug|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Release|Win32.Build.0 = Release|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Release|x64.ActiveCfg = Release|Win32
|
||||
{C570156D-3729-40F7-BE6D-5BF411DE128A}.Release|x64.Build.0 = Release|Win32
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Debug|x64.Build.0 = Debug|x64
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Release|Win32.Build.0 = Release|Win32
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Release|x64.ActiveCfg = Release|x64
|
||||
{10A99A1A-F837-4176-9803-CAD29E1626EB}.Release|x64.Build.0 = Release|x64
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Debug|x64.Build.0 = Debug|x64
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Release|Win32.Build.0 = Release|Win32
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Release|x64.ActiveCfg = Release|x64
|
||||
{BA27142D-4833-49CC-9D57-5B926FCB2698}.Release|x64.Build.0 = Release|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235}.Release|Win32.Build.0 = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235}.Release|x64.ActiveCfg = Release|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236}.Release|Win32.Build.0 = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236}.Release|x64.ActiveCfg = Release|x64
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}.Release|Win32.Build.0 = Release|Win32
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2}.Release|x64.ActiveCfg = Release|x64
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Debug|x64.Build.0 = Debug|x64
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Release|Win32.Build.0 = Release|Win32
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Release|x64.ActiveCfg = Release|x64
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D}.Release|x64.Build.0 = Release|x64
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Debug|x64.Build.0 = Debug|x64
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Release|Win32.Build.0 = Release|Win32
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Release|x64.ActiveCfg = Release|x64
|
||||
{992F2F1B-CE2A-44EE-8E24-13DE4DFC8B9B}.Release|x64.Build.0 = Release|x64
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Debug|x64.Build.0 = Debug|x64
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Release|Win32.Build.0 = Release|Win32
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Release|x64.ActiveCfg = Release|x64
|
||||
{FE3EF8DB-18A6-4932-8B5A-69AC5A803EF5}.Release|x64.Build.0 = Release|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Debug|x64.Build.0 = Debug|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Release|Win32.Build.0 = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Release|x64.ActiveCfg = Release|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237}.Release|x64.Build.0 = Release|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239}.Release|Win32.Build.0 = Release|Win32
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239}.Release|x64.ActiveCfg = Release|x64
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Debug|x64.Build.0 = Debug|x64
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Release|Win32.Build.0 = Release|Win32
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Release|x64.ActiveCfg = Release|x64
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5}.Release|x64.Build.0 = Release|x64
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782}.Release|Win32.Build.0 = Release|Win32
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782}.Release|x64.ActiveCfg = Release|x64
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}.Release|Win32.Build.0 = Release|Win32
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF}.Release|x64.ActiveCfg = Release|x64
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Debug|x64.Build.0 = Debug|x64
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Release|Win32.Build.0 = Release|Win32
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Release|x64.ActiveCfg = Release|x64
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{4615AD84-2342-4235-B117-0EFA3367D236} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{5F821CE7-2FAA-4E64-B501-8833D19BC4E2} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{9EEE5D94-EA5F-44A2-99F0-609A0DE80D8D} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D237} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D239} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{2DBD0F9C-0815-479B-B476-D6D694678FC5} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{7F06782C-7CE2-4DF0-8A74-5E4151310782} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{3D7D6847-D15F-4ED8-92F4-6688596E6EEF} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{0ACDD27D-746F-4229-BEBC-28D0CD189846} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
{4615AD84-2342-4235-B117-0EFA3367D235} = {8B0594E3-9D71-4D64-9897-1223A5892DEF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
@@ -0,0 +1,54 @@
|
||||
#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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
Device Driver Installation
|
||||
|
||||
Use the INF-Wizard program to generate the INF file (modify the vendor and product IDs, strings etc). Create different inf-files to install different types of devices (devices with different IDs).
|
||||
Unplug the device(s) from the system. This is optional.
|
||||
Open the Windows Device Manager and remove all incorrectly installed USB devices (device entries with a yellow exclamation mark). This is optional.
|
||||
Reconnect the device(s) to the system.
|
||||
When Windows asks for a driver, choose the inf-file(s) created above. Windows will warn that the driver is is not 'digitally signed'. Ignore this message and continue with the installation. Since version 1.2.0.0, a valid digital signature is embedded inside libusb0.sys for AMD/Intel x86_64 version of Windows so that the users can install the driver as well under 64bit x86_64 version of Windows Vista/7/2008/2008R2.
|
||||
Open the Windows Device Manager to verify that the device is installed correctly. Run the test program (testlibusb-win.exe) from the 'bin directory'. It should print out the descriptors of your device(s).
|
||||
A reboot isn't necessary.
|
||||
Starting from version 1.2.1.0, the inf-wizard.exe has embedded driver binaries and provide an option to install the driver at the end of the process.
|
||||
|
||||
Removing the Device Driver
|
||||
|
||||
The device driver can not be easily removed from the system. You can however try to use usbdeview to remove the entries. Under Vista and Windows 7, you can use pnputil to remove the driver package.
|
||||
|
||||
Updating the Device Driver
|
||||
|
||||
Download the latest device driver binary package (libusb-win32-device-bin-x.x.x.x.zip or tar.gz).
|
||||
Modify the inf-file as described in the Installation section.
|
||||
Open the Device Manager and select the device you want to update.
|
||||
Choose 'Properties->Driver->Update'. Disable the automatic installation and select the new inf-file manually.
|
||||
Since 1.2.1.0, inf-wizard.exe can be used to automatically install/update the device driver.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,676 @@
|
||||
// DataLink.h: interface for the CDataLink class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#if !defined(AFX_DataLink_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
#define AFX_DataLink_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#define MV_TRACE if ( g_pLogger && g_pLogger->m_lLogMask & LOGACTIONS ) g_pLogger->SendAndFlushPerMode
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000 /*ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h
|
||||
|
||||
#include "logger.h"
|
||||
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
||||
#include "SsiStatus.h"
|
||||
|
||||
#define MV_TIMER_POLL_58 0x58
|
||||
#define MV_TIMER_POLL_59 0x59
|
||||
#define MV_TIMER_POLL_2B 0x2B
|
||||
|
||||
#define MAX_ASYNC_CONTEXT 10
|
||||
#define MV_CMD_UNKNOWN 0x00
|
||||
#define MV_CMD_POLL_00_01 0x01
|
||||
#define MV_CMD_GET_POS_XYZ_00_02 0x02
|
||||
#define MV_CMD_SET_POS_XYZ_00_03 0x03
|
||||
#define MV_CMD_GET_POS_R_00_04 0x04
|
||||
#define MV_CMD_SET_POS_R_00_05 0x05
|
||||
#define MV_CMD_SET_ZOOM_00_06 0x06
|
||||
#define MV_CMD_GET_ZOOM_00_07 0x07
|
||||
#define MV_CMD_GET_STARUP_CONFIG_00 0x00
|
||||
#define MV_CMD_GET_SUB_CONFIG_28 0x28 // Get 0x12 bytes
|
||||
#define MV_CMD_GET_SUB_CONFIG_29 0x29 // Get 0x60 bytes - two subcode
|
||||
#define MV_CMD_SERVO_CMD_2B 0x2b // Get 0x45 bytes
|
||||
#define MV_CMD_START_MACHINE_2C 0x2c // Get 0x20 bytes
|
||||
#define MV_CMD_GET_UNK_31 0x31 // Get 0x20
|
||||
#define MV_CMD_GET_UNK_32 0x32 // Get 0x02
|
||||
#define MV_CMD_GET_UNK_34 0x34 // Get 0x02
|
||||
#define MV_CMD_GET_UNK_35 0x35 // Get 0x10
|
||||
#define MV_CMD_GET_UNK_3C 0x3C // Get 0x10
|
||||
#define MV_CMD_GET_X_INDEX_41 0x41 // Get 0x06
|
||||
#define MV_CMD_GET_Y_INDEX_42 0x42 // Get 0x06
|
||||
#define MV_CMD_GET_MAG_43 0x43 // Get 0x06
|
||||
#define MV_CMD_GET_ZOOM_DECEL_45 0x45 // Get 0x06
|
||||
#define MV_CMD_SET_JOYSTICK_MODE_47 0x47 //
|
||||
#define MV_CMD_MOVE_AXIS_4C 0x4C // Get 0x02
|
||||
#define MV_CMD_GET_INDEX_4E 0x4E // Get 0x07
|
||||
#define MV_CMD_SEEK_INDEX_4F 0x4F // Get 0x07
|
||||
#define MV_CMD_MAX_SPEED_50 0x50
|
||||
#define MV_CMD_MAX_ACCEL_51 0x51
|
||||
#define MV_CMD_MOVE_TO_53 0x53 // Get 0x11
|
||||
#define MV_CMD_GET_UNK_56 0x56 // Get 0x20
|
||||
#define MV_CMD_GET_SCALE_58 0x58 // Get 0x11
|
||||
#define MV_CMD_GET_POLL_59 0x59 // Get 0x3E
|
||||
#define MV_CMD_GET_WORKING_LIMITS_5E 0x5E // Get 0x78
|
||||
#define MV_CMD_GET_CONFIG_60 0x60 // Get 0x72 bytes
|
||||
#define MV_CMD_GET_RAW_SCALE_63 0x63 // Get 0x63
|
||||
#define MV_CMD_GET_CONFIG_69 0x69 // Get 0xFE
|
||||
#define MV_CMD_GET_UNK_6A 0x6A // Get 0x6a
|
||||
#define MV_CMD_SET_LIGHT_6E 0x6E // Get 0xFE
|
||||
#define MV_CMD_GET_MACHINE_SIGNATURE_6F 0x6F // Get 0xFE
|
||||
#define MV_CMD_GET_LIGHT_CONFIG_70 0x70 // Get 0xFE
|
||||
#define MV_CMD_GET_UNK_71 0x71 // Get 0xFE
|
||||
#define MV_CMD_GET_UNK_74 0x74 // Get 0xFE
|
||||
#define MV_CMD_GET_UNK_75 0x75 // Get 0xFE
|
||||
#define MV_CMD_MAX_DECEL_76 0x76 // Get 0x11
|
||||
#define MV_CMD_GET_SCALE_SLACK_7C 0x7C // Get 0x04
|
||||
|
||||
#define MAX_BUFF_SIZE 0x200
|
||||
|
||||
#define USB_ENDPOINT_TYPE_CONTROL 0
|
||||
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
|
||||
#define USB_ENDPOINT_TYPE_BULK 2
|
||||
#define USB_ENDPOINT_TYPE_INTERRUPT 3
|
||||
|
||||
#define USB_DEVICE_DESCRIPTOR_TYPE 1
|
||||
#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2
|
||||
|
||||
#define THREAD_RUNNING 0
|
||||
#define THREAD_PAUSED 1
|
||||
#define THREAD_EXIT -1
|
||||
|
||||
// Device configuration and interface id.
|
||||
#define MV_USB_CONFIG 1
|
||||
#define MV_USB_INTF 0
|
||||
|
||||
#define EP_01 0x01
|
||||
#define EP_02 0x02
|
||||
#define EP_03 0x03
|
||||
#define EP_81 0x81
|
||||
#define EP_82 0x82
|
||||
#define EP_84 0x84
|
||||
|
||||
#define EP_01_CMD_IDX 0 // index to usb buffers
|
||||
#define EP_81_DATA_IDX 1 //
|
||||
#define EP_02_CMD_IDX 2 //
|
||||
#define EP_82_DATA_IDX 3 //
|
||||
#define EP_03_CMD_IDX 4 //
|
||||
#define EP_84_DATA_IDX 5 //
|
||||
|
||||
#define lEPSIZE 6
|
||||
#define MAXRINGS 5 // for MicroVu Vertex 220
|
||||
#define MAXSEGS 8
|
||||
|
||||
#define TWO_RINGS 2
|
||||
#define EIGHT_SEGS 8
|
||||
#define FIVE_RINGS 5
|
||||
|
||||
const long MAXINTENSITY = 0x3FF;
|
||||
#define mvMAXLIGHTVALUE 1024
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
//****************************************************************************************************
|
||||
// Set the _status to Idle after reply data has been received.
|
||||
// How to recover? In order to send data, _status must be Idle. If the system is not available
|
||||
// for 1 second, assume something wrong and treat it as "TimeOut".
|
||||
// Another way to do this is to lock this structure is to use a mutex to ensure single-threaded
|
||||
// access.
|
||||
//****************************************************************************************************
|
||||
typedef struct s_axis // axis parameters
|
||||
{
|
||||
long _pos_58;
|
||||
long _pos_59;
|
||||
long _scale_pos;
|
||||
long _speed;
|
||||
long _acceleration;
|
||||
long _deceleration;
|
||||
double _deg;
|
||||
} AXIS;
|
||||
struct s_axis_config // axis configuration
|
||||
{
|
||||
double _scale_resolution;
|
||||
long _scale_range;
|
||||
long _neg_working_limit;
|
||||
long _pos_working_limit;
|
||||
long _scale_count;
|
||||
long _max_speed;
|
||||
long _max_accel;
|
||||
long _max_decel;
|
||||
long _index_10;
|
||||
long _index_03;
|
||||
bool _bhomed;
|
||||
};
|
||||
struct s_zm_axis_config // zm configuration
|
||||
{
|
||||
int _mag_step; // number of steps
|
||||
long _max_speed;
|
||||
long _scale_count; // total scale count
|
||||
long _neg_working_limit; // within the limits
|
||||
long _pos_working_limit;
|
||||
long _max_accel;
|
||||
long _max_decel;
|
||||
long _index_03;
|
||||
long _index_10;
|
||||
int _slack;
|
||||
};
|
||||
|
||||
struct s_r_axis_config
|
||||
{
|
||||
double _scale_resolution;
|
||||
long _scale_count; // total scale count
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
struct struct_machine
|
||||
{ // g_machine structure
|
||||
struct s_machine_config
|
||||
{
|
||||
wchar_t _str_servo_Id[16];
|
||||
wchar_t _str_model[16];
|
||||
wchar_t _str_model_nbr[16];
|
||||
wchar_t _str_serial_no[16];
|
||||
int _vector_light_model;
|
||||
char _str_2b[64];
|
||||
BYTE _str_bin_2b[64];
|
||||
char _str_4c02_signature[64];
|
||||
BYTE _str_bin_4c02[64];
|
||||
char _str_6f00_signature[64];
|
||||
BYTE _str_bin_6f00[64];
|
||||
char _str_7000_signature[64];
|
||||
BYTE _str_bin_7000[64];
|
||||
int _usb_command_wait;
|
||||
int _usb_command_timeout;
|
||||
struct s_axis_config x_axis;
|
||||
struct s_axis_config y_axis;
|
||||
struct s_axis_config z_axis;
|
||||
struct s_zm_axis_config zm_axis;
|
||||
struct s_r_axis_config r1_axis;
|
||||
struct s_r_axis_config r2_axis;
|
||||
int _nbr_lamps;
|
||||
double _dXYZSpeed; // this is not part of the MV original config data
|
||||
} s_machine_config;
|
||||
struct s_status
|
||||
{
|
||||
bool _homed;
|
||||
bool _machine_running;
|
||||
bool _poll_58_active;
|
||||
bool _poll_59_active;
|
||||
bool _poll_2b_active;
|
||||
bool _bXMoving;
|
||||
bool _bYMoving;
|
||||
bool _bZMoving;
|
||||
bool _bZMMoving;
|
||||
bool _bXYZZMIdle;
|
||||
} s_status;
|
||||
union {
|
||||
struct s_lights_300 // special data structure for 5x8 ring configuration
|
||||
{
|
||||
int _segment[FIVE_RINGS][EIGHT_SEGS];
|
||||
int _bottom_light;
|
||||
int _axial_light;
|
||||
} s_lights_300;
|
||||
struct s_lights_200 // special data structure for 2x8 ring configuration
|
||||
{
|
||||
int _segment[TWO_RINGS][EIGHT_SEGS];
|
||||
int _bottom_light;
|
||||
int _axial_light;
|
||||
} s_lights_200;
|
||||
};
|
||||
long _hit_pos_x; // touch probe
|
||||
long _hit_pos_y; // touch probe
|
||||
struct s_axis x;
|
||||
struct s_axis y;
|
||||
struct s_axis z;
|
||||
struct s_axis zm;
|
||||
struct s_axis r1;
|
||||
struct s_axis r2;
|
||||
};
|
||||
|
||||
#define MICROVU_VID 0x0d26
|
||||
#define MICROVU_PID 0x1001
|
||||
|
||||
//****************************************************************************************************
|
||||
// Binary MicroVu command structure, out going
|
||||
//
|
||||
//****************************************************************************************************
|
||||
#define pMV_CMD_01 ((s_MV_CMD_BUFF_01 *) ep_buff[EP_01_CMD_IDX]._buffer)
|
||||
|
||||
struct s_MV_CMD_BUFF_01
|
||||
{
|
||||
UCHAR uCmdByte;
|
||||
//----------------------------------------------------------------------
|
||||
// [endpoint 0x00000001] 00000060 : 530001010100fffe1d89ffff4d37fffebeee000000000000c34e0000021a0000003200000000000f423b000029fb0000138800000000003d08ee00030d4000030d40000000000000000000000000000000000000000000000000000000000000
|
||||
// *Command : 53 Move To -- X Y Z ZM Scale-0123511 -0045769 -0082194 00000000
|
||||
// *Speed : 00049998 00000538 00000050 00000000
|
||||
// *Unk1 : 00999995 00010747 00005000 00000000
|
||||
// *Unk2 : 03999982 00200000 00200000 00000000
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
DWORD dAddr;
|
||||
BYTE cmd1;
|
||||
} S_MV_CMD_0x29;
|
||||
struct
|
||||
{
|
||||
wchar_t servo_Id[16];
|
||||
unsigned int unk_1[16];
|
||||
} S_MV_CMD_0x2b;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x41;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x42;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x43;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x45;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x4E;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
BYTE cmd1;
|
||||
} S_MV_CMD_0x4F;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x50;
|
||||
struct
|
||||
{
|
||||
UCHAR uSubCmdByte;
|
||||
UCHAR statusByte[4];
|
||||
struct S_POS
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
LONG z;
|
||||
LONG zm;
|
||||
} S_POS;
|
||||
struct S_SPEED
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
LONG z;
|
||||
LONG zm;
|
||||
}S_SPEED;
|
||||
struct S_ACC
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
LONG z;
|
||||
LONG zm;
|
||||
}S_ACC;
|
||||
struct S_DEC
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
LONG z;
|
||||
LONG zm;
|
||||
}S_DEC;
|
||||
} S_MV_CMD_0x53;
|
||||
struct // single axis move command
|
||||
{
|
||||
UCHAR uAxis;
|
||||
UCHAR statusByte;
|
||||
LONG lPosition;
|
||||
LONG lSpeed;
|
||||
LONG lAcc;
|
||||
LONG lDecel;
|
||||
} S_MV_CMD_0x4C;
|
||||
struct // single axis move command
|
||||
{
|
||||
UCHAR uAxis;
|
||||
LONG lR1_Pos;
|
||||
LONG lR2_Pos;
|
||||
LONG lX;
|
||||
LONG lY;
|
||||
LONG lZ;
|
||||
} S_MV_CMD_0x4C10;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
BYTE cmd1;
|
||||
} S_MV_CMD_0x59;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x69;
|
||||
struct
|
||||
{
|
||||
UINT uSubCmdByte;
|
||||
UINT segment[FIVE_RINGS][EIGHT_SEGS];
|
||||
UINT bottom_light;
|
||||
UINT axial_light;
|
||||
} S_MV_CMD_300_0x6e;
|
||||
struct
|
||||
{
|
||||
UINT uSubCmdByte;
|
||||
UINT segment[TWO_RINGS][EIGHT_SEGS];
|
||||
UINT bottom_light;
|
||||
UINT axial_light;
|
||||
} S_MV_CMD_200_0x6e;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x6F;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x76;
|
||||
struct
|
||||
{
|
||||
BYTE cmd0;
|
||||
} S_MV_CMD_0x7C;
|
||||
};
|
||||
};
|
||||
|
||||
//======================
|
||||
typedef struct s_xyzzm
|
||||
{
|
||||
bool bFast;
|
||||
long from;
|
||||
long to;
|
||||
long speed;
|
||||
long acc;
|
||||
long dec;
|
||||
double dFromMM;
|
||||
double dToMM;
|
||||
} AXISMOVE;
|
||||
#pragma pack(pop)
|
||||
|
||||
//======================
|
||||
struct struct_ep_buff
|
||||
{
|
||||
int _ep;
|
||||
BYTE _save_send_cmd;
|
||||
BYTE _save_send_cmd0;
|
||||
BYTE _save_send_cmd1;
|
||||
char *_buffer; // MAX_BUFF_SIZE
|
||||
int _size;
|
||||
void *_async_context;
|
||||
BOOL _hProtoPending;
|
||||
HANDLE _event;
|
||||
};
|
||||
|
||||
enum SETTLE_STATUS
|
||||
{
|
||||
NOTSETTLED = 0,
|
||||
SETTLED,
|
||||
TIMEDOUT
|
||||
};
|
||||
|
||||
// CSettleStageParams and CSettleStage are copied from QVI, but QVI is based on millionths of and inch
|
||||
// and we will use microns for MV
|
||||
class CSettleStageParams
|
||||
{
|
||||
public:
|
||||
CSettleStageParams()
|
||||
{
|
||||
EDGE_RETRY_TIMEOUT_X = 800;
|
||||
EDGE_RETRY_TIMEOUT_Y = 800;
|
||||
EDGE_RETRY_TIMEOUT_Z = 800;
|
||||
EDGE_RETRY_TIMEOUT_MAG = 800;
|
||||
EDGE_RETRY_BANDWIDTH_X = 1;
|
||||
EDGE_RETRY_BANDWIDTH_Y = 1;
|
||||
EDGE_RETRY_BANDWIDTH_Z = 1;
|
||||
EDGE_RETRY_BANDWIDTH_MAG = 1;
|
||||
EDGE_RETRY_COUNT_X = 1;
|
||||
EDGE_RETRY_COUNT_Y = 1;
|
||||
EDGE_RETRY_COUNT_Z = 1;
|
||||
EDGE_RETRY_COUNT_MAG = 1;
|
||||
};
|
||||
|
||||
long EDGE_RETRY_TIMEOUT_X; //300
|
||||
long EDGE_RETRY_TIMEOUT_Y; //300
|
||||
long EDGE_RETRY_TIMEOUT_Z; //300
|
||||
long EDGE_RETRY_TIMEOUT_MAG; //300
|
||||
long EDGE_RETRY_BANDWIDTH_X; //50
|
||||
long EDGE_RETRY_BANDWIDTH_Y; //50
|
||||
long EDGE_RETRY_BANDWIDTH_Z; //50
|
||||
long EDGE_RETRY_BANDWIDTH_MAG; //50
|
||||
long EDGE_RETRY_COUNT_X; //1
|
||||
long EDGE_RETRY_COUNT_Y; //1
|
||||
long EDGE_RETRY_COUNT_Z; //1
|
||||
long EDGE_RETRY_COUNT_MAG; //1
|
||||
};
|
||||
|
||||
class CSettleStage
|
||||
{
|
||||
public:
|
||||
CSettleStage(long lAxis, double dStartTime, long lStart, long lDeadband, double dTestIncrSec, double dMaxTimeSec);
|
||||
enum SETTLE_STATUS Test(double dCurTime, long lCurPos);
|
||||
|
||||
private:
|
||||
double m_dStartTime;
|
||||
long m_lStartPos;
|
||||
long m_lDeadband;
|
||||
double m_dTestIncrSec;
|
||||
double m_dMaxTimeSec;
|
||||
double m_dIncrStartTimeSec;
|
||||
long m_lAxis;
|
||||
};
|
||||
|
||||
//======================================================================================
|
||||
class CMv_Proto
|
||||
{
|
||||
public:
|
||||
// EP 01/81 channel threads.
|
||||
static int g_hEP81_Thread_State;
|
||||
static unsigned __stdcall g_EP81_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP81_Thread_Id;
|
||||
|
||||
// EP 02/82 channel threads.
|
||||
static int g_hEP82_Thread_State;
|
||||
static unsigned __stdcall g_EP82_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP82_Thread_Id;
|
||||
//
|
||||
// g_hEP01_Thread_Event is used to kick a command
|
||||
//
|
||||
static int g_hEP01_Thread_State;
|
||||
static unsigned __stdcall g_EP01_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP01_Thread_Id;
|
||||
static HANDLE g_hEP01_Serial_Mutex; // EP01
|
||||
//
|
||||
static int g_hEP02_Thread_State;
|
||||
static unsigned __stdcall g_EP02_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP02_Thread_Id;
|
||||
static HANDLE g_hEP02_Serial_Mutex; // EP02
|
||||
|
||||
static HANDLE g_hHomedEvent;
|
||||
|
||||
double ScaleToMM(long lCount, double dResolution);
|
||||
long MMtoScale(double lDistanceMM, double dResolution);
|
||||
static void Trace_EP_Buff(long lIndex);
|
||||
|
||||
static void _process_rcv_transfer_data(int iEP);
|
||||
static SSI_STATUS _process_MV_CMD_SERVO_CMD_2B();
|
||||
static SSI_STATUS _process_MV_CMD_2C();
|
||||
static SSI_STATUS _process_MV_CMD_GET_SUB_CONFIG_28();
|
||||
static SSI_STATUS _process_MV_CMD_GET_CONFIG_60();
|
||||
static SSI_STATUS _process_MV_CMD_GET_CONFIG_69();
|
||||
static SSI_STATUS _process_MV_CMD_SET_LIGHT_6E();
|
||||
static SSI_STATUS _process_MV_CMD_GET_X_INDEX_41();
|
||||
static SSI_STATUS _process_MV_CMD_GET_Y_INDEX_42();
|
||||
static SSI_STATUS _process_MV_CMD_GET_MAG_43();
|
||||
static SSI_STATUS _process_MV_CMD_GET_ZOOM_DECEL_45();
|
||||
static SSI_STATUS _process_MV_CMD_GET_INDEX_4E();
|
||||
static SSI_STATUS _process_MV_CMD_MAX_SPEED_50();
|
||||
static SSI_STATUS _process_MV_CMD_MAX_ACCEL_51();
|
||||
static SSI_STATUS _process_MV_CMD_GET_UNK_56();
|
||||
static SSI_STATUS _process_MV_CMD_GET_SCALE_58();
|
||||
static SSI_STATUS _process_MV_CMD_GET_POLL_59();
|
||||
static SSI_STATUS _process_MV_CMD_GET_WORKING_LIMITS_5E();
|
||||
static SSI_STATUS _process_MV_CMD_GET_LIGHT_CONFIG_70();
|
||||
static SSI_STATUS _process_MV_CMD_MAX_DECEL_76();
|
||||
static SSI_STATUS _process_MV_CMD_GET_SCALE_SLACK_7C();
|
||||
static SSI_STATUS _process_MV_CMD_GET_FINE_SCALE();
|
||||
|
||||
// Global Structures
|
||||
static struct_ep_buff ep_buff[lEPSIZE];
|
||||
static struct_machine g_machine;
|
||||
|
||||
//
|
||||
CMv_Proto();
|
||||
virtual ~CMv_Proto();
|
||||
SSI_STATUS Init_MvUsb();
|
||||
SSI_STATUS Exit_MvUsb();
|
||||
SSI_STATUS Load_MicroVu_Config();
|
||||
SSI_STATUS GetAppPath(CString &Path);
|
||||
SSI_STATUS ExtractAppPath(CString &Path);
|
||||
|
||||
static double TimeInSecs(void);
|
||||
static CLogger* g_pLogger;
|
||||
static usb_dev_handle *g_dev;
|
||||
bool m_bHomingActive;
|
||||
|
||||
usb_dev_handle* _open_usb_dev(void);
|
||||
SSI_STATUS _start_machine();
|
||||
SSI_STATUS _shutdown_machine();
|
||||
SSI_STATUS _do_single_threaded_usb_comm(int iEP);
|
||||
SSI_STATUS _poll_machine_2b();
|
||||
SSI_STATUS _poll_machine_58();
|
||||
SSI_STATUS _poll_machine_59();
|
||||
|
||||
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 _get_config();
|
||||
SSI_STATUS _get_xyz_index();
|
||||
SSI_STATUS _replay_capture(CString cFileName);
|
||||
SSI_STATUS _process_replay_capture_commands(char *inBuff, FILE* pInFile);
|
||||
static void _swap_byte(unsigned short &Val);
|
||||
static void _reverse_dword(DWORD *);
|
||||
static void _scale2inch(unsigned long scale, double &inch);
|
||||
static void _inch2scale(unsigned long &scale, double inch);
|
||||
static long _4char2long(unsigned char *cBuff);
|
||||
static void _char2bin(unsigned char *cBuff, BYTE *cBytes, int len);
|
||||
SSI_STATUS _calculate_straightline_motion(AXISMOVE &X, AXISMOVE &Y, AXISMOVE &Z, double dSpeedMM);
|
||||
SSI_STATUS WaitForSettleXYZZM();
|
||||
void mv_set_full_ringlight_data(long lIntensity);
|
||||
void mv_set_ringlight_data(long lMaxSize, double *pSegments);
|
||||
|
||||
SSI_STATUS _set_position_xyz(AXISMOVE &X, AXISMOVE &Y, AXISMOVE &Z);
|
||||
//
|
||||
// Motion Related
|
||||
//
|
||||
SSI_STATUS mv_motion_is_supported();
|
||||
SSI_STATUS mv_motion_startup(double x_scale_resolution, double y_scale_resolution, double z_scale_resolution);
|
||||
SSI_STATUS mv_motion_get_axis_count(int &iCount);
|
||||
SSI_STATUS mv_motion_set_speed_xyz(double dSpeed);
|
||||
SSI_STATUS mv_motion_get_speed_xyz(double &dSpeed);
|
||||
SSI_STATUS mv_motion_set_speed_r(long r_speed);
|
||||
SSI_STATUS mv_motion_get_settle_time();
|
||||
SSI_STATUS mv_motion_get_deadband();
|
||||
SSI_STATUS mv_motion_get_refresh_deadband();
|
||||
SSI_STATUS mv_motion_get_position_xyz(double &_dX, double &_dY, double &_dZ);
|
||||
SSI_STATUS mv_motion_set_position_xyz(double dX, double dY, double dZ, bool bWait);
|
||||
SSI_STATUS mv_motion_get_position_r(double &dPositionR);
|
||||
SSI_STATUS mv_motion_set_position_r(double dPositionR);
|
||||
SSI_STATUS mv_motion_store_position_xyz();
|
||||
SSI_STATUS mv_motion_get_stored_positions_xyz();
|
||||
SSI_STATUS mv_motion_is_axis_moving();
|
||||
bool mv_motion_is_homed();
|
||||
SSI_STATUS mv_motion_set_stage_limits();
|
||||
SSI_STATUS mv_motion_get_stage_limits();
|
||||
SSI_STATUS mv_motion_dcc_scan_start();
|
||||
SSI_STATUS mv_motion_dcc_scan_get_data_size();
|
||||
SSI_STATUS mv_motion_dcc_scan_get_data();
|
||||
SSI_STATUS mv_motion_Dcc_Home();
|
||||
SSI_STATUS mv_motion_shut_down();
|
||||
SSI_STATUS mv_motion_fly_mode_cancel();
|
||||
SSI_STATUS mv_motion_get_axes_max_speed(double &dMaxSpeedX, double &dMaxSpeedY, double &dMaxSpeedZ);
|
||||
SSI_STATUS mv_motion_get_3D_max_speed(double &dMaxSpeed);
|
||||
SSI_STATUS mv_motion_get_position_meas_point();
|
||||
//
|
||||
SSI_STATUS mv_optics_is_supported();
|
||||
SSI_STATUS mv_optics_start_up();
|
||||
SSI_STATUS mv_optics_get_magnification_steps(int& iSteps);
|
||||
SSI_STATUS mv_optics_get_numeric_aperture();
|
||||
SSI_STATUS mv_optics_get_magnification(int& iStep);
|
||||
SSI_STATUS mv_optics_set_magnification(int iStep);
|
||||
SSI_STATUS mv_optics_get_deadband();
|
||||
SSI_STATUS mv_optics_get_scale_range(long &neg_scale_range, long &pos_scale_range);
|
||||
SSI_STATUS mv_optics_get_scale_position(long &lScale);
|
||||
SSI_STATUS mv_optics_set_scale_position(const long lScale);
|
||||
SSI_STATUS mv_optics_refresh_lens();
|
||||
SSI_STATUS mv_optics_enable_grid();
|
||||
SSI_STATUS mv_optics_is_grid_enabled();
|
||||
SSI_STATUS mv_optics_enable_laser();
|
||||
SSI_STATUS mv_optics_is_laser_enabled();
|
||||
SSI_STATUS mv_optics_shut_down();
|
||||
SSI_STATUS mv_light_is_supported(BOOL &bTrue);
|
||||
SSI_STATUS mv_light_start_up();
|
||||
SSI_STATUS mv_light_get_lamp_count(int& iCount);
|
||||
SSI_STATUS mv_light_get_lamp_info();
|
||||
SSI_STATUS mv_light_set_lamp_state(double dBottomPercent, double dTopPercent);
|
||||
SSI_STATUS mv_light_shut_down();
|
||||
SSI_STATUS mv_light_set_light();
|
||||
SSI_STATUS mv_light_set_light_off();
|
||||
|
||||
SSI_STATUS mv_pendant_enable(BOOL bTrue);
|
||||
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_POS_XYZ_00_02();
|
||||
SSI_STATUS _send_cmd_MV_CMD_SET_POS_XYZ_00_03();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_POS_R_00_04();
|
||||
SSI_STATUS _send_cmd_MV_CMD_SET_POS_R_00_05();
|
||||
SSI_STATUS _send_cmd_MV_CMD_SET_ZOOM_00_06();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_ZOOM_00_07();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_STARUP_CONFIG_00();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_SUB_CONFIG_28();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_SUB_CONFIG_29(BYTE cmd0, DWORD addr, BYTE cmd1);
|
||||
SSI_STATUS _send_cmd_MV_CMD_SERVO_CMD_2B();
|
||||
SSI_STATUS _send_cmd_MV_CMD_START_MACHINE_2C(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_31();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_32();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_34();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_35();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_3C();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_X_INDEX_41(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_Y_INDEX_42(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_MAG_43(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_ZOOM_DECEL_45(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_MOVE_AXIS_4C(BYTE Axis, long lDestination, BYTE lStatusByte);
|
||||
SSI_STATUS _send_cmd_PRE_ROTARY();
|
||||
SSI_STATUS _send_cmd_MV_CMD_MOVE_AXIS_4C10(long lCount);
|
||||
SSI_STATUS _send_cmd_MV_CMD_SET_JOYSTICK_MODE_47(BOOL bTrue);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_INDEX_4E(BYTE cmd0, BYTE send_len, BYTE recv_len);
|
||||
SSI_STATUS _send_cmd_MV_CMD_SEEK_INDEX_4F(BYTE cmd0, BYTE cmd1);
|
||||
SSI_STATUS _send_cmd_MV_CMD_MAX_SPEED_50(BYTE cmd0, BYTE send_len, BYTE recv_len);
|
||||
SSI_STATUS _send_cmd_MV_CMD_MAX_ACCEL_51(BYTE cmd0, BYTE send_len, BYTE recv_len);
|
||||
SSI_STATUS _send_cmd_MV_CMD_MOVE_TO_53();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_STAGE_RANGE_56();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_SCALE_58(long &lX, long &lY, long &lZ);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_POLL_59(long &lX, long &lY, long &lZ, long &lZM);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_WORKING_LIMITS_5E();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_CONFIG_60();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_RAW_SCALE_63();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_CONFIG_69(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_6A();
|
||||
SSI_STATUS _send_cmd_MV_CMD_SET_LIGHT_6E();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_MACHINE_SIGNATURE_6F(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_LIGHT_CONFIG_70();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_71();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_74();
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_UNK_75();
|
||||
SSI_STATUS _send_cmd_MV_CMD_MAX_DECEL_76(BYTE cmd0, BYTE send_len, BYTE recv_len);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_SCALE_SLACK_7C(BYTE cmd0);
|
||||
SSI_STATUS _send_cmd_MV_CMD_GET_FINE_SCALE(long &lX, long &lY, long &lZ, long &lZM);
|
||||
};
|
||||
|
||||
#endif
|
||||
// !defined(AFX_DataLink_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <conio.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
HKEY OpenKeySection(const TCHAR *i_Section)
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
|
||||
if(i_Section)
|
||||
{
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, i_Section, 0, KEY_WRITE|KEY_READ, &hKey);
|
||||
if(!hKey)
|
||||
{
|
||||
DWORD dw;
|
||||
RegCreateKeyEx(HKEY_LOCAL_MACHINE, i_Section, 0, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_READ, NULL, &hKey, &dw);
|
||||
}
|
||||
}
|
||||
|
||||
return hKey;
|
||||
}
|
||||
|
||||
bool ReadRegKey(const TCHAR *i_Section, const TCHAR *i_Key, int &o_Value)
|
||||
{
|
||||
bool ReadOK = false;
|
||||
|
||||
if(i_Section)
|
||||
{
|
||||
HKEY hKey = OpenKeySection(i_Section);
|
||||
|
||||
if(hKey)
|
||||
{
|
||||
DWORD dwType;
|
||||
DWORD dwCount;
|
||||
|
||||
LONG lResult = RegQueryValueEx(hKey, i_Key, NULL, &dwType, NULL, &dwCount);
|
||||
|
||||
if(lResult == ERROR_SUCCESS && dwType == REG_DWORD)
|
||||
{
|
||||
lResult = RegQueryValueEx(hKey, i_Key, NULL, &dwType, (LPBYTE)&o_Value, &dwCount);
|
||||
ReadOK = true;
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
return ReadOK;
|
||||
}
|
||||
|
||||
void WriteRegKey(const TCHAR *i_Section, const TCHAR *i_Key, int i_Value)
|
||||
{
|
||||
if(i_Section)
|
||||
{
|
||||
HKEY hKey = OpenKeySection(i_Section);
|
||||
|
||||
if(hKey)
|
||||
{
|
||||
RegSetValueEx(hKey, i_Key, NULL, REG_DWORD, (LPBYTE)&i_Value, sizeof(i_Value));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteRegKey(const TCHAR *i_Section, const TCHAR *i_Key)
|
||||
{
|
||||
if(i_Section)
|
||||
{
|
||||
HKEY hKey = OpenKeySection(i_Section);
|
||||
|
||||
if(hKey)
|
||||
{
|
||||
/*LONG lResult = */RegDeleteKey(hKey, i_Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by HSI.rc
|
||||
//
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDR_FRAMEGRABBER 102
|
||||
#define IDR_MOTION 103
|
||||
#define IDR_LIGHTING 104
|
||||
#define IDR_OPTICS 105
|
||||
#define IDD_CONFIG_DLG 201
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 202
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 201
|
||||
#define _APS_NEXT_SYMED_VALUE 106
|
||||
#endif
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _ATL_STATIC_REGISTRY
|
||||
#include <atlbase.h>
|
||||
# include <statreg.h>
|
||||
# if _MSC_VER < 1300
|
||||
# include <statreg.cpp>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _MSC_VER < 1300
|
||||
# include <atlimpl.cpp>
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#include "stdafx_net.h"
|
||||
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <afxodlgs.h> // MFC OLE dialog classes
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
// Proto.h: interface for the CProto class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SSISTATUS_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
#define AFX_SSISTATUS_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
enum SSI_STATUS {
|
||||
SSI_STATUS_NORMAL = 0,
|
||||
SSI_STATUS_DATALINK_ERROR,
|
||||
SSI_STATUS_SETUP_ASYNC_CONTEXT_ERROR,
|
||||
SSI_STATUS_MV_COMMAND_TIMEOUT,
|
||||
SSI_STATUS_MV_COMMAND_BUSY,
|
||||
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
|
||||
};
|
||||
|
||||
enum SSI_STATUS_SMARTMOTOR {
|
||||
SSI_STATUS_SMARTMOTOR_NORMAL = 0,
|
||||
SSI_STATUS_SMARTMOTOR_COMMERR,
|
||||
SSI_STATUS_SMARTMOTOR_UNKNOWN_ERROR,
|
||||
SSI_STATUS_SMARTMOTOR_LIMIT_REACHED,
|
||||
SSI_STATUS_SMARTMOTOR_TIMEOUT,
|
||||
SSI_STATUS_SMARTMOTOR_INVALID_PARAMETERS,
|
||||
SSI_STATUS_SMARTMOTOR_DATALINK_ERROR
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_PROTO_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
@@ -0,0 +1,56 @@
|
||||
#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_)
|
||||
@@ -0,0 +1,350 @@
|
||||
enum FUN_CMD
|
||||
{
|
||||
|
||||
CT_FUN,
|
||||
CT_MOTOR,
|
||||
CT_SCALE,
|
||||
CT_LIGHT,
|
||||
CT_INT,
|
||||
CT_DATA
|
||||
|
||||
};
|
||||
|
||||
enum MOTOR_CMD
|
||||
{
|
||||
|
||||
CT_MOVEX,
|
||||
|
||||
CT_MOVEY,
|
||||
|
||||
CT_MOVEZ,
|
||||
|
||||
|
||||
CT_MOVETOX,
|
||||
CT_MOVETOY,
|
||||
CT_MOVETOZ,
|
||||
|
||||
CT_MOVETOFX,
|
||||
CT_MOVETOFY,
|
||||
CT_MOVETOFZ,
|
||||
|
||||
CT_MOVETOSX,
|
||||
CT_MOVETOSY,
|
||||
CT_MOVETOSZ,
|
||||
|
||||
CT_MOVETOAX,
|
||||
CT_MOVETOAY,
|
||||
CT_MOVETOAZ,
|
||||
|
||||
CT_MOVETOASX,
|
||||
CT_MOVETOASY,
|
||||
CT_MOVETOASZ,
|
||||
|
||||
CT_MOVETOAFX,
|
||||
CT_MOVETOAFY,
|
||||
CT_MOVETOAFZ,
|
||||
|
||||
CT_RESETXYZ,
|
||||
CT_RESETX,
|
||||
CT_RESETY,
|
||||
CT_RESETZ,
|
||||
|
||||
CT_STOPA,
|
||||
CT_STOPX,
|
||||
CT_STOPY,
|
||||
CT_STOPZ,
|
||||
|
||||
CT_STOPFA,
|
||||
CT_STOPFX,
|
||||
CT_STOPFY,
|
||||
CT_STOPFZ,
|
||||
|
||||
CT_SET_SPEEDX,
|
||||
|
||||
|
||||
CT_SET_SPEEDY,
|
||||
|
||||
|
||||
CT_SET_SPEEDZ,
|
||||
|
||||
CT_READ_SPEEDX,
|
||||
CT_READ_SPEEDY,
|
||||
CT_READ_SPEEDZ,
|
||||
|
||||
CT_SET_PRECISIONX,
|
||||
CT_SET_PRECISIONY,
|
||||
CT_SET_PRECISIONZ,
|
||||
|
||||
CT_SET_DEFAULTX,
|
||||
CT_SET_DEFAULTY,
|
||||
CT_SET_DEFAULTZ,
|
||||
|
||||
CT_READ_PRECISIONX,
|
||||
CT_READ_PRECISIONY,
|
||||
CT_READ_PRECISIONZ,
|
||||
CT_RESET,
|
||||
|
||||
CT_MOVEV,
|
||||
CT_MOVETOV,
|
||||
CT_RESETV,
|
||||
CT_STOPV,
|
||||
CT_SET_SPEEDV,
|
||||
CT_READ_SPEEDV,
|
||||
CT_SET_DEFAULTV,
|
||||
CT_TESTV,
|
||||
CT_TSTOPV,
|
||||
CT_TEST_STOP,
|
||||
CT_READ_V,
|
||||
|
||||
CT_M_SPEED,
|
||||
CT_M_DIS,
|
||||
CT_M_FRESH,
|
||||
CT_M_CMD,
|
||||
CT_M_READ_DAT,
|
||||
CT_SET_MOTOR_CAL,
|
||||
|
||||
CT_M_SWITCH_START,
|
||||
CT_M_SWITCH_CLOSE,
|
||||
CT_M_SWITCH_TOP,
|
||||
CT_M_SWITCH_BOM,
|
||||
CT_M_SWITCH_RESET,
|
||||
CT_M_SWITCH_VALUE,
|
||||
CT_M_RESET_LEFT,
|
||||
CT_M_RESET_RIGHT,
|
||||
|
||||
CT_LASE_TIMMER_ON,
|
||||
CT_LASE_TIMMER_OFF,
|
||||
CT_M_PROBE_ON,
|
||||
CT_M_PROBE_OFF,
|
||||
CT_MOVETOXYZ,
|
||||
CT_MOVETOXYZ_LASE,
|
||||
CT_GET_LASE,
|
||||
CT_MOVETOXYZV,
|
||||
CT_M_LASE_ON,
|
||||
CT_M_LASE_OFF,
|
||||
CT_M_BCL_ON,
|
||||
CT_M_BCL_OFF,
|
||||
CT_MOVETOXYZ_JM,
|
||||
CT_READ_MOTOR_CAL,
|
||||
CT_END
|
||||
|
||||
};
|
||||
|
||||
enum SCALE_CMD
|
||||
{
|
||||
|
||||
CT_SEC_FLAG,
|
||||
|
||||
CT_SCALEX,
|
||||
CT_SCALEY,
|
||||
CT_SCALEZ,
|
||||
|
||||
CT_SECTIONX,
|
||||
CT_SECTIONY,
|
||||
CT_SECTIONZ,
|
||||
|
||||
CT_SET_AXISX,
|
||||
CT_SET_AXISY,
|
||||
CT_SET_AXISZ,
|
||||
|
||||
CT_SET_SECTIONX,
|
||||
CT_SET_SECTIONY,
|
||||
CT_SET_SECTIONZ,
|
||||
|
||||
CT_X_BEGIN,
|
||||
CT_Y_BEGIN,
|
||||
CT_Z_BEGIN,
|
||||
|
||||
CT_X_SECTION_END,
|
||||
CT_Y_SECTION_END,
|
||||
CT_Z_SECTION_END,
|
||||
|
||||
CT_X_SECTION_DEC,
|
||||
CT_Y_SECTION_DEC,
|
||||
CT_Z_SECTION_DEC,
|
||||
|
||||
CT_SET_SECTION_X,
|
||||
CT_SET_SECTION_Y,
|
||||
CT_SET_SECTION_Z,
|
||||
|
||||
CT_PROBE_FLAG,
|
||||
CT_SET_LINE_X,
|
||||
CT_SET_LINE_Y,
|
||||
CT_SET_LINE_Z,
|
||||
|
||||
CT_SET_PROBE_LINE,
|
||||
CT_SET_PROBE_SECTION,
|
||||
CT_SET_VERNO,
|
||||
CT_SET_RESET_FLAG,
|
||||
CT_GET_RESET_FLAG
|
||||
|
||||
};
|
||||
|
||||
enum LIGHT_CMD
|
||||
{
|
||||
|
||||
CT_LIGHT1_SIZE,
|
||||
CT_LIGHT2_SIZE,
|
||||
CT_LIGHT3_SIZE,
|
||||
CT_LIGHT4_SIZE,
|
||||
|
||||
CT_LIGHT1_SWITCH,
|
||||
CT_LIGHT2_SWITCH,
|
||||
CT_LIGHT3_SWITCH,
|
||||
CT_LIGHT4_SWITCH,
|
||||
CT_LIGHT5_SWITCH,
|
||||
CT_LIGHT_CMD
|
||||
|
||||
};
|
||||
|
||||
enum INT_CMD
|
||||
{
|
||||
|
||||
CT_STOPMX,
|
||||
CT_STOPMY,
|
||||
CT_STOPMZ,
|
||||
CT_STOPXYZ,
|
||||
|
||||
CT_ENDXYZ,
|
||||
|
||||
CT_SWITCHX,
|
||||
CT_SWITCHY,
|
||||
CT_SWITCHZ,
|
||||
|
||||
CT_PROBE,
|
||||
CT_PROBE_SWITCH,
|
||||
CT_XYZLASE,
|
||||
CT_SEND_XYZLASE,
|
||||
CT_END1
|
||||
|
||||
};
|
||||
|
||||
enum PRO_DATA
|
||||
{
|
||||
CT_READ_AXISXYZ,
|
||||
CT_READ_AXISX,
|
||||
CT_READ_AXISY,
|
||||
CT_READ_AXISZ,
|
||||
|
||||
CT_READ_PROBEXYZ,
|
||||
CT_READ_PROBEX,
|
||||
CT_READ_PROBEY,
|
||||
CT_READ_PROBEZ,
|
||||
|
||||
CT_SAVE_MOTORX1,
|
||||
CT_SAVE_MOTORX2,
|
||||
CT_SAVE_MOTORX3,
|
||||
CT_SAVE_MOTORX4,
|
||||
CT_SAVE_MOTORX5,
|
||||
|
||||
CT_SAVE_MOTORY1,
|
||||
CT_SAVE_MOTORY2,
|
||||
CT_SAVE_MOTORY3,
|
||||
CT_SAVE_MOTORY4,
|
||||
CT_SAVE_MOTORY5,
|
||||
|
||||
CT_SAVE_MOTORZ1,
|
||||
CT_SAVE_MOTORZ2,
|
||||
CT_SAVE_MOTORZ3,
|
||||
CT_SAVE_MOTORZ4,
|
||||
CT_SAVE_MOTORZ5,
|
||||
|
||||
CT_READ_MOTORX1,
|
||||
CT_READ_MOTORX2,
|
||||
CT_READ_MOTORX3,
|
||||
CT_READ_MOTORX4,
|
||||
CT_READ_MOTORX5,
|
||||
|
||||
CT_READ_MOTORY1,
|
||||
CT_READ_MOTORY2,
|
||||
CT_READ_MOTORY3,
|
||||
CT_READ_MOTORY4,
|
||||
CT_READ_MOTORY5,
|
||||
|
||||
CT_READ_MOTORZ1,
|
||||
CT_READ_MOTORZ2,
|
||||
CT_READ_MOTORZ3,
|
||||
CT_READ_MOTORZ4,
|
||||
CT_READ_MOTORZ5,
|
||||
|
||||
CT_SAVE_SCALEX,
|
||||
CT_SAVE_SCALEY,
|
||||
CT_SAVE_SCALEZ,
|
||||
|
||||
CT_READ_SCALEX,
|
||||
CT_READ_SCALEY,
|
||||
CT_READ_SCALEZ,
|
||||
|
||||
CT_SAVE_SECTION_FLAGX,
|
||||
CT_SAVE_SECTION_FLAGY,
|
||||
CT_SAVE_SECTION_FLAGZ,
|
||||
|
||||
CT_READ_SECTION_FLAGX,
|
||||
CT_READ_SECTION_FLAGY,
|
||||
CT_READ_SECTION_FLAGZ,
|
||||
|
||||
CT_SAVE_PROBE,
|
||||
CT_READ_PROBE,
|
||||
|
||||
CT_SAVE_SEC_REALX,
|
||||
CT_SAVE_SEC_INTX,
|
||||
CT_SAVE_SEC_SCALEX,
|
||||
|
||||
CT_SAVE_SEC_REALY,
|
||||
CT_SAVE_SEC_INTY,
|
||||
CT_SAVE_SEC_SCALEY,
|
||||
|
||||
CT_SAVE_SEC_REALZ,
|
||||
CT_SAVE_SEC_INTZ,
|
||||
CT_SAVE_SEC_SCALEZ,
|
||||
|
||||
CT_READ_SEC_REALX,
|
||||
CT_READ_SEC_INTX,
|
||||
CT_READ_SEC_SCALEX,
|
||||
|
||||
CT_READ_SEC_REALY,
|
||||
CT_READ_SEC_INTY,
|
||||
CT_READ_SEC_SCALEY,
|
||||
|
||||
CT_READ_SEC_REALZ,
|
||||
CT_READ_SEC_INTZ,
|
||||
CT_READ_SEC_SCALEZ,
|
||||
|
||||
CT_READ_SYSTEM,
|
||||
CT_READ_XSECTION_INT,
|
||||
CT_READ_XSECTION_REAL,
|
||||
CT_READ_XSECTION_SCALE,
|
||||
|
||||
CT_READ_YSECTION_INT,
|
||||
CT_READ_YSECTION_REAL,
|
||||
CT_READ_YSECTION_SCALE,
|
||||
|
||||
CT_READ_ZSECTION_INT,
|
||||
CT_READ_ZSECTION_REAL,
|
||||
CT_READ_ZSECTION_SCALE,
|
||||
|
||||
|
||||
CT_WRITE_SYSTEM,
|
||||
CT_WRITE_XSECTION_INT,
|
||||
CT_WRITE_XSECTION_REAL,
|
||||
CT_WRITE_XSECTION_SCALE,
|
||||
|
||||
CT_WRITE_YSECTION_INT,
|
||||
CT_WRITE_YSECTION_REAL,
|
||||
CT_WRITE_YSECTION_SCALE,
|
||||
|
||||
CT_WRITE_ZSECTION_INT,
|
||||
CT_WRITE_ZSECTION_REAL,
|
||||
CT_WRITE_ZSECTION_SCALE,
|
||||
|
||||
CT_READ_AXISV,
|
||||
CT_READ_ADC,
|
||||
CT_READ_ADC_INDEX,
|
||||
|
||||
CT_PRO_DAT_END,
|
||||
CT_CLEAR_PROBE_FLAG,
|
||||
|
||||
CT_READ_IO_DAT,
|
||||
CT_WRITE_IO_DAT
|
||||
|
||||
};
|
||||
@@ -0,0 +1,272 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "cmmio_base.h"
|
||||
#ifdef _WIN64
|
||||
#include "..\..\..\WAI64bit\WAI64bit.h"
|
||||
#endif
|
||||
|
||||
// added notifying feature to base class CMMIO [7/30/2004] /MP
|
||||
// - SetCallback(ptr) to establish the feedback path
|
||||
// then AddReceived will notify if such a ptr was set
|
||||
// caller receive function is prototyped as function(CString), i.e. Recieved(CString sWhat)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CMMIO::Init()
|
||||
{
|
||||
m_RXTempPtr = NULL;
|
||||
m_RXHead=NULL;
|
||||
m_RXTail=NULL;
|
||||
m_SXTempPtr = NULL;
|
||||
m_SXHead=NULL;
|
||||
m_SXTail=NULL;
|
||||
CurrentPointer=0;
|
||||
m_iNbMsgWaiting=0;
|
||||
m_terminator='\0';
|
||||
m_usesTerminator=FALSE;
|
||||
m_pReceiveNotify = NULL;
|
||||
}
|
||||
|
||||
void CMMIO::SetCallback(CMMIO::p_fstr ptr)
|
||||
{
|
||||
m_pReceiveNotify = ptr;
|
||||
}
|
||||
|
||||
DWORD CMMIO::Send(CString buffer, BOOL needsResponse/*=FALSE*/)
|
||||
{
|
||||
//ZH 12-12-05 EnterCriticalSection(&m_QueueLock); //ZH-122904
|
||||
|
||||
char LocBuffer[MAX_OUTPUT_BUFFER_SIZE];
|
||||
int length = buffer.GetLength ();
|
||||
if (length >MAX_OUTPUT_BUFFER_SIZE)
|
||||
{
|
||||
length = MAX_OUTPUT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
unsigned short* ptr = (unsigned short*)buffer.GetBuffer (MAX_OUTPUT_BUFFER_SIZE);
|
||||
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
LocBuffer[i] = (char)(ptr[i] & 0xff);
|
||||
}
|
||||
DWORD res = Send(LocBuffer,length, needsResponse);
|
||||
|
||||
//ZH 12-12-05 LeaveCriticalSection( &m_QueueLock ); //ZH-122904
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// GetNextReceived() : Helper function, rreturns receives messages placed in the queue
|
||||
// by LineReceive()
|
||||
//
|
||||
int CMMIO::GetNextReceived(char *inputBuf)
|
||||
{
|
||||
struct SerialList *Free;
|
||||
int cnt=0;
|
||||
|
||||
// If there is a previous block then delete it
|
||||
if (NULL != m_RXTempPtr)
|
||||
delete[] m_RXTempPtr;
|
||||
m_RXTempPtr = NULL;
|
||||
|
||||
// We are messing with pointers so use the CriticalSection
|
||||
// EnterCriticalSection(&m_QueueLock);
|
||||
|
||||
// If there any more to return
|
||||
if( m_RXHead )
|
||||
{
|
||||
Free = m_RXHead;
|
||||
m_RXHead = m_RXHead->Next;
|
||||
|
||||
// Point the temp pointer at the block
|
||||
m_RXTempPtr = Free->Buffer;
|
||||
cnt = Free->Bytes;
|
||||
// delete the list entry
|
||||
delete Free;
|
||||
--m_iNbMsgWaiting; // mp
|
||||
|
||||
// move over the data to the user's buffer
|
||||
if (NULL != inputBuf)
|
||||
memcpy (inputBuf, m_RXTempPtr, cnt);
|
||||
}
|
||||
|
||||
if( m_RXHead == NULL )
|
||||
m_RXTail = NULL;
|
||||
|
||||
// All done so out of the CriticalSection
|
||||
// LeaveCriticalSection( &m_QueueLock );
|
||||
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
int CMMIO::AddReceived( const char *Buffer,DWORD Bytes)
|
||||
{
|
||||
DWORD index = 0; //primary buffer index
|
||||
struct SerialList *Ptr;
|
||||
static char Buffer2[MAX_RECIEVE_BUFFER_SIZE]; // result buffer
|
||||
static char* pBuffer2 = &Buffer2[0];
|
||||
unsigned char c;
|
||||
bool bArmed;
|
||||
/************************************************************************/
|
||||
/* Greg Guilbeau - 2011/08/23 */
|
||||
/* The following line(s) have been modified to handle x64 conversion */
|
||||
/************************************************************************/
|
||||
/* int count; */
|
||||
INT_PTR count;
|
||||
static int escape = 0;
|
||||
static int tilde = 0;
|
||||
static int tildeseqcount = 0;
|
||||
|
||||
bool bDone = false;
|
||||
bool bEventRequest = false;
|
||||
|
||||
//TRACE(_T("AddReceived> pBuffer2 = %x\n"),pBuffer2);
|
||||
// TRACE(_T("Content %s\n"),Buffer);
|
||||
if (FALSE /*Bytes==0*/)
|
||||
{
|
||||
TRACE(_T("CMMIO> Exiting , no real input"));
|
||||
return TRUE;
|
||||
}
|
||||
do
|
||||
{
|
||||
bArmed = false;
|
||||
|
||||
for (;index<Bytes;index++)
|
||||
{
|
||||
c=Buffer[index] & 0xff;
|
||||
//TRACE(_T("== %02x% ==\n"),c); //copy char one by one
|
||||
*(pBuffer2++) = c ; //copy char one by one
|
||||
|
||||
// check for end of packet. ignore if this is the last char anyways
|
||||
if (m_usesTerminator && c == m_terminator && (index < Bytes - 1))
|
||||
{
|
||||
bArmed = TRUE;
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == Bytes)
|
||||
bArmed = bDone = true;
|
||||
|
||||
// We are messing with pointers so use the CriticalSection
|
||||
if (bArmed )
|
||||
{
|
||||
// EnterCriticalSection(&m_QueueLock);
|
||||
//Allocate a new list and add it in
|
||||
count = pBuffer2-(&Buffer2[0]);
|
||||
if (m_pReceiveNotify)
|
||||
{ // send a string to callback or,
|
||||
char* pLocalBuffer = new char[count+1];
|
||||
if (pLocalBuffer)
|
||||
{
|
||||
memcpy (pLocalBuffer,Buffer2,count);
|
||||
pLocalBuffer[count] = 0;
|
||||
CString LocalStr(pLocalBuffer);
|
||||
(*m_pReceiveNotify)(LocalStr);
|
||||
delete pLocalBuffer;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // add it as before to received data ....
|
||||
Ptr = new struct SerialList;
|
||||
Ptr->Buffer = new char[count + 1 ];
|
||||
/************************************************************************/
|
||||
/* Greg Guilbeau - 2011/08/23 */
|
||||
/* The following line(s) have been modified to handle x64 conversion */
|
||||
/************************************************************************/
|
||||
/* Ptr->Bytes = count; */
|
||||
#ifdef _WIN64
|
||||
Ptr->Bytes = WAI64bit::to32bit(count,__FILE__,__LINE__);
|
||||
#else
|
||||
Ptr->Bytes = count,__FILE__,__LINE__;
|
||||
#endif
|
||||
Ptr->Next = NULL;
|
||||
memcpy( Ptr->Buffer, Buffer2, count );
|
||||
Ptr->Buffer[count] = 0;
|
||||
|
||||
memcpy(m_sLastMessage,Buffer2,count); //copy to last message
|
||||
m_sLastMessage[count]=0;
|
||||
|
||||
if( m_RXTail )
|
||||
m_RXTail->Next = Ptr;
|
||||
else
|
||||
m_RXHead = Ptr;
|
||||
m_RXTail = Ptr;
|
||||
|
||||
// All done so out of the CriticalSection
|
||||
++m_iNbMsgWaiting;
|
||||
}
|
||||
// LeaveCriticalSection( &m_QueueLock );
|
||||
pBuffer2=&Buffer2[0]; // reset out buffer
|
||||
count = 0;
|
||||
bEventRequest = true;
|
||||
}
|
||||
}
|
||||
while (!bDone);
|
||||
//TRACE (_T("CMMIO> Done\n"));
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
void CMMIO::LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter /*= FALSE*/)
|
||||
{
|
||||
if (nbCharAvail != -1)
|
||||
{
|
||||
//TRACE(_T("LineReceive got %d chars \n"),nbCharAvail);
|
||||
char c;
|
||||
for (int i=0 ; i<nbCharAvail ; i++ )
|
||||
{
|
||||
c=s[i];
|
||||
m_InputBuffer[CurrentPointer++] = c;
|
||||
|
||||
// only add a packet if we have a delimiter
|
||||
if ((!m_usesTerminator && i == nbCharAvail -1) || (m_usesTerminator && c == m_terminator) || ignoreDelimiter)
|
||||
{
|
||||
m_InputBuffer[CurrentPointer] = '\0';
|
||||
AddReceived(m_InputBuffer, CurrentPointer);
|
||||
CurrentPointer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
DWORD CMMIO::Close()
|
||||
{
|
||||
struct SerialList *Free;
|
||||
|
||||
// Delete the contents of the temp rx pointer if any
|
||||
delete[] m_RXTempPtr;
|
||||
m_RXTempPtr = NULL;
|
||||
|
||||
// Clear down all internal lists
|
||||
// EnterCriticalSection( &m_QueueLock );
|
||||
while( m_RXHead )
|
||||
{
|
||||
Free = m_RXHead;
|
||||
m_RXHead = m_RXHead->Next;
|
||||
delete[] Free->Buffer;
|
||||
delete Free;
|
||||
}
|
||||
m_RXHead = NULL;
|
||||
|
||||
// for now we are not using the Transmit list
|
||||
#if 0
|
||||
|
||||
while( m_TXHead )
|
||||
{
|
||||
Free = m_TXHead;
|
||||
m_TXHead = m_TXHead->Next;
|
||||
delete[] Free->Buffer;
|
||||
delete Free;
|
||||
}
|
||||
m_TXHead = NULL;
|
||||
#endif
|
||||
// LeaveCriticalSection( &m_QueueLock );
|
||||
return(TRUE);
|
||||
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// END OF BASE CLASS CMMIO
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
#ifndef CMMIO_BASE_H
|
||||
#define CMMIO_BASE_H
|
||||
|
||||
#include <WinBase.h>
|
||||
#include <WinDef.h>
|
||||
|
||||
|
||||
#define MAX_OUTPUT_BUFFER_SIZE 2048
|
||||
#define MAX_RECIEVE_BUFFER_SIZE 16000
|
||||
|
||||
// TCP, serial style routines
|
||||
struct SerialList
|
||||
{
|
||||
struct SerialList *Next;
|
||||
DWORD Bytes;
|
||||
int Item;
|
||||
char *Buffer;
|
||||
};
|
||||
|
||||
class CMMIO
|
||||
{
|
||||
private:
|
||||
// For now we are not using the transmit list
|
||||
// struct SerialList *m_TXHead;
|
||||
char m_terminator;
|
||||
BOOL m_usesTerminator;
|
||||
char m_InputBuffer[MAX_RECIEVE_BUFFER_SIZE];
|
||||
int CurrentPointer;
|
||||
char m_sLastMessage[MAX_RECIEVE_BUFFER_SIZE];
|
||||
|
||||
struct SerialList *m_RXHead;
|
||||
struct SerialList *m_RXTail;
|
||||
char *m_RXTempPtr;
|
||||
CString m_LastError;
|
||||
BOOL m_hasError;
|
||||
|
||||
protected:
|
||||
CString m_lastErrMsg;
|
||||
int m_iNbMsgWaiting;
|
||||
BOOL m_UseBuffferedSend;
|
||||
CRITICAL_SECTION m_QueueLock;
|
||||
CRITICAL_SECTION m_ReadLock;
|
||||
CRITICAL_SECTION m_WriteLock;
|
||||
|
||||
struct SerialList *m_SXHead;
|
||||
struct SerialList *m_SXTail;
|
||||
char *m_SXTempPtr;
|
||||
|
||||
protected:
|
||||
virtual void Init();
|
||||
int AddReceived( const char *Buffer,DWORD Bytes); // [7/30/2004]
|
||||
void Error(CString sErr) {
|
||||
TRACE(sErr);
|
||||
m_LastError = sErr;
|
||||
m_hasError = TRUE;
|
||||
}
|
||||
|
||||
virtual DWORD Close();
|
||||
|
||||
public:
|
||||
CMMIO()
|
||||
{
|
||||
InitializeCriticalSection( &m_QueueLock ); // Sean Flynn mutex needs to be initialized prior to attempting to lock otherwise it will core
|
||||
InitializeCriticalSection( &m_ReadLock ); // initializing here will ensure the mutex is always initialized
|
||||
InitializeCriticalSection( &m_WriteLock );
|
||||
Init();
|
||||
};
|
||||
|
||||
virtual ~CMMIO()
|
||||
{
|
||||
DeleteCriticalSection( &m_QueueLock ); // Clean up the mutexes resources when the destructor is called.
|
||||
DeleteCriticalSection( &m_ReadLock );
|
||||
DeleteCriticalSection( &m_WriteLock );
|
||||
};
|
||||
|
||||
virtual DWORD Open() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL getError(CString& sErr) {
|
||||
BOOL hasError = m_hasError;
|
||||
if (m_hasError)
|
||||
{
|
||||
sErr = m_LastError;
|
||||
m_hasError = FALSE;
|
||||
}
|
||||
return (hasError);
|
||||
}
|
||||
|
||||
virtual int GetNextReceived(char *inputBuf=NULL);
|
||||
|
||||
virtual int HasNextReceived(void) {
|
||||
return (m_RXHead ? m_RXHead->Bytes : FALSE);
|
||||
}
|
||||
virtual void SetTerminateChar(char ch) {
|
||||
m_terminator=ch;
|
||||
m_usesTerminator=TRUE;
|
||||
}
|
||||
virtual void LineReceive(char* s, int nbCharAvail, BOOL ignoreDelimiter = FALSE);
|
||||
virtual CString GetLastErrStr() {
|
||||
return m_lastErrMsg;
|
||||
}
|
||||
|
||||
typedef void(*p_fstr)(CString);
|
||||
void SetCallback(p_fstr);
|
||||
|
||||
virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse=FALSE) = 0; // [8/11/2004]
|
||||
virtual DWORD Send(CString buffer, BOOL needsResponse=FALSE); // [8/11/2004]
|
||||
|
||||
virtual bool IsValid() = 0; // pure virtual function
|
||||
protected:
|
||||
p_fstr m_pReceiveNotify;
|
||||
};
|
||||
|
||||
|
||||
#endif // CMMIO_BASE_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,192 @@
|
||||
#ifndef CMMIO_SERIAL_H
|
||||
#define CMMIO_SERIAL_H
|
||||
|
||||
#include <WinBase.h>
|
||||
#include <WinDef.h>
|
||||
#include "CMMIO_BASE.H "
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
*$!!***************************************************************************
|
||||
*$!! MODULE NAME
|
||||
*$!! Serial.h
|
||||
*$!!
|
||||
*$!! DESCRIPTION
|
||||
*$!! Header file for CSerial.
|
||||
*$!!
|
||||
*$!! AUTHOR
|
||||
*$!! M.J.S.Gooder.
|
||||
*$!!
|
||||
*$!! HISTORY
|
||||
*$!! $Log: /Plugins/BPI/Serial.h $
|
||||
*$!!
|
||||
*$!! 28 19/03/98 14:04 Mgooder
|
||||
*$!!***************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Function for starting serial monitor thread
|
||||
unsigned int WINAPI CSerialTask(LPVOID CSerialPtr);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Useful serial codes
|
||||
const char CS_NUL = 0;
|
||||
const char CS_SOH = 1;
|
||||
const char CS_STX = 2;
|
||||
const char CS_ETX = 3;
|
||||
const char CS_EOT = 4;
|
||||
const char CS_ENQ = 5;
|
||||
const char CS_ACK = 6;
|
||||
const char CS_BEL = 7;
|
||||
const char CS_LF = 10;
|
||||
const char CS_DLE = 16;
|
||||
const char CS_X_ON = 17;
|
||||
const char CS_X_OFF = 19;
|
||||
const char CS_NAK = 21;
|
||||
const char CS_ETB = 23;
|
||||
const char CS_CAN = 24;
|
||||
const char CS_ESC = 27;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Handshake settings
|
||||
const int CS_HANDSHAKE_RTSCTS = 1;
|
||||
const int CS_HANDSHAKE_XONXOFF = 2;
|
||||
const int CS_HANDSHAKE_NONE = 3;
|
||||
const int CS_HANDSHAKE_RTSCTS_DTRDSR = 4;
|
||||
const int CS_HANDSHAKE_FOR_SO7 = 5;
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Debug constants
|
||||
const int CS_DEBUG_SIZE = 1024;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Timeouts (ms)
|
||||
const int CS_DEFAULT_RX_TIMEOUT = 25;
|
||||
const int CS_DEFAULT_TX_TIMEOUT = 1000;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// The CSerial class
|
||||
|
||||
class CSerial : public CMMIO
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CSerial();
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CSerial();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
// Open the serial port ( if possible ) using the parameters set by SetPort()
|
||||
DWORD Open();
|
||||
// Setup the serial port prior to opening it
|
||||
int SetPort( int Port, int Baud = 0, char Parity = 0, int Bits = 0,
|
||||
int StopBits = 0, int HandShake = 0 );
|
||||
// Set up the port timeouts
|
||||
void SetTimeouts( int RXTimeout = CS_DEFAULT_RX_TIMEOUT,
|
||||
int TXTimeout = CS_DEFAULT_TX_TIMEOUT );
|
||||
// Get the serial port settings
|
||||
void GetPortData( int *Port, int *Baud, char *Parity, int *Bits,
|
||||
int *StopBits, int *HandShake );
|
||||
// Test if the serial port is open
|
||||
bool IsValid() {
|
||||
return IsOpen()!=0;
|
||||
}
|
||||
int IsOpen( void );
|
||||
// Close the serial port
|
||||
DWORD Close( void );
|
||||
// Flush all data in any serial port buffers
|
||||
int FlushPort( void );
|
||||
// Attempt to read the specified number of bytes
|
||||
DWORD ReadPort( char *Buffer, DWORD Bytes );
|
||||
DWORD ReadPort( CString &Buffer, DWORD Bytes );
|
||||
// Attempt to write the specified number of bytes
|
||||
DWORD WritePort( const char *Buffer, DWORD Bytes );
|
||||
// Send the specifed number of bytes out when possible
|
||||
int Transmit( const char *Buffer, DWORD Bytes );
|
||||
// Add a block of data to the internal list of receieved blocks
|
||||
int AddReceived( const char *Buffer, DWORD Bytes );
|
||||
// Get the next block of data added with AddReceived()
|
||||
// char *GetNextReceived( void );
|
||||
// Find the maximum port number available
|
||||
int MaxPort( void );
|
||||
// Add text to the debug output
|
||||
void AddToDebug( const char *Ptr, DWORD BytesToCopy, int State );
|
||||
// Attach this serial port to a debug window
|
||||
//CSerialRaw *AttachWnd( CWnd *Wnd );
|
||||
// Convert ascii hex into an int
|
||||
int HexToInt( char *Data, int Bytes );
|
||||
|
||||
virtual DWORD Send(LPCSTR buffer, int l, BOOL needsResponse=FALSE);
|
||||
//virtual DWORD Send(CString what);
|
||||
|
||||
// Called when data is received on the serial port
|
||||
virtual void OnReceive( void );
|
||||
// Called when data has been sent using the Transmit() function
|
||||
virtual void OnTransmit( int Item, DWORD Error );
|
||||
|
||||
private:
|
||||
// Private so no comment :-)
|
||||
void RegisterDebugWindow(void);
|
||||
void SendBuffer(int Next);
|
||||
void ReceiveTask(void);
|
||||
int ProgramPort(int Port,int Baud,char Parity,int Bits,int StopBits,int HandShake);
|
||||
|
||||
// Attributes
|
||||
protected:
|
||||
int m_RXTimeout;
|
||||
int m_TXTimeout;
|
||||
|
||||
// Attributes
|
||||
private:
|
||||
char m_Parity;
|
||||
// char m_DebugData[CS_DEBUG_SIZE];
|
||||
// char m_DebugState[CS_DEBUG_SIZE];
|
||||
// char *m_RXTempPtr;
|
||||
int m_Port;
|
||||
int m_Baud;
|
||||
int m_Bits;
|
||||
int m_StopBits;
|
||||
int m_HandShake;
|
||||
int m_MaxTXRetries;
|
||||
int m_DebugInPtr;
|
||||
int m_DebugCount;
|
||||
int m_Item;
|
||||
// struct SerialList *m_TXHead;
|
||||
// struct SerialList *m_TXTail;
|
||||
// struct SerialList *m_RXHead;
|
||||
// struct SerialList *m_RXTail;
|
||||
OVERLAPPED m_ReceiveOLap;
|
||||
OVERLAPPED m_TransmitOLap;
|
||||
OVERLAPPED m_ReadOLap;
|
||||
OVERLAPPED m_WriteOLap;
|
||||
HANDLE m_PortHandle;
|
||||
HANDLE m_ThreadHandle;
|
||||
HANDLE m_ReceiveTaskEvent;
|
||||
|
||||
private:
|
||||
friend unsigned int WINAPI CSerialTask(LPVOID CSerialPtr);
|
||||
|
||||
//Buffer for incomming commands:
|
||||
int CurrentPointer;
|
||||
public:
|
||||
HANDLE m_hWaitCMMResponse;
|
||||
HANDLE m_hNewRx;
|
||||
|
||||
// BV Nov 2001: Made public
|
||||
// CRITICAL_SECTION m_QueueLock;
|
||||
BOOL m_iRecvState;
|
||||
CString m_csRecv;
|
||||
INT m_iRecvByte;
|
||||
};
|
||||
|
||||
#endif // CMMIO_SERIAL_H
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 484 KiB |
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,433 @@
|
||||
// protocol for control SevenOcean's Machine
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef AFX_SO7_Proto_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
#define AFX_SO7_Proto_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "..\Tools\UsbUtility\logger.h"
|
||||
#include "CMD_H.h"
|
||||
#include "..\..\..\..\..\ThirdParty\UsbSupport\LibUsb_Win\Include\lusb0_usb.h"
|
||||
#include "..\MicroVu\SsiStatus.h"
|
||||
|
||||
#define MAX_BUFF_SIZE 0x200
|
||||
|
||||
#define USB_ENDPOINT_TYPE_CONTROL 0
|
||||
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
|
||||
#define USB_ENDPOINT_TYPE_BULK 2
|
||||
#define USB_ENDPOINT_TYPE_INTERRUPT 3
|
||||
|
||||
#define USB_DEVICE_DESCRIPTOR_TYPE 1
|
||||
#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2
|
||||
|
||||
#define THREAD_RUNNING_STATE1 0
|
||||
#define THREAD_RUNNING_STATE2 2
|
||||
#define THREAD_PAUSED 1
|
||||
#define THREAD_EXIT -1
|
||||
|
||||
// Device configuration and interface id.
|
||||
#define SO7_USB_CONFIG 1
|
||||
#define SO7_USB_INTF 0
|
||||
|
||||
|
||||
|
||||
#define EP_S07_01 0x01
|
||||
#define EP_S07_02 0x02
|
||||
#define EP_S07_03 0x03
|
||||
#define EP_S07_81 0x81
|
||||
#define EP_S07_82 0x82
|
||||
#define EP_S07_84 0x84
|
||||
|
||||
#define EP_01_CMD_IDX 0 // index to usb buffers
|
||||
#define EP_81_DATA_IDX 1 //
|
||||
#define EP_02_CMD_IDX 2 //
|
||||
#define EP_82_DATA_IDX 3 //
|
||||
#define EP_03_CMD_IDX 4 //
|
||||
#define EP_84_DATA_IDX 5 //
|
||||
|
||||
#define lEPSIZE 6
|
||||
#define MAXRINGS 5 // for MicroVu Vertex 220
|
||||
#define MAXSEGS 8
|
||||
|
||||
#define TWO_RINGS 2
|
||||
#define EIGHT_SEGS 8
|
||||
#define FIVE_RINGS 5
|
||||
|
||||
const long MAX_INTENSITY = 0x3FF;
|
||||
#define MAXLIGHTVALUE 256
|
||||
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
//****************************************************************************************************
|
||||
// Set the _status to Idle after reply data has been received.
|
||||
// How to recover? In order to send data, _status must be Idle. If the system is not available
|
||||
// for 1 second, assume something wrong and treat it as "TimeOut".
|
||||
// Another way to do this is to lock this structure is to use a mutex to ensure single-threaded
|
||||
// access.
|
||||
//****************************************************************************************************
|
||||
//====================================================================================================
|
||||
|
||||
typedef struct s_so7_axis // axis parameters
|
||||
{
|
||||
char _Move_Speed_Gear;
|
||||
union
|
||||
{
|
||||
long _long_;
|
||||
char _char_[4];
|
||||
}_pos_fixed;
|
||||
union
|
||||
{
|
||||
long _long_;
|
||||
char _char_[4];
|
||||
}_scale_pos;
|
||||
double _d_cur_pos_;
|
||||
long _scale_probe;
|
||||
double _dSet_Zero_Pos;
|
||||
long _lSet_Zero_Pos;
|
||||
} SO7AXIS;
|
||||
struct s_so7_axis_config // axis configuration
|
||||
{
|
||||
double _motor_precision;//set precision
|
||||
double _motor_wheelbase;//set wheelbase
|
||||
|
||||
char _speed_base[5];
|
||||
char _speed_fresh[5];
|
||||
char _speed_start[5];
|
||||
char _speed_max[5];
|
||||
double _speed_slow_dis[5];
|
||||
|
||||
long _scale_range;
|
||||
double _neg_working_limit;
|
||||
double _pos_working_limit;
|
||||
|
||||
double _scale_resolution;
|
||||
bool _bhomed;
|
||||
};
|
||||
struct s_so7_zm_axis_config // zm configuration
|
||||
{
|
||||
int _ComPort;
|
||||
double _StartDegree;
|
||||
double _EndDegree;
|
||||
double _RelativeZeroDegree;
|
||||
double _Deadband;
|
||||
int _ReadingInterval;
|
||||
double _PulseScale;
|
||||
short _SpeedFast;
|
||||
short _SpeedSlow;
|
||||
CString _ProductID;
|
||||
long _neg_working_limit;
|
||||
long _pos_working_limit;
|
||||
double _neg_deg_working_limit; // within the limits
|
||||
double _pos_deg_working_limit;
|
||||
|
||||
union
|
||||
{
|
||||
short _short_;
|
||||
char _char_[2];
|
||||
}_speed;
|
||||
};
|
||||
struct s_so7_machine_interface_config
|
||||
{
|
||||
BOOL _EnCloseLoop;
|
||||
int _RetryTimes;
|
||||
double _ShiftPositionX;
|
||||
double _ShiftPositionY;
|
||||
double _ShiftPositionZ;
|
||||
};
|
||||
|
||||
//======================
|
||||
typedef struct s_so7_xyzzm
|
||||
{
|
||||
bool bFast;
|
||||
long from;
|
||||
long to;
|
||||
long speed;
|
||||
long acc;
|
||||
long dec;
|
||||
double dFromMM;
|
||||
double dToMM;
|
||||
} SO7AXISMOVE;
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
struct struct_so7_machine
|
||||
{ // g_machine structure
|
||||
struct s_machine_config
|
||||
{
|
||||
double _dXYZSpeed;
|
||||
|
||||
struct s_so7_axis_config x_axis;
|
||||
struct s_so7_axis_config y_axis;
|
||||
struct s_so7_axis_config z_axis;
|
||||
struct s_so7_zm_axis_config zm_axis;
|
||||
struct s_so7_machine_interface_config motion;
|
||||
} s_machine_config;
|
||||
struct s_status
|
||||
{
|
||||
bool _homed;
|
||||
bool _machine_running;
|
||||
bool _bXMoving;
|
||||
bool _bYMoving;
|
||||
bool _bZMoving;
|
||||
bool _bZMMoving;
|
||||
char _bIsZMMotionFinished;
|
||||
bool _bZMHoming;
|
||||
bool _bXYZZMIdle;
|
||||
} s_status;
|
||||
union {
|
||||
struct s_lights_value
|
||||
{
|
||||
char _top_light;
|
||||
char _bottom_light;
|
||||
char _ring_light;
|
||||
char _coaxial_light;
|
||||
char _spare_light1;
|
||||
char segment[TWO_RINGS];
|
||||
} s_lights_value;
|
||||
};
|
||||
char cFixtureFlag;
|
||||
char Light_Size;
|
||||
char Light_Switch;
|
||||
char ADC_Number;
|
||||
int ADC_Value;
|
||||
char Sys_Reset_Flag;
|
||||
char cVerNumber;
|
||||
char InterruptFlag[2];
|
||||
int _motor_pulse_num;
|
||||
|
||||
struct s_so7_axis x;
|
||||
struct s_so7_axis y;
|
||||
struct s_so7_axis z;
|
||||
struct s_so7_axis zm;
|
||||
|
||||
};
|
||||
|
||||
#define SEVENOCEAN_VID 0x4532
|
||||
#define SEVENOCEAN_PID 0x5567
|
||||
|
||||
//****************************************************************************************************
|
||||
// Binary SevenOcean command structure, out going
|
||||
//
|
||||
//****************************************************************************************************
|
||||
#define pSO7_CMD_02 ((s_SO7_CMD_BUFF_02 *) ep_buff[EP_02_CMD_IDX]._buffer)
|
||||
|
||||
struct s_SO7_CMD_BUFF_02
|
||||
{
|
||||
UCHAR uCmdByte;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
BYTE uSubCmdByte;
|
||||
char data[9];
|
||||
}s_SO7_CMD_MOVE_TO_XYZ;
|
||||
struct
|
||||
{
|
||||
BYTE uSubCmdByte;
|
||||
char data[12];
|
||||
}s_SO7_CMD_MOVETOXYZV;
|
||||
struct
|
||||
{
|
||||
BYTE uSubCmdByte;
|
||||
BYTE uStartCmdByte;
|
||||
char _bottom_light;
|
||||
char _top_light;
|
||||
char _ring_light;
|
||||
char _coaxial_light;
|
||||
char _spare_light1;
|
||||
char _outer_ring_light_switch;
|
||||
char _inner_ring_light_switch;
|
||||
BYTE uEndCmdByte;
|
||||
}s_SO7_CMD_SET_LIGHT;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
//======================
|
||||
struct struct_so7_ep_buff
|
||||
{
|
||||
int _ep;
|
||||
BYTE _save_send_cmd;
|
||||
BYTE _save_send_cmd0;
|
||||
BYTE _save_send_cmd1;
|
||||
char *_buffer; // MAX_BUFF_SIZE
|
||||
int _size;
|
||||
void *_async_context;
|
||||
BOOL _hProtoPending;
|
||||
HANDLE _event;
|
||||
};
|
||||
|
||||
//======================================================================================
|
||||
class CSO7_Proto
|
||||
{
|
||||
public:
|
||||
// EP 81/82 channel threads.
|
||||
static int g_hEP8x_Thread_State;
|
||||
static unsigned __stdcall g_EP8x_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP8x_Thread_Id;
|
||||
|
||||
// EP 02channel threads.
|
||||
static int g_hEP02_Thread_State;
|
||||
static unsigned __stdcall g_EP02_Thread(LPVOID pThis);
|
||||
static HANDLE g_hEP02_Thread_Id;
|
||||
static HANDLE g_hEP02_Serial_Mutex; // EP02
|
||||
|
||||
static HANDLE g_hHomedEvent;
|
||||
|
||||
//
|
||||
CSO7_Proto();
|
||||
virtual ~CSO7_Proto();
|
||||
|
||||
// Global Structures
|
||||
static struct_so7_ep_buff ep_buff[lEPSIZE];
|
||||
static struct_so7_machine g_machine;
|
||||
|
||||
|
||||
SSI_STATUS_MOTION Init_SO7Usb();
|
||||
SSI_STATUS_MOTION Exit_SO7Usb();
|
||||
|
||||
usb_dev_handle* _open_usb_dev(void);
|
||||
SSI_STATUS_MOTION _do_single_threaded_usb_comm(int iEP);
|
||||
|
||||
SSI_STATUS_MOTION _read_data_8x(int iEP_Base);
|
||||
SSI_STATUS_MOTION _send_usb_cmd(int iEP_Base);
|
||||
SSI_STATUS_MOTION _write_usb_data_only(int iEP_Base);
|
||||
static void _process_rcv_transfer_data(int iEP);
|
||||
|
||||
static double TimeInSecs(void);
|
||||
static CLogger* g_pLogger;
|
||||
static usb_dev_handle *g_dev;
|
||||
bool m_bHomingActive;
|
||||
|
||||
double ScaleToMM(long lCount, double dResolution);
|
||||
long MMtoScale(double lDistanceMM, double dResolution);
|
||||
static void Trace_EP_Buff(long lIndex);
|
||||
|
||||
static void _swap_byte(unsigned short &Val);
|
||||
static void _reverse_dword(DWORD *);
|
||||
static void _scale2inch(unsigned long scale, double &inch);
|
||||
static void _inch2scale(unsigned long &scale, double inch);
|
||||
static long _4char2long(unsigned char *cBuff);
|
||||
static long _3char2long(unsigned char *cBuff);
|
||||
static void _char2bin(unsigned char *cBuff, BYTE *cBytes, int len);
|
||||
|
||||
SSI_STATUS_MOTION _replay_capture(CString cFileName);
|
||||
SSI_STATUS_MOTION _process_replay_capture_commands(char *inBuff, FILE* pInFile);
|
||||
SSI_STATUS_MOTION Load_SevenOcean_Inifile(CString csSO7INIFile);
|
||||
SSI_STATUS_MOTION Save_SevenOcean_Inifile(CString csSO7INIFile);
|
||||
SSI_STATUS_MOTION Load_So7_Config();
|
||||
SSI_STATUS_MOTION Save_So7_Config();
|
||||
SSI_STATUS_MOTION GetAppPath(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);
|
||||
bool so7_motion_is_homed();
|
||||
SSI_STATUS_MOTION so7_motion_Dcc_Home();
|
||||
SSI_STATUS_MOTION _start_machine();
|
||||
SSI_STATUS_MOTION _shutdown_machine();
|
||||
SSI_STATUS_MOTION so7_motion_probe_on_off_(bool _bOnOff);
|
||||
SSI_STATUS_MOTION so7_motion_reset_worktable_lower_left();
|
||||
SSI_STATUS_MOTION so7_motion_reset_worktable_top_right();
|
||||
SSI_STATUS_MOTION so7_motion_stop_motor_to_get_laser_data();
|
||||
SSI_STATUS_MOTION so7_motion_laser_on_off(bool _bOnOff);
|
||||
SSI_STATUS_MOTION so7_motion_fixture_on_off(bool _bOnOff);
|
||||
SSI_STATUS_MOTION so7_motion_fixture_up_down(bool _bOnOff);
|
||||
SSI_STATUS_MOTION so7_motion_reset_controller_parameter();
|
||||
|
||||
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_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 _calculate_straightline_motion(double dSpeedMM);
|
||||
|
||||
SSI_STATUS_MOTION so7_optics_set_scale_position(long lScale);
|
||||
SSI_STATUS_MOTION so7_optics_get_scale_position(long &lScale);
|
||||
SSI_STATUS_MOTION so7_optics_get_scale_range(long &neg_scale_range, long &pos_scale_range);
|
||||
|
||||
void so7_set_full_ringlight_data(long lIntensity);
|
||||
void so7_set_ringlight_data(long lMaxSize, double *pSegments);
|
||||
|
||||
SSI_STATUS_MOTION so7_light_set_light_off();
|
||||
SSI_STATUS_MOTION so7_light_set_light();
|
||||
SSI_STATUS_MOTION so7_light_set_lamp_state(double dBottomPercent, double dTopPercent);
|
||||
|
||||
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_Z(char SpeedGear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_ZM(char SpeedGear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_STOP_MOVE_XYZ();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_RESET_XYZ();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_RESET_V();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_STOP_V();
|
||||
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_TO_POS_X();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_TO_POS_Y();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_TO_POS_Z();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_TO_POS_ZM();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_TO_POS_XYZ(char ProbeType);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_MOVE_TO_POS_XYZV();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_AXIS_XYZ();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_PROBE_XYZ();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_V_DATA();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_GET_RESET_FLAG();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_GET_FIXTURE_VALUE();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_RESET_FLAG();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_LIGHT_SIZE(char subCMD,BYTE LightValue);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_ALL_LIGHT_VALUE();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_VER_NUMBER();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_CORRECTION_SCALE(char cAxisType);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_SECTION(char cAxisType);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_COMMON_COMMAND(char Cmd,char SubCmd,char Type);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_COMMON_COMMAND_DATA(char Cmd,char SubCmd,char Type,char Data);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_ZOOM_SPEED(char xyz_gear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_SPEED_PARAMETER(char axis_type,char xyz_gear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_SPEED_PRECISION(char axis_type);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_SPEED_PARAMETER(char axis_type,char xyz_gear);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_SET_MOTOR_SPEED_WHEELBASE_PARAMETER();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_MOTOR_SPEED_WHEELBASE_PARAMETER();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_SPEED_PRECISION(char axis_type);
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_INTERRUPT_MESSAGE();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_READ_ZOOM_MOTION_STATUS();
|
||||
SSI_STATUS_MOTION _send_cmd_SO7_CMD_OPEN_KEYENCE_LASER();
|
||||
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_X();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_Y();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_Z();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_ZM();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_RESET_XYZ();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_TO_POS_X();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_TO_POS_Y();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_TO_POS_Z();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_TO_POS_ZM();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_MOVE_TO_POS_XYZ();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_AXIS_XYZ();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_PROBE_XYZ();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_V_DATA();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_GET_GET_RESET_FLAG();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_GET_GET_FIXTURE_VALUE();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_SET_LIGHT();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_SET_SPEED_PARAMETER();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_SET_SPEED_PRECISION();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_SPEED_PARAMETERX();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_SPEED_PARAMETERY();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_SPEED_PARAMETERZ();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_SET_SPEED_MOTOR_WHEELBASE_PARAMETER();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_MOTOR_SPEED_WHEELBASE_PARAMETER();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_SPEED_PRECISIONX();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_SPEED_PRECISIONY();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_SPEED_PRECISIONZ();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_INTERRUPT_MESSAGE();
|
||||
static SSI_STATUS_MOTION _process_SO7_CMD_READ_ZOOM_MOTION_STATUS();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,238 @@
|
||||
#include "StdAfx.h"
|
||||
#include <WinDef.h>
|
||||
#include <WinBase.h>
|
||||
#include "..\Keyence\LkIF.h"
|
||||
#include "So7_Interface.h "
|
||||
|
||||
#define MAX_STORAGE_DATA_SIZE 65536
|
||||
|
||||
CSo7_Interface::CSo7_Interface()
|
||||
{
|
||||
m_bIsStorage=FALSE;
|
||||
m_iSetOutNo=0;
|
||||
m_StoredDataNumber=0;
|
||||
m_NeedStorageDataNumber=0;
|
||||
|
||||
}
|
||||
|
||||
CSo7_Interface::~CSo7_Interface()
|
||||
{
|
||||
FreeLibrary(m_hImageDLL);
|
||||
}
|
||||
//========================================
|
||||
void CSo7_Interface::KeyenceLaserInit(void)
|
||||
{
|
||||
m_hImageDLL=LoadLibrary(_T("Image.dll"));
|
||||
if(m_hImageDLL)
|
||||
{
|
||||
m_pGetCalcData=(pLKIF_GetCalcData)GetProcAddress(m_hImageDLL,"LKIF_GetCalcData");
|
||||
m_pDataStorageStart=(pLKIF_DataStorageStart)GetProcAddress(m_hImageDLL,"LKIF_DataStorageStart");
|
||||
m_pDataStorageStop=(pLKIF_DataStorageStop)GetProcAddress(m_hImageDLL,"LKIF_DataStorageStop");
|
||||
m_pDataStorageInit=(pLKIF_DataStorageInit)GetProcAddress(m_hImageDLL,"LKIF_DataStorageInit");
|
||||
m_pDataStorageGetData=(pLKIF_DataStorageGetData)GetProcAddress(m_hImageDLL,"LKIF_DataStorageGetData");
|
||||
m_pDataStorageGetStatus=(pLKIF_DataStorageGetStatus)GetProcAddress(m_hImageDLL,"LKIF_DataStorageGetStatus");
|
||||
m_pSetDataStorage=(pLKIF_SetDataStorage)GetProcAddress(m_hImageDLL,"LKIF_SetDataStorage");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//==============================================
|
||||
void CSo7_Interface::Get_KeyenceLaserData(float *LaserValue1,float *LaserValue2)
|
||||
{
|
||||
*LaserValue1=10;
|
||||
*LaserValue2=10;
|
||||
LKIF_FLOATVALUE GetVal1,GetVal2;
|
||||
if(m_pGetCalcData(&GetVal1,&GetVal2)!=1)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
switch(GetVal1.FloatResult)
|
||||
{
|
||||
case LKIF_FLOATRESULT_RANGEOVER_P:
|
||||
{
|
||||
*LaserValue1=50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_RANGEOVER_N:
|
||||
{
|
||||
*LaserValue1=-50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_WAITING:
|
||||
{
|
||||
*LaserValue1=0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*LaserValue1=GetVal1.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(GetVal2.FloatResult)
|
||||
{
|
||||
case LKIF_FLOATRESULT_RANGEOVER_P:
|
||||
{
|
||||
*LaserValue2=50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_RANGEOVER_N:
|
||||
{
|
||||
*LaserValue2=-50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_WAITING:
|
||||
{
|
||||
*LaserValue2=0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*LaserValue2=GetVal2.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================
|
||||
BOOL CSo7_Interface::StartStoreData(int _NeedStorageDataNumber,int _SampleTime)
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (!m_bIsStorage)
|
||||
{
|
||||
bStatus=m_pDataStorageInit();
|
||||
if (_NeedStorageDataNumber<1)
|
||||
{
|
||||
_NeedStorageDataNumber=1;
|
||||
}
|
||||
else if (_NeedStorageDataNumber>65536)
|
||||
{
|
||||
_NeedStorageDataNumber=65536;
|
||||
}
|
||||
m_NeedStorageDataNumber=_NeedStorageDataNumber;
|
||||
|
||||
if (_SampleTime<0.4)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_1;
|
||||
}
|
||||
else if (_SampleTime<1)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_2;
|
||||
}
|
||||
else if (_SampleTime<2)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_5;
|
||||
}
|
||||
else if (_SampleTime<4)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_10;
|
||||
}
|
||||
else if (_SampleTime<10)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_20;
|
||||
}
|
||||
else if (_SampleTime<20)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_50;
|
||||
}
|
||||
else if (_SampleTime<40)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_100;
|
||||
}
|
||||
else if (_SampleTime<100)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_200;
|
||||
}
|
||||
else if (_SampleTime<200)
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_500;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_StorageCycle=LKIF_STORAGECYCLE_1000;
|
||||
}
|
||||
bStatus=m_pSetDataStorage(LKIF_TARGETOUT_OUT1,m_NeedStorageDataNumber,m_StorageCycle);
|
||||
|
||||
if (bStatus)
|
||||
{
|
||||
bStatus=m_pDataStorageStart();
|
||||
}
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CSo7_Interface::StopStoreData()
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (m_bIsStorage)
|
||||
{
|
||||
bStatus=m_pDataStorageStop();
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CSo7_Interface::PauseScanAndGetData(float *GetStorageData,int *GetStorageNumber)
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (m_bIsStorage)
|
||||
{
|
||||
bStatus=m_pDataStorageStop();
|
||||
bStatus=GetStoredData(GetStorageData,GetStorageNumber);
|
||||
bStatus=m_pDataStorageStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
bStatus=GetStoredData(GetStorageData,GetStorageNumber);
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CSo7_Interface::GetStoredData(float *GetStorageData,int *GetStorageNumber)
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
GetStoreDataStatus();
|
||||
if (!m_bIsStorage)
|
||||
{
|
||||
LKIF_FLOATVALUE GetStorageValue[MAX_STORAGE_DATA_SIZE];
|
||||
bStatus=m_pDataStorageGetData(m_iSetOutNo,m_StoredDataNumber,GetStorageValue,GetStorageNumber);
|
||||
for(int i=0;i<*GetStorageNumber;i++)
|
||||
{
|
||||
switch(GetStorageValue[i].FloatResult)
|
||||
{
|
||||
case LKIF_FLOATRESULT_RANGEOVER_P:
|
||||
{
|
||||
*GetStorageData++=50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_RANGEOVER_N:
|
||||
{
|
||||
*GetStorageData++=-50;
|
||||
break;
|
||||
}
|
||||
case LKIF_FLOATRESULT_WAITING:
|
||||
{
|
||||
*GetStorageData++=0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
*GetStorageData++=GetStorageValue[i].Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return bStatus;
|
||||
};
|
||||
//==============================================
|
||||
BOOL CSo7_Interface::GetStoreDataStatus()
|
||||
{
|
||||
BOOL bStatus(FALSE);
|
||||
bStatus=m_pDataStorageGetStatus(m_iSetOutNo,&m_bIsStorage,&m_StoredDataNumber);
|
||||
return bStatus;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
// protocol for control SevenOcean's Machine
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef SO7_INTERFACE_H_INCLUDED_
|
||||
#define SO7_INTERFACE_H_INCLUDED_
|
||||
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
typedef int (WINAPI* pGetLaserStoredData) (float *GetStorageData,int *GetStorageNumber);
|
||||
// Starting the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageStart)(void);
|
||||
// Stopping the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageStop)(void);
|
||||
// Initializing the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageInit)(void);
|
||||
// Outputting the Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageGetData)(IN int OutNo,IN int NumOutBuffer,OUT LKIF_FLOATVALUE *OutBuffer,OUT int *NumReceived);
|
||||
// Data Storage Accumulation Status Output
|
||||
typedef BOOL (WINAPI* pLKIF_DataStorageGetStatus)(IN int OutNo,OUT BOOL *IsStorage,OUT int *NumStorageData);
|
||||
// Set Data Storage
|
||||
typedef BOOL (WINAPI* pLKIF_SetDataStorage)(IN LKIF_TARGETOUT TargetOut,IN int NumStorage,IN LKIF_STORAGECYCLE StorageCycle);
|
||||
|
||||
//======================================================================================
|
||||
class CSo7_Interface
|
||||
{
|
||||
protected:
|
||||
int m_iSetOutNo;
|
||||
int m_NeedStorageDataNumber;
|
||||
LKIF_STORAGECYCLE m_StorageCycle;
|
||||
HINSTANCE m_hImageDLL;
|
||||
public:
|
||||
|
||||
CSo7_Interface();
|
||||
~CSo7_Interface();
|
||||
|
||||
//»ñÈ¡Êý¾ÝµÄº¯ÊýÖ¸Õë
|
||||
pLKIF_GetCalcData m_pGetCalcData;
|
||||
pLKIF_DataStorageStart m_pDataStorageStart;
|
||||
pLKIF_DataStorageStop m_pDataStorageStop;
|
||||
pLKIF_DataStorageInit m_pDataStorageInit;
|
||||
pLKIF_DataStorageGetData m_pDataStorageGetData;
|
||||
pLKIF_DataStorageGetStatus m_pDataStorageGetStatus;
|
||||
pLKIF_SetDataStorage m_pSetDataStorage;
|
||||
|
||||
int m_StoredDataNumber;
|
||||
BOOL m_bIsStorage;
|
||||
void KeyenceLaserInit(void);
|
||||
void Get_KeyenceLaserData(float *LaserValue1,float *LaserValue2);
|
||||
BOOL StartStoreData(int _NeedStorageDataNumber,int _SampleTime);
|
||||
BOOL StopStoreData();
|
||||
BOOL GetStoreDataStatus();
|
||||
BOOL GetStoredData(float *GetStorageData,int *GetStorageNumber);
|
||||
BOOL PauseScanAndGetData(float *GetStorageData,int *GetStorageNumber);
|
||||
};
|
||||
|
||||
#endif
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,413 @@
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Destruct Csmartmotor_Proto.
|
||||
Destruct Csmartmotor_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Unable to open device _start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
@@ -0,0 +1,114 @@
|
||||
[HARDWARE]
|
||||
SPEED_BASE_X1=2
|
||||
SPEED_MAX_X1=0
|
||||
SPEED_START_X1=10
|
||||
SPEED_FRESH_X1=10
|
||||
SPEED_SLOW_X1=0.000
|
||||
;
|
||||
SPEED_BASE_X2=2
|
||||
SPEED_MAX_X2=0
|
||||
SPEED_START_X2=10
|
||||
SPEED_FRESH_X2=10
|
||||
SPEED_SLOW_X2=0.000
|
||||
;
|
||||
SPEED_BASE_X3=2
|
||||
SPEED_MAX_X3=1
|
||||
SPEED_START_X3=10
|
||||
SPEED_FRESH_X3=10
|
||||
SPEED_SLOW_X3=0.000
|
||||
;
|
||||
SPEED_BASE_X4=1
|
||||
SPEED_MAX_X4=0
|
||||
SPEED_START_X4=20
|
||||
SPEED_FRESH_X4=10
|
||||
SPEED_SLOW_X4=0.000
|
||||
;
|
||||
SPEED_BASE_X5=1
|
||||
SPEED_MAX_X5=0
|
||||
SPEED_START_X5=20
|
||||
SPEED_FRESH_X5=10
|
||||
SPEED_SLOW_X5=0.000
|
||||
;
|
||||
SPEED_BASE_Y1=5
|
||||
SPEED_MAX_Y1=200
|
||||
SPEED_START_Y1=30
|
||||
SPEED_FRESH_Y1=10
|
||||
SPEED_SLOW_Y1=0.600
|
||||
;
|
||||
SPEED_BASE_Y2=3
|
||||
SPEED_MAX_Y2=60
|
||||
SPEED_START_Y2=10
|
||||
SPEED_FRESH_Y2=10
|
||||
SPEED_SLOW_Y2=0.200
|
||||
;
|
||||
SPEED_BASE_Y3=1
|
||||
SPEED_MAX_Y3=5
|
||||
SPEED_START_Y3=3
|
||||
SPEED_FRESH_Y3=3
|
||||
SPEED_SLOW_Y3=0.100
|
||||
;
|
||||
SPEED_BASE_Y4=5
|
||||
SPEED_MAX_Y4=0
|
||||
SPEED_START_Y4=50
|
||||
SPEED_FRESH_Y4=5
|
||||
SPEED_SLOW_Y4=0.000
|
||||
;
|
||||
SPEED_BASE_Y5=5
|
||||
SPEED_MAX_Y5=0
|
||||
SPEED_START_Y5=80
|
||||
SPEED_FRESH_Y5=5
|
||||
SPEED_SLOW_Y5=0.000
|
||||
;
|
||||
SPEED_BASE_Z1=5
|
||||
SPEED_MAX_Z1=200
|
||||
SPEED_START_Z1=50
|
||||
SPEED_FRESH_Z1=10
|
||||
SPEED_SLOW_Z1=0.500
|
||||
;
|
||||
SPEED_BASE_Z2=5
|
||||
SPEED_MAX_Z2=50
|
||||
SPEED_START_Z2=10
|
||||
SPEED_FRESH_Z2=10
|
||||
SPEED_SLOW_Z2=0.100
|
||||
;
|
||||
SPEED_BASE_Z3=5
|
||||
SPEED_MAX_Z3=5
|
||||
SPEED_START_Z3=5
|
||||
SPEED_FRESH_Z3=10
|
||||
SPEED_SLOW_Z3=0.000
|
||||
;
|
||||
SPEED_BASE_Z4=5
|
||||
SPEED_MAX_Z4=0
|
||||
SPEED_START_Z4=50
|
||||
SPEED_FRESH_Z4=5
|
||||
SPEED_SLOW_Z4=0.000
|
||||
;
|
||||
SPEED_BASE_Z5=5
|
||||
SPEED_MAX_Z5=0
|
||||
SPEED_START_Z5=80
|
||||
SPEED_FRESH_Z5=5
|
||||
SPEED_SLOW_Z5=0.000
|
||||
;
|
||||
X_MOTOR_PRECISION=0.019
|
||||
Y_MOTOR_PRECISION=0.019
|
||||
Z_MOTOR_PRECISION=0.004
|
||||
;
|
||||
X_MOTOR_WHEELBASE=20.000
|
||||
Y_MOTOR_WHEELBASE=20.000
|
||||
Z_MOTOR_WHEELBASE=1.500
|
||||
;
|
||||
MOTOR_PULSE_NUM=10000
|
||||
;
|
||||
[WORKTABLE]
|
||||
X_SCALE_RESOLUTION=0.400
|
||||
Y_SCALE_RESOLUTION=0.400
|
||||
Z_SCALE_RESOLUTION=0.400
|
||||
;
|
||||
X_NEG_WORKING_LIMIT=0.000
|
||||
Y_NEG_WORKING_LIMIT=0.000
|
||||
Z_NEG_WORKING_LIMIT=0.000
|
||||
;
|
||||
X_POS_WORKING_LIMIT=400.000
|
||||
Y_POS_WORKING_LIMIT=300.000
|
||||
Z_POS_WORKING_LIMIT=200.000
|
||||
;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
copy Mix.dll %windir%\system32
|
||||
copy sdk3000_7130.dll %windir%\system32
|
||||
copy Deinterlace.ax %windir%\system32
|
||||
copy SDK3000.ocx %windir%\system32
|
||||
regsvr32/u/s %windir%\system32\Deinterlace.ax
|
||||
regsvr32/s %windir%\system32\Deinterlace.ax
|
||||
regsvr32/u/s %windir%\system32\SDK3000.ocx
|
||||
regsvr32/s %windir%\system32\SDK3000.ocx
|
||||
regsvr32/s Comdlg32.ocx
|
||||
regsvr32/s mscomctl.ocx
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
[HARDWARE]
|
||||
SPEED_X1=10000
|
||||
ACCELERATION_X1=50
|
||||
DECELERATION_X1=50
|
||||
;
|
||||
SPEED_X2=100000
|
||||
ACCELERATION_X2=100
|
||||
DECELERATION_X2=100
|
||||
;
|
||||
SPEED_X3=500000
|
||||
ACCELERATION_X3=200
|
||||
DECELERATION_X3=200
|
||||
;
|
||||
SPEED_X4=1000000
|
||||
ACCELERATION_X4=300
|
||||
DECELERATION_X4=300
|
||||
;
|
||||
SPEED_X5=0
|
||||
ACCELERATION_X5=0
|
||||
DECELERATION_X5=0
|
||||
;
|
||||
SPEED_Y1=10000
|
||||
ACCELERATION_Y1=50
|
||||
DECELERATION_Y1=50
|
||||
;
|
||||
SPEED_Y2=100000
|
||||
ACCELERATION_Y2=100
|
||||
DECELERATION_Y2=100
|
||||
;
|
||||
SPEED_Y3=500000
|
||||
ACCELERATION_Y3=200
|
||||
DECELERATION_Y3=200
|
||||
;
|
||||
SPEED_Y4=1000000
|
||||
ACCELERATION_Y4=300
|
||||
DECELERATION_Y4=300
|
||||
;
|
||||
SPEED_Y5=0
|
||||
ACCELERATION_Y5=0
|
||||
DECELERATION_Y5=0
|
||||
;
|
||||
SPEED_Z1=10000
|
||||
ACCELERATION_Z1=50
|
||||
DECELERATION_Z1=50
|
||||
;
|
||||
SPEED_Z2=100000
|
||||
ACCELERATION_Z2=100
|
||||
DECELERATION_Z2=100
|
||||
;
|
||||
SPEED_Z3=500000
|
||||
ACCELERATION_Z3=200
|
||||
DECELERATION_Z3=200
|
||||
;
|
||||
SPEED_Z4=1000000
|
||||
ACCELERATION_Z4=300
|
||||
DECELERATION_Z4=300
|
||||
;
|
||||
SPEED_Z5=0
|
||||
ACCELERATION_Z5=0
|
||||
DECELERATION_Z5=0
|
||||
;
|
||||
[WORKTABLE]
|
||||
X_SCALE_RESOLUTION=0.400
|
||||
Y_SCALE_RESOLUTION=0.400
|
||||
Z_SCALE_RESOLUTION=0.400
|
||||
;
|
||||
X_NEG_WORKING_LIMIT=0.000
|
||||
Y_NEG_WORKING_LIMIT=0.000
|
||||
Z_NEG_WORKING_LIMIT=0.000
|
||||
;
|
||||
X_POS_WORKING_LIMIT=200.000
|
||||
Y_POS_WORKING_LIMIT=200.000
|
||||
Z_POS_WORKING_LIMIT=200.000
|
||||
;
|
||||
@@ -0,0 +1,18 @@
|
||||
[7OCEANAUTOZOOM]
|
||||
ZOOM_PRODUCT_ID=So7-123456
|
||||
ZOOM_COM_PORT=1
|
||||
ZOOM_START_DEG=10.000000
|
||||
ZOOM_END_DEG=230.000000
|
||||
ZOOM_ORG_DEG=360.000000
|
||||
ZOOM_DEADBAND_DEG=0.050000
|
||||
ZOOM_PULSE_PER_DEG=78.546050203026880
|
||||
ZOOM_READING_INTERVAL_TIME=60
|
||||
ZOOM_MOTOR_SPEED_FAST=2000
|
||||
ZOOM_MOTOR_SPEED_SLOW=800
|
||||
;
|
||||
[HARDWARE]
|
||||
CLOSE_LOOP_ENABLED=0
|
||||
RETRY_TIMES=5
|
||||
SHIFT_POSITION_X=0
|
||||
SHIFT_POSITION_Y=0
|
||||
SHIFT_POSITION_Z=0
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "stdafx.h"
|
||||
#include "Logger.h"
|
||||
#include <atltime.h>
|
||||
void CLogger::SendAtTime(const char* buffer)
|
||||
{
|
||||
|
||||
if (!m_File)
|
||||
{
|
||||
m_File = _wfsopen(m_FileName, _T("at"), _SH_DENYWR);
|
||||
}
|
||||
if(m_File)
|
||||
{
|
||||
CTime _cTime=CTime::GetCurrentTime();
|
||||
CString csTime=_cTime.Format("[%m/%d %H:%M] ");
|
||||
_ftprintf(m_File,_T("%s\r\n"), csTime);
|
||||
fprintf(m_File,"%s", buffer);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
//=============================================================================
|
||||
#include "stdafx.h"
|
||||
#include "SsiStatus.h"
|
||||
#include "logger.h"
|
||||
#include "math.h"
|
||||
#include "Proto_Util.h"
|
||||
|
||||
#define MY_CONFIG 1
|
||||
#define MAX_DEVPATH_LENGTH 256
|
||||
#define ENDPOINT_TIMEOUT 500
|
||||
#define MAX_BUFF_SIZE 1024
|
||||
|
||||
//===========================================================================
|
||||
double CProto_Util::ScaleToMM(long lCount, double dResolution)
|
||||
{
|
||||
double dMM = 0.0;
|
||||
dMM = lCount * dResolution;
|
||||
return dMM;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
long CProto_Util::MMtoScale(double lDistanceMM, double dResolution)
|
||||
{
|
||||
long lCounts = 0;
|
||||
if (dResolution)
|
||||
lCounts = (long) (lDistanceMM / dResolution);
|
||||
else
|
||||
ASSERT(0);
|
||||
return lCounts;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
long CProto_Util::_4char2long(unsigned char *cBuff)
|
||||
{
|
||||
union
|
||||
{
|
||||
long l_value;
|
||||
char c_array[5];
|
||||
};
|
||||
memset (c_array, 0, 5);
|
||||
c_array[0] = cBuff[3];
|
||||
c_array[1] = cBuff[2];
|
||||
c_array[2] = cBuff[1];
|
||||
c_array[3] = cBuff[0];
|
||||
return(l_value);
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CProto_Util::_reverse_dword(DWORD *dWord)
|
||||
{
|
||||
BYTE cBuff[4];
|
||||
BYTE *dwBuff = (BYTE *)dWord;
|
||||
for ( int ii = 0 ; ii < 4 ; ++ii )
|
||||
cBuff[ii]= dwBuff[ii];
|
||||
|
||||
dwBuff[0] = cBuff[3];
|
||||
dwBuff[1] = cBuff[2];
|
||||
dwBuff[2] = cBuff[1];
|
||||
dwBuff[3] = cBuff[0];
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
void CProto_Util::_scale2inch(unsigned long scale, double &inch)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(scale);
|
||||
UNREFERENCED_PARAMETER(inch);
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
void CProto_Util::_inch2scale(unsigned long &scale, double inch)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(scale);
|
||||
UNREFERENCED_PARAMETER(inch);
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
// convert a string of characters into its binary form
|
||||
void CProto_Util::_char2bin(unsigned char *cBuff, BYTE *cBytes, int iLen)
|
||||
{
|
||||
memset(cBytes, 0, MAX_BUFF_SIZE);
|
||||
for (int i=0;i<iLen;i++)
|
||||
{
|
||||
sscanf_s((const char *)(cBuff+i*2), "%2x", (cBytes+i));
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
void CProto_Util::_swap_byte(unsigned short &Val)
|
||||
{
|
||||
unsigned short MSB = Val<<8;
|
||||
BYTE LSB = Val>>8;
|
||||
Val = MSB|LSB;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
double CProto_Util::TimeInSecs(void)
|
||||
{
|
||||
double Secs;
|
||||
|
||||
LARGE_INTEGER HPCounterTicksPerSecond;
|
||||
BOOL HasHPCounter = QueryPerformanceFrequency(&HPCounterTicksPerSecond);
|
||||
|
||||
if (HasHPCounter == TRUE)
|
||||
{
|
||||
// Use high resolution clock.
|
||||
double HPCounterTicksPersec = (DWORD)((double) HPCounterTicksPerSecond.QuadPart);
|
||||
LARGE_INTEGER HPTicks;
|
||||
QueryPerformanceCounter(&HPTicks);
|
||||
Secs = ((double)HPTicks.QuadPart / HPCounterTicksPersec);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use clock with less resolution.
|
||||
Secs = GetTickCount();
|
||||
Secs /= 1000.0;
|
||||
}
|
||||
return Secs;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
CProto_Util::CProto_Util()
|
||||
{
|
||||
g_pLogger = new CLogger(_T("\\UtilityDebug.Log"));
|
||||
};
|
||||
|
||||
//******************************************************************************
|
||||
CProto_Util::~CProto_Util()
|
||||
{
|
||||
delete g_pLogger;
|
||||
g_pLogger = NULL;
|
||||
}
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
//******************************************************************************
|
||||
// Send is direct and async.
|
||||
// The receive thread will receive data and interpret it.
|
||||
//******************************************************************************
|
||||
SSI_STATUS CProto_Util::Initialize()
|
||||
{
|
||||
SSI_STATUS Status=SSI_STATUS_NORMAL;
|
||||
UNREFERENCED_PARAMETER(Status);
|
||||
if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
g_pLogger->SendAndFlushPerMode(_T("Exit Initialize Usb\n"));
|
||||
return SSI_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS CProto_Util::Terminate()
|
||||
{
|
||||
SSI_STATUS Status=SSI_STATUS_NORMAL;
|
||||
if (g_pLogger->m_lLogMask & LOGACTIONS)
|
||||
g_pLogger->SendAndFlushPerMode(_T("Exit Exit_MvUsb\n"));
|
||||
return Status;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS CProto_Util::ExtractAppPath(CString &Path)
|
||||
{
|
||||
CString tmpPath = Path;
|
||||
tmpPath.TrimRight();
|
||||
tmpPath.TrimLeft();
|
||||
int nLastSlash = tmpPath.ReverseFind('\\');
|
||||
if (nLastSlash > -1)
|
||||
{ // complete path
|
||||
tmpPath = Path.Left(nLastSlash);
|
||||
Path = tmpPath;
|
||||
}
|
||||
else
|
||||
{ // not a complete path
|
||||
Path="";
|
||||
};
|
||||
return SSI_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
//******************************************************************************
|
||||
SSI_STATUS CProto_Util::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;
|
||||
}
|
||||
return SSI_STATUS_NORMAL;
|
||||
};
|
||||
|
||||
void CProto_Util::_ascii2bin(char *cBuff)
|
||||
{
|
||||
char x[3];
|
||||
char t[MAX_BUFF_SIZE];
|
||||
|
||||
int iSize = strlen(cBuff)/2;
|
||||
memset(t, 0, MAX_BUFF_SIZE);
|
||||
for (int j=0;j<iSize;j++)
|
||||
{
|
||||
memset(x, 0, 3);
|
||||
memcpy(x, cBuff+(j*2), 2);
|
||||
sscanf_s(x, "%2x", &(t[j]));
|
||||
};
|
||||
memset(cBuff, 0, MAX_BUFF_SIZE);
|
||||
memcpy(cBuff, t, iSize);
|
||||
};
|
||||
|
||||
void CProto_Util::_clear_blanks(char *cBuff)
|
||||
{
|
||||
char pBuff[MAX_BUFF_SIZE];
|
||||
int j = strlen(cBuff);
|
||||
int k = 0;
|
||||
for (int i=0; i<j; i++)
|
||||
{
|
||||
if ((cBuff[i]!=' ') && (cBuff[i]!= 0x0d) && (cBuff[i]!= 0x0a) ) pBuff[k++] = cBuff[i];
|
||||
};
|
||||
pBuff[k] = 0;
|
||||
strcpy(cBuff, pBuff);
|
||||
return;
|
||||
};
|
||||
@@ -0,0 +1,104 @@
|
||||
// Proto_Util.h: interface for the CDataLink class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#if !defined(AFX_Proto_Util_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
#define AFX_Proto_Util_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#define MV_TRACE if ( g_pLogger && g_pLogger->m_lLogMask & LOGACTIONS ) g_pLogger->SendAndFlushPerMode
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "logger.h"
|
||||
#include "SsiStatus.h"
|
||||
|
||||
enum SETTLE_STATUS
|
||||
{
|
||||
NOTSETTLED = 0,
|
||||
SETTLED,
|
||||
TIMEDOUT
|
||||
};
|
||||
|
||||
// CSettleStageParams and CSettleStage are copied from QVI, but QVI is based on millionths of and inch
|
||||
// and we will use microns for MV
|
||||
class CSettleStageParams
|
||||
{
|
||||
public:
|
||||
CSettleStageParams()
|
||||
{
|
||||
EDGE_RETRY_TIMEOUT_X = 800;
|
||||
EDGE_RETRY_TIMEOUT_Y = 800;
|
||||
EDGE_RETRY_TIMEOUT_Z = 800;
|
||||
EDGE_RETRY_TIMEOUT_MAG = 800;
|
||||
EDGE_RETRY_BANDWIDTH_X = 1;
|
||||
EDGE_RETRY_BANDWIDTH_Y = 1;
|
||||
EDGE_RETRY_BANDWIDTH_Z = 1;
|
||||
EDGE_RETRY_BANDWIDTH_MAG = 1;
|
||||
EDGE_RETRY_COUNT_X = 1;
|
||||
EDGE_RETRY_COUNT_Y = 1;
|
||||
EDGE_RETRY_COUNT_Z = 1;
|
||||
EDGE_RETRY_COUNT_MAG = 1;
|
||||
};
|
||||
|
||||
long EDGE_RETRY_TIMEOUT_X; //300
|
||||
long EDGE_RETRY_TIMEOUT_Y; //300
|
||||
long EDGE_RETRY_TIMEOUT_Z; //300
|
||||
long EDGE_RETRY_TIMEOUT_MAG; //300
|
||||
long EDGE_RETRY_BANDWIDTH_X; //50
|
||||
long EDGE_RETRY_BANDWIDTH_Y; //50
|
||||
long EDGE_RETRY_BANDWIDTH_Z; //50
|
||||
long EDGE_RETRY_BANDWIDTH_MAG; //50
|
||||
long EDGE_RETRY_COUNT_X; //1
|
||||
long EDGE_RETRY_COUNT_Y; //1
|
||||
long EDGE_RETRY_COUNT_Z; //1
|
||||
long EDGE_RETRY_COUNT_MAG; //1
|
||||
};
|
||||
|
||||
class CSettleStage
|
||||
{
|
||||
public:
|
||||
CSettleStage(long lAxis, double dStartTime, long lStart, long lDeadband, double dTestIncrSec, double dMaxTimeSec);
|
||||
enum SETTLE_STATUS Test(double dCurTime, long lCurPos);
|
||||
|
||||
private:
|
||||
double m_dStartTime;
|
||||
long m_lStartPos;
|
||||
long m_lDeadband;
|
||||
double m_dTestIncrSec;
|
||||
double m_dMaxTimeSec;
|
||||
double m_dIncrStartTimeSec;
|
||||
long m_lAxis;
|
||||
};
|
||||
|
||||
//======================================================================================
|
||||
class CProto_Util
|
||||
{
|
||||
public:
|
||||
|
||||
double ScaleToMM(long lCount, double dResolution);
|
||||
long MMtoScale(double lDistanceMM, double dResolution);
|
||||
|
||||
//
|
||||
CProto_Util();
|
||||
virtual ~CProto_Util();
|
||||
SSI_STATUS Initialize();
|
||||
SSI_STATUS Terminate();
|
||||
SSI_STATUS GetAppPath(CString &Path);
|
||||
SSI_STATUS ExtractAppPath(CString &Path);
|
||||
|
||||
double TimeInSecs(void);
|
||||
CLogger* g_pLogger;
|
||||
void _swap_byte(unsigned short &Val);
|
||||
void _reverse_dword(DWORD *);
|
||||
void _scale2inch(unsigned long scale, double &inch);
|
||||
void _inch2scale(unsigned long &scale, double inch);
|
||||
long _4char2long(unsigned char *cBuff);
|
||||
void _char2bin(unsigned char *cBuff, BYTE *cBytes, int len);
|
||||
void _clear_blanks(char *cBuff);
|
||||
void _ascii2bin(char *cBuff);
|
||||
SSI_STATUS WaitForSettleXYZZM();
|
||||
};
|
||||
|
||||
#endif
|
||||
// !defined(AFX_Proto_Util_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
@@ -0,0 +1 @@
|
||||
Usb Port Initialized.
|
||||
@@ -0,0 +1,5 @@
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
@@ -0,0 +1,275 @@
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
Destruct Cso7_Proto.
|
||||
Construct Cso7_Proto.
|
||||
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.
|
||||
Construct Cso7_Proto.
|
||||
Init:Open device succeed .
|
||||
_start_machine
|
||||
Exit: Exit_SO7Usb
|
||||
Destruct Cso7_Proto.
|
||||
@@ -0,0 +1,114 @@
|
||||
[HARDWARE]
|
||||
SPEED_BASE_X1=5
|
||||
SPEED_MAX_X1=120
|
||||
SPEED_START_X1=20
|
||||
SPEED_FRESH_X1=10
|
||||
SPEED_SLOW_X1=0.500
|
||||
;
|
||||
SPEED_BASE_X2=3
|
||||
SPEED_MAX_X2=30
|
||||
SPEED_START_X2=10
|
||||
SPEED_FRESH_X2=10
|
||||
SPEED_SLOW_X2=0.200
|
||||
;
|
||||
SPEED_BASE_X3=1
|
||||
SPEED_MAX_X3=5
|
||||
SPEED_START_X3=5
|
||||
SPEED_FRESH_X3=10
|
||||
SPEED_SLOW_X3=0.000
|
||||
;
|
||||
SPEED_BASE_X4=1
|
||||
SPEED_MAX_X4=0
|
||||
SPEED_START_X4=50
|
||||
SPEED_FRESH_X4=5
|
||||
SPEED_SLOW_X4=0.000
|
||||
;
|
||||
SPEED_BASE_X5=1
|
||||
SPEED_MAX_X5=0
|
||||
SPEED_START_X5=80
|
||||
SPEED_FRESH_X5=5
|
||||
SPEED_SLOW_X5=0.000
|
||||
;
|
||||
SPEED_BASE_Y1=5
|
||||
SPEED_MAX_Y1=120
|
||||
SPEED_START_Y1=20
|
||||
SPEED_FRESH_Y1=10
|
||||
SPEED_SLOW_Y1=0.600
|
||||
;
|
||||
SPEED_BASE_Y2=3
|
||||
SPEED_MAX_Y2=30
|
||||
SPEED_START_Y2=10
|
||||
SPEED_FRESH_Y2=10
|
||||
SPEED_SLOW_Y2=0.100
|
||||
;
|
||||
SPEED_BASE_Y3=1
|
||||
SPEED_MAX_Y3=5
|
||||
SPEED_START_Y3=5
|
||||
SPEED_FRESH_Y3=10
|
||||
SPEED_SLOW_Y3=0.000
|
||||
;
|
||||
SPEED_BASE_Y4=1
|
||||
SPEED_MAX_Y4=0
|
||||
SPEED_START_Y4=50
|
||||
SPEED_FRESH_Y4=5
|
||||
SPEED_SLOW_Y4=0.000
|
||||
;
|
||||
SPEED_BASE_Y5=1
|
||||
SPEED_MAX_Y5=0
|
||||
SPEED_START_Y5=80
|
||||
SPEED_FRESH_Y5=5
|
||||
SPEED_SLOW_Y5=0.000
|
||||
;
|
||||
SPEED_BASE_Z1=5
|
||||
SPEED_MAX_Z1=170
|
||||
SPEED_START_Z1=50
|
||||
SPEED_FRESH_Z1=10
|
||||
SPEED_SLOW_Z1=0.500
|
||||
;
|
||||
SPEED_BASE_Z2=3
|
||||
SPEED_MAX_Z2=50
|
||||
SPEED_START_Z2=10
|
||||
SPEED_FRESH_Z2=10
|
||||
SPEED_SLOW_Z2=0.100
|
||||
;
|
||||
SPEED_BASE_Z3=1
|
||||
SPEED_MAX_Z3=5
|
||||
SPEED_START_Z3=5
|
||||
SPEED_FRESH_Z3=10
|
||||
SPEED_SLOW_Z3=0.000
|
||||
;
|
||||
SPEED_BASE_Z4=1
|
||||
SPEED_MAX_Z4=0
|
||||
SPEED_START_Z4=50
|
||||
SPEED_FRESH_Z4=5
|
||||
SPEED_SLOW_Z4=0.000
|
||||
;
|
||||
SPEED_BASE_Z5=1
|
||||
SPEED_MAX_Z5=0
|
||||
SPEED_START_Z5=80
|
||||
SPEED_FRESH_Z5=5
|
||||
SPEED_SLOW_Z5=0.000
|
||||
;
|
||||
X_MOTOR_PRECISION=0.009
|
||||
Y_MOTOR_PRECISION=0.004
|
||||
Z_MOTOR_PRECISION=0.004
|
||||
;
|
||||
X_MOTOR_WHEELBASE=25.016
|
||||
Y_MOTOR_WHEELBASE=25.028
|
||||
Z_MOTOR_WHEELBASE=1.875
|
||||
;
|
||||
MOTOR_PULSE_NUM=10000
|
||||
;
|
||||
[WORKTABLE]
|
||||
X_SCALE_RESOLUTION=0.500
|
||||
Y_SCALE_RESOLUTION=0.500
|
||||
Z_SCALE_RESOLUTION=0.500
|
||||
;
|
||||
X_NEG_WORKING_LIMIT=0.000
|
||||
Y_NEG_WORKING_LIMIT=0.000
|
||||
Z_NEG_WORKING_LIMIT=0.000
|
||||
;
|
||||
X_POS_WORKING_LIMIT=400.000
|
||||
Y_POS_WORKING_LIMIT=300.000
|
||||
Z_POS_WORKING_LIMIT=200.000
|
||||
;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
[HARDWARE]
|
||||
SPEED_X1=10000
|
||||
ACCELERATION_X1=50
|
||||
DECELERATION_X1=50
|
||||
;
|
||||
SPEED_X2=100000
|
||||
ACCELERATION_X2=100
|
||||
DECELERATION_X2=100
|
||||
;
|
||||
SPEED_X3=500000
|
||||
ACCELERATION_X3=200
|
||||
DECELERATION_X3=200
|
||||
;
|
||||
SPEED_X4=1000000
|
||||
ACCELERATION_X4=300
|
||||
DECELERATION_X4=300
|
||||
;
|
||||
SPEED_X5=0
|
||||
ACCELERATION_X5=0
|
||||
DECELERATION_X5=0
|
||||
;
|
||||
SPEED_Y1=10000
|
||||
ACCELERATION_Y1=50
|
||||
DECELERATION_Y1=50
|
||||
;
|
||||
SPEED_Y2=100000
|
||||
ACCELERATION_Y2=100
|
||||
DECELERATION_Y2=100
|
||||
;
|
||||
SPEED_Y3=500000
|
||||
ACCELERATION_Y3=200
|
||||
DECELERATION_Y3=200
|
||||
;
|
||||
SPEED_Y4=1000000
|
||||
ACCELERATION_Y4=300
|
||||
DECELERATION_Y4=300
|
||||
;
|
||||
SPEED_Y5=0
|
||||
ACCELERATION_Y5=0
|
||||
DECELERATION_Y5=0
|
||||
;
|
||||
SPEED_Z1=10000
|
||||
ACCELERATION_Z1=50
|
||||
DECELERATION_Z1=50
|
||||
;
|
||||
SPEED_Z2=100000
|
||||
ACCELERATION_Z2=100
|
||||
DECELERATION_Z2=100
|
||||
;
|
||||
SPEED_Z3=500000
|
||||
ACCELERATION_Z3=200
|
||||
DECELERATION_Z3=200
|
||||
;
|
||||
SPEED_Z4=1000000
|
||||
ACCELERATION_Z4=300
|
||||
DECELERATION_Z4=300
|
||||
;
|
||||
SPEED_Z5=0
|
||||
ACCELERATION_Z5=0
|
||||
DECELERATION_Z5=0
|
||||
;
|
||||
[WORKTABLE]
|
||||
X_SCALE_RESOLUTION=0.400
|
||||
Y_SCALE_RESOLUTION=0.400
|
||||
Z_SCALE_RESOLUTION=0.400
|
||||
;
|
||||
X_NEG_WORKING_LIMIT=0.000
|
||||
Y_NEG_WORKING_LIMIT=0.000
|
||||
Z_NEG_WORKING_LIMIT=0.000
|
||||
;
|
||||
X_POS_WORKING_LIMIT=200.000
|
||||
Y_POS_WORKING_LIMIT=200.000
|
||||
Z_POS_WORKING_LIMIT=200.000
|
||||
;
|
||||
@@ -0,0 +1,18 @@
|
||||
[7OCEANAUTOZOOM]
|
||||
ZOOM_PRODUCT_ID=So7123456
|
||||
ZOOM_COM_PORT=1
|
||||
ZOOM_START_DEG=6.000000
|
||||
ZOOM_END_DEG=226.000000
|
||||
ZOOM_ORG_DEG=356.000000
|
||||
ZOOM_DEADBAND_DEG=0.050000
|
||||
ZOOM_PULSE_PER_DEG=78.546050203026880
|
||||
ZOOM_READING_INTERVAL_TIME=60
|
||||
ZOOM_MOTOR_SPEED_FAST=2000
|
||||
ZOOM_MOTOR_SPEED_SLOW=800
|
||||
;
|
||||
[HARDWARE]
|
||||
CLOSE_LOOP_ENABLED=0
|
||||
RETRY_TIMES=5
|
||||
SHIFT_POSITION_X=0
|
||||
SHIFT_POSITION_Y=0
|
||||
SHIFT_POSITION_Z=0
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#include "..\..\..\..\include\stdafx_net.h"
|
||||
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <afxodlgs.h> // MFC OLE dialog classes
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
@@ -0,0 +1,25 @@
|
||||
// Proto.h: interface for the CProto class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SSISTATUS_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
#define AFX_SSISTATUS_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
enum SSI_STATUS {
|
||||
SSI_STATUS_NORMAL = 0,
|
||||
SSI_STATUS_DATALINK_ERROR,
|
||||
SSI_STATUS_SETUP_ASYNC_CONTEXT_ERROR,
|
||||
SSI_STATUS_SYNC_READ_ERROR,
|
||||
SSI_STATUS_SYNC_WRITE_ERROR,
|
||||
SSI_STATUS_MV_COMMAND_TIMEOUT,
|
||||
SSI_STATUS_MV_COMMAND_BUSY,
|
||||
SSI_STATUS_REPLAY_FILE_ERROR,
|
||||
SSI_STATUS_MV_CONFIG_FILE_NOT_FOUND,
|
||||
SSI_STATUS_MV_HOMING_TIMEOUT,
|
||||
SSI_STATUS_ERROR,
|
||||
SSI_STATUS_INVALID_PARAMETERS
|
||||
};
|
||||
#endif // !defined(AFX_PROTO_H__B422904C_2CEB_495B_B7BD_B45AB30286DD__INCLUDED_)
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,114 @@
|
||||
#pragma once
|
||||
|
||||
// AnimaticsUtilityDlg dialog
|
||||
|
||||
class AnimaticsUtilityDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(AnimaticsUtilityDlg)
|
||||
|
||||
public:
|
||||
AnimaticsUtilityDlg(CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~AnimaticsUtilityDlg();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_ANIMATICS_UTIL_DIALOG };
|
||||
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnInitDialog();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
|
||||
|
||||
CString SpeedParameterX[5];
|
||||
CString AccelParameterX[5];
|
||||
CString DecelParameterX[5];
|
||||
CString SpeedParameterY[5];
|
||||
CString AccelParameterY[5];
|
||||
CString DecelParameterY[5];
|
||||
CString SpeedParameterZ[5];
|
||||
CString AccelParameterZ[5];
|
||||
CString DecelParameterZ[5];
|
||||
|
||||
CString ScaleResolutionX;
|
||||
CString ScaleResolutionY;
|
||||
CString ScaleResolutionZ;
|
||||
|
||||
CString NegSoftLimitX;
|
||||
CString NegSoftLimitY;
|
||||
CString NegSoftLimitZ;
|
||||
|
||||
CString PosSoftLimitX;
|
||||
CString PosSoftLimitY;
|
||||
CString PosSoftLimitZ;
|
||||
|
||||
CString PosPulseX;
|
||||
CString PosPulseY;
|
||||
CString PosPulseZ;
|
||||
CString PosmmX;
|
||||
CString PosmmY;
|
||||
CString PosmmZ;
|
||||
CString PosmmChangedX;
|
||||
CString PosmmChangedY;
|
||||
CString PosmmChangedZ;
|
||||
|
||||
CString MoveToDisX;
|
||||
CString MoveToDisY;
|
||||
CString MoveToDisZ;
|
||||
|
||||
CString RepeTestMoveFromDis;
|
||||
CString RepeTestMoveToDis;
|
||||
CString RepeTestTimes;
|
||||
CString RepeTestInterval;
|
||||
CEdit RepeTestMsgOut;
|
||||
CString MsgX,MsgY,MsgZ;
|
||||
|
||||
CString SmartMotorSendCmd;
|
||||
CString SmartMotorGetResponse;
|
||||
|
||||
HICON m_hRed;
|
||||
HICON m_hGreen;
|
||||
HICON m_hGray;
|
||||
HICON m_hWhite;
|
||||
HICON m_hBlack;
|
||||
|
||||
CProcessButton MoveX_Left;
|
||||
CProcessButton MoveX_Right;
|
||||
CProcessButton MoveY_Front;
|
||||
CProcessButton MoveY_Back;
|
||||
CProcessButton MoveZ_Up;
|
||||
CProcessButton MoveZ_Down;
|
||||
|
||||
//=============================
|
||||
void ChangeParameterOnEdit();
|
||||
void ShowParameterOnEdit();
|
||||
void ShowMotorStatusX();
|
||||
void ShowMotorStatusY();
|
||||
void ShowMotorStatusZ();
|
||||
BOOL SmartMotorRepeTest();
|
||||
void OutputWithScroll(const CString &strNewText,CEdit &edtOutput);
|
||||
afx_msg void OnBnClickedButtonStartAnimaticsMachine();
|
||||
afx_msg void OnBnClickedButtonStopAnimaticsMachine();
|
||||
afx_msg void OnBnClickedCancel();
|
||||
void ShowWorktableEdit();
|
||||
afx_msg void OnEnKillfocusEditWorktable();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
|
||||
afx_msg void OnBnClickedButtonAnimaticsMoveToXyz();
|
||||
afx_msg void OnBnClickedButtonPosSetZero();
|
||||
afx_msg void OnBnClickedButtonSaveConfig();
|
||||
afx_msg void OnBnClickedButtonReadConfig();
|
||||
afx_msg void OnBnClickedRadioAnimaticsSpeedGear1();
|
||||
afx_msg void OnBnClickedRadioAnimaticsSpeedGear2();
|
||||
afx_msg void OnBnClickedRadioAnimaticsSpeedGear3();
|
||||
afx_msg void OnBnClickedRadioAnimaticsSpeedGear4();
|
||||
afx_msg void OnBnClickedButtonAnimaticsMoveToX();
|
||||
afx_msg void OnBnClickedButtonAnimaticsMoveToY();
|
||||
afx_msg void OnBnClickedButtonAnimaticsMoveToZ();
|
||||
|
||||
afx_msg void OnEnKillfocusEditAnimaticsCmd();
|
||||
afx_msg void OnBnClickedButtonBeginRepeTest();
|
||||
afx_msg void OnBnClickedButtonSaveRepetest();
|
||||
afx_msg void OnBnClickedButtonAnimaticsHome();
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
#include "stdafx.h"
|
||||
#include "Animatics_UtilDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CAnimatics_UtilDlg ¶Ô»°¿ò
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC(CAnimatics_UtilDlg, CDialog)
|
||||
|
||||
CAnimatics_UtilDlg::CAnimatics_UtilDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CAnimatics_UtilDlg::IDD, pParent)
|
||||
{
|
||||
m_YPos=0.0;
|
||||
m_XPos=0.0;
|
||||
m_ZPos=0.0;
|
||||
}
|
||||
|
||||
CAnimatics_UtilDlg::~CAnimatics_UtilDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CAnimatics_UtilDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAnimatics_UtilDlg, CDialog)
|
||||
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CAnimatics_UtilDlg ÏûÏ¢´¦Àí³ÌÐò
|
||||
|
||||
BOOL CAnimatics_UtilDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// Add "About..." menu item to system menu.
|
||||
|
||||
// IDM_ABOUTBOX must be in the system command range.
|
||||
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||||
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||||
|
||||
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||
if (pSysMenu != NULL)
|
||||
{
|
||||
BOOL bNameValid;
|
||||
CString strAboutMenu;
|
||||
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||||
ASSERT(bNameValid);
|
||||
if (!strAboutMenu.IsEmpty())
|
||||
{
|
||||
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||||
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#include "..\..\..\Animatics\Animatics_Proto.h"
|
||||
#include "ProcessButton.h"
|
||||
#include "afxwin.h"
|
||||
extern SmartMotor_Proto* pSmartMotor_Proto;
|
||||
|
||||
|
||||
// CAnimatics_UtilDlg 对话框
|
||||
|
||||
class CAnimatics_UtilDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CAnimatics_UtilDlg)
|
||||
|
||||
public:
|
||||
CAnimatics_UtilDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||
virtual ~CAnimatics_UtilDlg();
|
||||
|
||||
// 对话框数据
|
||||
enum { IDD = IDD_ANIMATICS_UTIL_DIALOG };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
virtual BOOL OnInitDialog();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
double m_XPos;
|
||||
double m_YPos;
|
||||
double m_ZPos;
|
||||
|
||||
CString m_OutMessage;
|
||||
CString m_X_Pos;
|
||||
CString m_Y_Pos;
|
||||
CString m_Z_Pos;
|
||||
CString m_Zm_Pos;
|
||||
|
||||
CString m_csTop_Light_Value;
|
||||
CString m_csBom_Light_Value;
|
||||
CString m_csFan_Light_Value;
|
||||
CString m_csBom1_Light_Value;
|
||||
CString m_csBom2_Light_Value;
|
||||
CString m_csFan1_Light_Switch;
|
||||
CString m_csFan2_Light_Switch;
|
||||
|
||||
CString m_cs_Light_Switch;
|
||||
CString m_cs_Light_Size_Value;
|
||||
|
||||
CString m_cs_Version_Number;
|
||||
|
||||
CString m_cs_XScaleCoeff;
|
||||
CString m_cs_YScaleCoeff;
|
||||
CString m_cs_ZScaleCoeff;
|
||||
|
||||
HICON m_hRed;
|
||||
HICON m_hGreen;
|
||||
HICON m_hGray;
|
||||
HICON m_hWhite;
|
||||
HICON m_hBlack;
|
||||
|
||||
CProcessButton m_Button_MoveX_Left;
|
||||
CProcessButton m_Button_MoveX_Right;
|
||||
CProcessButton m_Button_MoveY_Front;
|
||||
CProcessButton m_Button_MoveY_Back;
|
||||
CProcessButton m_Button_MoveZ_Up;
|
||||
CProcessButton m_Button_MoveZ_Down;
|
||||
CProcessButton m_Button_MoveV_Zoom_In;
|
||||
CProcessButton m_Button_MoveV_Zoom_Out;
|
||||
|
||||
|
||||
|
||||
};
|
||||
@@ -0,0 +1,457 @@
|
||||
//#define PASSNUM 110
|
||||
//#define PASSNUM1 200
|
||||
enum FUN_CMD
|
||||
{
|
||||
|
||||
CT_FUN,
|
||||
CT_MOTOR,
|
||||
CT_SCALE,
|
||||
CT_LIGHT,
|
||||
CT_INT,
|
||||
CT_DATA
|
||||
|
||||
};
|
||||
|
||||
enum MOTOR_CMD
|
||||
{
|
||||
|
||||
CT_MOVEX,
|
||||
|
||||
CT_MOVEY,
|
||||
|
||||
CT_MOVEZ,
|
||||
|
||||
|
||||
CT_MOVETOX,
|
||||
CT_MOVETOY,
|
||||
CT_MOVETOZ,
|
||||
|
||||
CT_MOVETOFX,
|
||||
CT_MOVETOFY,
|
||||
CT_MOVETOFZ,
|
||||
|
||||
CT_MOVETOSX,
|
||||
CT_MOVETOSY,
|
||||
CT_MOVETOSZ,
|
||||
|
||||
CT_MOVETOAX,
|
||||
CT_MOVETOAY,
|
||||
CT_MOVETOAZ,
|
||||
|
||||
CT_MOVETOASX,
|
||||
CT_MOVETOASY,
|
||||
CT_MOVETOASZ,
|
||||
|
||||
CT_MOVETOAFX,
|
||||
CT_MOVETOAFY,
|
||||
CT_MOVETOAFZ,
|
||||
|
||||
CT_RESETXYZ,
|
||||
CT_RESETX,
|
||||
CT_RESETY,
|
||||
CT_RESETZ,
|
||||
|
||||
CT_STOPA,
|
||||
CT_STOPX,
|
||||
CT_STOPY,
|
||||
CT_STOPZ,
|
||||
|
||||
CT_STOPFA,
|
||||
CT_STOPFX,
|
||||
CT_STOPFY,
|
||||
CT_STOPFZ,
|
||||
|
||||
CT_SET_SPEEDX,
|
||||
|
||||
|
||||
CT_SET_SPEEDY,
|
||||
|
||||
|
||||
CT_SET_SPEEDZ,
|
||||
|
||||
CT_READ_SPEEDX,
|
||||
CT_READ_SPEEDY,
|
||||
CT_READ_SPEEDZ,
|
||||
|
||||
CT_SET_PRECISIONX,
|
||||
CT_SET_PRECISIONY,
|
||||
CT_SET_PRECISIONZ,
|
||||
|
||||
CT_SET_DEFAULTX,
|
||||
CT_SET_DEFAULTY,
|
||||
CT_SET_DEFAULTZ,
|
||||
|
||||
CT_READ_PRECISIONX,
|
||||
CT_READ_PRECISIONY,
|
||||
CT_READ_PRECISIONZ,
|
||||
CT_RESET,
|
||||
|
||||
CT_MOVEV,
|
||||
CT_MOVETOV,
|
||||
CT_RESETV,
|
||||
CT_STOPV,
|
||||
CT_SET_SPEEDV,
|
||||
CT_READ_SPEEDV,
|
||||
CT_SET_DEFAULTV,
|
||||
CT_TESTV,
|
||||
CT_TSTOPV,
|
||||
CT_TEST_STOP,
|
||||
CT_READ_V,
|
||||
|
||||
CT_M_SPEED,
|
||||
CT_M_DIS,
|
||||
CT_M_FRESH,
|
||||
CT_M_CMD,
|
||||
CT_M_READ_DAT,
|
||||
CT_SET_MOTOR_CAL,
|
||||
|
||||
CT_M_SWITCH_START,
|
||||
CT_M_SWITCH_CLOSE,
|
||||
CT_M_SWITCH_TOP,
|
||||
CT_M_SWITCH_BOM,
|
||||
CT_M_SWITCH_RESET,
|
||||
CT_M_SWITCH_VALUE,
|
||||
CT_M_RESET_LEFT,
|
||||
CT_M_RESET_RIGHT,
|
||||
|
||||
CT_LASE_TIMMER_ON,
|
||||
CT_LASE_TIMMER_OFF,
|
||||
CT_M_PROBE_ON,
|
||||
CT_M_PROBE_OFF,
|
||||
CT_MOVETOXYZ,
|
||||
CT_MOVETOXYZ_LASE,
|
||||
CT_GET_LASE,
|
||||
CT_MOVETOXYZV,
|
||||
CT_M_LASE_ON,
|
||||
CT_M_LASE_OFF,
|
||||
CT_M_BCL_ON,
|
||||
CT_M_BCL_OFF,
|
||||
CT_MOVETOXYZ_JM,
|
||||
|
||||
CT_END
|
||||
|
||||
};
|
||||
|
||||
enum SCALE_CMD
|
||||
{
|
||||
|
||||
CT_SEC_FLAG,
|
||||
|
||||
CT_SCALEX,
|
||||
CT_SCALEY,
|
||||
CT_SCALEZ,
|
||||
|
||||
CT_SECTIONX,
|
||||
CT_SECTIONY,
|
||||
CT_SECTIONZ,
|
||||
|
||||
CT_SET_AXISX,
|
||||
CT_SET_AXISY,
|
||||
CT_SET_AXISZ,
|
||||
|
||||
CT_SET_SECTIONX,
|
||||
CT_SET_SECTIONY,
|
||||
CT_SET_SECTIONZ,
|
||||
|
||||
CT_X_BEGIN,
|
||||
CT_Y_BEGIN,
|
||||
CT_Z_BEGIN,
|
||||
|
||||
CT_X_SECTION_END,
|
||||
CT_Y_SECTION_END,
|
||||
CT_Z_SECTION_END,
|
||||
|
||||
CT_X_SECTION_DEC,
|
||||
CT_Y_SECTION_DEC,
|
||||
CT_Z_SECTION_DEC,
|
||||
|
||||
CT_SET_SECTION_X,
|
||||
CT_SET_SECTION_Y,
|
||||
CT_SET_SECTION_Z,
|
||||
|
||||
CT_PROBE_FLAG,
|
||||
CT_SET_LINE_X,
|
||||
CT_SET_LINE_Y,
|
||||
CT_SET_LINE_Z,
|
||||
|
||||
CT_SET_PROBE_LINE,
|
||||
CT_SET_PROBE_SECTION,
|
||||
CT_SET_VERNO,
|
||||
CT_SET_RESET_FLAG,
|
||||
CT_GET_RESET_FLAG
|
||||
|
||||
};
|
||||
|
||||
enum LIGHT_CMD
|
||||
{
|
||||
|
||||
CT_LIGHT1_SIZE,
|
||||
CT_LIGHT2_SIZE,
|
||||
CT_LIGHT3_SIZE,
|
||||
CT_LIGHT4_SIZE,
|
||||
|
||||
CT_LIGHT1_SWITCH,
|
||||
CT_LIGHT2_SWITCH,
|
||||
CT_LIGHT3_SWITCH,
|
||||
CT_LIGHT4_SWITCH,
|
||||
CT_LIGHT5_SWITCH,
|
||||
CT_LIGHT_CMD
|
||||
|
||||
};
|
||||
|
||||
enum INT_CMD
|
||||
{
|
||||
|
||||
CT_STOPMX,
|
||||
CT_STOPMY,
|
||||
CT_STOPMZ,
|
||||
CT_STOPXYZ,
|
||||
|
||||
CT_ENDXYZ,
|
||||
|
||||
CT_SWITCHX,
|
||||
CT_SWITCHY,
|
||||
CT_SWITCHZ,
|
||||
|
||||
CT_PROBE,
|
||||
CT_PROBE_SWITCH,
|
||||
CT_XYZLASE,
|
||||
CT_SEND_XYZLASE,
|
||||
CT_END1
|
||||
|
||||
};
|
||||
|
||||
enum PRO_DATA
|
||||
{
|
||||
CT_READ_AXISXYZ,
|
||||
CT_READ_AXISX,
|
||||
CT_READ_AXISY,
|
||||
CT_READ_AXISZ,
|
||||
|
||||
CT_READ_PROBEXYZ,
|
||||
CT_READ_PROBEX,
|
||||
CT_READ_PROBEY,
|
||||
CT_READ_PROBEZ,
|
||||
|
||||
CT_SAVE_MOTORX1,
|
||||
CT_SAVE_MOTORX2,
|
||||
CT_SAVE_MOTORX3,
|
||||
CT_SAVE_MOTORX4,
|
||||
CT_SAVE_MOTORX5,
|
||||
|
||||
CT_SAVE_MOTORY1,
|
||||
CT_SAVE_MOTORY2,
|
||||
CT_SAVE_MOTORY3,
|
||||
CT_SAVE_MOTORY4,
|
||||
CT_SAVE_MOTORY5,
|
||||
|
||||
CT_SAVE_MOTORZ1,
|
||||
CT_SAVE_MOTORZ2,
|
||||
CT_SAVE_MOTORZ3,
|
||||
CT_SAVE_MOTORZ4,
|
||||
CT_SAVE_MOTORZ5,
|
||||
|
||||
CT_READ_MOTORX1,
|
||||
CT_READ_MOTORX2,
|
||||
CT_READ_MOTORX3,
|
||||
CT_READ_MOTORX4,
|
||||
CT_READ_MOTORX5,
|
||||
|
||||
CT_READ_MOTORY1,
|
||||
CT_READ_MOTORY2,
|
||||
CT_READ_MOTORY3,
|
||||
CT_READ_MOTORY4,
|
||||
CT_READ_MOTORY5,
|
||||
|
||||
CT_READ_MOTORZ1,
|
||||
CT_READ_MOTORZ2,
|
||||
CT_READ_MOTORZ3,
|
||||
CT_READ_MOTORZ4,
|
||||
CT_READ_MOTORZ5,
|
||||
|
||||
CT_SAVE_SCALEX,
|
||||
CT_SAVE_SCALEY,
|
||||
CT_SAVE_SCALEZ,
|
||||
|
||||
CT_READ_SCALEX,
|
||||
CT_READ_SCALEY,
|
||||
CT_READ_SCALEZ,
|
||||
|
||||
CT_SAVE_SECTION_FLAGX,
|
||||
CT_SAVE_SECTION_FLAGY,
|
||||
CT_SAVE_SECTION_FLAGZ,
|
||||
|
||||
CT_READ_SECTION_FLAGX,
|
||||
CT_READ_SECTION_FLAGY,
|
||||
CT_READ_SECTION_FLAGZ,
|
||||
|
||||
CT_SAVE_PROBE,
|
||||
CT_READ_PROBE,
|
||||
|
||||
CT_SAVE_SEC_REALX,
|
||||
CT_SAVE_SEC_INTX,
|
||||
CT_SAVE_SEC_SCALEX,
|
||||
|
||||
CT_SAVE_SEC_REALY,
|
||||
CT_SAVE_SEC_INTY,
|
||||
CT_SAVE_SEC_SCALEY,
|
||||
|
||||
CT_SAVE_SEC_REALZ,
|
||||
CT_SAVE_SEC_INTZ,
|
||||
CT_SAVE_SEC_SCALEZ,
|
||||
|
||||
CT_READ_SEC_REALX,
|
||||
CT_READ_SEC_INTX,
|
||||
CT_READ_SEC_SCALEX,
|
||||
|
||||
CT_READ_SEC_REALY,
|
||||
CT_READ_SEC_INTY,
|
||||
CT_READ_SEC_SCALEY,
|
||||
|
||||
CT_READ_SEC_REALZ,
|
||||
CT_READ_SEC_INTZ,
|
||||
CT_READ_SEC_SCALEZ,
|
||||
|
||||
CT_READ_SYSTEM,
|
||||
CT_READ_XSECTION_INT,
|
||||
CT_READ_XSECTION_REAL,
|
||||
CT_READ_XSECTION_SCALE,
|
||||
|
||||
CT_READ_YSECTION_INT,
|
||||
CT_READ_YSECTION_REAL,
|
||||
CT_READ_YSECTION_SCALE,
|
||||
|
||||
CT_READ_ZSECTION_INT,
|
||||
CT_READ_ZSECTION_REAL,
|
||||
CT_READ_ZSECTION_SCALE,
|
||||
|
||||
|
||||
CT_WRITE_SYSTEM,
|
||||
CT_WRITE_XSECTION_INT,
|
||||
CT_WRITE_XSECTION_REAL,
|
||||
CT_WRITE_XSECTION_SCALE,
|
||||
|
||||
CT_WRITE_YSECTION_INT,
|
||||
CT_WRITE_YSECTION_REAL,
|
||||
CT_WRITE_YSECTION_SCALE,
|
||||
|
||||
CT_WRITE_ZSECTION_INT,
|
||||
CT_WRITE_ZSECTION_REAL,
|
||||
CT_WRITE_ZSECTION_SCALE,
|
||||
|
||||
CT_READ_AXISV,
|
||||
CT_READ_ADC,
|
||||
CT_READ_ADC_INDEX,
|
||||
|
||||
CT_PRO_DAT_END,
|
||||
CT_CLEAR_PROBE_FLAG,
|
||||
|
||||
CT_READ_IO_DAT,
|
||||
CT_WRITE_IO_DAT
|
||||
|
||||
};
|
||||
|
||||
enum PASSWORD
|
||||
{
|
||||
#ifdef PASSNUM
|
||||
Llz_unknow=PASSNUM,//110,
|
||||
#else
|
||||
llz_unknow = 0,
|
||||
#endif
|
||||
Llz_Start,
|
||||
Llz_Check_PassWord,
|
||||
Llz_Set_User_Dat,
|
||||
Llz_Get_User_Dat,
|
||||
Llz_Get_Fun,
|
||||
Llz_Scale_Dat,
|
||||
Llz_Save_Config_Dat,
|
||||
Llz_Change_SCR_Coor,
|
||||
Llz_Read_Config_Dat,
|
||||
Llz_Distance,
|
||||
Llz_Circle,
|
||||
Llz_Angle,
|
||||
Llz_PLDis,
|
||||
Llz_GetID,
|
||||
Llz_total
|
||||
};
|
||||
|
||||
enum BARCODE
|
||||
{
|
||||
Bar_unknow = 220,
|
||||
|
||||
Bar_Line_Scalex,
|
||||
Bar_Line_Scaley,
|
||||
Bar_Section_Scalex,
|
||||
Bar_Section_Scaley,
|
||||
|
||||
Bar_total
|
||||
};
|
||||
|
||||
enum Video_Surce
|
||||
{
|
||||
Video,
|
||||
|
||||
SDK3000,
|
||||
CG400,
|
||||
MVIP_1,
|
||||
MVIP_2,
|
||||
MVIP_3,
|
||||
|
||||
MV8000E_2,
|
||||
MV8000E_6,
|
||||
MV8000E_2_IP,
|
||||
MV8000E_8,
|
||||
MV8000E_BAR_3,
|
||||
MV8000E_BAR_5,
|
||||
MV8000E_BAR_IP2,
|
||||
MV8000E_BAR_8,
|
||||
|
||||
V80M,
|
||||
V80M_SDK3000,
|
||||
V80M_MV8000E_2,
|
||||
V80M_MV8000E_BAR_3,
|
||||
V80M_MV8000E_BAR_5,
|
||||
V80M_MV8000E_8,
|
||||
|
||||
V140M,
|
||||
V140M_SDK3000,
|
||||
V140M_MV8000E_5,
|
||||
V140M_MV8000E_8,
|
||||
|
||||
V910M,
|
||||
V910M_SDK3000,
|
||||
V910M_MV8000E_2,
|
||||
V910M_MV8000E_BAR_3,
|
||||
V910M_MV8000E_BAR_5,
|
||||
V910M_MV8000E_8,
|
||||
|
||||
MV8000E_10,
|
||||
MV8000E_12,
|
||||
MV8000E_16,
|
||||
|
||||
MV8800E_8,
|
||||
MV8800E_10,
|
||||
MV8800E_12,
|
||||
MV8800E_16,
|
||||
|
||||
V140M_MV8800E_11,
|
||||
V140M_MV8000E_11,
|
||||
|
||||
V1000M,
|
||||
V1000M_2,
|
||||
|
||||
V1000M_30M,
|
||||
V1KM_V1KM,
|
||||
V1000M_30M_BARCODE,
|
||||
V1KM_V1KM_BARCODE,
|
||||
|
||||
V140M_TTK,
|
||||
VGALF_3C4L,
|
||||
|
||||
|
||||
Total
|
||||
};
|
||||
|
||||
#define NULCCD if((video_type == MV8000E_8)||(video_type == VGALF_3C4L)||(video_type==V140M_MV8000E_11)/*||(video_type==V140M_TTK)*/||(video_type==V140M_MV8000E_8)||(video_type==MV8000E_BAR_5)||((video_type>=MV8000E_10)&&(video_type<V1000M)))
|
||||
|
||||
#define MVECCD if((video_type>=MV8800E_8)&&(video_type<=MV8800E_16))
|
||||
@@ -0,0 +1,320 @@
|
||||
// CaptureDataDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Mv_Util.h"
|
||||
#include "CaptureDataDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "..\..\..\MicroVu\Mv_Proto.h"
|
||||
|
||||
extern CMv_Proto *m_pMv_Proto;
|
||||
|
||||
// CCaptureDataDlg dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(CCaptureDataDlg, CDialogEx)
|
||||
|
||||
CCaptureDataDlg::CCaptureDataDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(CCaptureDataDlg::IDD, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCaptureDataDlg::~CCaptureDataDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CCaptureDataDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CCaptureDataDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BUTTON_UPDATE_CONFIG, &CCaptureDataDlg::OnBnClickedButtonUpdateConfig)
|
||||
ON_BN_CLICKED(IDC_BUTTON_BROWSE_LOG, &CCaptureDataDlg::OnBnClickedButtonBrowseLog)
|
||||
ON_BN_CLICKED(IDC_BUTTON_GET_MV_CONFIG, &CCaptureDataDlg::OnBnClickedButtonGetMvConfig)
|
||||
ON_BN_CLICKED(IDC_RADIO_CREATE_MV_CONFIG, &CCaptureDataDlg::OnBnClickedRadioCreateMvConfig)
|
||||
ON_BN_CLICKED(IDC_RADIO_UPDATE_MV_CONFIG, &CCaptureDataDlg::OnBnClickedRadioUpdateMvConfig)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
//=============================================================================
|
||||
// CCaptureDataDlg message handlers
|
||||
//=============================================================================
|
||||
void CCaptureDataDlg::OnBnClickedButtonUpdateConfig()
|
||||
{
|
||||
char inBuff[MAX_LINE_LEN];
|
||||
FILE* pOutFile;
|
||||
FILE* pMvFile;
|
||||
FILE* pExtractLogFile;
|
||||
|
||||
memset(_str_7000, 0, MAX_SHORT_LEN);
|
||||
memset(_str_6f00, 0, MAX_SHORT_LEN);
|
||||
memset(_str_4c02, 0, MAX_SHORT_LEN);
|
||||
|
||||
//==================================================================================
|
||||
// Create condensed file first.
|
||||
//==================================================================================
|
||||
CMv_Proto_Dump* mv_proto_dump = new CMv_Proto_Dump;
|
||||
int retStatus = mv_proto_dump->MainSnoopyFunction(m_SnoopyLogFile, OUT_CONDENSED, MACHINE_MICROVU);
|
||||
delete mv_proto_dump;
|
||||
if (retStatus == -1)
|
||||
{
|
||||
m_status_msg += _T("\r\nError: SnoopyLog not found or unable to create condensed file.");
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
return;
|
||||
}
|
||||
m_proto_filename = m_SnoopyLogFile + _T(".condensed.proto.txt");
|
||||
m_status_msg = _T("\r\nStatus : Extract file created. - ") + m_proto_filename;
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
|
||||
//==================================================================================
|
||||
// Extract 7000/6f00/4c02 from the condensed files.
|
||||
//==================================================================================
|
||||
_wfopen_s(&pExtractLogFile, m_proto_filename, _T("r")); // open the condensed file
|
||||
fgets((char *)inBuff, MAX_LINE_LEN, pExtractLogFile ); // pick up the first line
|
||||
while (!feof(pExtractLogFile))
|
||||
{
|
||||
if (inBuff[0] != '>')
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
else
|
||||
if (!_strnicmp(inBuff+30, _6000_BUFF, 7))
|
||||
{
|
||||
// convert the ascii text into wchar_t code.
|
||||
memset(_c_str_model, 0, MAX_SHORT_LEN*2);
|
||||
memset(_c_str_serial_no, 0, MAX_SHORT_LEN*2);
|
||||
memset(_str_model, 0, MAX_SHORT_LEN*2);
|
||||
memset(_str_serial_no, 0, MAX_SHORT_LEN*2);
|
||||
for (int i = 0; i<16; ++i)
|
||||
{
|
||||
_c_str_serial_no[i] = (unsigned char) (*(inBuff+37+i*2) - '0');
|
||||
_c_str_serial_no[i] = (_c_str_serial_no[i] << 4) + (unsigned char) (*(inBuff+37+i*2+1) - '0');
|
||||
_c_str_model[i] = (unsigned char) (*(inBuff+101+i*2) - '0');
|
||||
_c_str_model[i] = (_c_str_model[i] << 4 ) + (unsigned char) (*(inBuff+101+i*2+1) - '0');
|
||||
};
|
||||
wcstombs(_str_serial_no, _wc_str_serial_no, 16);
|
||||
wcstombs(_str_model, _wc_str_model, 16);
|
||||
strcpy(_str_SerialNo, _STR_SerialNo_Label);
|
||||
strcat(_str_SerialNo, _str_serial_no);
|
||||
int i = (int) strlen(_str_SerialNo);
|
||||
_str_SerialNo[i] = 0x0a;
|
||||
_str_SerialNo[i+1] = 0;
|
||||
strcpy(_str_Model, _STR_Model_Label);
|
||||
strcat(_str_Model, _str_model);
|
||||
i = (int) strlen(_str_Model);
|
||||
_str_Model[i] = 0x0a;
|
||||
_str_Model[i+1] = 0;
|
||||
}
|
||||
else
|
||||
if (!(inBuff[40] == '1' && inBuff[41] == '0'))
|
||||
{
|
||||
}
|
||||
else
|
||||
if (!_strnicmp(inBuff+35, _7000_BUFF, 4))
|
||||
{
|
||||
strcpy(_str_7000, _STR_7000_Label);
|
||||
strcat(_str_7000, inBuff+35);
|
||||
strcpy(m_pMv_Proto->g_machine.s_machine_config._str_7000_signature, inBuff+35);
|
||||
}
|
||||
else
|
||||
if (!_strnicmp(inBuff+35, _6f00_BUFF, 4))
|
||||
{
|
||||
strcpy(_str_6f00, _STR_6f00_Label);
|
||||
strcat(_str_6f00, inBuff+35);
|
||||
strcpy(m_pMv_Proto->g_machine.s_machine_config._str_6f00_signature, inBuff+35);
|
||||
}
|
||||
fgets((char *)inBuff, MAX_LINE_LEN, pExtractLogFile ); // pick up the first line
|
||||
};
|
||||
fclose(pExtractLogFile);
|
||||
|
||||
//==================================================================================
|
||||
// Create a new mv_config file.
|
||||
//==================================================================================
|
||||
if (((CButton *)GetDlgItem(IDC_RADIO_CREATE_MV_CONFIG))->GetCheck())
|
||||
{
|
||||
m_status_msg += _T("\r\nStatus : Creating new mv_config file.");
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
MvConfigNew();
|
||||
return;
|
||||
};
|
||||
|
||||
//==================================================================================
|
||||
// Create the temp_mv_config_file from old mv_config.
|
||||
//==================================================================================
|
||||
_wfopen_s(&pMvFile, m_mv_config_full_path_name, _T("r")); // open the condensed file
|
||||
|
||||
if (pMvFile == NULL)
|
||||
{
|
||||
m_status_msg += _T("\r\nUnable to open mv_config file.");
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
return;
|
||||
};
|
||||
|
||||
CString _temp_name = m_AppPath + _T("\\") + m_temp_mv_config_filename + _T(".") + _wc_str_serial_no + _T(".cfg");
|
||||
_wfopen_s(&pOutFile, _temp_name, _T("w")); // open the condensed file
|
||||
if (pOutFile == NULL)
|
||||
{
|
||||
m_status_msg += _T("\r\nUnable to create temp_mv_config file.");
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
return;
|
||||
};
|
||||
fputs(_str_SerialNo, pOutFile);
|
||||
fputs(_str_Model, pOutFile);
|
||||
fputs(_str_7000, pOutFile);
|
||||
fputs(_str_6f00, pOutFile);
|
||||
// fputs(_str_4c02, pOutFile);
|
||||
|
||||
fgets((char *)inBuff, MAX_LINE_LEN, pMvFile ); // pick up the first line
|
||||
while (!feof(pMvFile))
|
||||
{
|
||||
if (!_strnicmp(inBuff, _STR_7000_Label, 9) ||
|
||||
!_strnicmp(inBuff, _STR_6f00_Label, 9) ||
|
||||
// !_strnicmp(inBuff, _STR_4c02_Label, 9) ||
|
||||
!_strnicmp(inBuff, _STR_SerialNo_Label, 9) ||
|
||||
!_strnicmp(inBuff, _STR_Model_Label, 6))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs(inBuff, pOutFile);
|
||||
};
|
||||
fgets((char *)inBuff, MAX_LINE_LEN, pMvFile ); // pick up the first line
|
||||
};
|
||||
|
||||
fclose(pMvFile);
|
||||
fclose(pOutFile);
|
||||
m_status_msg += _T("\r\nStatus : temp_mv_config created - \r\n ") + _temp_name;
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Defaults to c:\Windows\usbsnoop.log
|
||||
// Use File Dialog to point to the log file.
|
||||
// This file must exist.
|
||||
void CCaptureDataDlg::OnBnClickedButtonBrowseLog()
|
||||
{
|
||||
CString strFilters = _T("All Files (*.*)|*.*||");
|
||||
CString strExt = _T("log");
|
||||
CFileDialog fileDlg(TRUE, strExt, (LPCTSTR) m_SnoopyLogFile, OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, strFilters, this);
|
||||
FILE* pLogFile;
|
||||
INT_PTR nResult;
|
||||
while (true) {
|
||||
nResult = fileDlg.DoModal();
|
||||
if (nResult == IDOK)
|
||||
{
|
||||
m_SnoopyLogFile = fileDlg.GetPathName();
|
||||
_wfopen_s(&pLogFile, m_SnoopyLogFile, _T("r")); // see if we can read the file.
|
||||
if (pLogFile == NULL)
|
||||
{
|
||||
m_status_msg += _T("\r\n Snoopy Input File not found.");
|
||||
MessageBox( _T("UsbSnoop.log not found."), _T("Message"), MB_OK);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_SNOOP_LOG_FILE))->SetWindowText(m_SnoopyLogFile);
|
||||
fclose(pLogFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Defaults to the current directory with a file called mv_config.cfg.
|
||||
// This file may not exist.
|
||||
void CCaptureDataDlg::OnBnClickedButtonGetMvConfig()
|
||||
{
|
||||
CString strFilters = _T("All Files (*.*)|*.*||");
|
||||
CString strExt = _T("cfg");
|
||||
CString csMvFile = _T("mv_config.cfg");
|
||||
CFileDialog fileDlg(TRUE, strExt, (LPCTSTR) csMvFile, OFN_HIDEREADONLY, strFilters, this);
|
||||
FILE* pMvFile;
|
||||
INT_PTR nResult;
|
||||
while (true) {
|
||||
nResult = fileDlg.DoModal();
|
||||
if (nResult == IDOK)
|
||||
{
|
||||
csMvFile = fileDlg.GetPathName();
|
||||
_wfopen_s(&pMvFile, csMvFile, _T("r")); // see if we can read the file.
|
||||
if (pMvFile == NULL)
|
||||
{
|
||||
m_status_msg += _T("\r\nmv_config.cfg file not found. Creating a new temp_mv_config.cfg without mv_config.cfg file.");
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mv_config_full_path_name = csMvFile;
|
||||
fclose(pMvFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
BOOL CCaptureDataDlg::OnInitDialog()
|
||||
{
|
||||
m_status_msg = _T("System Ready.");
|
||||
m_SnoopyLogFile = _T("C:\\Windows\\usbsnoop.log");
|
||||
m_mv_config_filename = _T("mv_config.cfg");
|
||||
m_temp_mv_config_filename = _T("temp_mv_config");
|
||||
m_pMv_Proto->GetAppPath(m_AppPath);
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_SNOOP_LOG_FILE))->SetWindowText(m_SnoopyLogFile);
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
((CButton *)GetDlgItem(IDC_RADIO_CREATE_MV_CONFIG))->SetCheck(0);
|
||||
((CButton *)GetDlgItem(IDC_RADIO_UPDATE_MV_CONFIG))->SetCheck(1);
|
||||
CString strAppPath;
|
||||
m_pMv_Proto->GetAppPath(strAppPath);
|
||||
m_mv_config_full_path_name = strAppPath + _T("\\") + m_mv_config_filename;
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->EnableWindow(true);
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_MV_CONFIG_FILE))->SetWindowText(m_mv_config_full_path_name);
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
void CCaptureDataDlg::MvConfigNew()
|
||||
{
|
||||
CString fn;
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_SNOOP_LOG_FILE))->GetWindowText(fn);
|
||||
|
||||
FILE* pOutFile;
|
||||
CString _temp_name = m_AppPath + _T("\\") + m_temp_mv_config_filename + _T(".") + _wc_str_serial_no + _T(".cfg");
|
||||
_wfopen_s(&pOutFile, _temp_name, _T("w")); // open the condensed file
|
||||
if (pOutFile == NULL)
|
||||
{
|
||||
m_status_msg += _T("\r\nStatus : Unable to create temp_mv_config file.");
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
return;
|
||||
};
|
||||
fputs(_str_SerialNo, pOutFile);
|
||||
fputs(_str_Model, pOutFile);
|
||||
fputs(_str_7000, pOutFile);
|
||||
fputs(_str_6f00, pOutFile);
|
||||
fputs(_str_4c02, pOutFile);
|
||||
fclose(pOutFile);
|
||||
m_status_msg += _T("\r\nTemp_mv_config created - \r\n ") + _temp_name;
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_STATUS_WINDOW))->SetWindowText(m_status_msg);
|
||||
return;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void CCaptureDataDlg::OnBnClickedRadioCreateMvConfig()
|
||||
{
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_MV_CONFIG_FILE))->EnableWindow(false);
|
||||
((CEdit *)GetDlgItem(IDC_BUTTON_GET_MV_CONFIG))->EnableWindow(false);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void CCaptureDataDlg::OnBnClickedRadioUpdateMvConfig()
|
||||
{
|
||||
((CEdit *)GetDlgItem(IDC_EDIT_MV_CONFIG_FILE))->EnableWindow(true);
|
||||
((CEdit *)GetDlgItem(IDC_BUTTON_GET_MV_CONFIG))->EnableWindow(true);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
#include "afxwin.h"
|
||||
#include "Mv_Proto_Dump.H"
|
||||
|
||||
#define MAX_LINE_LEN 512
|
||||
#define MAX_SHORT_LEN 128
|
||||
|
||||
#define _STR_7000_Label "STR_7000="
|
||||
#define _STR_6f00_Label "STR_6f00="
|
||||
#define _STR_4c02_Label "STR_4c02="
|
||||
#define _STR_SerialNo_Label "SerialNo="
|
||||
#define _STR_Model_Label "Model="
|
||||
//
|
||||
#define _6000_BUFF "7e : 60"
|
||||
#define _7000_BUFF "7000"
|
||||
#define _6f00_BUFF "6f00"
|
||||
#define _4c02_BUFF "4c02"
|
||||
|
||||
// CCaptureDataDlg dialog
|
||||
|
||||
class CCaptureDataDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CCaptureDataDlg)
|
||||
|
||||
public:
|
||||
CCaptureDataDlg(CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~CCaptureDataDlg();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_DIALOG_UPDATE_MV_CONFIG };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnInitDialog();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnBnClickedButtonUpdateConfig();
|
||||
afx_msg void OnBnClickedButtonBrowseLog();
|
||||
afx_msg void OnBnClickedButtonGetMvConfig();
|
||||
CString m_status_msg;
|
||||
CString m_SnoopyLogFile;
|
||||
CString m_mv_config_full_path_name;
|
||||
CString m_mv_config_filename;
|
||||
CString m_temp_mv_config_filename;
|
||||
CString m_proto_filename;
|
||||
CString m_AppPath;
|
||||
CMv_Proto_Dump* mv_proto_dump;
|
||||
|
||||
union {
|
||||
wchar_t _wc_str_serial_no[MAX_SHORT_LEN];
|
||||
char _c_str_serial_no[MAX_SHORT_LEN*2];
|
||||
};
|
||||
char _str_serial_no[MAX_SHORT_LEN*2];
|
||||
union {
|
||||
wchar_t _wc_str_model[MAX_SHORT_LEN];
|
||||
char _c_str_model[MAX_SHORT_LEN*2];
|
||||
};
|
||||
char _str_model[MAX_SHORT_LEN*2];
|
||||
|
||||
void MvConfigNew();
|
||||
afx_msg void OnBnClickedRadioCreateMvConfig();
|
||||
afx_msg void OnBnClickedRadioUpdateMvConfig();
|
||||
|
||||
char _str_SerialNo[MAX_SHORT_LEN];
|
||||
char _str_Model[MAX_SHORT_LEN];
|
||||
char _str_7000[MAX_SHORT_LEN];
|
||||
char _str_6f00[MAX_SHORT_LEN];
|
||||
char _str_4c02[MAX_SHORT_LEN];
|
||||
};
|
||||
@@ -0,0 +1,126 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// DirDialog.cpp: implementation of the CDirDialog class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DirDialog.h"
|
||||
#include "shlobj.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
// Callback function called by SHBrowseForFolder's browse control
|
||||
// after initialization and when selection changes
|
||||
static int __stdcall BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
CDirDialog* pDirDialogObj = (CDirDialog*)lpData;
|
||||
|
||||
if (uMsg == BFFM_INITIALIZED && !pDirDialogObj->m_strSelDir.IsEmpty())
|
||||
{
|
||||
::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)(pDirDialogObj->m_strSelDir));
|
||||
}
|
||||
else // uMsg == BFFM_SELCHANGED
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CDirDialog::CDirDialog()
|
||||
{
|
||||
}
|
||||
|
||||
CDirDialog::~CDirDialog()
|
||||
{
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
int CDirDialog::DoBrowse()
|
||||
{
|
||||
LPMALLOC pMalloc;
|
||||
if (SHGetMalloc (&pMalloc)!= NOERROR)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BROWSEINFO bInfo;
|
||||
LPITEMIDLIST pidl;
|
||||
ZeroMemory ( (PVOID) &bInfo,sizeof (BROWSEINFO));
|
||||
|
||||
if (!m_strInitDir.IsEmpty ())
|
||||
{
|
||||
OLECHAR olePath[MAX_PATH];
|
||||
ULONG chEaten;
|
||||
ULONG dwAttributes;
|
||||
HRESULT hr;
|
||||
LPSHELLFOLDER pDesktopFolder;
|
||||
//
|
||||
// Get a pointer to the Desktop's IShellFolder interface.
|
||||
//
|
||||
if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
|
||||
{
|
||||
//
|
||||
// IShellFolder::ParseDisplayName requires the file name be in Unicode.
|
||||
//
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, (LPCSTR) m_strInitDir.GetBuffer(MAX_PATH), -1,
|
||||
olePath, MAX_PATH);
|
||||
|
||||
m_strInitDir.ReleaseBuffer (-1);
|
||||
//
|
||||
// Convert the path to an ITEMIDLIST.
|
||||
//
|
||||
hr = pDesktopFolder->ParseDisplayName(NULL,
|
||||
NULL,
|
||||
olePath,
|
||||
&chEaten,
|
||||
&pidl,
|
||||
&dwAttributes);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pMalloc ->Free (pidl);
|
||||
pMalloc ->Release ();
|
||||
return 0;
|
||||
}
|
||||
bInfo.pidlRoot = pidl;
|
||||
|
||||
}
|
||||
}
|
||||
bInfo.hwndOwner = NULL;
|
||||
bInfo.pszDisplayName = m_strPath.GetBuffer (MAX_PATH);
|
||||
bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? _T("Open"):m_strTitle;
|
||||
bInfo.ulFlags = BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS;
|
||||
bInfo.lpfn = BrowseCtrlCallback; // address of callback function
|
||||
bInfo.lParam = (LPARAM)this; // pass address of object to callback function
|
||||
|
||||
if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
m_strPath.ReleaseBuffer();
|
||||
m_iImageIndex = bInfo.iImage;
|
||||
|
||||
if (::SHGetPathFromIDList(pidl,m_strPath.GetBuffer(MAX_PATH)) == FALSE)
|
||||
{
|
||||
pMalloc ->Free(pidl);
|
||||
pMalloc ->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_strPath.ReleaseBuffer();
|
||||
|
||||
pMalloc ->Free(pidl);
|
||||
pMalloc ->Release();
|
||||
|
||||
return 1;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user