From 5f0fac5f04dcf488507ddcc1f07b136e18067c40 Mon Sep 17 00:00:00 2001 From: GOB Date: Sat, 28 Sep 2024 23:31:11 +0900 Subject: [PATCH] Fixes inPeriodic function --- src/M5UnitComponent.cpp | 4 +++- src/M5UnitComponent.hpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/M5UnitComponent.cpp b/src/M5UnitComponent.cpp index 832e293..2f6ab33 100644 --- a/src/M5UnitComponent.cpp +++ b/src/M5UnitComponent.cpp @@ -126,7 +126,9 @@ bool Component::assign(TwoWire& wire) bool Component::selectChannel(const uint8_t ch) { - M5_LIB_LOGV("%s:%u", deviceName(), ch); + if (ch != 255) { + M5_LIB_LOGV("%s:%u", deviceName(), ch); + } bool ret{true}; if (hasParent()) { ret = _parent->selectChannel(channel()); diff --git a/src/M5UnitComponent.hpp b/src/M5UnitComponent.hpp index a35da04..6eb1999 100644 --- a/src/M5UnitComponent.hpp +++ b/src/M5UnitComponent.hpp @@ -166,7 +166,7 @@ class Component { /*! @brief In periodic measurement? */ inline bool inPeriodic() const { - return _periodic; + return in_periodic(); } //! @brief Periodic measurement data updated? inline bool updated() const @@ -345,6 +345,10 @@ class Component { virtual const char* unit_device_name() const = 0; virtual types::uid_t unit_identifier() const = 0; virtual types::attr_t unit_attribute() const = 0; + inline virtual bool in_periodic() const + { + return _periodic; + } // Duplicate the adapter for children // Note that ownership of the return pointer is delegated to the destination