Commands not appending
Posted: Thu Apr 09, 2015 7:19 pm
I am trying to run the makergear m2 printer with my own python code and using printcore for commands. So I connect to the printer and send code like this:
string = "G1 X%s Y%s F2000" % (nx, ny)
p.send(string)
string = "G1 Z%s F100" % height
p.send(string)
Pretty sloppy, but it gets the job done most of the time. I'm running into an issue though. I have a separate thread that runs through the above code, and I would expect that the commands get appended to the 'mainqueue' because I'm using the 'send' command and the printer is printing when the thread runs through my block of code. However; the printer makes it through about 3/4 of the commands I tell it to and then stops. When I debugged the program, it never appended the commands because it never thought the printer was in the process of printing, but the program goes through every step (presumably because I'm working through it more slowly?).
I have the code like I showed above running in a loop for a specified amount of points I want it to go to. If I put a time.sleep command in between the loops to let the printer 'catch up' to the code, things work well. So my question is how do I make the commands append to the queue?
Hope this wasn't too confusing!
string = "G1 X%s Y%s F2000" % (nx, ny)
p.send(string)
string = "G1 Z%s F100" % height
p.send(string)
Pretty sloppy, but it gets the job done most of the time. I'm running into an issue though. I have a separate thread that runs through the above code, and I would expect that the commands get appended to the 'mainqueue' because I'm using the 'send' command and the printer is printing when the thread runs through my block of code. However; the printer makes it through about 3/4 of the commands I tell it to and then stops. When I debugged the program, it never appended the commands because it never thought the printer was in the process of printing, but the program goes through every step (presumably because I'm working through it more slowly?).
I have the code like I showed above running in a loop for a specified amount of points I want it to go to. If I put a time.sleep command in between the loops to let the printer 'catch up' to the code, things work well. So my question is how do I make the commands append to the queue?
Hope this wasn't too confusing!