mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-02-17 06:29:15 +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
|
callback(-2); // our prog track cant measure current
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
progDriver->setResetCounterPointer(&(DCCWaveform::progTrack.sentResetsSincePacket));
|
||||||
|
|
||||||
ackManagerRejoin=TrackManager::isJoined();
|
ackManagerRejoin=TrackManager::isJoined();
|
||||||
if (ackManagerRejoin ) {
|
if (ackManagerRejoin ) {
|
||||||
|
@ -98,6 +98,8 @@ void MotorDriver::setPower(POWERMODE mode) {
|
|||||||
bool on=mode==POWERMODE::ON;
|
bool on=mode==POWERMODE::ON;
|
||||||
if (on) {
|
if (on) {
|
||||||
IODevice::write(powerPin,HIGH);
|
IODevice::write(powerPin,HIGH);
|
||||||
|
if (resetsCounterP != NULL)
|
||||||
|
*resetsCounterP = 0;
|
||||||
}
|
}
|
||||||
else IODevice::write(powerPin,LOW);
|
else IODevice::write(powerPin,LOW);
|
||||||
powerMode=mode;
|
powerMode=mode;
|
||||||
|
@ -73,8 +73,12 @@ class MotorDriver {
|
|||||||
inline byte getFaultPin() {
|
inline byte getFaultPin() {
|
||||||
return faultPin;
|
return faultPin;
|
||||||
}
|
}
|
||||||
|
inline void setResetCounterPointer(byte *bp) { // load resetPacketCounter pointer
|
||||||
|
resetsCounterP = bp;
|
||||||
|
}
|
||||||
void checkPowerOverload(bool useProgLimit, byte trackno);
|
void checkPowerOverload(bool useProgLimit, byte trackno);
|
||||||
private:
|
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, bool input, FASTPIN & result);
|
||||||
void getFastPin(const FSH* type,int pin, FASTPIN & result) {
|
void getFastPin(const FSH* type,int pin, FASTPIN & result) {
|
||||||
getFastPin(type, pin, 0, 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);
|
track[t]->setPower(POWERMODE::OFF);
|
||||||
trackMode[t]=TRACK_MODE_OFF;
|
trackMode[t]=TRACK_MODE_OFF;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
track[trackToSet]->setResetCounterPointer(NULL); // only the prog track has this pointer set
|
||||||
}
|
}
|
||||||
trackMode[trackToSet]=mode;
|
trackMode[trackToSet]=mode;
|
||||||
trackDCAddr[trackToSet]=dcAddr;
|
trackDCAddr[trackToSet]=dcAddr;
|
||||||
|
Loading…
Reference in New Issue
Block a user