Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
8.95k stars 5.16k forks source link

Refactor bulksensor timestamp calculation code #6566

Closed KevinOConnor closed 1 month ago

KevinOConnor commented 2 months ago

The code to calculate a timestamp for each sample in a bulk_sensor report is complex, and every sensor implementation was performing the calculation. This PR moves that calculation into the generic ChipClockUpdater class. This simplifies the sensor specific code.

@garethky - fyi.

-Kevin

garethky commented 2 months ago

This is exactly what I was hoping for!

KevinOConnor commented 2 months ago

I added an additional commit to this PR that further simplifies the bulk sensor implementations. As part of this additional commit, the ChipClockUpdater class has been renamed to FixedFreqReader (and the new class will handle the low-level queuing of the sensor_bulk_data messages).

-Kevin