Index: trunk/MagicSoft/Cosy/devdrv/macs.cc
===================================================================
--- trunk/MagicSoft/Cosy/devdrv/macs.cc	(revision 2019)
+++ trunk/MagicSoft/Cosy/devdrv/macs.cc	(revision 2278)
@@ -127,7 +127,15 @@
 }
 
-void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, timeval_t *tv)
-{
-//    cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set." << endl;
+void Macs::HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, timeval_t *tv)
+{
+    //    cout << "Node #" << dec << (int)GetId() << ": Sdo=" << hex << idx  << "/" << (int)subidx << " set." << endl;
+
+    // If a real drive operation is requested from the MACS and
+    // the MACS is not correctly initialized the operation is
+    // rejected. (This is expecially harmfull if the NoWait state
+    // is set incorrectly)
+    if (data)
+        SetZombie();
+
     switch (idx)
     {
@@ -201,5 +209,5 @@
 
     }
-    NodeDrv::HandleSDOOK(idx, subidx, tv);
+    NodeDrv::HandleSDOOK(idx, subidx, data, tv);
 }
 
@@ -223,4 +231,16 @@
     SendSDO(0x1800, 1, (LWORD_t)(flag?0:1)<<31); 
     WaitForSdo(0x1800, 1);           
+}
+
+void Macs::StartNode()
+{
+    //
+    // Switch node from pre-operational state to operational state
+    // (This is not CANOpen compatible)
+    // After this the MACS will react on real movement commands.
+    //
+    lout << "- " << GetNodeName() << ": Starting Node." << endl;
+    SendSDO(0x1000, 1, (LWORD_t)1);
+    WaitForSdo(0x1000, 1);
 }
 
@@ -251,5 +271,5 @@
     StopGuarding();
 
-    usleep(2000*GetGuardTime());
+// ****FIXME***   usleep(2000*GetGuardTime());
 
     lout << "- " << GetNodeName() << ": Requesting Mac Software Version." << endl;
@@ -257,5 +277,6 @@
     WaitForSdo(0x100a);
     // FIXME! Not statically linked!
-    if (fSoftVersion<0x00000044) // 00.68
+    //if (fSoftVersion<0x00000044) // 00.68
+    if (fSoftVersion<0x00000045) // 00.69
     {
         lout << GetNodeName() << " - Software Version too old!" << endl;
@@ -269,19 +290,23 @@
     ReqVelRes(); // Init fVelRes
 
-    lout << "- " << GetNodeName() << ": Motor on." << endl;
-    SendSDO(0x3000, string('o', 'n'));
-    WaitForSdo(0x3000);
+    /* Should not be necessary anymore. This is done by the MACS itself.
+     lout << "- " << GetNodeName() << ": Motor on." << endl;
+     SendSDO(0x3000, string('o', 'n'));
+     WaitForSdo(0x3000);
+     */
 
     SetPDO1On(FALSE); // this is a workaround for the Macs
     SetPDO1On(TRUE);
 
-    SetNoWait(TRUE);
-
-//    StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms
-
-//    StartGuarding(250, 4);
-//    StartHostGuarding();
-}
-
+    //This is now standard in the MACS
+    //SetNoWait(TRUE);
+
+    // StartGuarding(200, 2, kFALSE); // Using PDO1 @ 100ms
+    // StartGuarding(250, 4);
+    // StartHostGuarding();
+
+    StartNode();
+}
+/*
 void Macs::StopMotor()
 {
@@ -292,10 +317,11 @@
     WaitForSdo(0x3000);
 }
-
+*/
 void Macs::StopDevice()
 {
     //EnableTimeout(kFALSE);
 
-    SetNoWait(FALSE);
+    //No need to switch it off.
+    //SetNoWait(FALSE);
 
     StopHostGuarding();
@@ -402,4 +428,5 @@
 }
 
+/*
 void Macs::SetNoWait(BYTE_t flag)
 {
@@ -408,4 +435,5 @@
     WaitForSdo(0x3008);
 }
+*/
 
 void Macs::StartVelSync()
Index: trunk/MagicSoft/Cosy/devdrv/macs.h
===================================================================
--- trunk/MagicSoft/Cosy/devdrv/macs.h	(revision 2019)
+++ trunk/MagicSoft/Cosy/devdrv/macs.h	(revision 2278)
@@ -34,5 +34,5 @@
 
     void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, timeval_t *tv);
-    void HandleSDOOK(WORD_t idx, BYTE_t subidx, timeval_t *tv);
+    void HandleSDOOK(WORD_t idx, BYTE_t subidx, LWORD_t data, timeval_t *tv);
     //void HandleSDOError(LWORD_t data) { NodeDrv::HandleSDOError(data); }
 
@@ -84,5 +84,5 @@
     void SetDeceleration(LWORD_t dec);
     void SetVelocity(LWORD_t vel);
-    void SetNoWait(BYTE_t flag=TRUE);
+    //void SetNoWait(BYTE_t flag=TRUE);
     void SetRpmMode(BYTE_t mode=TRUE);
     void SetRpmVelocity(LWORDS_t cvel);
@@ -99,5 +99,7 @@
     void StartAbsPos(LWORDS_t pos);
 
-    void StopMotor();
+    //void StopMotor();
+
+    void StartNode();
 
     int IsPositioning() const { return fPosActive; }
Index: trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc
===================================================================
--- trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc	(revision 2019)
+++ trunk/MagicSoft/Cosy/devdrv/shaftencoder.cc	(revision 2278)
@@ -16,5 +16,6 @@
 
 ShaftEncoder::ShaftEncoder(const BYTE_t nodeid, const char *name, MLog &out)
-    : NodeDrv(nodeid, name, out), fLabel(NULL), fPosHasChanged(false)
+    : NodeDrv(nodeid, name, out), fPos(0), fVel(0), fAcc(0),
+    fTurn(0), fLabel(NULL), fPosHasChanged(false)
 {
 }
