Test if index 1F22 exists for Master OD (Concise DCF)
authorgreg
Thu, 10 May 2007 09:33:07 +0200
changeset 183 4cddad17c81f
parent 182 988f2b302aa6
child 184 fb253029c7d4
Test if index 1F22 exists for Master OD (Concise DCF)
src/states.c
--- a/src/states.c	Fri May 04 13:57:54 2007 +0200
+++ b/src/states.c	Thu May 10 09:33:07 2007 +0200
@@ -99,6 +99,10 @@
 /*****************************************************************************/
 UNS8 setState(CO_Data* d, e_nodeState newState)
 {
+	UNS16 wIndex = 0x1F22;
+	const indextable *ptrTable;
+  	ODCallback_t *Callback;
+	UNS32 errorCode;
 	while(newState != d->nodeState){
 		switch( newState ){
 			case Initialisation:
@@ -123,8 +127,17 @@
 				switchCommunicationState(d, &newCommunicationState);
 				if (!(*(d->iam_a_slave)))
 				{
-					UNS32 res;
-					res = decompo_dcf(d,0x01);
+					ptrTable =(*d->scanIndexOD)(wIndex, &errorCode, &Callback);
+  					
+  					if (errorCode != OD_SUCCESSFUL)
+  						{
+  							(*d->preOperational)();
+  						}
+					else
+						{
+							UNS32 res;
+							res = decompo_dcf(d,0x01);
+						}				
 				}
 				else 
 				{