Skip to content

Commit

Permalink
Fix Debounce configuration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mairas committed Dec 12, 2024
1 parent f2d9979 commit 04a5c21
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 04a5c21

Please sign in to comment.