aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/ldc1612.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras/ldc1612.py')
-rw-r--r--klippy/extras/ldc1612.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/klippy/extras/ldc1612.py b/klippy/extras/ldc1612.py
index e2f502d1..4b8a3f72 100644
--- a/klippy/extras/ldc1612.py
+++ b/klippy/extras/ldc1612.py
@@ -10,9 +10,6 @@ MIN_MSG_TIME = 0.100
BATCH_UPDATES = 0.100
-BYTES_PER_SAMPLE = 4
-SAMPLES_PER_BLOCK = bulk_sensor.MAX_BULK_MSG_SIZE // BYTES_PER_SAMPLE
-
LDC1612_ADDR = 0x2a
LDC1612_FREQ = 12000000
@@ -98,9 +95,8 @@ class LDC1612:
self.bulk_queue = bulk_sensor.BulkDataQueue(mcu, oid=oid)
# Clock tracking
chip_smooth = self.data_rate * BATCH_UPDATES * 2
- self.clock_sync = bulk_sensor.ClockSyncRegression(mcu, chip_smooth)
- self.clock_updater = bulk_sensor.ChipClockUpdater(self.clock_sync,
- BYTES_PER_SAMPLE)
+ self.clock_updater = bulk_sensor.ChipClockUpdater(mcu, chip_smooth,
+ ">I")
self.last_error_count = 0
# Process messages in batches
self.batch_bulk = bulk_sensor.BatchBulkHelper(
@@ -114,8 +110,8 @@ class LDC1612:
cmdqueue = self.i2c.get_command_queue()
self.query_ldc1612_cmd = self.mcu.lookup_command(
"query_ldc1612 oid=%c rest_ticks=%u", cq=cmdqueue)
- self.clock_updater.setup_query_command(
- self.mcu, "query_ldc1612_status oid=%c", oid=self.oid, cq=cmdqueue)
+ self.clock_updater.setup_query_command("query_ldc1612_status oid=%c",
+ oid=self.oid, cq=cmdqueue)
self.ldc1612_setup_home_cmd = self.mcu.lookup_command(
"ldc1612_setup_home oid=%c clock=%u threshold=%u"
" trsync_oid=%c trigger_reason=%c", cq=cmdqueue)
@@ -150,7 +146,7 @@ class LDC1612:
# Measurement decoding
def _extract_samples(self, raw_samples):
# Convert messages to samples
- samples = self.clock_updater.extract_samples(">I", raw_samples)
+ samples = self.clock_updater.extract_samples(raw_samples)
# Convert samples
freq_conv = float(LDC1612_FREQ) / (1<<28)
count = 0