Index: /trunk/MagicSoft/Cosy/aposs/Manual.m
===================================================================
--- /trunk/MagicSoft/Cosy/aposs/Manual.m	(revision 1715)
+++ /trunk/MagicSoft/Cosy/aposs/Manual.m	(revision 1716)
@@ -4,7 +4,13 @@
 /*                                                                         */
 kVERSION    = 0   /*                                                       */
-kSUBVERSION = 2   /*                                                       */
+kSUBVERSION = 3   /*                                                       */
 /*                                                                         */
 /*  HISTORY:                                                               */
+/*                                                                         */
+/*   * V0.3:                                                               */
+/*       - added support for the elevation axis brake                      */
+/*       - enabled check for operation mode (remote control/pc)            */
+/*       - added 'reset' label                                             */
+/*       - moved syncv/cstart to setting rf                                */
 /*                                                                         */
 /*   * V0.2:                                                               */
@@ -135,11 +141,4 @@
 
 /*-------------------------------------------------------------------------*/
-/* Make sure 'Reglerfreigabe' not set                                      */
-/*-------------------------------------------------------------------------*/
-RF = 0
-out 1 0
-out 2 0     
-
-/*-------------------------------------------------------------------------*/
 /* Error routine                                                           */
 /*-------------------------------------------------------------------------*/
@@ -151,12 +150,19 @@
 /* mainloop rotation mode but stand still                                  */
 /*-------------------------------------------------------------------------*/
-if (get cannr==1) or (get cannr==3) then
-   print "Starting..."             
-else          
-   /*motor off /* switch off motor controlling: No 'Schleppfehler' */
-   print "Synchronizing..."             
-   motor on
-   syncv
-endif      
+                              
+brake = 0
+   
+reset:   
+   out 1 0
+   out 2 0   
+   RF = 0
+   motor off    
+   waitt 1000
+   
+   if (brake==1) then         
+      waitt 3000          /* wait 3s for DKC to stop the motor */
+      out (kIoModule+1) 0 /* brake the brake                   */
+      waitt 1000
+   endif   
          
 mainloop:       
@@ -168,36 +174,23 @@
    if (get cannr==1) or (get cannr==2) then
        ready = in 1
-   elseif get cannr==3 then
-       ready = in (kIoModule+5)
+   elseif (get cannr==3) then
+       ready = in (kIoModule+5)  /* !!!FIXME!!! */
    endif   
        
-   if fuse==0 then 
+   if (ready==0) and (RF==1) then
+      print "DKC not ready, but RF set... setting RF=AH=0!"
+      goto reset
+   elseif fuse==0 then 
       print "Motor-Power Fuse not OK!"
-      waitt 500
-      goto mainloop
+      goto reset
+   elseif vltg==0 then 
+      print "Overvoltage control broken!"
+      goto reset
    elseif emcy==0 then 
       print "Please release Emergency Stop!"
-      waitt 500 
-      goto mainloop
-   elseif vltg==0 then 
-      print "Overvoltage control broken!"
-      waitt 500 
-      goto mainloop
-/*      
-   elseif mode==1 then
+      goto reset
+   elseif mode==0 then
       print "Control not in manual mode!"
-      out 1 0
-      out 2 0
-      waitt 500
-      exit
-*/                 
-   elseif (ready==0) and (RF==1) then
-      print "DKC not ready... setting RF=AH=0!"
-      out 1 0
-      out 2 0   
-      RF = 0
-      motor off
-      waitt 1000
-      goto mainloop    
+      goto reset
    elseif (ready==1) and (RF==0) then
       print "DKC powered, RF=0... setting RF=AH=1!"
@@ -216,7 +209,21 @@
       RF = 1
       waitt 100
+
+      if (brake==0) then
+         out (kIoModule+1) 1
+         brake = 1
+         waitt 1000
+      endif
+
       motor on
-      cstart
-      /*waitt 100*/
+         
+      if (get cannr==2) then
+         syncv
+         print "Synchronizing speed..."             
+      else   
+         cstart
+         print "Starting revolution mode..."             
+         waitt 500
+      endif   
    elseif (ready==0) or (RF==0) then
       goto mainloop
@@ -246,5 +253,11 @@
       out 2 0
       RF = 0
-      waitt 100      
+      waitt 100
+      
+      if (brake==1) then
+         waitt 5000
+         out (kIoModule+1) 0
+         waitt 500
+      endif         
 
       print "Error #", errno
