RocNet Protocol documentation

http://wiki.rocrail.net/doku.php?id=roc ... netnode-en

RocNet Protocol documentation

Postby Dagnall » 20.09.2016, 14:05

Rob,
Can I suggest an update for the http://wiki.rocrail.net/doku.php?id=rocnet:rocnet-prot-en ?
In
Code: Select all
18   set channel   channel#   valueH   valueL   

When I use the (excellent) "Fine Tune" tab, I am seeing a 4th data byte, with the value (0: Set offPos , 1: Set onPos)..
I'm not sure if there other settings for offsteps, on steps or options elsewhere.

Also, a note here for anyone else doing their own RocNet:
Where the documentation says (as an example..
Code: Select all
(write port event)   port#    idH   idL   port

This means in effect that you can have many more than just the 4 data bytes shown.. as you will actually get multiple ports data sent in a single message : port1, idH(port1) , idl(port1) port(port1), port2, idH(port2) , idl(port2) port(port2),
Its really obvious when you see it ! :wink:

All the best
Dagnall
ESP8266 Based RocNet Universal 8 i/o decoder and Mobile Decoder. http://wiki.rocrail.net/doku.php?id=users:dagnall53:description
G Scale 3D printed Locos and wagons : (on Thingyverse)
Dagnall
 

Re: RocNet Protocol documentation

Postby Dagnall » 18.02.2017, 17:36

Rob,
An question about the protocol..And specifically the rocnet response to Identify.

Is there somewhere where "class" ( data1 of the "group 3, code 8" byte in the identify response) is documented. ?
I think "bit 0= accessory"" bit 1= dcc" "Bit 3=RFID", but what do the other bits represent??

I would also like to better understand the group 7 code 5 data format,
I cannot find any precise documentation for "iotype; flags; cstype; or csdevice" and It also seems to need a 5th data byte that is not shown in the documentation...?

At the moment i have built up my response message with the following code, which shows what these variables mean, based on the github info... But I am afraid I am still confused :oops: .. ..
Can you give a simple explanation of what each bit of the variables means... :)

Code: Select all
 
          sendMessage[8] = RN[15]; //    iotype      0=GPIO, 1=I2c-0, 2=I2C-1not pi
          sendMessage[9] = RN[16]; //    flags bit    0 = ack (data->sack ? 0x01:0x00) | (data->rfid ? 0x02:0x00) | (data->usepb ? 0x04:0x00) | (data->adcsensor ? 0x08:0x00);
          sendMessage[10] = RN[17]; //   cstype     :0=none, 1=dcc232, 2=sprog //(  for [9]...data->tl_info ? 0x10:0x00) | (data->tl_monitor ? 0x20:0x00) | (data->ismobile ? 0x40:0x00);
          sendMessage[11] = RN[18]; //  csdevice usb 0/1
          sendMessage[12] = RN[19];


is there somewhere where these variables are clearly defined??

Many thanks
Dagnall
ESP8266 Based RocNet Universal 8 i/o decoder and Mobile Decoder. http://wiki.rocrail.net/doku.php?id=users:dagnall53:description
G Scale 3D printed Locos and wagons : (on Thingyverse)
Dagnall
 

Re: RocNet Protocol documentation

Postby rjversluis » 18.02.2017, 17:47

Hi Dagnall,

Code: Select all
#define RN_CLASS_IO      0x01
#define RN_CLASS_DCC     0x02
#define RN_CLASS_RFID    0x04


