[ver] v1.1f update due to tweaks to interface from new parking override control. [new] Parking motion override control via new `M56 P0` and `M56 P1` command, which disables and enables the parking motion, respectively. Requires ENABLE_PARKING_OVERRIDE_CONTROL and PARKING_ENABLE enabled in config.h. Primarily for OEMs. [new] `M56` appears in the $G report when enabled. [new] Five new build info identification letters. Some were missing and a couple are new. Updated the CSV and documentation to reflect these new items. [new] Spindle enable pin configuration option to alter its behavior based on how certain lasers work. By default, Grbl treats the enable pin separately and leaves it on when S is 0. The new option turns the enable pin on and off with S>0 and S=0. This only is in effect when a user enables the USE_SPINDLE_DIR_AS_ENABLE_PIN option. [fix] M4 is now allowed to work when USE_SPINDLE_DIR_AS_ENABLE_PIN is enabled. Previously this was blocked and was problematic for laser folks using M4. [fix] Properly declared system variables as extern. Not sure how that went unnoticed or why it worked up until now but it has. [fix] EXTREMELY RARE. When AMASS is intentionally disabled and sent a motion command that is _one step_ in length, Grbl would not actuate the step due to numerical round-off. Applied a fix to prevent the round-off issue. [fix] Added a compile-time check for AMASS settings to make sure that the numerical round-off issue doesn’t effect it. This would only happen if someone set AMASS max levels to zero. It does not effect AMASS with its current defaults. [fix] Wrapped the mc_parking_motion() function in an ifdef for porting purposes. [fix] Fixed an issue when in inverse time mode and G0’s would require a F word. This was not correct. [fix] Added a note in the defaults.h file that MAX_TRAVEL values must be positive. Some users were setting this negative and it was causing issues.
		
			
				
	
	
	
		
			8.8 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	Grbl v1.1 Laser Mode
DISCLAIMER: Lasers are extremely dangerous devices. They can instantly cause fires and permanently damage your vision. Please read and understand all related documentation for your laser prior to using it. The Grbl project is not resposible for any damage or issues the firmware may cause, as defined by its GPL license.
Outlined in this document is how Grbl alters its running conditions for the new laser mode to provide both improved performance and attempting to enforce some basic user safety precautions.
Laser Mode Overview
The main difference between default Grbl operation and the laser mode is how the spindle/laser output is controlled with motions involved. Every time a spindle state M3 M4 M5 or spindle speed Sxxx is altered, Grbl would come to a stop, allow the spindle to change, and then continue. This is the normal operating procedure for a milling machine spindle. It needs time to change speeds.
However, if a laser starts and stops like this for every spindle change, this leads to scorching and uneven cutting/engraving! Grbl's new laser mode prevents unnecessary stops whenever possible and adds a new dynamic laser power mode that automagically scales power based on current speed related to programmed rate. So, you can get super clean and crisp results, even on a low-acceleration machine!
Enabling or disabling Grbl's laser mode is easy. Just alter the $32 Grbl setting.
- To Enable: Send Grbl a $32=1command.
- To Disable: Send Grbl a $32=0command.
WARNING: If you switch back from laser mode to a spindle for milling, you MUST disable laser mode by sending Grbl a $32=0 command. Milling operations require the spindle to get up to the right rpm to cut correctly and to be safe, helping to prevent a tool from breaking and flinging metal shards everywhere. With laser mode disabled, Grbl will briefly pause upon any spindle speed or state change to give the spindle a chance to get up to speed before continuing.
Laser Mode Operation
When laser mode is enabled, Grbl controls laser power by varying the 0-5V voltage from the spindle PWM D11 pin. 0V should be treated as disabled, while 5V is full power. Intermediate output voltages are also assumed to be linear with laser power, such that 2.5V is approximate 50% laser power. (A compile time option exists to shift this linear model to start at a non-zero voltage.)
By default, the spindle PWM frequency is 1kHz, which is the recommended PWM frequency for most current Grbl-compatible lasers system. If a different frequency is required, this may be altered by editing the cpu_map.h file.
The laser is enabled with the M3 spindle CW and M4 spindle CCW commands. These enable two different laser modes that are advantageous for different reasons each.
- 
M3Constant Laser Power Mode:- 
Constant laser power mode simply keeps the laser power as programmed, regardless if the machine is moving, accelerating, or stopped. This provides better control of the laser state. With a good G-code program, this can lead to more consistent cuts in more difficult materials. 
- 
For a clean cut and prevent scorching with M3constant power mode, it's a good idea to add lead-in and lead-out motions around the line you want to cut to give some space for the machine to accelerate and decelerate.
- 
NOTE: M3can be used to keep the laser on for focusing.
 
