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>2022-03-11 20:43:12 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-03-11 20:43:12 +0300
commit50d3f4727f7e09a649d8b757f2ebe69a6190cecf (patch)
tree93cc6a238f97021c4de3d1fd3f6116e272c38f78
parent89c14792ff410f27fee31dbc08ab65563e0fd0db (diff)
Bug fix to changing heater states
-rw-r--r--src/Tools/Tool.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Tools/Tool.cpp b/src/Tools/Tool.cpp
index d115504d..005fefde 100644
--- a/src/Tools/Tool.cpp
+++ b/src/Tools/Tool.cpp
@@ -458,17 +458,18 @@ void Tool::Standby() noexcept
void Tool::HeatersToActiveOrStandby(bool active) const noexcept
{
const Tool * const currentTool = reprap.GetCurrentTool();
- for (size_t heater = 0; heater < heaterCount; heater++)
+ for (size_t heaterIndex = 0; heaterIndex < heaterCount; heaterIndex++)
{
+ const int heaterNumber = heaters[heaterIndex];
// 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))
+ if (currentTool == this || currentTool == nullptr || !currentTool->UsesHeater(heaterNumber))
{
String<StringLength100> message;
GCodeResult ret;
try
{
- reprap.GetHeat().SetTemperature(heaters[heater], ((active) ? activeTemperatures[heater] : standbyTemperatures[heater]), active);
- ret = reprap.GetHeat().SetActiveOrStandby(heaters[heater], this, active, message.GetRef());
+ reprap.GetHeat().SetTemperature(heaterNumber, ((active) ? activeTemperatures[heaterIndex] : standbyTemperatures[heaterIndex]), active);
+ ret = reprap.GetHeat().SetActiveOrStandby(heaterNumber, this, active, message.GetRef());
}
catch (const GCodeException& exc)
{
@@ -486,12 +487,13 @@ void Tool::HeatersToActiveOrStandby(bool active) const noexcept
void Tool::HeatersToOff() const noexcept
{
const Tool * const currentTool = reprap.GetCurrentTool();
- for (size_t heater = 0; heater < heaterCount; heater++)
+ for (size_t heaterIndex = 0; heaterIndex < heaterCount; heaterIndex++)
{
+ const int heaterNumber = heaters[heaterIndex];
// Don't switch a heater to standby if the active tool is using it and is different from this tool
- if (currentTool == this || currentTool == nullptr || !currentTool->UsesHeater(heater))
+ if (currentTool == this || currentTool == nullptr || !currentTool->UsesHeater(heaterNumber))
{
- reprap.GetHeat().SwitchOff(heaters[heater]);
+ reprap.GetHeat().SwitchOff(heaterNumber);
}
}
}