Stuttering on Job Start

Lightburn 0.9.16 on Windows 10, connecting to a K40 with Mini Gerbil over about 4 feet of USB, not hubs. No issues present with vector cuts or engraves (fill, outline, and both). Steppers and gantry are keeping steps and run smooth.

I am experiencing stuttering issues at the beginning of any job engraving images. In one case, the stuttering lasted for the first 50 seconds and then self-resolved. I experimented with adding a dwell command in the G code but that only delayed the job. A 50 second delay would be followed by a 50 second stutter. I exported the G Code and ran it in CNCJS without problem.

I saw this post and tried the suggestion of switching between tabs during the job. If I started a job and immediately switched tabs a few times between console, laser, and move, the stuttering would self resolve and the remainder of the job would function perfectly.

Let me know if I can provide any other information helpful in tracking this issue down.

This is not correct and if anyone “experiences” this it is clearly just a coincidence. Who would ever release software that would behave in this manner? We definitely would not. We design and develop much better code than this idea would suggest.

This isn’t uncommon if you’re trying to go too fast, but “too fast” depends on the firmware being used.

While I can certainly appreciate this idea, it doesn’t change the fact that I continue to experience this stuttering at the beginning of an image engrave, even at speeds as low as 50mm/s. The stutter is almost imperceptible at that speed, but still present. I will also mention that this stutter is much different from that of a stepper being pushed past the mechanical limit of the gantry.

I have also double checked - exporting the G Code from Lightburn and running it in a different G Code sender works perfectly. Same computer, same USB com port, same mini gerbil, same G Code, same machine settings, different results. Let me know if I have missed something but I fail to see how the same code can function so differently between Lightburn sending to the machine and a different G Code sender.

Windows itself has a weird under-the-hood behavior that will briefly increase the scheduling priority of a process if the user is clicking on it, in an attempt to make the active process more responsive, so there is at least some logic behind the “clicking makes it faster” idea. That said, both the GCode system thread and the serial communication thread have high priority, and should not be getting starved.

So, it’s not infeasible - I’ll look into it.

That said LightBurn sends GCode without even waiting for a response from the target controller. I wonder if I’m overloading it as opposed to staving it.

1 Like

I’ve investigated this a bunch, and it looks like it has something to do with Windows dynamic thread scheduling, but even that isn’t clear - it could also be related to USB packet buffering. If you click ‘Start’, then just hover the mouse back and forth across the buttons in the Laser window, there is no stuttering. If you click start and just leave it, it stutters.

It resolves itself in about 5 to 10 seconds, but it looks like when the job is first started, the communication thread is sending bursts of data, the controller is consuming all of it, and stalling while waiting for more to arrive. I’ve gone so far as a complete rewrite of the serial communication code, from scratch, directly talking to Windows, thinking that it might’ve been caused by the framework we use, and it does the same thing, so I’m at a loss as to what’s happening here. There is nothing in the code that behaves any differently 10 seconds after you click start, so I’m at a loss to explain what’s going on.

I’ve managed to improve it somewhat by querying for the controller’s buffer size when we first connect, and sending more data if the controller can accept it, which all but eliminates the stutter on the Ortur machine I have here, and should do the same for the Gerbil.

1 Like

In a conversation with another user here about this issue, someone mentioned a weird behavior of Chrome - if viewing flash or multimedia, system performance improved. I did some searching and found a solution to the stutter problem - it will be in the next release.

1 Like

Well, I humbley stand corrected. Microsoft would release software that would behave in this manner. :crazy_face:

1 Like

Can you tell me which release this will be in? I looked for release notes and could not see this fix mentioned. @LightBurn

This was released with 0.9.17