Link command to plugin function

Hi people!

I have developed a plugin for Repeteir-Host, visualize a webcam integrated into my printer. So, I would like to invent a command, as “M789”, to take a photo through my plugin.

How can I link the command “M789” to execute a “function” from my plugin? In other words, I would like to: Repetier-Host read and execute the GCODE line per line; when its find the command “M789”, it stops the print, the plugin takes a photo, and it resumes the print.



  • That is only partly and not that way possible.

    Partly because not all connectors execute gcode in host. sd print and repetier-server prints do not do that so not possible in this case.

    For direct serial print you can not interfere gcodes but there are host commands. So make it a host command

    Then it will trigger the host command event. You can register your self in IHost:
    event FunctionGCode ExecuteHostCommandEvent;

    to that event. Syntax of taget function is:
    void ExecuteHostCommand(GCode code);

    Then do what you want. But that might have impact on quality if this takes too long. It prevents new commands from being send so make sure it is quick of just trigger snapshot in other thread. Also note that you will most likely not be able to trigger it at a special position. You need to add code for this in the gcode if required and then do not forget that firmware buffers moves so head will move at that moment if you do not add 40 times M400 to make it sync position. That is what we do in server when we make snapshots at a special position.
Sign In or Register to comment.