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-10 14:50:14 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-12-10 14:50:14 +0300
commit289d2f286a3fdf084c325d4db87f8075c154df6a (patch)
treee14e43504bfc5380f62e6a3065f8715d2698d3dd
parent904cf76271936d3799070ea67cacf387326f5ba4 (diff)
Bug fix: release port if temp sensor configuration failed
Also: in CAN expansion board mode, announce ourselves to the main board
-rw-r--r--src/Heating/Heat.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp
index 47eb288f..40f116fa 100644
--- a/src/Heating/Heat.cpp
+++ b/src/Heating/Heat.cpp
@@ -358,6 +358,11 @@ void Heat::SendHeatersStatus(CanMessageBuffer& buf) noexcept
// Check whether it is time to poll sensors and PIDs and send regular messages
if ((int32_t)(millis() - nextWakeTime) >= 0)
{
+#if SUPPORT_REMOTE_COMMANDS
+ // Announce ourselves to the main board, if it hasn't acknowledged us already
+ CanInterface::SendAnnounce(&buf);
+#endif
+
// Walk the sensor list and poll all sensors. The list is in increasing sensor number order.
{
#if SUPPORT_CAN_EXPANSION
@@ -1082,16 +1087,24 @@ GCodeResult Heat::ConfigureSensor(GCodeBuffer& gb, const StringRef& reply) THROW
}
bool changed = false;
- const GCodeResult rslt = newSensor->Configure(gb, reply, changed);
- if (rslt == GCodeResult::ok)
+ try
{
- InsertSensor(newSensor);
+ const GCodeResult rslt = newSensor->Configure(gb, reply, changed);
+ if (rslt == GCodeResult::ok)
+ {
+ InsertSensor(newSensor);
+ }
+ else
+ {
+ delete newSensor;
+ }
+ return rslt;
}
- else
+ catch (const GCodeException&)
{
delete newSensor;
+ throw;
}
- return rslt;
}
// Modifying or reporting on an existing sensor