[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DDL-ML] DDL-Patch fuer Nothalt (NMRA)



Tach,

angehaengt ein Nothalt-Patch zum ddl-xmas-2001-RC1,
momentan nur fuer NMRA-Dekoder.
Einzuspielen mit "patch -p0 <nothalt-nmra.patch"
Dann ins DDL-Verzeichnis wechseln und neu kompilieren.


Fuer die Realisierung eines Motorola-Nothalts brauche ich noch ein paar 
Informationen:
* Welche Packetfolge für welche Protokollvariante muss erzeugt werden
* Kann ich in der Funktion handleSETGL() (Modul srcp.c) sequentell mehrmals
  die Funktion comp_maerklin_x() aufrufen, ohne daß ein packet nicht erzeugt
  und ausgegeben wird?

Aber schon erwaehnt besitze ich keine Motorola-Dekoder, um die Funktion zu
testen. Deshalb wuerde es mich freuen, wenn ein anderer die Arbeit uebernehmen
wuerde.

-- 
Markus
diff -r -c DDL-RC1/erddcd/srcp.c DDL/erddcd/srcp.c
*** DDL-RC1/erddcd/srcp.c	Tue Nov  6 10:37:06 2001
--- DDL/erddcd/srcp.c	Sat Dec  8 13:51:52 2001
***************
*** 135,146 ****
  
     memset(p,0,3);
     strncpy(p,protocol,2);
- 
-    if (direction==2) { // emergency halt
-       V=0;             // this is not really an emergency halt
-       direction=1;     // but the best thing i can do until a
-                        // real implementation is done
-    }
   
     if (p[0]=='P' && p[1]=='S') { // protocol by server
        // until this daemon has a real address-protocol handling
--- 135,140 ----
***************
*** 154,159 ****
--- 148,158 ----
     switch (p[0]) {
        case 'M':
           if (!(ENABLED_PROTOCOLS & EP_MAERKLIN)) return;
+          if (direction==2) { // emergency halt
+ 	   V=0;             // this is not really an emergency halt
+ 	   direction=1;     // but the best thing i can do until a
+                	            // real implementation is done
+ 	 } 
           switch (p[1]) {
               case '1':
                  speed = virtualV2realV(V, V_max, 14);
***************
*** 224,230 ****
             case 'B':
                 speed = virtualV2realV(V, V_max, 14);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                error=comp_nmra_baseline(addr, direction, speed);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
                    update_NMRAPacketPool_LocoInfo(p,addr,direction,
--- 223,230 ----
             case 'B':
                 speed = virtualV2realV(V, V_max, 14);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
! 	       if (direction != 2) error=comp_nmra_baseline(addr, direction, speed);
! 	            else error=comp_nmra_baseline(addr, 0, 1);	// emergency halt: FS 1
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
                    update_NMRAPacketPool_LocoInfo(p,addr,direction,
***************
*** 235,242 ****
            case '1':
                 speed = virtualV2realV(V, V_max, 27);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                error=comp_nmra_f4b7s28(addr, direction, speed, func,
                                         f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
                    update_NMRAPacketPool_LocoInfo(p,addr,direction,
--- 235,244 ----
            case '1':
                 speed = virtualV2realV(V, V_max, 27);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                if (direction != 2) error=comp_nmra_f4b7s28(addr, direction, speed, func,
                                         f[0], f[1], f[2], f[3]);
+ 		    else error=comp_nmra_f4b7s28(addr, 0, 1, func,
+                                        f[0], f[1], f[2], f[3]);  // emergency halt: FS 1
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
                    update_NMRAPacketPool_LocoInfo(p,addr,direction,
***************
*** 247,253 ****
            case '2':
                 speed = virtualV2realV(V, V_max, 127);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                error=comp_nmra_f4b7s128(addr, direction, speed, func,
                                    f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
--- 249,257 ----
            case '2':
                 speed = virtualV2realV(V, V_max, 127);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                if (direction != 2) error=comp_nmra_f4b7s128(addr, direction, speed, func,
!                                   f[0], f[1], f[2], f[3]);
! 		    else error=comp_nmra_f4b7s128(addr, 0, 1, func,
                                    f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
***************
*** 258,264 ****
            case '3':
                 speed = virtualV2realV(V, V_max, 27);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                error=comp_nmra_f4b14s28(addr, direction, speed, func,
                                    f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
--- 262,270 ----
            case '3':
                 speed = virtualV2realV(V, V_max, 27);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                if (direction != 2) error=comp_nmra_f4b14s28(addr, direction, speed, func,
!                                   f[0], f[1], f[2], f[3]);
! 		    else error=comp_nmra_f4b14s28(addr, 0, 1, func,
                                    f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
***************
*** 270,276 ****
            case '4':
                 speed = virtualV2realV(V, V_max, 127);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                error=comp_nmra_f4b14s128(addr, direction, speed, func,
                                    f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)
--- 276,284 ----
            case '4':
                 speed = virtualV2realV(V, V_max, 127);
                 if (speed>0 && !raw_mode) speed++; // do not send FS 1
!                if (direction != 2) error=comp_nmra_f4b14s128(addr, direction, speed, func,
!                                   f[0], f[1], f[2], f[3]);
! 		    else error=comp_nmra_f4b14s128(addr, 0, 1, func,
                                    f[0], f[1], f[2], f[3]);
                 if (speed>0 && !raw_mode) speed--; // re-correct speed
                 if (!error)