From ab393047c10c4ec041347982d27e24fa0296805b Mon Sep 17 00:00:00 2001 From: Colin Murdoch Date: Wed, 6 Sep 2023 11:20:23 +0100 Subject: [PATCH] Update MotorDriver.cpp Replace duplicate call to EXRAIL with single in overload. --- MotorDriver.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/MotorDriver.cpp b/MotorDriver.cpp index e3ecd64..4644ad5 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -576,8 +576,6 @@ void MotorDriver::checkPowerOverload(bool useProgLimit, byte trackno) { DIAG(F("TRACK %c FAULT PIN detected after %4M. Pause %4M)"), trackno + 'A', mslpc, power_sample_overload_wait); throttleInrush(false); setPower(POWERMODE::OVERLOAD); - DIAG(F("Calling EXRAIL")); - RMFT2::powerEvent(trackno, true); // Tell EXRAIL we have an overload break; } if (checkCurrent(useProgLimit)) { @@ -595,8 +593,6 @@ void MotorDriver::checkPowerOverload(bool useProgLimit, byte trackno) { trackno + 'A', mA, maxmA, mslpc, power_sample_overload_wait); throttleInrush(false); setPower(POWERMODE::OVERLOAD); - DIAG(F("Calling EXRAIL")); - RMFT2::powerEvent(trackno, true); // Tell EXRAIL we have an overload break; } // all well @@ -619,7 +615,9 @@ void MotorDriver::checkPowerOverload(bool useProgLimit, byte trackno) { // adjust next wait time power_sample_overload_wait *= 2; if (power_sample_overload_wait > POWER_SAMPLE_RETRY_MAX) - power_sample_overload_wait = POWER_SAMPLE_RETRY_MAX; + power_sample_overload_wait = POWER_SAMPLE_RETRY_MAX; + DIAG(F("Calling EXRAIL")); + RMFT2::powerEvent(trackno, true); // Tell EXRAIL we have an overload // power on test DIAG(F("TRACK %c POWER RESTORE (after %4M)"), trackno + 'A', mslpc); setPower(POWERMODE::ALERT);