Skip to content

fix: make SimpleRotary double-press backspace reliable#405

Draft
forntoh wants to merge 1 commit intomasterfrom
fix/376-simple-rotary-backspace
Draft

fix: make SimpleRotary double-press backspace reliable#405
forntoh wants to merge 1 commit intomasterfrom
fix/376-simple-rotary-backspace

Conversation

@forntoh
Copy link
Copy Markdown
Owner

@forntoh forntoh commented Apr 2, 2026

Summary

  • Make SimpleRotaryAdapter use an effective double-press threshold that is reliable with SimpleRotary's 200ms button sampling.
  • Keep DOUBLE_PRESS_THRESHOLD=0 behavior for disabling double-press, while clamping positive values below the minimum to avoid missed BACKSPACE actions.
  • Document the practical threshold guidance in the rotary examples.

Testing

  • pio ci -b esp32dev -l . -O platform=espressif32 -O framework=arduino -O $'lib_deps=\nmarcoschwartz/LiquidCrystal_I2C@^1.1.4\narduino-libraries/LiquidCrystal@^1.0.7\nmprograms/SimpleRotary@^1.1.3\nmadleech/Button@^1.0.0' examples/InputRotary/InputRotary.ino
  • pio ci -b esp32dev -l . -O platform=espressif32 -O framework=arduino -O $'lib_deps=\nmarcoschwartz/LiquidCrystal_I2C@^1.1.4\narduino-libraries/LiquidCrystal@^1.0.7\nmprograms/SimpleRotary@^1.1.3\nmadleech/Button@^1.0.0' examples/SimpleRotary/SimpleRotary.ino
  • pio ci -b esp32dev -l . -O platform=espressif32 -O framework=arduino -O $'lib_deps=\nmarcoschwartz/LiquidCrystal_I2C@^1.1.4\narduino-libraries/LiquidCrystal@^1.0.7\nmprograms/SimpleRotary@^1.1.3\nmadleech/Button@^1.0.0' examples/ButtonWithRotaryAdapter/ButtonWithRotaryAdapter.ino

Issue

Summary by CodeRabbit

  • Documentation

    • Enhanced comments in example sketches clarifying double-press configuration options and behavior.
  • Bug Fixes

    • Enforced minimum double-press timing threshold (500ms) based on button debounce delay for reliable detection; double-press detection can still be disabled by setting DOUBLE_PRESS_THRESHOLD to 0.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 15e5bc9a-ff72-4cd1-9f49-32aa1884eab2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/376-simple-rotary-backspace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Memory usage change @ 2f114dd

Board flash % RAM for global variables %
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:avr:uno 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkr1000 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
esp32:esp32:esp32 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
esp8266:esp8266:huzzah N/A N/A N/A N/A
Click for full report table
Board examples/Basic
flash
% examples/Basic
RAM for global variables
% examples/ButtonAdapter
flash
% examples/ButtonAdapter
RAM for global variables
% examples/Callbacks
flash
% examples/Callbacks
RAM for global variables
% examples/InputRotary
flash
% examples/InputRotary
RAM for global variables
% examples/IntFloatValues
flash
% examples/IntFloatValues
RAM for global variables
% examples/KeyboardAdapter
flash
% examples/KeyboardAdapter
RAM for global variables
% examples/List
flash
% examples/List
RAM for global variables
% examples/SimpleRotary
flash
% examples/SimpleRotary
RAM for global variables
% examples/SSD1803A_I2C
flash
% examples/SSD1803A_I2C
RAM for global variables
% examples/UseByRef
flash
% examples/UseByRef
RAM for global variables
% examples/DynamicMenu
flash
% examples/DynamicMenu
RAM for global variables
% examples/Widgets
flash
% examples/Widgets
RAM for global variables
% examples/RTOS
flash
% examples/RTOS
RAM for global variables
%
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:avr:uno 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkr1000 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
esp32:esp32:esp32 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
esp8266:esp8266:huzzah N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
Click for full report CSV
Board,examples/Basic<br>flash,%,examples/Basic<br>RAM for global variables,%,examples/ButtonAdapter<br>flash,%,examples/ButtonAdapter<br>RAM for global variables,%,examples/Callbacks<br>flash,%,examples/Callbacks<br>RAM for global variables,%,examples/InputRotary<br>flash,%,examples/InputRotary<br>RAM for global variables,%,examples/IntFloatValues<br>flash,%,examples/IntFloatValues<br>RAM for global variables,%,examples/KeyboardAdapter<br>flash,%,examples/KeyboardAdapter<br>RAM for global variables,%,examples/List<br>flash,%,examples/List<br>RAM for global variables,%,examples/SimpleRotary<br>flash,%,examples/SimpleRotary<br>RAM for global variables,%,examples/SSD1803A_I2C<br>flash,%,examples/SSD1803A_I2C<br>RAM for global variables,%,examples/UseByRef<br>flash,%,examples/UseByRef<br>RAM for global variables,%,examples/DynamicMenu<br>flash,%,examples/DynamicMenu<br>RAM for global variables,%,examples/Widgets<br>flash,%,examples/Widgets<br>RAM for global variables,%,examples/RTOS<br>flash,%,examples/RTOS<br>RAM for global variables,%
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:avr:uno,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkr1000,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,,,,
esp32:esp32:esp32,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
esp8266:esp8266:huzzah,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,,,,

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/input/SimpleRotaryAdapter.h`:
- Around line 18-22: The comment hardcodes "500ms" but the actual minimum is
computed from SIMPLE_ROTARY_BUTTON_DEBOUNCE_DELAY; update the documentation in
SimpleRotaryAdapter.h to avoid the magic number and instead reference the
computed minimum (e.g., "the minimum is computed from
SIMPLE_ROTARY_BUTTON_DEBOUNCE_DELAY") and/or show the expression used to compute
it so the comment remains correct if SIMPLE_ROTARY_BUTTON_DEBOUNCE_DELAY is
changed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 72281e3b-874a-44d6-a0c3-9fb1ebc77767

📥 Commits

Reviewing files that changed from the base of the PR and between 6548be8 and 2f114dd.

📒 Files selected for processing (4)
  • examples/ButtonWithRotaryAdapter/ButtonWithRotaryAdapter.ino
  • examples/InputRotary/InputRotary.ino
  • examples/SimpleRotary/SimpleRotary.ino
  • src/input/SimpleRotaryAdapter.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BACKSPACE not working

1 participant