Modified codes in MSG_ERR and MSG_WAR in emcy.c
authorluis
Fri, 28 Sep 2007 15:08:38 +0200
changeset 288 26015ee2c2c9
parent 287 fa4df65d0683
child 289 a22ce0314063
Modified codes in MSG_ERR and MSG_WAR in emcy.c
Defined OD_VALUE_RANGE_EXCEEDED in def.h
Modified gen_cfile.py so than range test for 1003h sub0 sends OD_VALUE_RANGE_EXCEEDED as abortcode when value written is different from 0.
doc/code_debug.txt
include/def.h
objdictgen/gen_cfile.py
src/emcy.c
--- a/doc/code_debug.txt	Thu Sep 27 09:42:51 2007 +0200
+++ b/doc/code_debug.txt	Fri Sep 28 15:08:38 2007 +0200
@@ -18,7 +18,7 @@
       2    -> Warning
       3    -> Information
 
-f   : 0    -> In file sync.c
+f   : 0    -> In file sync.c, emcy.c
       1    ->         lifegrd.c
       2    ->         objacces.c
       3    ->         timer.c
--- a/include/def.h	Thu Sep 27 09:42:51 2007 +0200
+++ b/include/def.h	Fri Sep 28 15:08:38 2007 +0200
@@ -35,6 +35,7 @@
 #define OD_NOT_MAPPABLE              0x06040041
 #define OD_LENGTH_DATA_INVALID       0x06070010
 #define OD_NO_SUCH_SUBINDEX 	     0x06090011
+#define OD_VALUE_RANGE_EXCEEDED      0x06090030 /* Value range test result */
 #define OD_VALUE_TOO_LOW             0x06090031 /* Value range test result */
 #define OD_VALUE_TOO_HIGH            0x06090032 /* Value range test result */
 /* Others SDO abort codes 
--- a/objdictgen/gen_cfile.py	Thu Sep 27 09:42:51 2007 +0200
+++ b/objdictgen/gen_cfile.py	Fri Sep 28 15:08:38 2007 +0200
@@ -107,8 +107,7 @@
     valueRangeContent = ""
     strDefine = "\n#define valueRange_EMC 0x9F /* Type for index 0x1003 subindex 0x00 (only set of value 0 is possible) */"
     strSwitch = """    case valueRange_EMC:
-      if (*(UNS8*)value < (UNS8)0) return OD_VALUE_TOO_LOW;
-      if (*(UNS8*)value > (UNS8)0) return OD_VALUE_TOO_HIGH;
+      if (*(UNS8*)value != (UNS8)0) return OD_VALUE_RANGE_EXCEEDED;
       break;\n"""
     internal_types["valueRange_EMC"] = ("UNS8", "", "valueRange_EMC")
     num = 0
--- a/src/emcy.c	Thu Sep 27 09:42:51 2007 +0200
+++ b/src/emcy.c	Fri Sep 28 15:08:38 2007 +0200
@@ -98,7 +98,7 @@
 {
 	Message m;
   
-	MSG_WAR(0xA001, "sendEMCY", 0);
+	MSG_WAR(0x3051, "sendEMCY", 0);
   
 	m.cob_id.w = cob_id ;
 	m.rtr = NOT_A_REQUEST;
@@ -134,7 +134,7 @@
 		{
 			if (d->error_data[index].active)
 			{
-				MSG_WAR(0xA002, "EMCY message already sent", 0);
+				MSG_WAR(0x3052, "EMCY message already sent", 0);
 				return 0;
 			} else d->error_data[index].active = 1;		/* set as active error */
 			break;
@@ -146,7 +146,7 @@
 	
 	if (index == EMCY_MAX_ERRORS)		/* error_data full */
 	{
-		MSG_ERR(0xA003, "error_data full", 0);
+		MSG_ERR(0x3053, "error_data full", 0);
 		return 1;
 	}
 	
@@ -213,7 +213,7 @@
 		*d->error_register = errRegister_tmp;
 	}
 	else
-		MSG_WAR(0xA004, "recovered error was not active", 0);
+		MSG_WAR(0x3054, "recovered error was not active", 0);
 }
 
 /*! This function is responsible to process an EMCY canopen-message.
@@ -229,11 +229,11 @@
 	UNS16 errCode;
 	UNS8 errReg;
 	
-	MSG_WAR(0xA005, "EMCY received. Proceed. ", 0);
+	MSG_WAR(0x3055, "EMCY received. Proceed. ", 0);
   
 	/* Test if the size of the EMCY is ok */
 	if ( m->len != 8) {
-		MSG_ERR(0xA006, "Error size EMCY. CobId  : ", m->cob_id.w);
+		MSG_ERR(0x1056, "Error size EMCY. CobId  : ", m->cob_id.w);
 		return;
 	}