Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Debounce configuration issues #798

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading