diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-04-28 01:29:21 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-04-28 01:29:21 +0300 |
commit | 5dda6c9d5aaa24ea94f9246db73e702580e5d0dc (patch) | |
tree | 510394af8799f64fdc2432da772a6770add33b24 /src/Fans | |
parent | 9ead98ce7dc8a4fe1454a7003b14fee1aab51941 (diff) |
Bug fixes, and restore correct heigt after a tool change
Thermostatically-controlled fans were no longer forced to run at >=50%
PWM when on
Proportional control of thermostatic fans no longer worked
When restoring position after a pause or after skipping a build object,
the inverse bed compensation applied when recomputing the user position
did not take account of the tool offset
After a tool change, if on a FDM printer then we now move the new tool
to the correct Z height before resuming the print
Diffstat (limited to 'src/Fans')
-rw-r--r-- | src/Fans/Fan.h | 6 | ||||
-rw-r--r-- | src/Fans/LocalFan.cpp | 29 |
2 files changed, 15 insertions, 20 deletions
diff --git a/src/Fans/Fan.h b/src/Fans/Fan.h index 8e124bf1..b3e10b73 100644 --- a/src/Fans/Fan.h +++ b/src/Fans/Fan.h @@ -63,12 +63,12 @@ protected: unsigned int fanNumber; // Variables that control the fan - float val; - float lastVal; + float val; // the value requested in the M106 command + float lastVal; // the last PWM value we sent to the fan, not allowing for blipping float minVal; float maxVal; float triggerTemperatures[2]; - uint32_t blipTime; // in milliseconds + uint32_t blipTime; // how long we blip the fan for, in milliseconds SensorsBitmap sensorsMonitored; String<MaxFanNameLength> name; diff --git a/src/Fans/LocalFan.cpp b/src/Fans/LocalFan.cpp index 28388c07..5fb4b8d5 100644 --- a/src/Fans/LocalFan.cpp +++ b/src/Fans/LocalFan.cpp @@ -66,7 +66,6 @@ void LocalFan::SetHardwarePwm(float pwmVal) noexcept // Refresh the fan PWM // Checking all the sensors is expensive, so only do this if checkSensors is true. -// If you want make sure that the PWM is definitely updated, set lastPWM negative before calling this void LocalFan::InternalRefresh(bool checkSensors) noexcept { float reqVal; @@ -80,7 +79,7 @@ void LocalFan::InternalRefresh(bool checkSensors) noexcept } else if (!checkSensors) { - reqVal = (lastVal == 0.0) ? 0.0 : val; + reqVal = lastVal; } else { @@ -144,28 +143,24 @@ void LocalFan::InternalRefresh(bool checkSensors) noexcept blipStartTime = millis(); } } - - if (blipping) + else if (blipping && millis() - blipStartTime >= blipTime) { - if (millis() - blipStartTime < blipTime) - { - reqVal = 1.0; - } - else - { - blipping = false; - } + blipping = false; } } -#if HAS_SMART_DRIVERS - else if (driverChannelsMonitored.IsNonEmpty() && lastVal != 0.0) + else { - reprap.GetPlatform().DriverCoolingFansOnOff(driverChannelsMonitored, false); // tell Platform that we have stopped a fan that cools drivers - } + blipping = false; +#if HAS_SMART_DRIVERS + if (driverChannelsMonitored.IsNonEmpty() && lastVal != 0.0) + { + reprap.GetPlatform().DriverCoolingFansOnOff(driverChannelsMonitored, false); // tell Platform that we have stopped a fan that cools drivers + } #endif + } - SetHardwarePwm(reqVal); lastVal = reqVal; + SetHardwarePwm((blipping) ? 1.0 : reqVal); } GCodeResult LocalFan::Refresh(const StringRef& reply) noexcept |