Those bits are saved in the class member variable:
Code: Select all
  case RN_STATIONARY_IDENTIFY:
    TraceOp.trc( name, TRCLEVEL_INFO, __LINE__, 9999, "queryids request from %d to %d", sndr, rcpt );
    msg = allocMem(128);
    msg[RN_PACKET_NETID] = data->location;
    msg[RN_PACKET_GROUP] = RN_GROUP_STATIONARY;
    rnReceipientAddresToPacket( sndr, msg, 0 );
    rnSenderAddresToPacket( data->id, msg, 0 );
    msg[RN_PACKET_ACTION] = RN_STATIONARY_IDENTIFY;
    msg[RN_PACKET_ACTION] |= (RN_ACTIONTYPE_EVENT << 5);
    msg[RN_PACKET_LEN] = 7 + StrOp.len(data->nickname);
    msg[RN_PACKET_DATA+0] = data->class;
    msg[RN_PACKET_DATA+1] = 70;
    msg[RN_PACKET_DATA+2] = revisionnr/256;
    msg[RN_PACKET_DATA+3] = revisionnr%256;
    msg[RN_PACKET_DATA+4] = 128;
    msg[RN_PACKET_DATA+5] = data->ip[data->ipsize-2];
    msg[RN_PACKET_DATA+6] = data->ip[data->ipsize-1];
    StrOp.copy((char*)&msg[RN_PACKET_DATA+7], data->nickname);
    break;

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 - CANGCx ] - [ G: CBUS - CANGCx ]
rjversluis
Site Admin
 

Re: RocNet Protocol documentation

Postby Dagnall » 29.07.2017, 18:23

Rob, sorry, some more questions.
Group 5, Message 7 is defined as 'read option' with data "iotype flags cstype csdevice".
I think I have these being sent correctly.

However.. the "OPTIONS " TAB also shows 'I2C Detect' with some addresses for 'GCA-Pi-02' ..03 ..04 ..07 and "rocdisplay"..
Where and how are these address variables sent to rocview??

I would like to set these correctly in my ESPWIFIRocnet code... which currently reports a
GGCA-Pi02 addresses of 0x22 0x24 .. (but these address change for unknown reasons with multiple 'get' )
and
"GCA-Pi07 address of "0x48 0x49 "

Many thanks
Dagnall
ESP8266 Based RocNet Universal 8 i/o decoder and Mobile Decoder. http://wiki.rocrail.net/doku.php?id=users:dagnall53:description
G Scale 3D printed Locos and wagons : (on Thingyverse)
Dagnall
 

Re: RocNet Protocol documentation

Postby rjversluis » 30.07.2017, 07:03

Hi Dagnall,

a snippet:
Code: Select all
  case RN_PROGRAMMING_RDOPT:
  case RN_PROGRAMMING_WROPT:
  {
    iONode node = NodeOp.inst( wProgram.name(), NULL, ELEMENT_NODE );
    wProgram.setmodid(node, sndr);
    wProgram.setcmd( node, wProgram.getoptions );
    wProgram.setval1( node, rn[RN_PACKET_DATA+0] );
    wProgram.setval2( node, rn[RN_PACKET_DATA+1] );
    wProgram.setval3( node, rn[RN_PACKET_DATA+2] );
    wProgram.setval4( node, rn[RN_PACKET_DATA+3] );
    /* I2C scan of 0x20, 0x30 and 0x40 */
    wProgram.setval5( node, rn[RN_PACKET_DATA+4]*256 + rn[RN_PACKET_DATA+5] );
    wProgram.setval6( node, rn[RN_PACKET_DATA+6]*256 + rn[RN_PACKET_DATA+7] );
    wProgram.setval7( node, rn[RN_PACKET_DATA+8]*256 + rn[RN_PACKET_DATA+9] );
    wProgram.setval8( node, rn[RN_PACKET_DATA+10] );
    if( rn[RN_PACKET_LEN] >= 13 )
      wProgram.setval9( node, rn[RN_PACKET_DATA+11]*256 + rn[RN_PACKET_DATA+12] );
    wProgram.setiid( node, data->iid );
    wProgram.setlntype(node, wProgram.lntype_rocnet);
    data->listenerFun( data->listenerObj, node, TRCLEVEL_INFO );
  }
  break;

I now documented it in the Wiki.
The 16 bit I2C scan values are bitmaps.

BTW: I added the C-Headerfile: http://wiki.rocrail.net/doku.php?id=roc ... t-en#files
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 - CANGCx ] - [ G: CBUS - CANGCx ]
rjversluis
Site Admin
 

