mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Compare commits
No commits in common. "fe9b1da8a3bcdced2465074dd882689d93e29b31" and "dcd332603c1cc97f0474f7e1266b76d1fa7af3ae" have entirely different histories.
fe9b1da8a3
...
dcd332603c
45
DCC.cpp
45
DCC.cpp
|
@ -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
|
||||
represented by the values for XXXXX are determined by the signaling system used and the prototype being
|
||||
modeled.
|
||||
|
||||
From https://normen.railcommunity.de/RCN-213.pdf:
|
||||
|
||||
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- ....
|
||||
|
||||
*/
|
||||
/* CAH Notes:
|
||||
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
|
||||
Zubehördecodern die Adresse 4 = 1000-0001 0111-0001 . Diese Adresse wird in
|
||||
Anwenderdialogen als Adresse 1 dargestellt.
|
||||
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 (~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 (value != (value & 0x1F)) return false; // 5 bits
|
||||
if (address != (address & 0x7FF)) return false; // 11 bits
|
||||
if (value != (value & 0x1F)) return false; // 5 bits
|
||||
|
||||
address+=3; // +3 offset according to RCN-213
|
||||
|
||||
byte b[3];
|
||||
b[0]= 0x80 // bits always on
|
||||
| ((address>>2) & 0x3F); // shift out 2, mask out used bits
|
||||
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[0]= 0x80 | (address>>5);
|
||||
b[1]= 0x01 | (((~address) & 0x1c)<<2) | ((address & 0x03)<<1);
|
||||
b[2]=value;
|
||||
DCCWaveform::mainTrack.schedulePacket(b, sizeof(b), repeats);
|
||||
DCCWaveform::mainTrack.schedulePacket(b, sizeof(b), repeats); // Repeat on packet three times
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// writeCVByteMain: Write a byte with PoM on main. This writes
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define GITHUB_SHA "devel-202402171752Z"
|
||||
#define GITHUB_SHA "devel-202402050827Z"
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "5.2.35"
|
||||
// 5.2.35 - Bugfix: Make DCC Extended Accessories follow RCN-213
|
||||
#define VERSION "5.2.34"
|
||||
// 5.2.34 - <A address aspect> Command fopr DCC Extended Accessories
|
||||
// - Exrail ASPECT(address,aspect) for above.
|
||||
// - EXRAIL DCCX_SIGNAL(Address,redAspect,amberAspect,greenAspect)
|
||||
|
|
Loading…
Reference in New Issue
Block a user