I’m trying to make it possible to extract trapq data with
[motion_report] in batch mode.
This would be helpful to simulate prints on printer that we don’t own, or to generate ground truth for testing tools like klipper_estimator.
My plan is to use the existing webhooks api of
motion_report and the
data_logger.py script. This is simpler than rewriting another serializer just for the debug mode.
There is two issues that need to be overcome:
- In batch mode, Klipper doesn’t run the webhooks server. Also, it doesn’t wait for
data_logger.pyto subscribe. This can easily be resolved.
- The trapq and stepper command histories are pulled from
motion_reportat regular intervals when a timer fires. In batch mode, the print_time goes by a lot faster than event_time. The histories buffers wraps around in the
API_UPDATE_INTERVALsince there is too many of moves simulated during this period.
I managed to pull a complete trapq trace (with a sample here) by using a very low
However this is incredibly hacky, as the timer is basically running against the CPU filling the buffers.
Does anyone have a better solution?