debounce Helper¶
-
template<typename Source>
Effect<1> RxESP32::Helpers::Temporal::debounce(Source &source, Source &target, uint32_t delay_ms, const typename Effect<1>::Options &options = {})¶ Debounce source changes with a delay.
Creates an Effect that waits for the source to stop changing before updating the target. Uses FreeRTOS timer (non-blocking). Each change resets the timer.
- Since
v0.1.0
Signal<String> search_input(""); Signal<String> debounced_search(""); // Update search only after user stops typing for 500ms auto debouncer = debounce(search_input, debounced_search, 500); search_input.set("h"); // Timer starts search_input.set("he"); // Timer resets search_input.set("hel"); // Timer resets // After 500ms of no changes, debounced_search = "hel"Note
Non-blocking - uses FreeRTOS timer callback.
Warning
Source and target must have the same type.
Minimum delay is
1ms(FreeRTOS limitation).
See Also¶
Temporal Helpers - Overview