Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2022-02-03 21:45:07 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-02-03 21:45:07 +0300
commit43dbde5e47a99b8ab6ba3eb2169df71e49184186 (patch)
treebc0b962bf032c17403f4834b1f813cc54873fc24 /src
parentaa5255c0e3d943d8b57bb0cc4a81214bfc695a5d (diff)
Renamed some constants and added Peltier cooling support
Diffstat (limited to 'src')
-rw-r--r--src/GCodes/GCodes2.cpp4
-rw-r--r--src/GCodes/GCodes4.cpp2
-rw-r--r--src/Heating/Heat.cpp8
-rw-r--r--src/Heating/Heater.h2
-rw-r--r--src/Heating/LocalHeater.cpp8
5 files changed, 14 insertions, 10 deletions
diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp
index b8ef38e8..ba21bcb1 100644
--- a/src/GCodes/GCodes2.cpp
+++ b/src/GCodes/GCodes2.cpp
@@ -1733,7 +1733,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
if (!cancelWait)
{
- const float tolerance = (gb.Seen('S')) ? max<float>(gb.GetFValue(), 0.1) : TEMPERATURE_CLOSE_ENOUGH;
+ const float tolerance = (gb.Seen('S')) ? max<float>(gb.GetFValue(), 0.1) : TemperatureCloseEnough;
bool seen = false;
if (gb.Seen('P'))
{
@@ -2092,7 +2092,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx
reprap.GetHeat().SetActiveTemperature(heater, temperature); // may throw
result = reprap.GetHeat().SetActiveOrStandby(heater, nullptr, true, reply);
- if (cancelWait || reprap.GetHeat().HeaterAtSetTemperature(heater, waitWhenCooling, TEMPERATURE_CLOSE_ENOUGH))
+ if (cancelWait || reprap.GetHeat().HeaterAtSetTemperature(heater, waitWhenCooling, TemperatureCloseEnough))
{
cancelWait = isWaiting = false;
break;
diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp
index 97950e37..fe89f463 100644
--- a/src/GCodes/GCodes4.cpp
+++ b/src/GCodes/GCodes4.cpp
@@ -405,7 +405,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) noexcept
break;
case GCodeState::m109WaitForTemperature:
- if (cancelWait || IsSimulating() || ToolHeatersAtSetTemperatures(reprap.GetCurrentTool(), gb.LatestMachineState().waitWhileCooling, TEMPERATURE_CLOSE_ENOUGH))
+ if (cancelWait || IsSimulating() || ToolHeatersAtSetTemperatures(reprap.GetCurrentTool(), gb.LatestMachineState().waitWhileCooling, TemperatureCloseEnough))
{
cancelWait = isWaiting = false;
gb.SetState(GCodeState::normal);
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp
index 60120adc..932ee8e4 100644
--- a/src/Heating/Heat.cpp
+++ b/src/Heating/Heat.cpp
@@ -261,8 +261,8 @@ void Heat::ResetHeaterModels() noexcept
void Heat::Init() noexcept
{
- extrusionMinTemp = HOT_ENOUGH_TO_EXTRUDE;
- retractionMinTemp = HOT_ENOUGH_TO_RETRACT;
+ extrusionMinTemp = DefaultMinExtrusionTemperature;
+ retractionMinTemp = DefaultMinRetractionTemperature;
coldExtrude = false;
heaterTask.Create(HeaterTaskStart, "HEAT", nullptr, TaskPriority::HeatPriority);
@@ -633,7 +633,9 @@ bool Heat::HeaterAtSetTemperature(int heater, bool waitWhenCooling, float tolera
{
const float dt = h->GetTemperature();
const float target = (stat == HeaterStatus::active) ? h->GetActiveTemperature() : h->GetStandbyTemperature();
- return (target < TEMPERATURE_LOW_SO_DONT_CARE)
+ const bool cooling = h->IsCoolingDevice();
+ return (!cooling && target < TemperatureSoLowDontCare)
+ || (cooling && target > TemperatureSoHighDontCare)
|| (fabsf(dt - target) <= tolerance)
|| (target < dt && !waitWhenCooling);
diff --git a/src/Heating/Heater.h b/src/Heating/Heater.h
index 43869f38..220164a4 100644
--- a/src/Heating/Heater.h
+++ b/src/Heating/Heater.h
@@ -105,6 +105,8 @@ public:
void SetAsToolHeater() noexcept;
void SetAsBedOrChamberHeater() noexcept;
+ bool IsCoolingDevice() const noexcept { return model.IsInverted(); }
+
#if SUPPORT_REMOTE_COMMANDS
uint8_t GetModeByte() const { return (uint8_t)GetMode(); }
#endif
diff --git a/src/Heating/LocalHeater.cpp b/src/Heating/LocalHeater.cpp
index 13a5303c..8930c066 100644
--- a/src/Heating/LocalHeater.cpp
+++ b/src/Heating/LocalHeater.cpp
@@ -190,8 +190,8 @@ GCodeResult LocalHeater::SwitchOn(const StringRef& reply) noexcept
}
const float target = GetTargetTemperature();
- const HeaterMode newMode = (temperature + TEMPERATURE_CLOSE_ENOUGH < target) ? HeaterMode::heating
- : (temperature > target + TEMPERATURE_CLOSE_ENOUGH) ? HeaterMode::cooling
+ const HeaterMode newMode = (temperature + TemperatureCloseEnough < target) ? HeaterMode::heating
+ : (temperature > target + TemperatureCloseEnough) ? HeaterMode::cooling
: HeaterMode::stable;
if (newMode != mode)
{
@@ -290,7 +290,7 @@ void LocalHeater::Spin() noexcept
{
case HeaterMode::heating:
{
- if (error <= TEMPERATURE_CLOSE_ENOUGH)
+ if (error <= TemperatureCloseEnough)
{
mode = HeaterMode::stable;
heatingFaultCount = 0;
@@ -358,7 +358,7 @@ void LocalHeater::Spin() noexcept
break;
case HeaterMode::cooling:
- if (-error <= TEMPERATURE_CLOSE_ENOUGH && targetTemperature > MaxAmbientTemperature)
+ if (-error <= TemperatureCloseEnough && targetTemperature > MaxAmbientTemperature)
{
// We have cooled to close to the target temperature, so we should now maintain that temperature
mode = HeaterMode::stable;