aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/adxl345.py
Commit message (Collapse)AuthorAgeFilesLines
* Isort all klippy codeTomasz Kramkowski2025-08-151-2/+7
|
* Run black on all first party python codeTomasz Kramkowski2025-08-061-64/+140
|
* adxl345: Allow read and write 127 register addressMRX80242025-04-031-2/+2
| | | | | | icm20948 accelerometer has an ACCEL_CONFIG register at address 127 Signed-off-by: Maksim Bolgov maksim8024@gmail.com
* adxl345: Fix read_axes_map() for non-adxl345 accelerometersKevin O'Connor2024-04-291-4/+4
| | | | | | | | | | | Commit 3f845019 unified the reading of the axes_map configuration variable, but broke the per-sensor scaling capabilities. Pass the scale parameters to read_axes_map() so that it can be implemented per-sensor. Reported by @Neko-vecter. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Rework ChipClockUpdater class into FixedFreqReaderKevin O'Connor2024-04-201-20/+10
| | | | | | | Move the sensor_bulk_data message queuing into the class, and then rename that class. This simplifies the users of the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Refactor ChipClockUpdater constructorKevin O'Connor2024-04-201-9/+5
| | | | | | | Build the clock_sync and struct.Struct() in the ChipClockUpdater constructor. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Move sample timestamp calculation to reusable codeKevin O'Connor2024-04-201-30/+18
| | | | | | | | | | Add a new extract_samples() method to the ChipClockUpdater class that calculates the sample timestamp for each sample in a list of bulk sensor reports. Update the adxl345 code to use that extract_samples() code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sensor_adxl345: No need to schedule start of bulk readingKevin O'Connor2024-01-191-10/+6
| | | | | | It's simpler and faster to enable the adxl345 in the python code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Don't assume chip_clock is zero on start of queriesKevin O'Connor2024-01-191-1/+1
| | | | | | | Send an explicit clock query in ChipClockUpdater to seed the initial clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sensor_bulk: New C file with helper code for sending bulk sensor measurementsKevin O'Connor2024-01-191-22/+6
| | | | | | | | | | Refactor the low-level "bulk sensor" management code in the mcu. This updates the sensor_adxl345.c, sensor_mpu9250.c, sensor_lis2dw.c, and sensor_angle.c code to use the same "bulk sensor" messages. All of these sensors will now send "sensor_bulk_data" and "sensor_bulk_status" messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sensor_adxl345: No need to send messages when stopping queriesKevin O'Connor2024-01-191-6/+2
| | | | | | Simplify the mcu code as any messages are ignored by the host anyway. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Simplify the registration of internal clients in BatchBulkHelperKevin O'Connor2023-12-261-20/+23
| | | | | | | | | | | | | | | Previously, the BatchBulkHelper class was designed primarily to register webhook clients, and internal clients used a wrapper class that emulated a webhooks client. Change BatchBulkHelper to support regular internal callbacks, and introduce a new BatchWebhooksClient class that can translate these internal callback to webhooks client messages. This makes it easier to register internal clients that can process the bulk messages every batch interval. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Rework APIDumpHelper() to BatchBulkHelper()Kevin O'Connor2023-12-261-18/+14
| | | | | | | The APIDumpHelper class is mainly intended to help process messages in batches. Rework the class methods to make that more clear. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: New add_mux_endpoint() helper function in APIDumpHelperKevin O'Connor2023-12-261-7/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Move APIDumpHelper() from motion_report.py to bulk_sensor.pyKevin O'Connor2023-12-261-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Add a read_axes_map() helper functionKevin O'Connor2023-12-261-6/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: No need to implement is_measuring()Kevin O'Connor2023-12-261-9/+0
| | | | | | | The APIDumpHelper class already ensures that the start/stop callbacks will only be called when needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Add new ChipClockUpdater helper classKevin O'Connor2023-12-261-30/+10
| | | | | | | All the accelerometers use a standard response for their query_status messages. Create a common helper class to process those responses. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Add new BulkDataQueue classKevin O'Connor2023-12-261-16/+5
| | | | | | | Move the bulk sample queue collection to a new helper class in bulk_sensor.py. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: New file with helper code for reading bulk sensorsKevin O'Connor2023-12-261-51/+6
| | | | | | | Move the ClockSyncRegression class from adxl345.py to a new bulk_sensors.py file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Simplify sequence and limit_count upconversionKevin O'Connor2023-12-101-11/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Apply correct scaling for X,Y and Z axesDmitry Butyugin2022-10-251-3/+4
| | | | | | | | According to ADXL345/ADXL343 datasheets, at 3.3V supply voltage, which is most frequent in the various boards, the sensitivity of X and Y axes changes to 265 LSB/g from 256 LSB/g at 2.5V. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* mpu9250: Use adxl345.AccelCommandHelper directlyKevin O'Connor2022-06-201-17/+20
| | | | | | | | | The MPU9250CommandHelper() class is nearly a duplicate of ADXL345CommandHelper(). Rename ADXL345QueryHelper() to AccelCommandHelper and remove user facing references to "adxl345". Use it directly from mpu9250.py . Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mpu9250: Use adxl345.AccelQueryHelper directlyKevin O'Connor2022-06-201-2/+2
| | | | | | | | The MPU9250QueryHelper() class is a duplicate of ADXL345QueryHelper(). Rename ADXL345QueryHelper() to AccelQueryHelper() and use it directly from mpu9250.py . Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Renamed decode_samples and fixed/added checks on empty dataDmitry Butyugin2021-10-131-4/+27
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* adxl345: Expanded invalid adxl345 id messageDmitry Butyugin2021-10-061-2/+5
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* adxl345: Renamed debug commands to fix their parsing by KlipperDmitry Butyugin2021-10-061-10/+10
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* adxl345: Allow multiple simultaneous clientsKevin O'Connor2021-08-301-12/+1
| | | | | | | It is now possible to have multiple tools gathering adxl345 data at the same time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Change default chip name from "default" to "adxl345"Kevin O'Connor2021-08-301-8/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Compress each sample from 6 bytes to 5 bytesKevin O'Connor2021-08-301-15/+29
| | | | | | | Transmit data from mcu to host using 5 bytes per sample and up to 10 samples per message block. This improves bandwidth efficiency. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Implement timing via new adxl345_status messagesKevin O'Connor2021-08-301-78/+125
| | | | | | | | Query the adxl345 message counter every 100ms so that accurate timing can be obtained during measurements. This allows the adxl345 data to be exported with timestamps while captures are running. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Support querying accelerometer data from webhooks interfaceKevin O'Connor2021-08-301-63/+109
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Add new start_internal_client() function and use in callersKevin O'Connor2021-08-301-22/+36
| | | | | | | | Introduce a new start_internal_client() function and change all client code to use that instead of manually calling start_measurements() and finish_measurements(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Always initialize device on start_measurements() callKevin O'Connor2021-08-301-15/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Move g-code commands to new helper classKevin O'Connor2021-08-301-91/+79
| | | | | | | | | | Separate out the G-Code command handlers to a new ADXLCommandHelper() class. This helps separate the sensing code from the user interface code. Deprecate the RATE parameter of the ACCELEROMETER_MEASURE command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Use config.getlist() for axes_map config optionKevin O'Connor2021-08-211-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Use "clock" suffix instead of "time" in commandsKevin O'Connor2021-04-301-5/+5
| | | | | | The debugging code knows how to handle fields that end in "clock". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adxl345: Verify the register writes, added debug adxl345 commandsDmitry Butyugin2021-04-241-20/+75
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* adxl345: Add accelerometer chip name to the raw data file nameDmitry Butyugin2021-02-021-6/+9
| | | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* resonance_tester: Resonance testing and input shaper auto-calibration (#3381)Dmitry Butyugin2020-10-141-27/+73
| | | Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
* adxl345: Add support for adxl345 accelerometerKevin O'Connor2020-09-051-0/+225
Add support for taking measurements from an adxl345 accelerometer via SPI interface. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>