1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 00:26:13 +01:00

Compare commits

..

No commits in common. "fe9b1da8a3bcdced2465074dd882689d93e29b31" and "dcd332603c1cc97f0474f7e1266b76d1fa7af3ae" have entirely different histories.

3 changed files with 16 additions and 34 deletions

43
DCC.cpp
View File

@ -289,45 +289,28 @@ decoders or data bytes to more complex accessory decoders. Each signal head can
XXXXX is for a single head. A value of 00000 for XXXXX indicates the absolute stop aspect. All other aspects XXXXX is for a single head. A value of 00000 for XXXXX indicates the absolute stop aspect. All other aspects
represented by the values for XXXXX are determined by the signaling system used and the prototype being represented by the values for XXXXX are determined by the signaling system used and the prototype being
modeled. modeled.
*/
From https://normen.railcommunity.de/RCN-213.pdf: /* CAH Notes:
More information is in RCN-213 about how the address bits are organized.
preamble -0- 1 0 A7 A6 A5 A4 A3 A2 -0- 0 ^A10 ^A9 ^A8 0 A1 A0 1 -0- ....
Thus in byte packet form the format is 10AAAAAA, 0AAA0AA1, 000XXXXX Thus in byte packet form the format is 10AAAAAA, 0AAA0AA1, 000XXXXX
Die Adresse für den ersten erweiterten Zubehördecoder ist wie bei den einfachen Note that the Basic accessory format mentions
Zubehördecodern die Adresse 4 = 1000-0001 0111-0001 . Diese Adresse wird in "By convention these bits (bits 4-6 of the second data byte) are in ones complement"
Anwenderdialogen als Adresse 1 dargestellt. but this note is absent from the advanced packet description.
The (~address) construct below applies this because this appears to be
required.
This means that the first address shown to the user as "1" is mapped
to internal address 4.
Note that the Basic accessory format mentions "By convention these
bits (bits 4-6 of the second data byte) are in ones complement" but
this note is absent from the advanced packet description. The
english translation does not mention that the address format for
the advanced packet follows the one for the basic packet but
according to the RCN-213 this is the case.
We allow for addresses from -3 to 2047-3 as that allows to address the
whole range of the 11 bits sent to track.
*/ */
if ((address > 2044) || (address < -3)) return false; // 2047-3, 11 bits but offset 3 if (address != (address & 0x7FF)) return false; // 11 bits
if (value != (value & 0x1F)) return false; // 5 bits if (value != (value & 0x1F)) return false; // 5 bits
address+=3; // +3 offset according to RCN-213
byte b[3]; byte b[3];
b[0]= 0x80 // bits always on b[0]= 0x80 | (address>>5);
| ((address>>2) & 0x3F); // shift out 2, mask out used bits b[1]= 0x01 | (((~address) & 0x1c)<<2) | ((address & 0x03)<<1);
b[1]= 0x01 // bits always on
| (((~(address>>8)) & 0x07)<<4) // shift out 8, invert, mask 3 bits, shift up 4
| ((address & 0x03)<<1); // mask 2 bits, shift up 1
b[2]=value; b[2]=value;
DCCWaveform::mainTrack.schedulePacket(b, sizeof(b), repeats); DCCWaveform::mainTrack.schedulePacket(b, sizeof(b), repeats); // Repeat on packet three times
return true; return true;
} }
// //
// writeCVByteMain: Write a byte with PoM on main. This writes // writeCVByteMain: Write a byte with PoM on main. This writes

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202402171752Z" #define GITHUB_SHA "devel-202402050827Z"

View File

@ -3,8 +3,7 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.35" #define VERSION "5.2.34"
// 5.2.35 - Bugfix: Make DCC Extended Accessories follow RCN-213
// 5.2.34 - <A address aspect> Command fopr DCC Extended Accessories // 5.2.34 - <A address aspect> Command fopr DCC Extended Accessories
// - Exrail ASPECT(address,aspect) for above. // - Exrail ASPECT(address,aspect) for above.
// - EXRAIL DCCX_SIGNAL(Address,redAspect,amberAspect,greenAspect) // - EXRAIL DCCX_SIGNAL(Address,redAspect,amberAspect,greenAspect)