- 
- 
M4Dynamic Laser Power Mode:- 
Dynamic laser power mode will automatically adjust laser power based on the current speed relative to the programmed rate. It essentially ensures the amount of laser energy along a cut is consistent even though the machine may be stopped or actively accelerating. This is very useful for clean, precise engraving and cutting on simple materials across a large range of G-code generation methods by CAM programs. It will generally run faster and may be all you need to use. 
- 
Grbl calculates laser power based on the assumption that laser power is linear with speed and the material. Often, this is not the case. Lasers can cut differently at varying power levels and some materials may not cut well at a particular speed and/power. In short, this means that dynamic power mode may not work for all situations. Always do a test piece prior to using this with a new material or machine. 
- 
When not in motion, M4dynamic mode turns off the laser. It only turns on when the machine moves. This generally makes the laser safer to operate, because, unlikeM3, it will never burn a hole through your table, if you stop and forget to turnM3off in time.
 
- 
Describe below are the operational changes to Grbl when laser mode is enabled. Please read these carefully and understand them fully, because nothing is worse than a garage fire.
- 
Grbl will move continuously through consecutive motion commands when programmed with a new Sspindle speed (laser power). The spindle PWM pin will be updated instantaneously through each motion without stopping.- 
Example: The following set of g-code commands will not pause between each of them when laser mode is enabled, but will pause when disabled. G1 X10 S100 F50 G1 X0 S90 G2 X0 I5 S80
- 
Grbl will enforce a laser mode motion stop in a few circumstances. Primarily to ensure alterations stay in sync with the g-code program. - Any M3,M4,M5spindle state change.
- M3only and no motion programmed: A- Sspindle speed change.
- M3only and no motion programmed: A- G1 G2 G3laser powered state change to- G0 G80laser disabled state.
- NOTE: M4does not stop for anything but a spindle state change.
 
- Any 
 
- 
- 
The laser will only turn on when Grbl is in a G1,G2, orG3motion mode.- 
In other words, a G0rapid motion mode orG38.xprobe cycle will never turn on and always disable the laser, but will still update the running modal state. When changed to aG1 G2 G3modal state, Grbl will immediately enable the laser based on the current running state.
- 
Please remember that G0is the default motion mode upon power up and reset. You will need to alter it toG1,G2, orG3if you want to manually turn on your laser. This is strictly a safety measure.
- 
Example: G0 M3 S1000will not turn on the laser, but will set the laser modal state toM3enabled and power ofS1000. A followingG1command will then immediately be set toM3andS1000.
- 
To have the laser powered during a jog motion, first enable a valid motion mode and spindle state. The following jog motions will inherit and maintain the previous laser state. Please use with caution though. This ability is primarily to allow turning on the laser on a very low power to use the laser dot to jog and visibly locate the start position of a job. 
 
- 
- 
An S0spindle speed of zero will turn off the laser. When programmed with a valid laser motion, Grbl will disable the laser instantaneously without stopping for the duration of that motion and future motions until set greater than zero..- M3constant laser mode, this is a great way to turn off the laser power while continuously moving between a- G1laser motion and a- G0rapid motion without having to stop. Program a short- G1 S0motion right before the- G0motion and a- G1 Sxxxmotion is commanded right after to go back to cutting.
 
###CAM Developer Implementation Notes
TODO: Add some suggestions on how to write laser G-code for Grbl.
- 
When using M3constant laser power mode, try to avoid force-sync conditions during a job whenever possible. Basically every spindle speed change must be accompanied by a valid motion. Any motion is fine, since Grbl will automatically enable and disable the laser based on the modal state. Avoid aG0andG1command with no axis words in this mode and in the middle of a job.
- 
Ensure smooth motions throughout by turning the laser on and off without an M3 M4 M5spindle state command. There are two ways to do this:- 
Program a zero spindle speed S0:S0is valid G-code and turns off the spindle/laser without changing the spindle state. In laser mode, Grbl will smoothly move through consecutive motions and turn off the spindle. Conversely, you can turn on the laser with a spindle speedSgreater than zero. Remember thatM3constant power mode requires any spindle speedSchange to be programmed with a motion to allow continuous motion, whileM4dynamic power mode does not.
- 
Program an unpowered motion between powered motions: If you are traversing between parts of a raster job that don't need to have the laser powered, program a G0rapid between them.G0enforces the laser to be disabled automatically. The last spindle speed programmed doesn't change, so if a valid powered motion, like aG1is executed after, it'll immediately re-power the laser with the last programmed spindle speed when executing that motion.
 
-