feat: decouple long-click retrigger interval from initial threshold#91
Merged
LennartHennigs merged 1 commit intomasterfrom Mar 23, 2026
Merged
Conversation
Decouples the initial long-press threshold from the continuous retrigger interval, taking the API style of PR #86 with the cleaner implementation approach of PR #90. - New overload: setLongClickDetectedRetriggerable(bool, unsigned int retrigger_ms) - New getter: getLongClickInterval() - bool-only overload delegates to the two-arg overload (resets interval to 0) - _checkForLongClick: first fire at longclick_time_ms, subsequent fires every retrigger_ms (falls back to longclick_time_ms if not set, preserving backward compatibility) - reset() now clears longclick_retriggerable and longclick_interval_ms - New example: LongpressRetriggerInterval - New tests: getLongClickInterval getter, retrigger timing with custom interval - test_helpers: pressAndHold() helper extracted; click() delegates to it Closes #86, Closes #90 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #86, closes #90 — takes the API style of #86 (interval bundled into the retriggerable setter) with the cleaner implementation approach of #90 (sentinel value instead of extra bool flag).
setLongClickDetectedRetriggerable(bool retriggerable, unsigned int retrigger_ms)— sets a custom retrigger cadence independent of the initial thresholdgetLongClickInterval()— alongside the other timing getters_checkForLongClick: first fire atlongclick_time_ms; subsequent fires everyretrigger_ms(falls back tolongclick_time_mswhen not set → fully backward compatible)reset()now clearslongclick_retriggerableandlongclick_interval_msLongpressRetriggerIntervalshowingsetLongClickTime(3000)+setLongClickDetectedRetriggerable(true, 500)Usage
Test plan
pio test -e epoxy-esp8266— all 13 callback tests pass (3 new), all 10 config tests pass (3 new)pio test -e epoxy-esp32— samepio test -e epoxy-nano— samelong_click_detected_custom_intervaltest verifies ≥3 fires with 100 ms retrigger intervalgetLongClickIntervaltests verify getter, setter, and reset-by-bool-overload behaviour🤖 Generated with Claude Code