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
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-12-14 22:18:05 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-12-14 22:18:05 +0300
commit3fe41418f92a630c8d8fbd3cb79be4bbb934c383 (patch)
tree5815f344f95bd4697b64894e20a103384c9b7754
parent2e0ac365cccfce0a9a0ef51d07471fd76092dcb5 (diff)
Improved error reporting when heaters won't turn on
-rw-r--r--src/Heating/Heater.cpp7
-rw-r--r--src/Tools/Tool.cpp26
2 files changed, 23 insertions, 10 deletions
diff --git a/src/Heating/Heater.cpp b/src/Heating/Heater.cpp
index 69d5c950..d8fdf867 100644
--- a/src/Heating/Heater.cpp
+++ b/src/Heating/Heater.cpp
@@ -604,8 +604,11 @@ void Heater::SetTemperature(float t, bool activeNotStandby) THROWS(GCodeExceptio
((activeNotStandby) ? activeTemperature : standbyTemperature) = t;
if (GetMode() > HeaterMode::suspended && active == activeNotStandby)
{
- String<1> dummy;
- (void)SwitchOn(dummy.GetRef());
+ String<StringLength100> reply;
+ if (SwitchOn(reply.GetRef()) > GCodeResult::warning)
+ {
+ throw GCodeException(-1, 1, reply.c_str());
+ }
}
}
}
diff --git a/src/Tools/Tool.cpp b/src/Tools/Tool.cpp
index ed5b8cda..99903869 100644
--- a/src/Tools/Tool.cpp
+++ b/src/Tools/Tool.cpp
@@ -421,24 +421,30 @@ bool Tool::AllHeatersAtHighTemperature(bool forExtrusion) const noexcept
return true;
}
+// Activate this tool
void Tool::Activate() noexcept
{
for (size_t heater = 0; heater < heaterCount; heater++)
{
+ String<StringLength100> message;
+ GCodeResult ret;
try
{
reprap.GetHeat().SetActiveTemperature(heaters[heater], activeTemperatures[heater]);
reprap.GetHeat().SetStandbyTemperature(heaters[heater], standbyTemperatures[heater]);
+ ret = reprap.GetHeat().Activate(heaters[heater], message.GetRef());
}
catch (const GCodeException& exc)
{
- String<StringLength100> message;
exc.GetMessage(message.GetRef(), nullptr);
- reprap.GetPlatform().Message(ErrorMessage, message.c_str());
+ ret = GCodeResult::error;
+ }
+ if (ret != GCodeResult::ok)
+ {
+ reprap.GetPlatform().MessageF((ret == GCodeResult::warning) ? WarningMessage : ErrorMessage, "%s\n", message.c_str());
}
- String<1> dummy;
- (void)reprap.GetHeat().Activate(heaters[heater], dummy.GetRef());
}
+
if (spindleNumber > -1)
{
Spindle& spindle = reprap.GetPlatform().AccessSpindle(spindleNumber);
@@ -483,17 +489,21 @@ void Tool::HeatersToActive() const noexcept
// Don't switch a heater to active if the active tool is using it and is different from this tool
if (currentTool == this || currentTool == nullptr || !currentTool->UsesHeater(heater))
{
+ String<StringLength100> message;
+ GCodeResult ret;
try
{
reprap.GetHeat().SetActiveTemperature(heaters[heater], activeTemperatures[heater]);
- String<1> dummy;
- (void)reprap.GetHeat().Activate(heaters[heater], dummy.GetRef());
+ ret = reprap.GetHeat().Activate(heaters[heater], message.GetRef());
}
catch (const GCodeException& exc)
{
- String<StringLength100> message;
exc.GetMessage(message.GetRef(), nullptr);
- reprap.GetPlatform().Message(ErrorMessage, message.c_str());
+ ret = GCodeResult::error;
+ }
+ if (ret != GCodeResult::ok)
+ {
+ reprap.GetPlatform().MessageF((ret == GCodeResult::warning) ? WarningMessage : ErrorMessage, "%s\n", message.c_str());
}
}
}