开云体育

Locked M?rklin CS3 and DCC accessories #maerklin


S?ren Jacob Lauritsen
 

Hi group,
?
I am struggling?with CS3 and DCC accessory decoders. I am using a CS3 (Central Station 3) which has the same Ethernet protocol as the CS2 (Central Station 2).
?
I cannot get accessories to work, so I checked the "Marklin Monitor" and noticed that JMRI sends out commands in the MM (Motorola) format for the CS3. As a test I created an MM based turnout and it switched just fine.
?
Is there any way to change accessory communication to DCC? CS3 supports both formats, and I mainly use DCC accessory decoders (that do not support MM).
?
Best regards
S?ren


S?ren Jacob Lauritsen
 

I had a look at the source code for turnout control (MarklinTurnout.java). Since my experience with the source code of JMRI is somewhat limited,?I?may?be missing something, it does, however, look as if the MarklinTurnout class is unintentionally hardcoded to the MM protocol.

Line 126 sets the protocol to "UNKNOWN":
126: int protocol = UNKNOWN;

The method in line 152 "getCANAddress" checks the protocol?and defaults to "MM" if set to anything but DCC.

? ? int getCANAddress() {
? ? ? ? switch (protocol) {
? ? ? ? ? ? case DCC:
? ? ? ? ? ? ? ? return _number + MarklinConstants.DCCACCSTART - 1;
? ? ? ? ? ? default:
? ? ? ? ? ? ? ? return _number + MarklinConstants.MM1ACCSTART - 1;
? ? ? ? }
? ? }

In line 164 it uses the above method to check what protocol it should be using:

? ? ? ? ? ?if (protocol == UNKNOWN) {?
? ? ? ? ? ? ? ?if (m.getAddress() == _number + MarklinConstants.MM1ACCSTART - 1) {
? ? ? ? ? ? ? ? ? ? protocol = MM2;
? ? ? ? ? ? ? ? } else if (m.getAddress() == _number + MarklinConstants.DCCACCSTART - 1) {
? ? ? ? ? ? ? ? ? ? protocol = DCC;
? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? //Message is not for us.
? ? ? ? ? ? ? ? ? ? return;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }

It does this by looking at the output of the "getCANAddress". Since the "protocol" variable is never set to anything but UNKNOWN, JMRI will always use "MM" for M?rklin turnout protocols (given the result of the "getCANAddress" method).?

Since the Central Station supports both DCC and MM for turnouts, it should be possible to somehow change the protocol to DCC. Is there any way in the XML files or anywhere that I can insert some sort of property to work around this issue? It does not seem like it, but maybe someone with more knowledge of the source code can shed some light on this.

Best regards
S?ren


Den tors. 4. maj 2023 kl. 20.33 skrev S?ren Jacob Lauritsen via <m=[email protected]>:

Hi group,
?
I am struggling?with CS3 and DCC accessory decoders. I am using a CS3 (Central Station 3) which has the same Ethernet protocol as the CS2 (Central Station 2).
?
I cannot get accessories to work, so I checked the "Marklin Monitor" and noticed that JMRI sends out commands in the MM (Motorola) format for the CS3. As a test I created an MM based turnout and it switched just fine.
?
Is there any way to change accessory communication to DCC? CS3 supports both formats, and I mainly use DCC accessory decoders (that do not support MM).
?
Best regards
S?ren


 

This may well be because the original coding was to connect to the CS1 which did not have the alternative protocols available.
It may well require modification to enable DCC mode for accessories.


On Fri, 5 May 2023 at 17:27, S?ren Jacob Lauritsen via <m=[email protected]> wrote:
I had a look at the source code for turnout control (MarklinTurnout.java). Since my experience with the source code of JMRI is somewhat limited,?I?may?be missing something, it does, however, look as if the MarklinTurnout class is unintentionally hardcoded to the MM protocol.