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>2020-01-18 18:21:02 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-18 18:21:02 +0300
commite0bbf71357b07c22e6d43be3cca5c7422163be32 (patch)
treeca83dbb87348e51c735b106900b69142f5c058f5 /src/Endstops/Endstop.cpp
parentd577af1d5874392d28c65427afbf4006f8a6d521 (diff)
Lock ZProbes when accessing them and added more items to OM
Diffstat (limited to 'src/Endstops/Endstop.cpp')
-rw-r--r--src/Endstops/Endstop.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Endstops/Endstop.cpp b/src/Endstops/Endstop.cpp
index ea4cf5a3..f80cdca9 100644
--- a/src/Endstops/Endstop.cpp
+++ b/src/Endstops/Endstop.cpp
@@ -10,6 +10,29 @@
// Endstop base class
DriversBitmap EndstopOrZProbe::stalledDrivers = 0; // used to track which drivers are reported as stalled, for stall detect endstops and stall detect Z probes
+#if SUPPORT_OBJECT_MODEL
+
+// Object model table and functions
+// Note: if using GCC version 7.3.1 20180622 and lambda functions are used in this table, you must compile this file with option -std=gnu++17.
+// Otherwise the table will be allocated in RAM instead of flash, which wastes too much RAM.
+
+// Macro to build a standard lambda function that includes the necessary type conversions
+#define OBJECT_MODEL_FUNC(...) OBJECT_MODEL_FUNC_BODY(Endstop, __VA_ARGS__)
+
+constexpr ObjectModelTableEntry Endstop::objectModelTable[] =
+{
+ // Within each group, these entries must be in alphabetical order
+ // 0. Endstop members
+ { "triggered", OBJECT_MODEL_FUNC(self->Stopped() == EndStopHit::atStop), ObjectModelEntryFlags::live },
+ { "type", OBJECT_MODEL_FUNC(self->GetEndstopType().ToString()), ObjectModelEntryFlags::none },
+};
+
+constexpr uint8_t Endstop::objectModelTableDescriptor[] = { 1, 2 };
+
+DEFINE_GET_OBJECT_MODEL_TABLE(Endstop)
+
+#endif
+
Endstop::Endstop(uint8_t p_axis, EndStopPosition pos) noexcept : axis(p_axis), atHighEnd(pos == EndStopPosition::highEndStop)
{
}