diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-10-01 16:31:05 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-10-01 19:15:55 -0400 |
commit | ece1f71c645da7115f497642c16278417a1f5292 (patch) | |
tree | 31b3e6d8a21f83be6be4ca14d03fc9277e330449 /klippy/stepper.py | |
parent | 776d8f9f79761fb3e9ae633290738a7c86118016 (diff) | |
download | kutter-ece1f71c645da7115f497642c16278417a1f5292.tar.gz kutter-ece1f71c645da7115f497642c16278417a1f5292.tar.xz kutter-ece1f71c645da7115f497642c16278417a1f5292.zip |
endstop: Support oversampling of the endstop
Some printers can show occasional noise on the endstop pin. Support
sampling the endstop pin multiple times to attempt to filter out this
noise.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r-- | klippy/stepper.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py index ab1af2ba..5040ce9e 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -6,6 +6,9 @@ import math, logging import homing, pins +ENDSTOP_OVERSAMPLE_COUNT = 4 +ENDSTOP_OVERSAMPLE_TIME = .000015 + class PrinterStepper: def __init__(self, printer, config, name): self.name = name @@ -52,6 +55,8 @@ class PrinterHomingStepper(PrinterStepper): self.mcu_endstop = pins.setup_pin( printer, 'endstop', config.get('endstop_pin')) + self.mcu_endstop.setup_oversample( + ENDSTOP_OVERSAMPLE_COUNT, ENDSTOP_OVERSAMPLE_TIME) self.mcu_endstop.add_stepper(self.mcu_stepper) self.position_min = config.getfloat('position_min', 0.) self.position_max = config.getfloat( |