diff options
Diffstat (limited to 'src/Heating/Heat.cpp')
-rw-r--r-- | src/Heating/Heat.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp index 8d7fb36f..5844d94c 100644 --- a/src/Heating/Heat.cpp +++ b/src/Heating/Heat.cpp @@ -524,9 +524,12 @@ GCodeResult Heat::ConfigureHeater(size_t heater, GCodeBuffer& gb, const StringRe return GCodeResult::error; } +#if SUPPORT_CAN_EXPANSION + const CanAddress board = IoPort::RemoveBoardAddress(pinName.GetRef()); +#endif if (StringEqualsIgnoreCase(pinName.c_str(), NoPinName)) { - // Settin the pin name to "nil" deletes the heater + // Setting the pin name to "nil" deletes the heater WriteLocker lock(heatersLock); Heater *oldHeater = nullptr; std::swap(oldHeater, heaters[heater]); @@ -550,13 +553,12 @@ GCodeResult Heat::ConfigureHeater(size_t heater, GCodeBuffer& gb, const StringRe const PwmFrequency freq = (gb.Seen('Q')) ? gb.GetPwmFrequency() : DefaultFanPwmFreq; #if SUPPORT_CAN_EXPANSION - const CanAddress board = IoPort::RemoveBoardAddress(pinName.GetRef()); - Heater *newHeater = (board != CanId::MasterAddress) ? (Heater *)new RemoteHeater(heater, board) : new LocalHeater(heater); + Heater * const newHeater = (board != CanId::MasterAddress) ? (Heater *)new RemoteHeater(heater, board) : new LocalHeater(heater); #else - Heater *newHeater = new LocalHeater(heater); + Heater * const newHeater = new LocalHeater(heater); #endif const GCodeResult rslt = newHeater->ConfigurePortAndSensor(pinName.c_str(), freq, sensorNumber, reply); - if (rslt == GCodeResult::ok) + if (rslt == GCodeResult::ok || rslt == GCodeResult::warning) { heaters[heater] = newHeater; } @@ -996,7 +998,7 @@ GCodeResult Heat::ConfigureSensor(GCodeBuffer& gb, const StringRef& reply) noexc } const GCodeResult rslt = newSensor->Configure(gb, reply); - if (rslt == GCodeResult::ok) + if (rslt == GCodeResult::ok || rslt == GCodeResult::warning) { InsertSensor(newSensor); } |