aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/buttons.py
Commit message (Collapse)AuthorAgeFilesLines
* mcu: Rename setup_minmax() to setup_adc_sample()Kevin O'Connor2024-06-211-1/+1
| | | | | | | Rename this method so that it is more distinct from the the common temperature setup_minmax() method. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: Fix possible ordering issue if a callback blocksKevin O'Connor2023-12-301-12/+12
| | | | | | | | | | Invoke button callbacks directly from the background thread. This ensures that button notifications are delivered and delivered in the correct order. Previously, if a callback blocked, it was possible a new update could start before the previous update was completed, which could lead to lost events or out of order events. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: Simplify ack upconversion codeKevin O'Connor2023-12-101-4/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* button: Support half-stepping encodersRufo Sanchez2021-10-111-34/+87
| | | | | | | | | | | | | 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: https://github.com/brianlow/Rotary/blob/6b784cca67c5f1ce5e11d757a540fc4c0311efca/Rotary.cpp#L21-L40 Signed-off-by: Rufo Sanchez <rufo@rufosanchez.com>
* buttons: Improve python3 compatibilityKevin O'Connor2020-09-041-3/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Rename try_load_module() to load_object()Kevin O'Connor2020-05-081-1/+1
| | | | | | | | 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>
* query_adc: Add a new module to help query and debug analog pinsKevin O'Connor2019-11-071-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: Only call into main thread on an adc button changeKevin O'Connor2019-11-071-17/+13
| | | | | | | Determine the selected button (and if it has changed) in the background thread first. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: No need to check for None on min_value/max_valueKevin O'Connor2019-11-071-21/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: Remove MCU_ADC_buttons debug capabilityKevin O'Connor2019-11-071-11/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: initialize mcu buttons based on inverted stateArksine2019-07-051-2/+3
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* serialhdl: Rename register_callback() to register_response()Kevin O'Connor2019-06-211-2/+2
| | | | | | Rename the method and use that name in the mcu class as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* buttons: Minor code movementKevin O'Connor2019-05-261-37/+43
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* menu: initial support for analog buttons (#977)Janar Sööt2019-04-141-0/+91
| | | Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* buttons: Wrap code to 80 columnsKevin O'Connor2019-02-271-5/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Rename add_config_object() to register_config_callback()Kevin O'Connor2018-09-031-1/+1
| | | | | | | | | 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>
* pins: Explicitly pass can_invert and can_pullup to lookup_pin()Kevin O'Connor2018-07-261-1/+1
| | | | | | | | | | | | 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>
* buttons: Improve rotary encoder handler by using Ben Buxton state machine. ↵Janar Sööt2018-07-011-11/+35
| | | | | | | (#445) https://github.com/brianlow/Rotary Signed-off-by: Janar Sööt <janar.soot@gmail.com>
* buttons: Add initial support for detecting button pressesKevin O'Connor2018-06-301-0/+143
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>