mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-19 23:46:02 +01:00
Now working
This commit is contained in:
parent
6095bf2b3b
commit
8c051710c6
2
DCC.cpp
2
DCC.cpp
@ -158,7 +158,7 @@ void DCC::setThrottle2( uint16_t cab, byte speedCode) {
|
||||
b[nB++] = speedCode; // for encoding see setThrottle
|
||||
|
||||
}
|
||||
if (speedCode==1) DCCQueue::scheduleEstopPacket(b, nB, 4, cab); // highest priority
|
||||
if ((speedCode & 0x7F) == 1) DCCQueue::scheduleEstopPacket(b, nB, 4, cab); // highest priority
|
||||
else DCCQueue::scheduleDCCSpeedPacket( b, nB, 4, cab);
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,10 @@
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "defines.h"
|
||||
#include "DCCQueue.h"
|
||||
#include "DCCWaveform.h"
|
||||
#include "DIAG.h"
|
||||
|
||||
// create statics
|
||||
DCCQueue* DCCQueue::lowPriorityQueue=new DCCQueue();
|
||||
@ -80,7 +82,8 @@ PendingSlot* DCCQueue::recycleList=nullptr;
|
||||
|
||||
void DCCQueue::scheduleEstopPacket(byte* packet, byte length, byte repeats,uint16_t loco) {
|
||||
|
||||
|
||||
// DIAG(F("DCC ESTOP loco=%d"),loco);
|
||||
|
||||
// kill any existing throttle packets for this loco
|
||||
PendingSlot * previous=nullptr;
|
||||
auto p=highPriorityQueue->head;
|
||||
@ -130,6 +133,7 @@ PendingSlot* DCCQueue::recycleList=nullptr;
|
||||
// remove this slot from the queue
|
||||
if (previous) previous->next=p->next;
|
||||
else highPriorityQueue->head=p->next;
|
||||
if (!highPriorityQueue->head) highPriorityQueue->tail=nullptr;
|
||||
|
||||
// and recycle it.
|
||||
recycle(p);
|
||||
@ -166,6 +170,7 @@ PendingSlot* DCCQueue::recycleList=nullptr;
|
||||
recycleList=p->next;
|
||||
}
|
||||
else {
|
||||
DIAG(F("New DCC queue slot"));
|
||||
p=new PendingSlot; // need a queue entry
|
||||
}
|
||||
p->next=nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user