cbus-traincontrol / cbus-traincontrol.github.io

Other
3 stars 4 forks source link

Support for long consist addresses #15

Open pnbgit opened 3 months ago

pnbgit commented 3 months ago

The latest RailCommunity DCC spec includes support for long Consist addresses, stored in CV19 and CV20. This is already supported by the latest firmware in ESU decoders.

The current CBUS consisting opcodes, PCON and KCON, only have a single byte for the consist address so can only support short consist addresses.

QCON would stay as defined, as it does not include the consist address and does not change in length, and the return is PLOC.

We need a new PCON opcode to support the extended consist address.

KCON can stay unchanged as it is to remove a loco from a consist, and the consist address is always set to 0.

Note that docs for QCON need updating, as it would be possible to use QCON with advanced consisting in conjunction with Railcom to find an advanced consist address (short or long) from a loco.

Proposed opcodes: PCONX 0x64
Format:
[]<Consist# Hi><Consist# Lo>

<Dat1> Session number
<Dat2><Dat3> is consist address (16 bits). 

Adds a decoder to a consist.
Dat2 & Dat3 will follow the standard format for DCC addresses, short or long, used elsewhere in CBUS, even though, for some reason, the DCC spec has it stored slightly differently in CV19 and CV20.  The MS 2 bits are set to 1 as usual for a long address, except that bit 14 is set to 0 if the consist direction is reversed.
Ardmay commented 3 weeks ago

The RailCommunity Spec. states long consists (multipul) are stored in CV20 and CV19. CV20 holds the hundreds element of the consist while CV19 holds the tens and units element. This new functionality is reported out in the latest RailCom spec. CV17 and CV18 still hold the non consist extended address as normal. This spec. update affords consist addresses 1 to 10239 with RailCom support.

pnbgit commented 3 weeks ago

Thanks for the correction, Michael. I had a senior moment when writing that issue, I have now edited the original post to show correctly CV19 and CV20. The other aspects of this requirement are unchanged.