OctoprintKlipperPlugin icon indicating copy to clipboard operation
OctoprintKlipperPlugin copied to clipboard

Assisted Homing G-code is sent out of order

Open fritzw opened this issue 5 years ago • 5 comments

Sometimes the G-code commands are sent out of order. They should obviously be in the following order:

  1. Lift nozzle
  2. Move to new position
  3. Move nozzle down to calibration height

Usually this works, but sometimes the order of the three commands is mixed up as in the following annotated OctoPrint terminal dump:

# First calibration move: broken
Send: G1 X200 Y20 F1500
Recv: ok
Send: G1 Z8 F500
Recv: ok
Send: G1 Z3 F500
Recv: ok
Send: M105
Recv: ok T0:22.8 /0.0 B:21.3 /0.0
# Second calibration move: broken in a different way
Send: G1 Z8 F500
Recv: ok
Send: G1 Z3 F500
Recv: ok
Send: G1 X20 Y20 F1500
Recv: ok
Send: M105
Recv: ok T0:22.8 /0.0 B:21.2 /0.0
# Third calibration move: okay
Send: G1 Z8 F500
Recv: ok
Send: G1 X200 Y20 F1500
Send: G1 Z3 F500
Recv: ok
Recv: ok
Send: M105
Recv: ok T0:22.8 /0.0 B:21.3 /0.0

Wild idea: Maybe the 3 G-code commands are sent to OctoPrint using 3 different HTTP requests, which get reordered somewhere on the way -- either in JavaScript or by HAproxy or by the OctoPrint server. Is it possible to send all 3 commands using a single request?

Environment:

fritzw avatar Nov 08 '18 20:11 fritzw

@fritzw You are absolutely correct. This is a case of the commands being sent separately and occasionally being received out of order. I have modified the klipper_leveling.js so that the three Gcode commands are sent as an array of strings with one OctoPrintClient.control.sendGcode command instead of separately as individual strings with separate OctoPrintClient.control.sendGcode commands.

I've run dozens of repositioning commands and am no longer having this issue.

I've committed the changes.

jameseleach avatar Feb 09 '19 21:02 jameseleach

any news on when this will be available to update to? I am having this issue on 0.2.5 version

kdwebster26 avatar Feb 11 '19 19:02 kdwebster26

So, I'm a complete novice to Github, commits, forks, merging, javascript, etc., so I actually did it wrong. I've since forked this repository, committed the change to the fork and submitted a pull request (this is the RIGHT way to do this).

Hopefully this makes it easy for @mmone to process this fix.

jameseleach avatar Feb 11 '19 23:02 jameseleach

I've released this fix on a my repository and would be interested in feedback. It's available here: https://github.com/jameseleach/OctoprintKlipperPlugin/releases

jameseleach avatar Feb 13 '19 19:02 jameseleach

I've released this fix on a my repository and would be interested in feedback. It's available here: https://github.com/jameseleach/OctoprintKlipperPlugin/releases

thanks will give it a whirl!

edit: works like a charm! Thanks

kdwebster26 avatar Feb 14 '19 02:02 kdwebster26