diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-04-20 17:39:53 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-04-20 17:39:53 +0300 |
commit | f33d299919ca83729da74d4ebcef48c66d9a007d (patch) | |
tree | 03e39a6a2a0195e6d44bc119a8e5eab34047ebd2 /src/Endstops/EndstopsManager.cpp | |
parent | 669b2fb36307dbb57e3686f1eaa5b12f89f640f9 (diff) |
Changes to PanelDue output code, add GpOut ports to OM
Suppress empty responses to PanelDue
Discard responses that PanelDue indicates that it isn't interested in
Added state.gpOut array
Renamed sensors.inputs to sensors.gpIn and return null array element for
unconfigured inputs
Diffstat (limited to 'src/Endstops/EndstopsManager.cpp')
-rw-r--r-- | src/Endstops/EndstopsManager.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Endstops/EndstopsManager.cpp b/src/Endstops/EndstopsManager.cpp index e58d2db3..253961c6 100644 --- a/src/Endstops/EndstopsManager.cpp +++ b/src/Endstops/EndstopsManager.cpp @@ -62,12 +62,15 @@ constexpr ObjectModelArrayDescriptor EndstopsManager::filamentMonitorsArrayDescr [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept -> ExpressionValue { return ExpressionValue(FilamentMonitor::GetMonitorAlreadyLocked(context.GetLastIndex())); } }; -constexpr ObjectModelArrayDescriptor EndstopsManager::inputsArrayDescriptor = +constexpr ObjectModelArrayDescriptor EndstopsManager::gpinArrayDescriptor = { nullptr, - [] (const ObjectModel *self, const ObjectExplorationContext&) noexcept -> size_t { return reprap.GetPlatform().GetNumInputsToReport(); }, + [] (const ObjectModel *self, const ObjectExplorationContext&) noexcept -> size_t { return reprap.GetPlatform().GetNumGpInputsToReport(); }, [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept -> ExpressionValue - { return ExpressionValue(&reprap.GetPlatform().GetGpInPort(context.GetLastIndex())); } + { + const GpInputPort& port = reprap.GetPlatform().GetGpInPort(context.GetLastIndex()); + return (port.IsUnused()) ? ExpressionValue(nullptr) : ExpressionValue(&port); + } }; constexpr ObjectModelArrayDescriptor EndstopsManager::probesArrayDescriptor = @@ -85,7 +88,7 @@ constexpr ObjectModelTableEntry EndstopsManager::objectModelTable[] = { "analog", OBJECT_MODEL_FUNC_NOSELF(&sensorsArrayDescriptor), ObjectModelEntryFlags::live }, { "endstops", OBJECT_MODEL_FUNC_NOSELF(&endstopsArrayDescriptor), ObjectModelEntryFlags::live }, { "filamentMonitors", OBJECT_MODEL_FUNC_NOSELF(&filamentMonitorsArrayDescriptor), ObjectModelEntryFlags::live }, - { "inputs", OBJECT_MODEL_FUNC_NOSELF(&inputsArrayDescriptor), ObjectModelEntryFlags::live }, + { "gpIn", OBJECT_MODEL_FUNC_NOSELF(&gpinArrayDescriptor), ObjectModelEntryFlags::live }, { "probes", OBJECT_MODEL_FUNC_NOSELF(&probesArrayDescriptor), ObjectModelEntryFlags::live }, }; |