1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 18:03:45 +02:00

DCCQ single loco leak

This commit is contained in:
Asbelos
2025-07-12 14:37:14 +01:00
parent d87c3bc87e
commit 3eac6a57b0
4 changed files with 45 additions and 14 deletions

16
DCC.cpp
View File

@@ -162,7 +162,7 @@ void DCC::setThrottle2( uint16_t cab, byte speedCode) {
else DCCQueue::scheduleDCCSpeedPacket( b, nB, 0, cab);
}
void DCC::setFunctionInternal(int cab, byte byte1, byte byte2) {
void DCC::setFunctionInternal(int cab, byte group, byte byte1, byte byte2) {
// DIAG(F("setFunctionInternal %d %x %x"),cab,byte1,byte2);
byte b[4];
byte nB = 0;
@@ -172,8 +172,8 @@ void DCC::setFunctionInternal(int cab, byte byte1, byte byte2) {
b[nB++] = lowByte(cab);
if (byte1!=0) b[nB++] = byte1;
b[nB++] = byte2;
DCCQueue::scheduleDCCPacket(b, nB, 0, cab);
DCCQueue::scheduleDCCFunctionPacket(b, nB, cab,group);
}
// returns speed steps 0 to 127 (1 == emergency stop)
@@ -949,31 +949,31 @@ bool DCC::issueReminder(LOCO * slot) {
return true; // reminder sent
case 1: // remind function group 1 (F0-F4)
if (flags & FN_GROUP_1) {
setFunctionInternal(loco,0, 128 | ((functions>>1)& 0x0F) | ((functions & 0x01)<<4)); // 100D DDDD
setFunctionInternal(loco,1,0, 128 | ((functions>>1)& 0x0F) | ((functions & 0x01)<<4)); // 100D DDDD
return true; // reminder sent
}
break;
case 3: // remind function group 2 F5-F8
if (flags & FN_GROUP_2) {
setFunctionInternal(loco,0, 176 | ((functions>>5)& 0x0F)); // 1011 DDDD
setFunctionInternal(loco,2,0, 176 | ((functions>>5)& 0x0F)); // 1011 DDDD
return true; // reminder sent
}
break;
case 5: // remind function group 3 F9-F12
if (flags & FN_GROUP_3) {
setFunctionInternal(loco,0, 160 | ((functions>>9)& 0x0F)); // 1010 DDDD
setFunctionInternal(loco,3,0, 160 | ((functions>>9)& 0x0F)); // 1010 DDDD
return true; // reminder sent
}
break;
case 7: // remind function group 4 F13-F20
if (flags & FN_GROUP_4) {
setFunctionInternal(loco,222, ((functions>>13)& 0xFF));
setFunctionInternal(loco,4,222, ((functions>>13)& 0xFF));
return true;
}
break;
case 9: // remind function group 5 F21-F28
if (flags & FN_GROUP_5) {
setFunctionInternal(loco,223, ((functions>>21)& 0xFF));
setFunctionInternal(loco,5,223, ((functions>>21)& 0xFF));
return true; // reminder sent
}
break;