Hello all,
I'm wondering if Octorpint has a method to halt all operations meaning send gcode commands, process files and so meanwhile a subprocess finishes. Basically I'm looking to pause the print Job when an API trigger a Job directly or the User press the Print button directly from the GUI.
When an API or User send the direct print job the system does automatically:
-
octoprint.printer.standard.job - INFO - Print job selected.... data of the job....
-
Then "FileSelected" event is rasied -> octoprint.plugins - INFO - >>>>>> Event detected: FileSelected
-
Then Printer state changes to starting -> octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
-
Then Printer state changes to Printer -> octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
-
Finally the "PrintStarted" event is rasised -> octoprint.plugins - INFO - >>>>>> Event detected: PrintStarted
At step 3(State STARTING) of the above flow, the printer starts to parse the selected file and sends GCode commands. What I want here is to pause everything one step earlier, during the event "FileSelected" to make some subprocesses and when it finish allow to continnue the print.
I already have a file preprocessor to obtain the desired data before the file is saved in the system, thats one step of the plugin; but this data is going to be transmitted to the printer only if the Job starts. So if the Job starts I need to halt everything until the printer acknowledge the reception of this data. That is already working and in place, the issue is that while sending this data the printer start working and it start mixing File Gcodes and the Data Custom Gcodes making erratic responses from the printer.
To halt the processes I've tried with Locks, didn't worked. Pause and Resume the print programatically and sometimes works some other not, and thats why I'm looking for a reliable method to do everything before the actual job starts.