button: Support half-stepping encoders

Adds support for half-stepping encoders (encoders that only emit two
steps per detent, instead of four). Incorporates the feedback from
@susisstrolch's PR: https://github.com/KevinOConnor/klipper/pull/4202
, which was itself built upon a previous PR from @nickbrennan01:
https://github.com/KevinOConnor/klipper/pull/730

Uses the table from the Rotary Arduino library linked in buttons.py:
6b784cca67/Rotary.cpp (L21-L40)

Signed-off-by: Rufo Sanchez <rufo@rufosanchez.com>
This commit is contained in:
Rufo Sanchez
2021-09-12 16:59:15 -05:00
committed by KevinOConnor
parent 5f184e3f98
commit b336a21fe7
3 changed files with 96 additions and 35 deletions

View File

@@ -3240,6 +3240,11 @@ lcd_type:
#encoder_pins:
# The pins connected to encoder. 2 pins must be provided when using
# encoder. This parameter must be provided when using menu.
#encoder_steps_per_detent:
# How many steps the encoder emits per detent ("click"). If the
# encoder takes two detents to move between entries or moves two
# entries from one detent, try changing this. Allowed values are 2
# (half-stepping) or 4 (full-stepping). The default is 4.
#click_pin:
# The pin connected to 'enter' button or encoder 'click'. This
# parameter must be provided when using menu. The presence of an