mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
set the reset packet counter of the prog track to 0 every time the track is turned on
This commit is contained in:
parent
43bac3f78e
commit
7a2fd90bfc
|
@ -76,6 +76,7 @@ void DCCACK::Setup(int cv, byte byteValueOrBitnum, ackOp const program[], ACK_C
|
|||
callback(-2); // our prog track cant measure current
|
||||
return;
|
||||
}
|
||||
progDriver->setResetCounterPointer(&(DCCWaveform::progTrack.sentResetsSincePacket));
|
||||
|
||||
ackManagerRejoin=TrackManager::isJoined();
|
||||
if (ackManagerRejoin ) {
|
||||
|
|
|
@ -98,6 +98,8 @@ void MotorDriver::setPower(POWERMODE mode) {
|
|||
bool on=mode==POWERMODE::ON;
|
||||
if (on) {
|
||||
IODevice::write(powerPin,HIGH);
|
||||
if (resetsCounterP != NULL)
|
||||
*resetsCounterP = 0;
|
||||
}
|
||||
else IODevice::write(powerPin,LOW);
|
||||
powerMode=mode;
|
||||
|
|
|
@ -73,8 +73,12 @@ class MotorDriver {
|
|||
inline byte getFaultPin() {
|
||||
return faultPin;
|
||||
}
|
||||
inline void setResetCounterPointer(byte *bp) { // load resetPacketCounter pointer
|
||||
resetsCounterP = bp;
|
||||
}
|
||||
void checkPowerOverload(bool useProgLimit, byte trackno);
|
||||
private:
|
||||
byte *resetsCounterP = NULL; // points to the resetPacketCounter if this is a prog track
|
||||
void getFastPin(const FSH* type,int pin, bool input, FASTPIN & result);
|
||||
void getFastPin(const FSH* type,int pin, FASTPIN & result) {
|
||||
getFastPin(type, pin, 0, result);
|
||||
|
|
|
@ -124,6 +124,8 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
|
|||
track[t]->setPower(POWERMODE::OFF);
|
||||
trackMode[t]=TRACK_MODE_OFF;
|
||||
}
|
||||
} else {
|
||||
track[trackToSet]->setResetCounterPointer(NULL); // only the prog track has this pointer set
|
||||
}
|
||||
trackMode[trackToSet]=mode;
|
||||
trackDCAddr[trackToSet]=dcAddr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user