How to record commands from internal ring buffer
davidson last edited by
I would like to capture all of the commands (such as G1 move commands etc.) that are sent to the 3D printer motors in the order they are executed. Normally this would be the same as the GCode file that is run on the printer if nothing else is done. However, if baby-steps are inserted by the printer operator, those are not present in the original GCode. I am wondering if there is a way, perhaps through an M-command or an HTTP request, to capture all the commands that are executed on the printer such that a reconstruction of the exact motions of a print can be created (including any baby-steps the operator performed during the recorded run). I understand Duet boards store the commands for the motors in an internal ring buffer before they are executed by the motors. I am wondering if there is a way to read that buffer and get the data back (either in a file or sent over HTTP)? If this is not possible, then it seems that it is necessary to write custom software that issues and records all commands. This would, in some ways, be redundant to the Duet web-interface but with the added feature to save all the commands issued. Does anyone on this forum have any know-how on this?
@davidson the buffer is not exposed to queries directly however if you are using the Duet in SBC mode with an attached SBC then every gcode sent to the printer via the SBC (i.e. from a gcode file, and from UI commands from the web interface) can be intercepted though an API.
@davidson you would need to modify the firmware to do that. Execution of each motor command is done in an interrupt handler, which is not an easy place to add logging code. However, once moves are finalised by the Prepare function, they are not touched until the interrupt service routine executes them (except in the case of power failure), so you could add your logging code there.