Robo3D / roboOctoprint

Octoprint tailored for Robo printers.
GNU Affero General Public License v3.0
2 stars 4 forks source link

[Bug] Canceling during start gcode will cause a bed crash #14

Closed Ximidar closed 6 years ago

Ximidar commented 6 years ago

Canceling in the middle of start GCODE causes octoprint to inject the Cancel GCODE commands into the buffer. This causes the printer to be set up incorrectly and results in a bed crash.

Changing monitoring state from 'Operational' to 'Printing'
Recv: echo:busy: processing
Changing monitoring state from 'Printing' to 'Operational'
Recv: echo:busy: processing
Recv: X:0.00 Y:197.00 Z:25.12 E:0.00 Count X:0 Y:15768 Z:20104
Recv: ok
Send: G28 Z0
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: ok
Send: G90
Recv: ok
Send: G92 E0
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: ok
Send: M84
Recv: ok
Send: N0 M110 N0*125
Recv: ok
Send: M400
Recv: ok
Send: M220 S100
Recv: ok
Send: M220 S100
Recv: ok
Send: M221 S100
Recv: ok
Send: M106 S0
Recv: ok
Send: M221 S100
Recv: ok
Send: M106 S0
Recv: ok
Send: G21
Recv: ok
Send: G90
Recv: ok
Send: G92 E0
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: ok
Send: M114
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: ok
Send: M107
Recv: ok
Send: M104 S230
Recv: ok
Send: M140 S60
Recv: ok
Send: G36
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: Probe Bounce is Z: 9.17
Recv: Probe Offset is Z: -4.02
Recv: Position After Adjustment X:8.00 Y:0.00 Z:10.00 E:0.00 Count X:640 Y:0 Z:8002
Recv: echo:Settings Stored (498 bytes; crc 9391)
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: X:184.01 Y:156.00 Z:9.02 E:0.00 Count X:14727 Y:12486 Z:11378
Recv: ok
Send: G4 S2
Recv: ok
Send: G1 Z15 F300
Recv: ok
Send: G1 X10 Y1 F7200
Recv: ok
Send: M109 S230
Recv: ok
Send: M140 S60
############################################################
# Right here the Start Gcode is interrupted and the Cancel GCODE begins
###########################################################
Recv: ok
Send: M220 S100
Recv: ok
Send: M221 S100
Recv: ok
Send: M106 S0
Recv: ok
Send: M104 S0
Recv: ok
Send: M140 S0
Recv: ok
Send: M107
Recv: ok
Send: G91
Recv: ok
Send: G1 Z10
Recv: ok
Send: G90
Recv: ok
Send: G28 X0 Y0
###########################################################
# Right here the cancel command Homes the X and Y which destroys our leveling data
###########################################################
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: X:0.00 Y:197.00 Z:25.01 E:0.00 Count X:0 Y:15768 Z:20014
Recv: ok
Send: G28 Z0
##########################################################
# Right here the command to home the Z axis is given, but the printer does not move the bed down for some reason.
##########################################################
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Recv: echo:busy: processing
Changing monitoring state from 'Operational' to 'Printing'
Recv: echo:busy: processing
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: ok
Send: N1 G90*17
Recv: ok
Send: N2 G92 E0*69
Recv: X:0.00 Y:197.00 Z:260.00 E:0.00 Count X:0 Y:15768 Z:208062
Recv: ok
Send: N3 M84*28
Recv: ok
####################################################
# Right here the Start GCODE Resumes and runs into the bed
####################################################
Send: N4 G1 Z0.35*78
Recv: ok
Send: N5 G1 X190 E15.0 F500*65
Recv: ok
Send: N6 G1 Z15 F300*5
Recv: ok
Send: N7 G92 E0*64
Recv: X:190.00 Y:197.00 Z:15.00 E:0.00 Count X:0 Y:15768 Z:207449
Recv: ok
Send: N8 G1 F7200*67
Recv: ok
Send: N9 M105*46

Thanks @peries for getting the serial data.

Ximidar commented 6 years ago

Alright, this is still interrupting the previous script. I'll work on another solution @peries

Ximidar commented 6 years ago

The problem is that Octoprint is not deleting the Queue when firing off the cancel print script. I added this function:

def kill_all_remaining_tasks(self):
        while not self._command_queue.empty():
            item = self._command_queue.get()
            self._logger.info("Deleting Task: " + str(item))
            self._command_queue.task_done()

        self._command_queue.join()
        return

That seems to kill of any remaining tasks before firing the cancel GCODE script.

Ximidar commented 6 years ago

@peries I loaded the new octoprint on your machine. I'm not seeing the problem anymore, could you test and confirm that the problem is gone?

Ximidar commented 6 years ago

Fixed.