Master now sends NMT_Reset only from default preOperational application callback
authorEdouard Tisserant
Tue, 19 Jun 2012 10:29:03 +0200
changeset 746 3e16d9a121b8
parent 745 0bd84a528133
child 747 4725d8f909ff
Master now sends NMT_Reset only from default preOperational application callback
src/states.c
--- a/src/states.c	Mon Jun 18 19:38:40 2012 +0200
+++ b/src/states.c	Tue Jun 19 10:29:03 2012 +0200
@@ -181,10 +181,6 @@
 				s_state_communication newCommunicationState = {0, 1, 1, 1, 1, 0, 1};
 				d->nodeState = Pre_operational;
 				switchCommunicationState(d, &newCommunicationState);
-				if (!(*(d->iam_a_slave)))
-				{
-					masterSendNMTstateChange (d, 0, NMT_Reset_Node);
-				}
                 (*d->preOperational)(d);
 			}
 			break;
@@ -313,6 +309,11 @@
 }
 
 void _initialisation(CO_Data* d){}
-void _preOperational(CO_Data* d){}
+void _preOperational(CO_Data* d){
+    if (!(*(d->iam_a_slave)))
+    {
+        masterSendNMTstateChange (d, 0, NMT_Reset_Node);
+    }
+}
 void _operational(CO_Data* d){}
 void _stopped(CO_Data* d){}