1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 23:56:13 +01:00

trigger overload first after second sample

This commit is contained in:
Harald Barth 2021-10-13 20:04:27 +02:00
parent f8fb08e331
commit a98657fef2
2 changed files with 7 additions and 3 deletions

View File

@ -156,10 +156,14 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
else else
if (power_sample_overload_wait>POWER_SAMPLE_OVERLOAD_WAIT) power_sample_overload_wait=POWER_SAMPLE_OVERLOAD_WAIT; if (power_sample_overload_wait>POWER_SAMPLE_OVERLOAD_WAIT) power_sample_overload_wait=POWER_SAMPLE_OVERLOAD_WAIT;
} else { } else {
setPowerMode(POWERMODE::OVERLOAD);
unsigned int mA=motorDriver->raw2mA(lastCurrent); unsigned int mA=motorDriver->raw2mA(lastCurrent);
unsigned int maxmA=motorDriver->raw2mA(tripValue); unsigned int maxmA=motorDriver->raw2mA(tripValue);
power_good_counter=0; if (power_good_counter > 0) {
power_good_counter = 0;
DIAG(F("*** %S TRACK POWER WARNING current=%d max=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA);
break;
}
setPowerMode(POWERMODE::OVERLOAD);
sampleDelay = power_sample_overload_wait; sampleDelay = power_sample_overload_wait;
DIAG(F("*** %S TRACK POWER OVERLOAD current=%d max=%d offtime=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA, sampleDelay); DIAG(F("*** %S TRACK POWER OVERLOAD current=%d max=%d offtime=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA, sampleDelay);
if (power_sample_overload_wait >= 10000) if (power_sample_overload_wait >= 10000)

View File

@ -23,7 +23,7 @@
#include "MotorDriver.h" #include "MotorDriver.h"
// Wait times for power management. Unit: milliseconds // Wait times for power management. Unit: milliseconds
const int POWER_SAMPLE_ON_WAIT = 100; const int POWER_SAMPLE_ON_WAIT = 50;
const int POWER_SAMPLE_OFF_WAIT = 1000; const int POWER_SAMPLE_OFF_WAIT = 1000;
const int POWER_SAMPLE_OVERLOAD_WAIT = 20; const int POWER_SAMPLE_OVERLOAD_WAIT = 20;