aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/bulk_sensor.py
Commit message (Collapse)AuthorAgeFilesLines
* bulk_sensor: Rename BulkDataQueue methodsKevin O'Connor2024-04-201-6/+6
| | | | | | | | Rename pull_samples() to pull_queue() and rename clear_sample() to clear_queue(). This avoids confusion between the queue of response messages and the larger list of samples stored within those messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Rework ChipClockUpdater class into FixedFreqReaderKevin O'Connor2024-04-201-13/+26
| | | | | | | 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/+11
| | | | | | | 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-1/+26
| | | | | | | | | | 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>
* bulk_sensor: Don't assume chip_clock is zero on start of queriesKevin O'Connor2024-01-191-6/+10
| | | | | | | 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-14/+20
| | | | | | | | | | 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>
* bulk_sensor: Fix missing logging importKevin O'Connor2023-12-281-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Add some module level documentationKevin O'Connor2023-12-261-0/+31
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Simplify the registration of internal clients in BatchBulkHelperKevin O'Connor2023-12-261-38/+28
| | | | | | | | | | | | | | | 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-25/+28
| | | | | | | 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: Minor code reorg to _stop() in APIDumpHelper()Kevin O'Connor2023-12-261-19/+19
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: New add_mux_endpoint() helper function in APIDumpHelperKevin O'Connor2023-12-261-10/+19
| | | | 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-0/+93
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* bulk_sensor: Add new ChipClockUpdater helper classKevin O'Connor2023-12-261-0/+48
| | | | | | | 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-0/+20
| | | | | | | 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-0/+53
Move the ClockSyncRegression class from adxl345.py to a new bulk_sensors.py file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>