Skip to content

Commit

Permalink
Fixes inPeriodic function
Browse files Browse the repository at this point in the history
  • Loading branch information
GOB52 committed Sep 28, 2024
1 parent 8b62e6b commit 5f0fac5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/M5UnitComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 5 additions & 1 deletion src/M5UnitComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5f0fac5

Please sign in to comment.