From 96a46f36c2a4008b11377b82352d7f39b02911ec Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 3 Jul 2023 00:21:52 +0200 Subject: [PATCH] Adjust overcurrent timeouts --- GITHUB_SHA.h | 2 +- MotorDriver.cpp | 6 +++--- MotorDriver.h | 4 ++-- version.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index ddcb181..f2440cb 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-overcurrent-202307021833Z" +#define GITHUB_SHA "devel-overcurrent-202307022222Z" diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 64bb8ca..dc82044 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -400,7 +400,7 @@ void MotorDriver::getFastPin(const FSH* type,int pin, bool input, FASTPIN & res // 2. ALERT to OVERLOAD: // Transition happens if different timeouts have elapsed. // If only the fault pin is active, timeout is -// POWER_SAMPLE_IGNORE_FAULT_LOW (50ms) +// POWER_SAMPLE_IGNORE_FAULT_LOW (100ms) // If only overcurrent is detected, timeout is // POWER_SAMPLE_IGNORE_CURRENT (100ms) // If fault pin and overcurrent are active, timeout is @@ -413,7 +413,7 @@ void MotorDriver::getFastPin(const FSH* type,int pin, bool input, FASTPIN & res // 3. OVERLOAD to ALERT // Transiton happens when timeout has elapsed, timeout // is named power_sample_overload_wait. It is started -// at POWER_SAMPLE_OVERLOAD_WAIT (10ms) at first entry +// at POWER_SAMPLE_OVERLOAD_WAIT (40ms) at first entry // to OVERLOAD and then increased by a factor of 2 // at further entries to the OVERLOAD condition. This // happens until POWER_SAMPLE_RETRY_MAX (10sec) is reached. @@ -525,7 +525,7 @@ void MotorDriver::checkPowerOverload(bool useProgLimit, byte trackno) { unsigned long mslpc = (commonFaultPin ? (micros() - globalOverloadStart) : microsSinceLastPowerChange(POWERMODE::OVERLOAD)); if (mslpc > power_sample_overload_wait) { // adjust next wait time - power_sample_overload_wait *= 4; + power_sample_overload_wait *= 2; if (power_sample_overload_wait > POWER_SAMPLE_RETRY_MAX) power_sample_overload_wait = POWER_SAMPLE_RETRY_MAX; // power on test diff --git a/MotorDriver.h b/MotorDriver.h index 0ebf494..454015d 100644 --- a/MotorDriver.h +++ b/MotorDriver.h @@ -260,13 +260,13 @@ class MotorDriver { // Times for overload management. Unit: microseconds. // Base for wait time until power is turned on again - static const unsigned long POWER_SAMPLE_OVERLOAD_WAIT = 10000UL; + static const unsigned long POWER_SAMPLE_OVERLOAD_WAIT = 40000UL; // Time after we consider all faults old and forgotten static const unsigned long POWER_SAMPLE_ALL_GOOD = 5000000UL; // Time after which we consider a ALERT over static const unsigned long POWER_SAMPLE_ALERT_GOOD = 20000UL; // How long to ignore fault pin if current is under limit - static const unsigned long POWER_SAMPLE_IGNORE_FAULT_LOW = 50000UL; + static const unsigned long POWER_SAMPLE_IGNORE_FAULT_LOW = 100000UL; // How long to ignore fault pin if current is higher than limit static const unsigned long POWER_SAMPLE_IGNORE_FAULT_HIGH = 5000UL; // How long to wait between overcurrent and turning off diff --git a/version.h b/version.h index 3741dc4..e445bb1 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,7 @@ #include "StringFormatter.h" -#define VERSION "4.2.62pre1" +#define VERSION "4.2.62pre2" // 4.2.62 - completely new overcurrent detection // 4.2.61 - MAX_CURRENT restriction (caps motor shield value) // 4.2.60 - Add mDNS capability to ESP32 for autodiscovery