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:
-rw-r--r--src/Endstops/EndstopsManager.cpp5
-rw-r--r--src/Heating/Heater.cpp29
-rw-r--r--src/Heating/Heater.h1
-rw-r--r--src/Heating/HeaterMonitor.cpp12
-rw-r--r--src/Heating/HeaterMonitor.h1
-rw-r--r--src/Version.h2
6 files changed, 41 insertions, 9 deletions
diff --git a/src/Endstops/EndstopsManager.cpp b/src/Endstops/EndstopsManager.cpp
index 052dbd3e..9953da8b 100644
--- a/src/Endstops/EndstopsManager.cpp
+++ b/src/Endstops/EndstopsManager.cpp
@@ -22,6 +22,7 @@
#include "Movement/Move.h"
#include <OutputMemory.h>
#include <Heating/Heat.h>
+#include <Heating/Sensors/TemperatureSensor.h>
#if SUPPORT_CAN_EXPANSION
# include "CanMessageBuffer.h"
@@ -42,8 +43,8 @@ ReadWriteLock EndstopsManager::zProbesLock;
constexpr ObjectModelArrayDescriptor EndstopsManager::sensorsArrayDescriptor =
{
&Heat::sensorsLock,
- [] (const ObjectModel *self, const ObjectExplorationContext&) noexcept -> size_t { return ((const Heat*)self)->GetNumSensorsToReport(); },
- [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept -> ExpressionValue { return ExpressionValue(((const Heat*)self)->FindSensor(context.GetLastIndex()).Ptr()); }
+ [] (const ObjectModel *self, const ObjectExplorationContext&) noexcept -> size_t { return reprap.GetHeat().GetNumSensorsToReport(); },
+ [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept -> ExpressionValue { return ExpressionValue(reprap.GetHeat().FindSensor(context.GetLastIndex()).Ptr()); }
};
constexpr ObjectModelArrayDescriptor EndstopsManager::endstopsArrayDescriptor =
diff --git a/src/Heating/Heater.cpp b/src/Heating/Heater.cpp
index 24b10302..1625ddb3 100644
--- a/src/Heating/Heater.cpp
+++ b/src/Heating/Heater.cpp
@@ -22,19 +22,36 @@
// Macro to build a standard lambda function that includes the necessary type conversions
#define OBJECT_MODEL_FUNC(...) OBJECT_MODEL_FUNC_BODY(Heater, __VA_ARGS__)
+#define OBJECT_MODEL_FUNC_IF(...) OBJECT_MODEL_FUNC_IF_BODY(Heater, __VA_ARGS__)
+
+constexpr ObjectModelArrayDescriptor Heater::monitorsArrayDescriptor =
+{
+ nullptr,
+ [] (const ObjectModel *self, const ObjectExplorationContext&) noexcept -> size_t { return MaxMonitorsPerHeater; },
+ [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept -> ExpressionValue { return ExpressionValue(self, 1); }
+
+};
constexpr ObjectModelTableEntry Heater::objectModelTable[] =
{
// Within each group, these entries must be in alphabetical order
// 0. Heater members
- { "current", OBJECT_MODEL_FUNC(self->GetTemperature(), 1), ObjectModelEntryFlags::live },
- { "max", OBJECT_MODEL_FUNC(self->GetHighestTemperatureLimit(), 1), ObjectModelEntryFlags::none },
- { "min", OBJECT_MODEL_FUNC(self->GetLowestTemperatureLimit(), 1), ObjectModelEntryFlags::none },
- { "sensor", OBJECT_MODEL_FUNC((int32_t)self->GetSensorNumber()), ObjectModelEntryFlags::none },
- { "state", OBJECT_MODEL_FUNC(self->GetStatus().ToString()), ObjectModelEntryFlags::live },
+ { "current", OBJECT_MODEL_FUNC(self->GetTemperature(), 1), ObjectModelEntryFlags::live },
+ { "max", OBJECT_MODEL_FUNC(self->GetHighestTemperatureLimit(), 1), ObjectModelEntryFlags::none },
+ { "min", OBJECT_MODEL_FUNC(self->GetLowestTemperatureLimit(), 1), ObjectModelEntryFlags::none },
+ { "monitors", OBJECT_MODEL_FUNC_NOSELF(&monitorsArrayDescriptor), ObjectModelEntryFlags::none },
+ { "sensor", OBJECT_MODEL_FUNC((int32_t)self->GetSensorNumber()), ObjectModelEntryFlags::none },
+ { "state", OBJECT_MODEL_FUNC(self->GetStatus().ToString()), ObjectModelEntryFlags::live },
+
+ // 1. Heater.monitors[] members
+ { "action", OBJECT_MODEL_FUNC_IF(self->monitors[context.GetLastIndex()].GetTrigger() != HeaterMonitorTrigger::Disabled,
+ (int32_t)self->monitors[context.GetLastIndex()].GetAction()), ObjectModelEntryFlags::none },
+ { "condition", OBJECT_MODEL_FUNC(self->monitors[context.GetLastIndex()].GetTriggerName()), ObjectModelEntryFlags::none },
+ { "limit", OBJECT_MODEL_FUNC_IF(self->monitors[context.GetLastIndex()].GetTrigger() != HeaterMonitorTrigger::Disabled,
+ self->monitors[context.GetLastIndex()].GetTemperatureLimit(), 1), ObjectModelEntryFlags::none },
};
-constexpr uint8_t Heater::objectModelTableDescriptor[] = { 1, 5 };
+constexpr uint8_t Heater::objectModelTableDescriptor[] = { 2, 6, 3 };
DEFINE_GET_OBJECT_MODEL_TABLE(Heater)
diff --git a/src/Heating/Heater.h b/src/Heating/Heater.h
index 5108d548..6020b071 100644
--- a/src/Heating/Heater.h
+++ b/src/Heating/Heater.h
@@ -83,6 +83,7 @@ public:
protected:
DECLARE_OBJECT_MODEL
+ OBJECT_MODEL_ARRAY(monitors)
enum class HeaterMode : uint8_t
{
diff --git a/src/Heating/HeaterMonitor.cpp b/src/Heating/HeaterMonitor.cpp
index bb1874b3..92a585e9 100644
--- a/src/Heating/HeaterMonitor.cpp
+++ b/src/Heating/HeaterMonitor.cpp
@@ -96,4 +96,16 @@ void HeaterMonitor::Report(unsigned int heater, unsigned int index, const String
}
}
+// Get the condition for a temperature event as a string
+const char *HeaterMonitor::GetTriggerName() const noexcept
+{
+ switch (trigger)
+ {
+ case HeaterMonitorTrigger::Disabled: return "disabled";
+ case HeaterMonitorTrigger::TemperatureExceeded: return "tooHigh";
+ case HeaterMonitorTrigger::TemperatureTooLow: return "tooLow";
+ default: return "undefined";
+ }
+}
+
// End
diff --git a/src/Heating/HeaterMonitor.h b/src/Heating/HeaterMonitor.h
index 42bdac38..2b4fb322 100644
--- a/src/Heating/HeaterMonitor.h
+++ b/src/Heating/HeaterMonitor.h
@@ -53,6 +53,7 @@ public:
float GetTemperatureLimit() const noexcept { return limit; } // Get the temperature limit
HeaterMonitorAction GetAction() const noexcept { return action; } // Get the action to trigger when a temperature event occurs
HeaterMonitorTrigger GetTrigger() const noexcept { return trigger; } // Get the condition for a temperature event
+ const char *GetTriggerName() const noexcept; // Get the condition for a temperature event
void Report(unsigned int heater, unsigned int index, const StringRef& reply) const noexcept; // Append a report of this monitor to the string
diff --git a/src/Version.h b/src/Version.h
index e62216a2..ed60842e 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -19,7 +19,7 @@
#endif
#ifndef DATE
-# define DATE "2020-02-16b2"
+# define DATE "2020-02-17b1"
#endif
#define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman, printm3d"