bidirectional Communication

Moderator: Moderators

bidirectional Communication

Postby Allgäu-Express » 07.11.2008, 11:35

Hello,
is it possible to communicate bidirectional with the command station?
For example, I have a Tams MasterControl running under P50x.
When I reduce the speed from a train at the command station (Tams) this is not reported to the loc-control-panel in rocrail.

best regards, Alex
Allgäu-Express
 

Re: bidirectional Communication

Postby ajzahn » 07.11.2008, 12:12

Allgäu-Express wrote:Hello,
is it possible to communicate bidirectional with the command station?
For example, I have a Tams MasterControl running under P50x.
When I reduce the speed from a train at the command station (Tams) this is not reported to the loc-control-panel in rocrail.

best regards, Alex



good question!
ajzahn
 

Postby Peter Mueller » 07.11.2008, 18:22

I have a Tams MasterControl, too. And I am also missing the bidirectional communication.
Peter Mueller
 

Postby rjversluis » 07.11.2008, 20:03

OK,

I added this event handling in the p50x library but I cannot test it here.
Some other developer or tester with IB or compatable device should do this before activating the code.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby ron&bram » 07.11.2008, 20:11

Hi Rob, did I hear developer needed?

I will run an update to 3886, compile, test and report.

See you soon back here,

Ronald
Best regards, Viele Grüsse, vriendelijke groeten, Ronald :rr_cap:
GCA85/50/93/145/146/153 Loconet, Twincenter+booster for locs, seperate booster for accessory decoders, dedicated laptop with XP and Ubuntu for Rocrail, AndRoc, LGB indoor OTF layout
ron&bram
 

Postby rjversluis » 07.11.2008, 20:24

Hi Ronald,

do not forget to remove the comment below this line:

/* TODO: ask for locomotive changes */
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

1st test result

Postby ron&bram » 07.11.2008, 21:46

Hi Rob,

First test report:

I checked out 3886, changed the p50x.c:
Code: Select all
      /* TODO: ask for locomotive changes */
      /* special test activation uncommented lines below*/
      do {
        if( SerialOp.write( o->serial, (char*)out, 2 ) ) {
          byte ans = 0;
          if( SerialOp.read( o->serial, (char*)&into[0], 1 ) ) {
            if (into[0] <0x80>serial, (char*)into+1, 4 );
              __handleLoco(p50, into);
            }
          }
        }
      } while(into[0] != 0x80);
      /* end special test activation*/

And compiled the lot.
Test procedure:
only use p50x lib (removed ddx and lenz from rocrail.ini)
start rocrail
start rocgui
set tracelevel in rocrail
power on in rocgui
move loco with short address 16 forwards and backwards, switch lights on and lights off with the twincenter controls.
stop rocrail.
zip the trace file
In the attached debug and byte level traces you can clearly see that the lib is getting feedback from the twincenter, both on speed and on functions. This is not reflected in rocgui, but could that be due to the fact that the twincenter returns 4096 as loco address? Short address of loco 12 is returned as 3072. Do you want me to reprogram a loco with a long address?
Don't be fooled by the lenz reference in the trace files, for historic reaons the command station controlled by the p50x lib is called lenz (and the station controlled by the lenz lib is nowadays called elite).

Please advise on further actions/testing required.

Best regards,
Ronald
You do not have the required permissions to view the files attached to this post.
Best regards, Viele Grüsse, vriendelijke groeten, Ronald :rr_cap:
GCA85/50/93/145/146/153 Loconet, Twincenter+booster for locs, seperate booster for accessory decoders, dedicated laptop with XP and Ubuntu for Rocrail, AndRoc, LGB indoor OTF layout
ron&bram
 

Postby rjversluis » 07.11.2008, 22:33

Tnx Ronald,

can you change line:

int addr = addrL + addrH << 8;

into

int addr = addrL + addrH << 6;

and try again.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby rjversluis » 07.11.2008, 22:36

or

int addr = addrL + ( addrH << 8 );
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby rjversluis » 07.11.2008, 22:38

12 << 8 = 3072
:-)
So we need the brackets around the High part and the shift operation.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby ron&bram » 07.11.2008, 22:58

As a picture says more then a thousands words.

Next to the uncomment part in my previous mail, other code change was:
Code: Select all
static void __handleLoco(iOP50x p50x, byte* status) {
  iOP50xData data = Data(p50x);

  iONode nodeC = NULL;

  int addrL = status[2];
  int addrH = status[3] & 0x3F;
  /* special version, added brackets around the addrH shift */
  int addr  = addrL + ( addrH << 8 );
which gave the result in the screenshot attached. Loco address right, name right, speed/functions right, only not reflected in Rocgui.

I await further instructions o mighty master of Rocrail :wink: :wink: (getting late and one red wine down).

Best regards, Ronald
You do not have the required permissions to view the files attached to this post.
Best regards, Viele Grüsse, vriendelijke groeten, Ronald :rr_cap:
GCA85/50/93/145/146/153 Loconet, Twincenter+booster for locs, seperate booster for accessory decoders, dedicated laptop with XP and Ubuntu for Rocrail, AndRoc, LGB indoor OTF layout
ron&bram
 

Postby rjversluis » 08.11.2008, 07:55

Are for addresses 12 and 16 locomotives defined?
The Rocrail model tries to find a loco object by address in this event case; nothing is broadcasted to the clients if not found.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby rjversluis » 08.11.2008, 07:58

OK, just overlooked something in your trace:

the event reaches the loc object and traces a line fromout loc.c, 82, just before it is broadcasted to all connected clients.
Now you must check the rocgui trace.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby rjversluis » 08.11.2008, 08:07

Or check your setting:

If the velocity is set to percent:
V = (100 * V_raw) / spcnt

otherwise:
V = (wLoc.getV_max( node ) * V_raw) / spcnt


in the trace the V_raw=3 and the calculated V is only sometimes 1 or 3 which will not move much in the rocgui's loco tab.

The speed steps set in Rocrail must be equal to the settings in the IB for that loco.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby ron&bram » 08.11.2008, 09:05

Hi Rob,

I'm not at home now, but will continue tonight, so a quick message to let you know I have not forgotten and to confirm that loc addresses are identical in IB and Rocrail, for the speed both RR and IB use % scale.
The way things look at the moment is pretty good I think.

Back tonight.
Ron
Best regards, Viele Grüsse, vriendelijke groeten, Ronald :rr_cap:
GCA85/50/93/145/146/153 Loconet, Twincenter+booster for locs, seperate booster for accessory decoders, dedicated laptop with XP and Ubuntu for Rocrail, AndRoc, LGB indoor OTF layout
ron&bram
 

Next

Return to P50 and P50x