Skip to content

Commit

Permalink
Merge pull request #798 from SignalK/fix_debounce
Browse files Browse the repository at this point in the history
Fix Debounce configuration issues
  • Loading branch information
mairas authored Dec 12, 2024
2 parents fc4634c + a002292 commit b9c6985
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
9 changes: 0 additions & 9 deletions src/sensesp/transforms/debounce.cpp

This file was deleted.

16 changes: 10 additions & 6 deletions src/sensesp/transforms/debounce.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ class Debounce : public SymmetricTransform<T> {
}
}

private:
int ms_min_delay_;
bool value_received_ = false;
T debounced_value_;
reactesp::DelayEvent* event_ = nullptr;
virtual bool to_json(JsonObject& doc) override {
doc["min_delay"] = ms_min_delay_;
return true;
Expand All @@ -76,9 +71,18 @@ class Debounce : public SymmetricTransform<T> {
ms_min_delay_ = config["min_delay"];
return true;
}

protected:
int ms_min_delay_;
bool value_received_ = false;
T debounced_value_;
reactesp::DelayEvent* event_ = nullptr;
};

const String ConfigSchema(const Debounce<bool>& obj);
template <typename T>
const String ConfigSchema(const Debounce<T>& obj) {
return R"###({"type":"object","properties":{"min_delay":{"title":"Minimum delay","type":"number","description":"The minimum time in ms between inputs for output to happen"}}})###";
}

typedef Debounce<bool> DebounceBool;
typedef Debounce<int> DebounceInt;
Expand Down

0 comments on commit b9c6985

Please sign in to comment.