mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-01-11 13:21:01 +01:00
Change PROG current detect during ACK
This commit is contained in:
parent
e27c176fdf
commit
333410c368
@ -99,6 +99,7 @@ void DCCWaveform::setPowerMode(POWERMODE mode) {
|
||||
|
||||
|
||||
void DCCWaveform::checkPowerOverload() {
|
||||
|
||||
if (millis() - lastSampleTaken < sampleDelay) return;
|
||||
lastSampleTaken = millis();
|
||||
|
||||
@ -109,11 +110,11 @@ void DCCWaveform::checkPowerOverload() {
|
||||
case POWERMODE::ON:
|
||||
// Check current
|
||||
lastCurrent = Hardware::getCurrentRaw(isMainTrack);
|
||||
if (lastCurrent <= rawCurrentTripValue) sampleDelay = POWER_SAMPLE_ON_WAIT;
|
||||
if (lastCurrent <= (ackPending?ACK_CURRENT_TRIP:rawCurrentTripValue)) sampleDelay = POWER_SAMPLE_ON_WAIT;
|
||||
else {
|
||||
setPowerMode(POWERMODE::OVERLOAD);
|
||||
unsigned int mA=Hardware::getCurrentMilliamps(isMainTrack,lastCurrent);
|
||||
unsigned int maxmA=Hardware::getCurrentMilliamps(isMainTrack,rawCurrentTripValue);
|
||||
unsigned int maxmA=Hardware::getCurrentMilliamps(isMainTrack,ackPending?ACK_CURRENT_TRIP:rawCurrentTripValue);
|
||||
DIAG(F("\n*** %S TRACK POWER OVERLOAD current=%d max=%d ***\n"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA);
|
||||
sampleDelay = POWER_SAMPLE_OVERLOAD_WAIT;
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ class DCCWaveform {
|
||||
unsigned long lastSampleTaken;
|
||||
unsigned int sampleDelay;
|
||||
int rawCurrentTripValue;
|
||||
|
||||
static const int ACK_CURRENT_TRIP=1000; // During ACK processing limit can be higher
|
||||
|
||||
// ACK management (Prog track only)
|
||||
bool ackPending;
|
||||
bool ackDetected;
|
||||
|
Loading…
Reference in New Issue
Block a user