Skip to content

Commit 95f4bf5

Browse files
committed
ldc: allow update deglitch
All my LDC1612 frequency samples are <3.15MHz. Signed-off-by: Timofey Titovets <[email protected]>
1 parent 53111fe commit 95f4bf5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/Config_Reference.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,9 @@ sensor_type: ldc1612
22712271
#high_current_drive: False
22722272
# Increase channel current limit. Make sense if autocalibration
22732273
# current shows high values (28+) and there are often errors during homing.
2274+
#deglitch: 10MHz
2275+
# Allow filter cutout high frequency noise. Should be strongly higher
2276+
# than highest frequency value in your calibration data.
22742277
#z_offset:
22752278
# The nominal distance (in mm) between the nozzle and bed that a
22762279
# probing attempt should stop at. This parameter must be provided.

klippy/extras/ldc1612.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
DEFAULT_LDC1612_FREQ = 12000000
1616
SETTLETIME = 0.005
1717
DRIVECUR = 15
18-
DEGLITCH = 0x05 # 10 Mhz
18+
DEGLITCH_OPTIONS = {
19+
"1MHz": 1,
20+
"3.3MHz": 4,
21+
"10MHz": 5,
22+
"33MHz": 3
23+
}
1924

2025
LDC1612_MANUF_ID = 0x5449
2126
LDC1612_DEV_ID = 0x3055
@@ -104,6 +109,8 @@ def __init__(self, config, calibration=None):
104109
self.printer = config.get_printer()
105110
self.calibration = calibration
106111
self.dccal = DriveCurrentCalibrate(config, self)
112+
self.deglitch = int(config.getchoice('deglitch', DEGLITCH_OPTIONS,
113+
default="10MHz"))
107114
self.data_rate = 250
108115
# Setup mcu sensor_ldc1612 bulk query code
109116
self.i2c = bus.MCU_I2C_from_config(config,
@@ -208,7 +215,7 @@ def _start_measurements(self):
208215
self.set_reg(REG_SETTLECOUNT0, int(SETTLETIME*self.frequency/16. + .5))
209216
self.set_reg(REG_CLOCK_DIVIDERS0, (1 << 12) | 1)
210217
self.set_reg(REG_ERROR_CONFIG, (0x1f << 11) | 1)
211-
self.set_reg(REG_MUX_CONFIG, 0x0208 | DEGLITCH)
218+
self.set_reg(REG_MUX_CONFIG, 0x0208 | self.deglitch)
212219
HIGH_CURRENT_DRV = int(self.dccal.get_high_cur_flag()) << 6
213220
REF_CLK_SRC = 1 << 9
214221
AUTO_AMP_DIS = 1 << 10

0 commit comments

Comments
 (0)