/****************************************************************************/
/* errdef.h  (c++)                                                          */
/*------------------------------------------------------------------------- */
/* Licencia GPL                                                             */
/* Enumeracion para los codigos de error de la clase Rhino                  */
/* Clase para la gestion del estado del controlador del Servo Robot XR4     */
/*                             RHINO                                        */
/****************************************************************************/
/* Marco Alvarez Reyna                                                      */
/* CIII UTN-FRC Argentina                                                   */
/* Mayo 2007 / Abril 2008                                                   */
/* mail: marcoalrey@gmail.com                                               */
/****************************************************************************/

// RHINO CONTROLER Error Codes
#define RB_ERR_NE 0

// COMMAND ERRORS
//	Meaning	Code   
#define	INV_CMD	10	// Invalid command.
#define	PAR_OUT	11	// Parameter out of bounds.
#define	MIS_PAR	12	// Missing parameter.
#define	NO_DLIM	13	// Expected delimiter not seen.
#define	TOO_MNY	14	// Command string too long.
#define	TP_ACTV	16	// The teach pendant is active or busy. 
				
// COMMUNICATION ERRORS 				
//	Meaning	Code	
#define	HST_OVF	20	// Host input buffer overflow.
#define	HST_TMO	21	// Host USART timed out.
#define	HST_ERR	22	// Host USART error (framing, parity, etc.).
#define	TP_OVF	23	// Teach pendant input buffer overflow.
#define	TP_TMO	24	// Teach pendant USART timed out.
#define	TP_ERRO	25	// Teach pendant USART error (framing, parity, etc.).
#define	TP_OVRN	26	// Teach pendant USART overrun.
#define	HST_OVR	27	// Host USART overrun.
				
// DIAGNOSTIC ERRORS							
//	Meaning	Code   
#define	BAD_RAM	30	// Bad RAM location.
#define	IP_ERR	32	// Teach pendant returned diagnostic error.
#define	NO_TP	34	// Teach pendant not present.
				
// TEACH PENDANT PROGRAM ERRORS 				
//	Meaning	Code	
#define	LAB_ERR	40	// Missing label.
#define	NO_PGRM	41	// No program in memory.
#define	MEM_FUL	42	// Insufficient teach pendant memory.
#define	EPM_FUL	43	// Insufficient EEPROM memory.
#define	RPL_ERR	44	// Can not replace first record.
#define	PROGRAM	45	// A pendant program already exists.
				
// EXECUTION ERRORS 				
//    	Meaning	Code	
#define	HRD_ERR	50	// Hard home routine failed.
#define	NO_HARD	51	// Hard home not set.
#define	NO_SOFT	52	// Soft home not set.
#define	AR_OVFL	53	// Arithmetic overflow.
#define	TRG_ERR	54	// Trig function returned error.
#define	STK_ERR	55	// Error stack overflow.
#define	BUSY	56	// Still executing a trapezoidal move.
#define	NO_MOTR	57	// Inactive motor referenced.
#define	MOV_DAT	58	// Insufficient move data (velocity or acceleration = 0).
#define	BAD_MOD	59	// Improper motor mode for command.
		
#define	NO_A_SW	60	// Limit switch A not found.
#define	NO_B_SW	61	// Limit switch B not found.
#define	NO_C_SW	62	// Limit switch C not found.
#define	NO_D_SW	63	// Limit switch D not found.
#define	NO_E_SW	64	// Limit switch E not found.
#define	NO_F_SW	65	// Limit switch F not found.
#define	NO_G_SW	66	// Limit switch G not found.
#define	NO_H_SW	67	// Limit switch H not found.
   			
#define	IMODE	69	// Interpolation move out of bounds.
				
#define	POS_OUT 70      // xvz position out of bounds.
				
#define	STK_A_S	80	// Limit switch A stuck.
#define	STK_B_S	81	// Limit switch B stuck.
#define	STK_C_S	82	// Limit switch C stuck.
#define	STK_D_S	83	// Limit switch D stuck.
#define	STK_E_S	84	// Lim it switch E stuck.
#define	STK_F_S	85	// Limit switch F stuck.
#define	STK_G_S	86	// Lim it switch G stuck.
#define	STK_H_S 87	// Lim it switch H stuck. 
#define	INV_RBT	91	// Invalid robot type specifier.
#define	INV_MOT	92	// Invalid motor specifier.
#define	INV_TL	93	
#define	INV_PND	94	// Invalid pendant mode.
#define	STOP	95	
#define	INV_XYZ	96	// Invalid xyz specifier. 
#define	XYZ_PAR	97	// Invalid xyz parameter.
				
// MOTOR ERRORS 							
//	Meaning	Code	
#define	A_STALL 100	// Motor A stalled.
#define	B_STALL	101	// Motor B stalled.
#define	C_STALL	102	// Motor C stalled.
#define	D_STALL	103	// Motor D stalled.
#define	E_STALL	104	// Motor E stalled.
#define	F_STALL	105	// Motor F stalled.
#define	G_STALL	106	// Motor G stalled.
#define	H_STALL	107	// Motor H stalled.
#define	A_CURRENT_LIMIT	110     // Motor A's current limit circuit was activated.
#define	B_CURRENT_LIMIT	111	// Motor B's current limit circuit was activated.
#define	C_CURRENT_LIMIT	112	// Motor C's current limit circuit was activated.
#define	D_CURRENT_LIMIT	113	// Motor D's current limit circuit was activated.
#define	E_CURRENT_LIMIT	114	// Motor E's current limit circuit was activated.
#define	F_CURRENT_LIMIT	115	// Motor F's current limit circuit was activated.
#define	G_CURRENT_LIMIT	116	// Motor G's current limit circuit was activated.
#define	H_CURRENT_LIMIT	117	// Motor H's current limit circuit was activated.
#define	I_CURRENT_LIMIT	118	// Aux Port 1's current limit circuit was activated.
#define	J_CURRENT_LIMIT	119	// Aux Port 2's current limit circuit was activated.

// RHINO CLASS Error Codes
#define RC_ERR_NE 128

#define ERR_CODE 129  //'Error Code' fuera de rango
#define LOG_LEV  130  //'Log Level' fuera de rango
#define NO_FILE  131  //No se pudo crear el archivo de registro

/****************************************************************************/
/* A medida que se codifica la clase se van agregando las distintas         */
/* definiciones de error en este segmento. En el vector "RhinoClassErrors"  */
/* perteneciente a "rhino.cpp" se escriben los mensajes de error            */
/* corrspondiente                                                           */
/****************************************************************************/
