# Snapmaker 2 Dwell setting Gcode G4:Px and Laser Speed

**URL:** <https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248>\
**Category:** Snapmaker 2.0 (3-in-1)\
**Created:** [August 3, 2021, 8:08pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248 "2021-08-03T20:08:39Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![VaporPhoxxe](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@VaporPhoxxe](https://forum.snapmaker.com/u/VaporPhoxxe)\
**Post date:** [August 3, 2021, 8:08pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/1 "2021-08-03T20:08:39Z")

</div>

Snapmaker 2 A350 Gcode Dwell time.  
What is the default laser on dwell time if G4 Px is not used?  
Using Snapmaker Luban software there is a setting for this (G4 Px), 0.1-1000ms/dot.  
Gcode generated from Lightburn does not contain this setting and I didn’t know how this was handled by the controller.  
Also the Snapmaker 2 laser function operates extremely slow as compared to the Snapmaker Original using the same gcode file by a factor of almost 4:1.  
I am running direct USB to the machine(s), not “loading” the file. I also have the touchscreen disconnected(SM2).  
Why is the performance so slow comparatively?  
Shouldn’t the Snapmaker 2 perform the same if not better than the Snapmaker Original?

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [August 3, 2021, 8:15pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/2 "2021-08-03T20:15:11Z")

</div>

> [@VaporPhoxxe](#):
>
> What is the default laser on dwell time if G4 Px is not used?

The way the laser works is M3 turns it on and M5 turns it off. If you don’t specify a dwell then the delay would be instant if there’s no other code in the middle, like a slow movement.

> [@VaporPhoxxe](#):
>
> Gcode generated from Lightburn does not contain this setting

This has come up before, and you could post the gcode to confirm, but I think lightburn has a movement in between the M3 turn on and M5 turn off, which combined with the slow movement speed effects a dwell. Lightburn draws a “line” (very short) where Luban draws a point.

> [@VaporPhoxxe](#):
>
> Also the Snapmaker 2 laser function operates extremely slow as compared to the Snapmaker Original using the same gcode file by a factor of almost 4:1.

In what way, cuts slower given same power settings? Or moves slower?

> [@VaporPhoxxe](#):
>
> I am running direct USB to the machine(s), not “loading” the file. I also have the touchscreen disconnected(SM2).

Running directly from Lightburn? Should work fine.

---

<div class="post-metadata">

**Author:** ![VaporPhoxxe](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@VaporPhoxxe](https://forum.snapmaker.com/u/VaporPhoxxe)\
**Post date:** [August 3, 2021, 8:24pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/3 "2021-08-03T20:24:15Z")

</div>

Slower as in when engraving a 100mm x 100mm image, the Snapmaker 2 will take 3 to 4 times longer to complete the exact same job as the Snapmaker Original, Snapmaker 2 with much shuddering and stuttering whereas the Snapmaker Original operates very smoothly and much faster.

Facebook link: [Facebook](https://www.facebook.com/100001836211077/videos/5394416730629481/)

LUBAN  
; G-code for laser engraving  
; Generated by Snapmaker Luban  
; Sun Aug 01 2021 11:53:27

G90  
G21  
; G-code START \<\<\<  
M106 P0 S255  
G1 F3000  
G1 X3.30 Y94.90  
M3 P35 S89  
G4 P010

LIGHTBURN  
; LightBurn 0.9.24  
; SnapMaker device profile, absolute coords  
; Bounds: X4.99 Y3.82 to X94.85 Y96.26  
G21  
G90  
; Image @ 3000 mm/min, 35% power  
M107  
M05  
G0X4.99 Y96.26 F2000  
; Layer C00  
G91  
M03 P0 S0  
G1Y-1.25 F3000  
M03 P35 S88.9

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [August 3, 2021, 8:34pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/4 "2021-08-03T20:34:11Z")

</div>

The lightburn code you posted is mostly the header, the very last line is where the laser turns on. The following lines would be the ones of interest, please post those.

---

<div class="post-metadata">

**Author:** ![VaporPhoxxe](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@VaporPhoxxe](https://forum.snapmaker.com/u/VaporPhoxxe)\
**Post date:** [August 3, 2021, 8:47pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/5 "2021-08-03T20:47:10Z")

</div>

Not the entire Gcode, but the beginning an end pieces.

; LightBurn 0.9.24  
; SnapMaker device profile, absolute coords  
; Bounds: X4.99 Y3.82 to X94.85 Y96.26  
G21  
G90  
; Image @ 3000 mm/min, 35% power  
M107  
M05  
G0X4.99 Y96.26 F2000  
; Layer C00  
G91  
M03 P0 S0  
G1Y-1.25 F3000  
M03 P35 S88.9  
G1Y-2.48  
M03 P0 S0  
G1Y-0.08  
M03 P35 S88.9  
G1Y-0.16  
M03 P0 S0  
G1Y-0.08  
M03 P35 S88.9  
G1Y-0.24  
M03 P0 S0  
G1Y-0.08  
M03 P35 S88.9  
G1Y-0.16  
M03 P0 S0  
G1Y-0.08  
M03 P35 S88.9  
G1Y-0.16  
M03 P0 S0  
G1Y-0.08  
.  
.  
.  
.  
M03 P0 S0  
G1Y2.72  
M03 P35 S88.9  
G1Y0.08  
M03 P0 S0  
G1Y0.32  
M03 P35 S88.9  
G1Y0.08  
M03 P0 S0  
G1Y1.25  
G90  
M107  
M05  
G90  
; return to user-defined finish pos  
G0 X0 Y0 F2000

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [August 3, 2021, 8:54pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/6 "2021-08-03T20:54:31Z")

</div>

> [@VaporPhoxxe](#):
>
> M03 P35 S88.9; Turn on  
> G1Y-0.16 ; Move / essentially a dwell  
> M03 P0 S0 ; Turn off

That 0.16mm move, at 3000mm/min, will take ~3ms, effectively behaving as a dwell. In reality because of the limited acceleration and deceleration the machine will not reach 3000mm/min, and will take quite a lot longer than 3ms.

> [@VaporPhoxxe](#):
>
> with much shuddering

Is the shuddering due to the many short movements combined with high acceleration? You could lower the acceleration temporarily as a test with `M204 P500 T500` issued via the terminal. Without saving that parameter will be reset after a power cycle of the machine. The default is 3000mm/s^2, much higher. Note, this will increase job time as each travel will take longer, typically you want acceleration as fast as possible while having good quality results.

---

<div class="post-metadata">

**Author:** ![VaporPhoxxe](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@VaporPhoxxe](https://forum.snapmaker.com/u/VaporPhoxxe)\
**Post date:** [August 3, 2021, 9:16pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/7 "2021-08-03T21:16:50Z")

</div>

The shuddering/chugging is still quite apparent even when running at 1000mm/min., with no appreciable difference in the time it takes to complete the job. Not to mention the difference in speed between the two machines.  
Did you see the video clip in the link to the Facebook post and see the difference in machine performance when compared side by side?

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [August 3, 2021, 9:17pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/8 "2021-08-03T21:17:58Z")

</div>

I did not.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/snapmaker/original/2X/4/4ada5d09f15943d70572d8ff25416ae8610e3bc1.png)

You’ll note the difference between travel speed and acceleration. I was not referring to travel speed, as changing that doesn’t affect maximum acceleration.

As the machine is limited in acceleration, the short fraction-of-a-millimeter moves are all limited by acceleration and the machine will never reach the commanded travel speed. I would expect 1000mm/min and 3000mm/min to take close to the same time to complete given the job being run.

Some quick maths finds that the required machine acceleration to achieve 3000mm/min velocity over half of the 0.16mm travel distance would be 15,625mm/s^2, far in excess of the default limit of 3,000mm/s^2. The actual achievable velocity in that case would be only 1300mm/min.

Some moves being commanded are even smaller at only 0.08mm, corresponding to a maximum velocity of 930mm/min. Hence, why at 1000mm/min you did not notice a change in job completion time.

---

<div class="post-metadata">

**Author:** ![VaporPhoxxe](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@VaporPhoxxe](https://forum.snapmaker.com/u/VaporPhoxxe)\
**Post date:** [August 3, 2021, 10:22pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/9 "2021-08-03T22:22:24Z")

</div>

The video and my post regarding this issue is in **Official Snapmaker Owners** group on facebook, just search for posts by me, Alan Fox, posted April 19th.  
Also in gathering information from other groups the following math should give me the approximate time to complete a job:  
If running a 100mm x 100mm tile at 318 dpi and 1200 mm/min for example… 318dpi is 12 lines per mm so 12 lines X 100mm = 1200mm per mm and you are running at 1200mm/min so 1mm should be equal to 1min and total tile should about 100 mins or 1hour 40mins.  
And like I mentioned, it’s approximate but in line with the performance of the Snapmaker Original, certainly not the Snapmaker 2 which is taking 6 to as much as 11 hours for the same size work piece and same file.  
I’m not arguing with you, you obviously have a much deeper understanding of the workings of these things, but my comparisons of speed and performance clearly show that there is something definitely lacking or seriously wrong going on here and I’m just trying to get it sorted out. Maybe it’s a design flaw or bad controller, I just don’t know.

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [August 3, 2021, 10:43pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/10 "2021-08-03T22:43:07Z")

</div>

I don’t have a facebook account, sorry.

The method of estimation time to completion as linear\_distance/travel\_speed is the naive calculation assuming the movement is not acceleration limited. In this case the movement is acceleration limited and that is not a good approximation to use as it will give a very wrong estimate.

> [@VaporPhoxxe](#):
>
> And like I mentioned, it’s approximate but in line with the performance of the Snapmaker Original, certainly not the Snapmaker 2 which is taking 6 to as much as 11 hours for the same size work piece and same file.

I suspect the movement on the original was not acceleration limited in the same way, then. I don’t know what size machine you have, but physically larger machines must accelerate slower given a similar stiffness, as it’s limited by the amount of force the linear modules can apply to the moving components.

> [@VaporPhoxxe](#):
>
> I’m not arguing with you

Not taken as such.

> [@VaporPhoxxe](#):
>
> Maybe it’s a design flaw or bad controller, I just don’t know.

You don’t have a bad controller.

A design oversight is more likely, as the behavior you want is called “laser inline power” and is something I integrated into my firmware as that functionality was not available when the snapmaker began writing their firmware. Someday I’ll get around to publishing that and suggesting it be integrated into the main firmware release.

There’s additional significant sources of delay that are yet more advanced that I haven’t yet mentioned, and I believe your numbers of 3-6x slower to be expected.

The reason it’s so shuddery is because after each movement the machine comes to a complete stop. So: move 0.08mm, stop, move another 0.08mm, stop. The “inline power” functionality allows the laser to turn on and off without the machine stopping.

If you’re interested I do have the firmware functional, I have been using it for ~6 months now, I could send it to you via a private message. It requires creating a new machine in Lightburn based on “Marlin” and not “Snapmaker” and then enabling this function:

 ![071bf79cdff86e9b808cd800046ccd466211f7ba](https://us1.discourse-cdn.com/flex022/uploads/snapmaker/original/2X/0/071bf79cdff86e9b808cd800046ccd466211f7ba.png)

---

<div class="post-metadata">

**Author:** ![VaporPhoxxe](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@VaporPhoxxe](https://forum.snapmaker.com/u/VaporPhoxxe)\
**Post date:** [August 4, 2021, 12:14am UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/11 "2021-08-04T00:14:34Z")

</div>

Wow!  
Very enlightening!  
And yes, I would absolutely be interested in your firmware.

---

<div class="post-metadata">

**Author:** ![Poedelie](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@Poedelie](https://forum.snapmaker.com/u/Poedelie)\
**Post date:** [August 13, 2021, 9:28am UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/12 "2021-08-13T09:28:52Z")

</div>

This thread is really interesting, would you mind sending me your custom firmware as well? Is your code published on GitHub somewhere?

---

<div class="post-metadata">

**Author:** ![gpt1plon](https://avatars.discourse-cdn.com/v4/letter/g/8e7dd6/32.png) [@gpt1plon](https://forum.snapmaker.com/u/gpt1plon)\
**Post date:** [October 28, 2021, 9:32pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/13 "2021-10-28T21:32:03Z")

</div>

Hello,  
Here we go, custom firware, always the way to go!  
I have been following with interest the discussion from Alan Fox on facebook about the Norton White Tile method and also doing it. I must admit it takes for ever to engrave the tiles while other laser take 3x less time.

Looks like snapmaker is not taking this very seriously and we need to really on people developing custom firmware to resolve issues !

@Edwin , any news on that issue?  
Thanks

---

<div class="post-metadata">

**Author:** ![brent113](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/brent113/32/11114_2.png) [@brent113](https://forum.snapmaker.com/u/brent113)\
**Post date:** [October 28, 2021, 9:37pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/14 "2021-10-28T21:37:32Z")

</div>

I should add I submitted the PR request, hopefully it’s integrated soon:

> <https://github.com/Snapmaker/Snapmaker2-Controller/pull/153>
>
> This pull request adds a new feature: Laser Inline Power. This greatly enhances …job completion time and quality for many types of jobs.
> 
> This pull request implements a feature from Marlin that was added to Marlin after Snapmaker forked. This addition is based on the work contained in this pull: https://github.com/MarlinFirmware/Marlin/pull/15335. Inline laser power is also a standard feature on GRBL firmware, another common laser cutter firmware.
> 
> \### Summary of New Features
> \- Enables optional use of inline power control by using a new I parameter on \`M3\`-\`M5\` in the form of \`M3 Pxx I\` (https://marlinfw.org/docs/gcode/M003.html)
> \- Increases compatibility by adding traditional power specified with the 0-255 S parameter in form of \`M3 Sxx\`
> \- Adds optional new parameter \`Sxx\` and \`Pxx\` to \`G0\`-\`G3\` movement commands to move with inline laser power specified in the form of \`G1 Yxx Pxx\`. (https://marlinfw.org/docs/gcode/G000-G001.html)
> \- A \`G28\` home command disables the laser for enhanced safety.
> \- Increases compatibility by adding traditional power specified with the 0-255 S parameter in form of \`M3 Sxx\`
> 
> \### Additional Changes
> \- A \`G28\` home command disables the laser for enhanced safety.
> \- Modified how the fan and power limits are controlled in \`toolhead\_laser.cpp\` to accommodate calls from within the stepper ISR by not triggering CAN communications within the ISR.
> \- Removes handler for unsupported air assist / coolant controls so that they return the standard unknown gcode handler so as to properly communicate to controlling software that air assist is unavailable.
> 
> When not enabling laser inline power the machine behaves the same as previous firmware, with the exception of the change made to \`G28\`.
> 
> \### Description of Laser Inline Power Behavior
> When enabled by using the \`I\` parameter laser control is moved into the planner and motion control modules to allow for smooth power changes.
> 
> \*\*First a review of previous laser power control:\*\*
> The \`M3\` command first calls \`planner.synchronize();\` which waits for all motion to complete. The machine decelerates and comes to a stop, then the laser power is changes, and then the machine accelerates to continue. Each deceleration/acceleration results in additional dwell that affects the accuracy of dwell timing, resulting in a slightly darker than intended laser burn. This is most pronounced when using continuously variable power in software like Lightburn (Lightburn calls this 'grayscale' mode, which is not dithered).
> 
> \*\*New behavior of laser inline power\*\*
> Control of the laser power has been moved into the planner and stepper ISR. The planner adds the requested power onto the motion block. As the blocks are executed in the stepper ISR the laser power is scaled with acceleration trapezoid to eliminate darkening caused by the machine moving at less than the commanded speed with the full laser power.
> !\[image\](https://user-images.githubusercontent.com/7025732/137256766-a3f7e4df-7c1a-4672-8c68-fe8c84da3362.png)
> 
> As the laser power is being controlled via the planner the \`planner.synchronize();\` is not necessary which allows the machine to use optimized exit and entry velocities similar to 3D printing.
> 
> \*\*Comparison between old and new behavior\*\*
> Here is a sample from a job using grayscale mode from Lightburn without laser inline power. Each concentric circle on the left and vertical line on the right is where the laser power changed, resulting in a pause as the motion came to a stop and resumed.
> !\[image\](https://user-images.githubusercontent.com/7025732/137254443-7a224ea0-2bff-4c1b-a137-e5d9faa247bc.png)
> 
> By enabling laser inline power and eliminating harmful motion pauses the job completes approximately 2x faster and is of higher quality.
> !\[image\](https://user-images.githubusercontent.com/7025732/137254610-1fed1b8b-1417-4d60-8306-83c929706be4.png)
> 
> When Lightburn or other software is configured to use inline power it generates gcode similar to the following:
> \`\`\`text
> G1 X0.3 S131.3
> G1 X0.7 S130.1
> G1 X0.1 S129.5
> G1 X0.8 S128.9
> \`\`\`

---

<div class="post-metadata">

**Author:** ![Artezio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.snapmaker.com/artezio/32/15834_2.png) [@Artezio](https://forum.snapmaker.com/u/Artezio)\
**Post date:** [October 29, 2021, 12:45am UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/15 "2021-10-29T00:45:41Z")

</div>

@gpt1plon Edwin is no longer with Snapmaker.

---

<div class="post-metadata">

**Author:** ![madeira21](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@madeira21](https://forum.snapmaker.com/u/madeira21)\
**Post date:** [November 7, 2021, 10:52am UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/16 "2021-11-07T10:52:31Z")

</div>

hello i am new with my sanpmaker A350 and would like to improve the laser engraving time, could you please share your firmware, thanks

---

<div class="post-metadata">

**Author:** ![bertbee](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bertbee](https://forum.snapmaker.com/u/bertbee)\
**Post date:** [November 20, 2021, 3:17pm UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/17 "2021-11-20T15:17:49Z")

</div>

@brent113 how can I lay my hands on this firmware of yours to speed up my laser times and add inline laser power control please?

---

<div class="post-metadata">

**Author:** ![brucejn](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@brucejn](https://forum.snapmaker.com/u/brucejn)\
**Post date:** [July 26, 2022, 11:43am UTC](https://forum.snapmaker.com/t/snapmaker-2-dwell-setting-gcode-g4-px-and-laser-speed/20248/18 "2022-07-26T11:43:34Z")

</div>

Thanks for your contribution @brent113  
Is there anyway I can get hold of this firmware as well, being successfully printing NWT and now have jumped to Canvas but the slow engraving times are killing me ☹

Have looked up GitHub for the firmware but wanted to check if you have it compiled as I’m running a mac ☹

Just few questions on the steps:  
After installing this:

> **[GitHub - Snapmaker/Snapmaker2-Controller: Snapmaker2-Controller is the...](https://github.com/Snapmaker/Snapmaker2-Controller)**
>
> Snapmaker2-Controller is the firmware for Snapmaker 2.0 3-in-1 3D Printers. - GitHub - Snapmaker/Snapmaker2-Controller: Snapmaker2-Controller is the firmware for Snapmaker 2.0 3-in-1 3D Printers.

Then on Lightburn to use:  
Create a new machine in Lightburn based on “Marlin” and not “Snapmaker” and then enable the “inline” function.

and then after that to use this fix:

> **[GitHub - nivekmai/Fix-Lightburn-for-Snapmaker-2.0: A set of scripts to fix...](https://github.com/nivekmai/Fix-Lightburn-for-Snapmaker-2.0)**
>
> A set of scripts to fix lightburn inline power files for Snapmaker 2.0 - GitHub - nivekmai/Fix-Lightburn-for-Snapmaker-2.0: A set of scripts to fix lightburn inline power files for Snapmaker 2.0

Please advice. TIA
