Commit Graph

16 Commits

Author SHA1 Message Date
Rufo Sanchez b336a21fe7 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>
2021-10-11 11:29:53 -04:00
Kevin O'Connor 166ce06aea buttons: Improve python3 compatibility
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-09-04 19:33:04 -04:00
Kevin O'Connor 787ed452c2 klippy: Rename try_load_module() to load_object()
Rename try_load_module() so that it uses consistent naming for
"printer objects".  Change the function to raise an error by default
if the specified module does not exist.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-08 11:05:14 -04:00
Kevin O'Connor 0bfb655f66 query_adc: Add a new module to help query and debug analog pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 19:28:27 -05:00
Kevin O'Connor 124ba12485 buttons: Only call into main thread on an adc button change
Determine the selected button (and if it has changed) in the
background thread first.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:49:56 -05:00
Kevin O'Connor 196a69c613 buttons: No need to check for None on min_value/max_value
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:42:55 -05:00
Kevin O'Connor d40f951d6f buttons: Remove MCU_ADC_buttons debug capability
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-11-07 18:32:26 -05:00
Arksine 0f1d42466b buttons: initialize mcu buttons based on inverted state
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2019-07-05 20:01:07 -04:00
Kevin O'Connor 647f1ee2e0 serialhdl: Rename register_callback() to register_response()
Rename the method and use that name in the mcu class as well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-21 18:14:00 -04:00
Kevin O'Connor 8cd8cb492e buttons: Minor code movement
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-05-26 00:18:48 -04:00
Janar Sööt 0a392b6543 menu: initial support for analog buttons (#977)
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-04-14 11:18:52 -04:00
Kevin O'Connor 2d99a1e802 buttons: Wrap code to 80 columns
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 13:34:22 -05:00
Kevin O'Connor 30013a1fb8 mcu: Rename add_config_object() to register_config_callback()
Change the name of the config registration method and pass an explicit
reference to the callback to the new method.  This makes the
relationship between mcu registration and build_config() more clear in
the calling code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-09-03 11:48:22 -04:00
Kevin O'Connor 273a98d39a pins: Explicitly pass can_invert and can_pullup to lookup_pin()
Don't pass pin_type to lookup_pin() - instead, if a pin can be
inverted or can have a pullup, then the caller must explicitly specify
that when calling lookup_pin().  This simplifies the code for the
cases where it is not valid to invert or pullup.

Explicitly pass the pin_type to setup_pin() and have ppins.setup_pin()
apply default pullup and invert flags.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-26 09:44:45 -04:00
Janar Sööt 3a1d9e779c buttons: Improve rotary encoder handler by using Ben Buxton state machine. (#445)
https://github.com/brianlow/Rotary

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2018-07-01 08:41:14 -04:00
Kevin O'Connor 38d7b9ada0 buttons: Add initial support for detecting button presses
Add mcu support for periodically polling for a button press.  Add host
code support for registering buttons and invoking callbacks for them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:28:51 -04:00