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>2019-09-09 21:05:41 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-09-09 21:05:41 +0300
commita527ffa39cf6688d2128a8d30c5560b703240197 (patch)
treea7c8928c1b8cfad64b0aac4b179ead8dd4d507c3 /src/Heating
parent74ee9cf3b40e1435ab9c3c3fe81545a44d52a475 (diff)
Fixes for remote pressure advance + other changes
Fix CAN data sent to extruders when pressure advance is used Added remote heater fault configuration Added more remote info messages
Diffstat (limited to 'src/Heating')
-rw-r--r--src/Heating/Heat.cpp32
-rw-r--r--src/Heating/Heater.cpp7
-rw-r--r--src/Heating/Heater.h4
-rw-r--r--src/Heating/LocalHeater.h1
-rw-r--r--src/Heating/RemoteHeater.cpp17
-rw-r--r--src/Heating/RemoteHeater.h1
6 files changed, 46 insertions, 16 deletions
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp
index 43ce31a2..2f2b024f 100644
--- a/src/Heating/Heat.cpp
+++ b/src/Heating/Heat.cpp
@@ -752,22 +752,24 @@ bool Heat::WriteModelParameters(FileStore *f) const
// Process M570
GCodeResult Heat::ConfigureHeaterMonitoring(size_t heater, GCodeBuffer& gb, const StringRef& reply)
{
- if (heater < MaxHeaters && heaters[heater] != nullptr)
+ const auto h = FindHeater(heater);
+ if (h.IsNull())
{
- bool seenValue = false;
- float maxTempExcursion, maxFaultTime;
- heaters[heater]->GetFaultDetectionParameters(maxTempExcursion, maxFaultTime);
- gb.TryGetFValue('P', maxFaultTime, seenValue);
- gb.TryGetFValue('T', maxTempExcursion, seenValue);
- if (seenValue)
- {
- heaters[heater]->SetFaultDetectionParameters(maxTempExcursion, maxFaultTime);
- }
- else
- {
- reply.printf("Heater %u allowed excursion %.1f" DEGREE_SYMBOL "C, fault trigger time %.1f seconds", heater, (double)maxTempExcursion, (double)maxFaultTime);
- }
+ reply.printf("Heater %u not found", heater);
+ return GCodeResult::error;
+ }
+
+ bool seenValue = false;
+ float maxTempExcursion, maxFaultTime;
+ h->GetFaultDetectionParameters(maxTempExcursion, maxFaultTime);
+ gb.TryGetFValue('P', maxFaultTime, seenValue);
+ gb.TryGetFValue('T', maxTempExcursion, seenValue);
+ if (seenValue)
+ {
+ return h->SetFaultDetectionParameters(maxTempExcursion, maxFaultTime, reply);
}
+
+ reply.printf("Heater %u allowed excursion %.1f" DEGREE_SYMBOL "C, fault trigger time %.1f seconds", heater, (double)maxTempExcursion, (double)maxFaultTime);
return GCodeResult::ok;
}
@@ -949,6 +951,8 @@ HeaterProtection& Heat::AccessHeaterProtection(size_t index) const
// Updates the PIDs and HeaterProtection items after a heater change
void Heat::UpdateHeaterProtection()
{
+ ReadLocker lock(heatersLock);
+
// Reassign the first mapped heater protection item of each PID where applicable
// and rebuild the linked list of heater protection elements per heater
for (size_t heater : ARRAY_INDICES(heaters))
diff --git a/src/Heating/Heater.cpp b/src/Heating/Heater.cpp
index ac66a8ea..a5ecb54c 100644
--- a/src/Heating/Heater.cpp
+++ b/src/Heating/Heater.cpp
@@ -57,6 +57,13 @@ GCodeResult Heater::SetModel(float gain, float tc, float td, float maxPwm, float
return GCodeResult::error;
}
+GCodeResult Heater::SetFaultDetectionParameters(float pMaxTempExcursion, float pMaxFaultTime, const StringRef& reply)
+{
+ maxTempExcursion = pMaxTempExcursion;
+ maxHeatingFaultTime = pMaxFaultTime;
+ return UpdateFaultDetectionParameters(reply);
+}
+
HeaterStatus Heater::GetStatus() const
{
const HeaterMode mode = GetMode();
diff --git a/src/Heating/Heater.h b/src/Heating/Heater.h
index 53bfcada..1d358bbe 100644
--- a/src/Heating/Heater.h
+++ b/src/Heating/Heater.h
@@ -60,8 +60,7 @@ public:
void GetFaultDetectionParameters(float& pMaxTempExcursion, float& pMaxFaultTime) const
{ pMaxTempExcursion = maxTempExcursion; pMaxFaultTime = maxHeatingFaultTime; }
- void SetFaultDetectionParameters(float pMaxTempExcursion, float pMaxFaultTime)
- { maxTempExcursion = pMaxTempExcursion; maxHeatingFaultTime = pMaxFaultTime; }
+ GCodeResult SetFaultDetectionParameters(float pMaxTempExcursion, float pMaxFaultTime, const StringRef& reply);
float GetHighestTemperatureLimit() const; // Get the highest temperature limit
float GetLowestTemperatureLimit() const; // Get the lowest temperature limit
@@ -103,6 +102,7 @@ protected:
virtual HeaterMode GetMode() const = 0;
virtual GCodeResult SwitchOn(const StringRef& reply) = 0;
virtual GCodeResult UpdateModel(const StringRef& reply) = 0;
+ virtual GCodeResult UpdateFaultDetectionParameters(const StringRef& reply) = 0;
int GetSensorNumber() const { return sensorNumber; }
void SetSensorNumber(int sn) { sensorNumber = sn; }
diff --git a/src/Heating/LocalHeater.h b/src/Heating/LocalHeater.h
index dc76e69c..5c207714 100644
--- a/src/Heating/LocalHeater.h
+++ b/src/Heating/LocalHeater.h
@@ -51,6 +51,7 @@ protected:
HeaterMode GetMode() const override { return mode; }
GCodeResult SwitchOn(const StringRef& reply) override; // Turn the heater on and set the mode
GCodeResult UpdateModel(const StringRef& reply) override; // Called when the heater model has been changed
+ GCodeResult UpdateFaultDetectionParameters(const StringRef& reply) override { return GCodeResult::ok; }
private:
void SetHeater(float power) const; // Power is a fraction in [0,1]
diff --git a/src/Heating/RemoteHeater.cpp b/src/Heating/RemoteHeater.cpp
index c425213b..a1510a8d 100644
--- a/src/Heating/RemoteHeater.cpp
+++ b/src/Heating/RemoteHeater.cpp
@@ -197,6 +197,23 @@ GCodeResult RemoteHeater::UpdateModel(const StringRef& reply)
return GCodeResult::error;
}
+GCodeResult RemoteHeater::UpdateFaultDetectionParameters(const StringRef& reply)
+{
+ CanMessageBuffer *buf = CanMessageBuffer::Allocate();
+ if (buf != nullptr)
+ {
+ const CanRequestId rid = CanInterface::AllocateRequestId(boardAddress);
+ CanMessageSetHeaterFaultDetectionParameters * const msg = buf->SetupRequestMessage<CanMessageSetHeaterFaultDetectionParameters>(rid, CanInterface::GetCanAddress(), boardAddress);
+ msg->heater = GetHeaterNumber();
+ msg->maxFaultTime = GetMaxHeatingFaultTime();
+ msg->maxTempExcursion = GetMaxTemperatureExcursion();
+ return CanInterface::SendRequestAndGetStandardReply(buf, rid, reply);
+ }
+
+ reply.copy("No CAN buffer");
+ return GCodeResult::error;
+}
+
void RemoteHeater::UpdateRemoteStatus(CanAddress src, const CanHeaterReport& report)
{
if (src == boardAddress)
diff --git a/src/Heating/RemoteHeater.h b/src/Heating/RemoteHeater.h
index 3e9c0b12..f373f84a 100644
--- a/src/Heating/RemoteHeater.h
+++ b/src/Heating/RemoteHeater.h
@@ -38,6 +38,7 @@ protected:
HeaterMode GetMode() const override;
GCodeResult SwitchOn(const StringRef& reply) override; // Turn the heater on and set the mode
GCodeResult UpdateModel(const StringRef& reply) override; // Called when the heater model has been changed
+ GCodeResult UpdateFaultDetectionParameters(const StringRef& reply) override;
private:
static constexpr uint32_t RemoteStatusTimeout = 2000;