Re: RocNet Protocol documentation

Postby Dagnall » 02.03.2018, 18:40

Hi Rob, another question from me

I'm looking at adding a "wireless" RocMouse capability for my ESP8266 code.
I assumed that Rocrail looks for a (any?) Rocmouse message (Group 2, Code 5?) as soon as it sees "dispatch".
But I have tried this and it does not seem to "bind" the controller to the loco.
Presumably there is some "Rocmouse BIND" communications sequence needed between the controller and the mouse that I have not implemented...
Can you direct me to somewhere where this dispatch/rocmouse initiate (/bind?) code command sequence is shown in detail?

Also :
Can you please add the description /details lines for the RN_MOBILE_ROCMOUSE_BIND (6) and
RN_MOBILE_ACK (7) to the mobile actions section in http://wiki.rocrail.net/doku.php?id=roc ... et-prot-en



Many thanks
Dagnall
ESP8266 Based RocNet Universal 8 i/o decoder and Mobile Decoder. http://wiki.rocrail.net/doku.php?id=users:dagnall53:description
G Scale 3D printed Locos and wagons : (on Thingyverse)
Dagnall
 

Re: RocNet Protocol documentation

Postby Dagnall » 03.04.2018, 13:16

Rob, Thanks for the link to the XML scripts. http://wiki.rocrail.net/doku.php?id=xmlscripting-en#commands
They were very interesting. I have now got Loco speed, and sound commanded over MQTT client.

But while looking through the data , I saw some very interesting entries: :
Code: Select all
21.10.8.6. locosetup (1)   childnode of rocnet                  No
acceleration   int      -   10   -   No
deceleration   int      -   10   -   No
nrpulses   int   Number of sensor pulses per wheel rotation.   -   3   -   No
scale   float   G scale   -   29.0   -   No
wheeldiameter

A the moment my ESP "Rocnet" mobile controller stores acc and dec as standard CV's, but wheel diameter and N pulses are stored as fixed numbers in the program.

So: first, are these XML script variables left over from your Rocnet mobile experiments?? ... in which case, should I ignore them!?
(I was planning on adding CV's for npulses and Wheeldiameter, but may change if you have a better approach...)

If they are important features that will remain and perhaps be used more in future, I would like to make ESPMQTTRocnetSound compatible with them. (....so you can expect more questions. :) ..)

for example,
Is the "mobile" boolean used to set Rocnet Class = DCC?
How do you propose to set / read wheeldiameter using Rocview Rocnet or RocPro programming...?
....??

What would you suggest?

Cheers as ever
Dagnall
ESP8266 Based RocNet Universal 8 i/o decoder and Mobile Decoder. http://wiki.rocrail.net/doku.php?id=users:dagnall53:description
G Scale 3D printed Locos and wagons : (on Thingyverse)
Dagnall
 

Re: RocNet Protocol documentation

Postby rjversluis » 03.04.2018, 13:48

Dagnall,

those entries are for:
http://wiki.rocrail.net/doku.php?id=gca-pi05-en
Has nothing todo with DCC or something else.
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 - CANGCx ] - [ G: CBUS - CANGCx ]
rjversluis
Site Admin
 

Re: RocNet Protocol documentation

Postby Dagnall » 05.04.2018, 12:27

That is what I expected.
I have not set my code to respond that it is GCA-Pi05 in case it causes compatibility issues.
I have, however, set my code so it responds as a "Rocnet Class" DCC, to discriminate it from the "accessory" decoders.

Just out of interest, have many Pi-05 been built /used?

Cheers
D

If you ever decide to add a new RocNet Class of "MobileDecoder", perhaps Nodeclass bit 4 = "MobileDecoder".. :wink:
ESP8266 Based RocNet Universal 8 i/o decoder and Mobile Decoder. http://wiki.rocrail.net/doku.php?id=users:dagnall53:description
G Scale 3D printed Locos and wagons : (on Thingyverse)
Dagnall
 


Return to RocNetNode