diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-11-21 11:52:12 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-11-21 11:52:12 +0300 |
commit | 37b4e02726993763b477181b6aa918089e2210b4 (patch) | |
tree | 63d9406b789c15ea4171aa52627da3181ab3e62f | |
parent | 87efb232ad022318edfa2b9e2d1fde096e8b1323 (diff) |
Fixed heater fault detection while heating up
Also shortened the M307 response so that it fits in the reply buffer
-rw-r--r-- | src/Heating/FOPDT.cpp | 11 | ||||
-rw-r--r-- | src/Heating/Heater.cpp | 2 | ||||
-rw-r--r-- | src/Heating/LocalHeater.cpp | 13 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/Heating/FOPDT.cpp b/src/Heating/FOPDT.cpp index b9018466..d78212ed 100644 --- a/src/Heating/FOPDT.cpp +++ b/src/Heating/FOPDT.cpp @@ -241,7 +241,7 @@ void FopDt::AppendModelParameters(unsigned int heaterNumber, const StringRef& st const char* const mode = (!usePid) ? "bang-bang" : (pidParametersOverridden) ? "custom PID" : "PID"; - str.catf("Heater %u model: heating rate %.3f, basic cooling rate %.3f", heaterNumber, (double)heatingRate, (double)basicCoolingRate); + str.catf("Heater %u: heating rate %.3f, cooling rate %.3f", heaterNumber, (double)heatingRate, (double)basicCoolingRate); if (fanCoolingRate > 0.0) { str.catf("/%.3f", (double)fanCoolingRate); @@ -249,18 +249,19 @@ void FopDt::AppendModelParameters(unsigned int heaterNumber, const StringRef& st str.catf(", dead time %.2f, max PWM %.2f, mode %s", (double)deadTime, (double)maxPwm, mode); if (inverted) { - str.cat(", inverted control"); + str.cat(", reverse control"); } if (includeVoltage) { - str.catf(", calibration voltage %.1f", (double)standardVoltage); + str.catf(", calibrated at %.1fV", (double)standardVoltage); } + str.lcatf("Predicted max temperature rise %d" DEGREE_SYMBOL "C", (int)EstimateMaxTemperatureRise()); if (usePid) { M301PidParameters params = GetM301PidParameters(false); - str.catf("\nComputed PID parameters: setpoint change: P%.1f, I%.3f, D%.1f", (double)params.kP, (double)params.kI, (double)params.kD); + str.lcatf("PID parameters: heating P%.1f I%.3f D%.1f", (double)params.kP, (double)params.kI, (double)params.kD); params = GetM301PidParameters(true); - str.catf(", load change: P%.1f, I%.3f, D%.1f", (double)params.kP, (double)params.kI, (double)params.kD); + str.catf(", steady P%.1f I%.3f D%.1f", (double)params.kP, (double)params.kI, (double)params.kD); } } diff --git a/src/Heating/Heater.cpp b/src/Heating/Heater.cpp index 01397163..18615e51 100644 --- a/src/Heating/Heater.cpp +++ b/src/Heating/Heater.cpp @@ -226,9 +226,9 @@ GCodeResult Heater::SetModel(float hr, float bcr, float fcr, float coolingRateEx { const float predictedMaxTemp = GetModel().EstimateMaxTemperatureRise() + NormalAmbientTemperature; const float noWarnTemp = (GetHighestTemperatureLimit() - NormalAmbientTemperature) * 1.5 + 50.0; // allow 50% extra power plus enough for an extra 50C - reply.printf("Heater %u predicted maximum temperature at full power is %d" DEGREE_SYMBOL "C", GetHeaterNumber(), (int)predictedMaxTemp); if (predictedMaxTemp > noWarnTemp) { + reply.printf("Heater %u predicted maximum temperature at full power is %d" DEGREE_SYMBOL "C", GetHeaterNumber(), (int)predictedMaxTemp); rslt = GCodeResult::warning; } } diff --git a/src/Heating/LocalHeater.cpp b/src/Heating/LocalHeater.cpp index eb0ffdd1..79847e02 100644 --- a/src/Heating/LocalHeater.cpp +++ b/src/Heating/LocalHeater.cpp @@ -297,7 +297,7 @@ void LocalHeater::Spin() noexcept else { const uint32_t now = millis(); - if ((float)(millis() - timeSetHeating) < GetModel().GetDeadTime() * SecondsToMillis * 1.5) + if ((float)(now - timeSetHeating) < GetModel().GetDeadTime() * SecondsToMillis * 1.5) { // Record the temperature for when we are past the dead time lastTemperatureValue = temperature; @@ -322,12 +322,15 @@ void LocalHeater::Spin() noexcept GetHeaterNumber(), (double)temperature, (double)derivative, (double)expectedRate); } } - else if (heatingFaultCount != 0) + else { - --heatingFaultCount; + lastTemperatureValue = temperature; + lastTemperatureMillis = now; + if (heatingFaultCount != 0) + { + --heatingFaultCount; + } } - lastTemperatureValue = temperature; - lastTemperatureMillis = now; } } } |