Merge tag 'v1.1f.20170131'

This commit is contained in:
Todd Fleming 2017-03-11 10:09:48 -05:00
commit ee65b9a7e2
19 changed files with 318 additions and 102 deletions

View File

@ -8,9 +8,14 @@
"H","Homing single axis commands","Enabled" "H","Homing single axis commands","Enabled"
"L","Two limit switches on axis","Enabled" "L","Two limit switches on axis","Enabled"
"A","Allow feed rate overrides in probe cycles","Enabled" "A","Allow feed rate overrides in probe cycles","Enabled"
"D","Use spindle direction as enable pin","Enabled"
"0","Spindle enable off when speed is zero","Enabled"
"S","Software limit pin debouncing","Enabled"
"R","Parking override control","Enabled"
"*","Restore all EEPROM command","Disabled" "*","Restore all EEPROM command","Disabled"
"$","Restore EEPROM `$` settings command","Disabled" "$","Restore EEPROM `$` settings command","Disabled"
"#","Restore EEPROM parameter data command","Disabled" "#","Restore EEPROM parameter data command","Disabled"
"I","Build info write user string command","Disabled" "I","Build info write user string command","Disabled"
"E","Force sync upon EEPROM write","Disabled" "E","Force sync upon EEPROM write","Disabled"
"W","Force sync upon work coordinate offset change","Disabled" "W","Force sync upon work coordinate offset change","Disabled"
"L","Homing initialization auto-lock","Disabled"
1 OPT: Code Build-Option Description State
8 H Homing single axis commands Enabled
9 L Two limit switches on axis Enabled
10 A Allow feed rate overrides in probe cycles Enabled
11 D Use spindle direction as enable pin Enabled
12 0 Spindle enable off when speed is zero Enabled
13 S Software limit pin debouncing Enabled
14 R Parking override control Enabled
15 * Restore all EEPROM command Disabled
16 $ Restore EEPROM `$` settings command Disabled
17 # Restore EEPROM parameter data command Disabled
18 I Build info write user string command Disabled
19 E Force sync upon EEPROM write Disabled
20 W Force sync upon work coordinate offset change Disabled
21 L Homing initialization auto-lock Disabled

View File

@ -1,3 +1,86 @@
----------------
Date: 2017-01-29
Author: Sonny Jeon
Subject: Tidying up parking override control implementation
[new] Added a default configuration for the parking override control
upon a reset or power-up. By default, parking is enabled, but this may
be disabled via a config.h option.
[fix] Parking override control should be checking if the command word
is passed, rather than the value.
----------------
Date: 2017-01-28
Author: chamnit
Subject: v1.1f. Parking override control. Spindle enable pin option.
[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 doesnt 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 G0s 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.
----------------
Date: 2017-01-14
Author: Sonny Jeon
Subject: Tool number bug fix. Updated documentation.
- [fix] Tool numbers were not being tracked and reported correctly. Now
shows tool number values in $G when programmed.
- [fix] Added a max tool number value check to the g-code parser.
- [doc] Added a new error code for invalid tool number. Updated CSV and
interface documents.
- [doc] Added a implementation note for buffer state in status reports.
Dont rely on this data for streaming.
---------------- ----------------
Date: 2017-01-03 Date: 2017-01-03
Author: Sonny Jeon Author: Sonny Jeon

View File

@ -110,3 +110,5 @@ On a final note, these interface tweaks came about out of necessity, because mor
- Laser mode `$` setting - When enabled, laser mode will move through consecutive G1, G2, and G3 motion commands that have different spindle speed values without stopping. A spindle speed of zero will disable the laser without stopping as well. However, when spindle states change, like M3 or M5, stops are still enforced. - Laser mode `$` setting - When enabled, laser mode will move through consecutive G1, G2, and G3 motion commands that have different spindle speed values without stopping. A spindle speed of zero will disable the laser without stopping as well. However, when spindle states change, like M3 or M5, stops are still enforced.
- NOTE: Parking motions are automatically disabled when laser mode is enabled to prevent burning. - NOTE: Parking motions are automatically disabled when laser mode is enabled to prevent burning.
- `G56 P1` and `G56 P0` - When enabled in config.h with Grbl's parking motion, these commands enable and disable, respectively, the parking motion. Like all override control commands, these commands are modal and are part of the g-code stream.

View File

@ -64,7 +64,7 @@ This command prints all of the active gcode modes in Grbl's G-code parser. When
These active modes determine how the next G-code block or command will be interpreted by Grbl's G-code parser. For those new to G-code and CNC machining, modes sets the parser into a particular state so you don't have to constantly tell the parser how to parse it. These modes are organized into sets called "modal groups" that cannot be logically active at the same time. For example, the units modal group sets whether your G-code program is interpreted in inches or in millimeters. These active modes determine how the next G-code block or command will be interpreted by Grbl's G-code parser. For those new to G-code and CNC machining, modes sets the parser into a particular state so you don't have to constantly tell the parser how to parse it. These modes are organized into sets called "modal groups" that cannot be logically active at the same time. For example, the units modal group sets whether your G-code program is interpreted in inches or in millimeters.
A short list of the modal groups, supported by Grbl, is shown below, but more complete and detailed descriptions can be found at LinuxCNC's [website](http://www.linuxcnc.org/docs/2.4/html/gcode_overview.html#sec:Modal-Groups). The G-code commands in **bold** indicate the default modes upon powering-up Grbl or resetting it. A short list of the modal groups, supported by Grbl, is shown below, but more complete and detailed descriptions can be found at LinuxCNC's [website](http://www.linuxcnc.org/docs/2.4/html/gcode_overview.html#sec:Modal-Groups). The G-code commands in **bold** indicate the default modes upon powering-up Grbl or resetting it. The commands in _italics_ indicate a special Grbl-only command.
| Modal Group Meaning | Member Words | | Modal Group Meaning | Member Words |
|:----:|:----:| |:----:|:----:|
@ -80,6 +80,9 @@ A short list of the modal groups, supported by Grbl, is shown below, but more co
|Program Mode | **M0**, M1, M2, M30| |Program Mode | **M0**, M1, M2, M30|
|Spindle State |M3, M4, **M5**| |Spindle State |M3, M4, **M5**|
|Coolant State | M7, M8, **M9** | |Coolant State | M7, M8, **M9** |
|Override Control | _M56_ |
Grbl supports a special _M56_ override control command, where this enables and disables Grbl's parking motion when a `P1` or a `P0` is passed with `M56`, respectively. This command is only available when both parking and this particular option is enabled.
In addition to the G-code parser modes, Grbl will report the active `T` tool number, `S` spindle speed, and `F` feed rate, which all default to 0 upon a reset. For those that are curious, these don't quite fit into nice modal groups, but are just as important for determining the parser state. In addition to the G-code parser modes, Grbl will report the active `T` tool number, `S` spindle speed, and `F` feed rate, which all default to 0 upon a reset. For those that are curious, these don't quite fit into nice modal groups, but are just as important for determining the parser state.

View File

@ -62,11 +62,9 @@ The real-time control commands, `~` cycle start/resume, `!` feed hold, `^X` sof
One important note are the override command characters. These are defined in the extended-ASCII character space and are generally not type-able on a keyboard. A GUI must be able to send these 8-bit values to support overrides. One important note are the override command characters. These are defined in the extended-ASCII character space and are generally not type-able on a keyboard. A GUI must be able to send these 8-bit values to support overrides.
#### EEPROM Issues #### EEPROM Issues
EEPROM access on the Arduino AVR CPUs turns off all of the interrupts while the CPU reads and writes to EEPROM. This poses a problem for certain features in Grbl, particularly if a user is streaming and running a g-code program, since it can pause the main step generator interrupt from executing on time. Most of the EEPROM access is restricted by Grbl when it's in certain states, but there are some things that developers need to know. EEPROM access on the Arduino AVR CPUs turns off all of the interrupts while the CPU _writes_ to EEPROM. This poses a problem for certain features in Grbl, particularly if a user is streaming and running a g-code program, since it can pause the main step generator interrupt from executing on time. Most of the EEPROM access is restricted by Grbl when it's in certain states, but there are some things that developers need to know.
* Settings should not be streamed with the character-counting streaming protocols. Only the simple send-response protocol works. This is because during the EEPROM write, the AVR CPU also shuts-down the serial RX interrupt, which means data can get corrupted or lost. * Settings should not be streamed with the character-counting streaming protocols. Only the simple send-response protocol works. This is because during the EEPROM write, the AVR CPU also shuts-down the serial RX interrupt, which means data can get corrupted or lost. This is safe with the send-response protocol, because it's not sending data after commanding Grbl to save data.
* When changing work coordinates or accessing the `G28`/`G30` predefined positions, Grbl has to fetch them from EEPROM. There is a small chance this access can pause the stepper or serial receive interrupt long enough to cause motion issues, but since it only fetches 12 bytes at a time at 2 cycles per fetch, the chances are very small that this will do anything to how Grbl runs. We just suggest keeping an eye on this and report to us any issues you might think are related to this.
For reference: For reference:
* Grbl's EEPROM write commands: `G10 L2`, `G10 L20`, `G28.1`, `G30.1`, `$x=`, `$I=`, `$Nx=`, `$RST=` * Grbl's EEPROM write commands: `G10 L2`, `G10 L20`, `G28.1`, `G30.1`, `$x=`, `$I=`, `$Nx=`, `$RST=`
@ -410,16 +408,16 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
- `[VER:]` and `[OPT:]`: Indicates build info data from a `$I` user query. These build info messages are followed by an `ok` to confirm the `$I` was executed, like so: - `[VER:]` and `[OPT:]`: Indicates build info data from a `$I` user query. These build info messages are followed by an `ok` to confirm the `$I` was executed, like so:
``` ```
[VER:v1.1d.20161014:Some string] [VER:v1.1f.20170131:Some string]
[OPT:VL] [OPT:VL,16,128]
ok ok
``` ```
- The first line `[VER:]` contains the build version and date. - The first line `[VER:]` contains the build version and date.
- A string may appear after the second `:` colon. It is a stored EEPROM string a user via a `$I=line` command or OEM can place there for personal use or tracking purposes. - A string may appear after the second `:` colon. It is a stored EEPROM string a user via a `$I=line` command or OEM can place there for personal use or tracking purposes.
- The `[OPT:]` line follows immediately after and contains character codes for compile-time options that were either enabled or disabled. The codes are defined below and a CSV file is also provided for quick parsing. This is generally only used for quickly diagnosing firmware bugs or compatibility issues. - The `[OPT:]` line follows immediately after and contains character codes for compile-time options that were either enabled or disabled and two values separated by commas, which indicates the total usable planner blocks and serial RX buffer bytes, respectively. The codes are defined below and a CSV file is also provided for quick parsing. This is generally only used for quickly diagnosing firmware bugs or compatibility issues.
| `OPT` Code | Setting Description, Units | | `OPT` Code | Setting Description, Units |
|:-------------:|----| |:-------------:|----|
| **`V`** | Variable spindle enabled | | **`V`** | Variable spindle enabled |
| **`N`** | Line numbers enabled | | **`N`** | Line numbers enabled |
@ -429,6 +427,10 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
| **`Z`** | Homing force origin enabled | | **`Z`** | Homing force origin enabled |
| **`H`** | Homing single axis enabled | | **`H`** | Homing single axis enabled |
| **`L`** | Two limit switches on axis enabled | | **`L`** | Two limit switches on axis enabled |
| **`D`** | Spindle direction pin used as enable pin |
| **`0`** | Spindle enable off when speed is zero enabled |
| **`S`** | Software limit pin debouncing enabled |
| **`R`** | Parking override control enabled |
| **`A`** | Allow feed rate overrides in probe cycles | | **`A`** | Allow feed rate overrides in probe cycles |
| **`*`** | Restore all EEPROM disabled | | **`*`** | Restore all EEPROM disabled |
| **`$`** | Restore EEPROM `$` settings disabled | | **`$`** | Restore EEPROM `$` settings disabled |
@ -436,6 +438,7 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
| **`I`** | Build info write user string disabled | | **`I`** | Build info write user string disabled |
| **`E`** | Force sync upon EEPROM write disabled | | **`E`** | Force sync upon EEPROM write disabled |
| **`W`** | Force sync upon work coordinate offset change disabled | | **`W`** | Force sync upon work coordinate offset change disabled |
| **`L`** | Homing initialization auto-lock disabled |
- `[echo:]` : Indicates an automated line echo from a command just prior to being parsed and executed. May be enabled only by a config.h option. Often used for debugging communication issues. A typical line echo message is shown below. A separate `ok` will eventually appear to confirm the line has been parsed and executed, but may not be immediate as with any line command containing motions. - `[echo:]` : Indicates an automated line echo from a command just prior to being parsed and executed. May be enabled only by a config.h option. Often used for debugging communication issues. A typical line echo message is shown below. A separate `ok` will eventually appear to confirm the line has been parsed and executed, but may not be immediate as with any line command containing motions.
``` ```

View File

@ -4,7 +4,7 @@
---- ----
Outlined in this document is how Grbl alters its running conditions for the new laser mode to provide both improved performance and enforcing some basic user safety precautions. 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 ## Laser Mode Overview
@ -29,16 +29,16 @@ The laser is enabled with the `M3` spindle CW and `M4` spindle CCW commands. The
- **`M3` Constant Laser Power Mode:** - **`M3` Constant 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. - 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 `M3` constant 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. - For a clean cut and prevent scorching with `M3` constant 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: `M3` can be used to keep the laser on for focusing. - NOTE: `M3` can be used to keep the laser on for focusing.
- **`M4` Dynamic Laser Power Mode:** - **`M4` Dynamic Laser Power Mode:**
- Dynamic laser power mode will automatically adjust laser power based on the current speed relative to the programmed rate. It'll 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. - 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. - 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, `M4` dynamic mode turns off the laser. It only turns on when the machine moves. This generally makes the laser safer to operate, because, unlike `M3`, it will never burn a hole through your table, if you stop and forget to turn `M3` off in time. - When not in motion, `M4` dynamic mode turns off the laser. It only turns on when the machine moves. This generally makes the laser safer to operate, because, unlike `M3`, it will never burn a hole through your table, if you stop and forget to turn `M3` off in time.
@ -70,7 +70,7 @@ Describe below are the operational changes to Grbl when laser mode is enabled. P
- 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. - 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.
- A `S0` spindle 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.. - An `S0` spindle 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..
- `M3` constant laser mode, this is a great way to turn off the laser power while continuously moving between a `G1` laser motion and a `G0` rapid motion without having to stop. Program a short `G1 S0` motion right before the `G0` motion and a `G1 Sxxx` motion is commanded right after to go back to cutting. - `M3` constant laser mode, this is a great way to turn off the laser power while continuously moving between a `G1` laser motion and a `G0` rapid motion without having to stop. Program a short `G1 S0` motion right before the `G0` motion and a `G1 Sxxx` motion is commanded right after to go back to cutting.
@ -78,12 +78,12 @@ Describe below are the operational changes to Grbl when laser mode is enabled. P
----- -----
###CAM Developer Implementation Notes ###CAM Developer Implementation Notes
TODO: Add some suggestions on how to write laser g-code for Grbl. TODO: Add some suggestions on how to write laser G-code for Grbl.
- When using `M3` constant 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 a `G0` and `G1` command with no axis words in this mode and in the middle of a job. - When using `M3` constant 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 a `G0` and `G1` command 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 M5` spindle state command. There are two ways to do this: - Ensure smooth motions throughout by turning the laser on and off without an `M3 M4 M5` spindle state command. There are two ways to do this:
- _Program a zero spindle speed `S0`_: `S0` is 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 speed `S` greater than zero. Remember that `M3` constant power mode requires any spindle speed `S` change to be programmed with a motion to allow continuous motion, while `M4` dynamic power mode does not. - _Program a zero spindle speed `S0`_: `S0` is 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 speed `S` greater than zero. Remember that `M3` constant power mode requires any spindle speed `S` change to be programmed with a motion to allow continuous motion, while `M4` dynamic 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 `G0` rapid between them. `G0` enforces the laser to be disabled automatically. The last spindle speed programmed doesn't change, so if a valid powered motion, like a `G1` is executed after, it'll immediately re-power the laser with the last programmed spindle speed when executing that motion. - _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 `G0` rapid between them. `G0` enforces the laser to be disabled automatically. The last spindle speed programmed doesn't change, so if a valid powered motion, like a `G1` is executed after, it'll immediately re-power the laser with the last programmed spindle speed when executing that motion.

View File

@ -379,12 +379,20 @@
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses // preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11. // the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno). // NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work. // NOTE: Without a direction pin, M4 will not have a pin output to indicate a difference with M3.
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with // NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.), // a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes! // this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
// not ported #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable. // not ported #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.
// Alters the behavior of the spindle enable pin with the USE_SPINDLE_DIR_AS_ENABLE_PIN option . By default,
// Grbl will not disable the enable pin if spindle speed is zero and M3/4 is active, but still sets the PWM
// output to zero. This allows the users to know if the spindle is active and use it as an additional control
// input. However, in some use cases, user may want the enable pin to disable with a zero spindle speed and
// re-enable when spindle speed is greater than zero. This option does that.
// NOTE: Requires USE_SPINDLE_DIR_AS_ENABLE_PIN to be enabled.
// #define SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED // Default disabled. Uncomment to enable.
// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces // With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces
// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be // removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be
// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user // sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user
@ -597,6 +605,15 @@
#define PARKING_PULLOUT_INCREMENT 5.0 // Spindle pull-out and plunge distance in mm. Incremental distance. #define PARKING_PULLOUT_INCREMENT 5.0 // Spindle pull-out and plunge distance in mm. Incremental distance.
// Must be positive value or equal to zero. // Must be positive value or equal to zero.
// Enables a special set of M-code commands that enables and disables the parking motion.
// These are controlled by `M56`, `M56 P1`, or `M56 Px` to enable and `M56 P0` to disable.
// The command is modal and will be set after a planner sync. Since it is g-code, it is
// executed in sync with g-code commands. It is not a real-time command.
// NOTE: PARKING_ENABLE is required. By default, M56 is active upon initialization. Use
// DEACTIVATE_PARKING_UPON_INIT to set M56 P0 as the power-up default.
// #define ENABLE_PARKING_OVERRIDE_CONTROL // Default disabled. Uncomment to enable
// #define DEACTIVATE_PARKING_UPON_INIT // Default disabled. Uncomment to enable.
// This option will automatically disable the laser during a feed hold by invoking a spindle stop // This option will automatically disable the laser during a feed hold by invoking a spindle stop
// override immediately after coming to a stop. However, this also means that the laser still may // override immediately after coming to a stop. However, this also means that the laser still may
// be reenabled by disabling the spindle stop override, if needed. This is purely a safety feature // be reenabled by disabling the spindle stop override, if needed. This is purely a safety feature

View File

@ -38,9 +38,9 @@
#define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm #define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm #define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm #define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -80,9 +80,9 @@
#define DEFAULT_X_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2 #define DEFAULT_X_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2
#define DEFAULT_Y_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2 #define DEFAULT_Y_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2 #define DEFAULT_Z_ACCELERATION (50.0*60*60) // 50*60*60 mm/min^2 = 50 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 225.0 // mm #define DEFAULT_X_MAX_TRAVEL 225.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 125.0 // mm #define DEFAULT_Y_MAX_TRAVEL 125.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 170.0 // mm #define DEFAULT_Z_MAX_TRAVEL 170.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 2800.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 2800.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -125,9 +125,9 @@
#define DEFAULT_X_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2 #define DEFAULT_X_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2
#define DEFAULT_Y_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2 #define DEFAULT_Y_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2
#define DEFAULT_Z_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2 #define DEFAULT_Z_ACCELERATION (15.0*60*60) // 15*60*60 mm/min^2 = 15 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm #define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm #define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm #define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -170,9 +170,9 @@
#define DEFAULT_X_ACCELERATION (250.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_X_ACCELERATION (250.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_Y_ACCELERATION (250.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_Y_ACCELERATION (250.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm #define DEFAULT_X_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm #define DEFAULT_Y_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm #define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -214,9 +214,9 @@
#define DEFAULT_X_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2 #define DEFAULT_X_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2
#define DEFAULT_Y_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2 #define DEFAULT_Y_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2
#define DEFAULT_Z_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2 #define DEFAULT_Z_ACCELERATION (400.0*60*60) // 400*60*60 mm/min^2 = 400 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 425.0 // mm #define DEFAULT_X_MAX_TRAVEL 425.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 465.0 // mm #define DEFAULT_Y_MAX_TRAVEL 465.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm #define DEFAULT_Z_MAX_TRAVEL 80.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -259,9 +259,9 @@
#define DEFAULT_X_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_X_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_Y_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_Y_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm #define DEFAULT_X_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm #define DEFAULT_Y_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm #define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -304,9 +304,9 @@
#define DEFAULT_X_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_X_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_Y_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_Y_ACCELERATION (500.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2 #define DEFAULT_Z_ACCELERATION (50.0*60*60) // 25*60*60 mm/min^2 = 25 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 740.0 // mm #define DEFAULT_X_MAX_TRAVEL 740.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 790.0 // mm #define DEFAULT_Y_MAX_TRAVEL 790.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm #define DEFAULT_Z_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -347,9 +347,9 @@
#define DEFAULT_X_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2 #define DEFAULT_X_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2
#define DEFAULT_Y_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2 #define DEFAULT_Y_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2
#define DEFAULT_Z_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2 #define DEFAULT_Z_ACCELERATION (600.0*60*60) // 600*60*60 mm/min^2 = 600 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 190.0 // mm #define DEFAULT_X_MAX_TRAVEL 190.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 180.0 // mm #define DEFAULT_Y_MAX_TRAVEL 180.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 150.0 // mm #define DEFAULT_Z_MAX_TRAVEL 150.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -386,9 +386,9 @@
#define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 500.0 // mm #define DEFAULT_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 750.0 // mm #define DEFAULT_Y_MAX_TRAVEL 750.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm #define DEFAULT_Z_MAX_TRAVEL 80.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -425,9 +425,9 @@
#define DEFAULT_X_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_X_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_Y_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 #define DEFAULT_Z_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 1000.0 // mm #define DEFAULT_X_MAX_TRAVEL 1000.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 1000.0 // mm #define DEFAULT_Y_MAX_TRAVEL 1000.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 1000.0 // mm #define DEFAULT_Z_MAX_TRAVEL 1000.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm #define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_STEP_PULSE_MICROSECONDS 10

View File

@ -252,16 +252,11 @@ uint8_t gc_execute_line(char *line)
default: gc_block.modal.program_flow = int_value; // Program end and reset default: gc_block.modal.program_flow = int_value; // Program end and reset
} }
break; break;
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN case 3: case 4: case 5:
case 4:
#endif
case 3: case 5:
word_bit = MODAL_GROUP_M7; word_bit = MODAL_GROUP_M7;
switch(int_value) { switch(int_value) {
case 3: gc_block.modal.spindle = SPINDLE_ENABLE_CW; break; case 3: gc_block.modal.spindle = SPINDLE_ENABLE_CW; break;
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN case 4: gc_block.modal.spindle = SPINDLE_ENABLE_CCW; break;
case 4: gc_block.modal.spindle = SPINDLE_ENABLE_CCW; break;
#endif
case 5: gc_block.modal.spindle = SPINDLE_DISABLE; break; case 5: gc_block.modal.spindle = SPINDLE_DISABLE; break;
} }
break; break;
@ -279,6 +274,12 @@ uint8_t gc_execute_line(char *line)
case 9: gc_block.modal.coolant = COOLANT_DISABLE; break; case 9: gc_block.modal.coolant = COOLANT_DISABLE; break;
} }
break; break;
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
case 56:
word_bit = MODAL_GROUP_M9;
gc_block.modal.override = OVERRIDE_PARKING_MOTION;
break;
#endif
default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); // [Unsupported M command] default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); // [Unsupported M command]
} }
@ -395,7 +396,7 @@ uint8_t gc_execute_line(char *line)
if (gc_block.modal.feed_rate == FEED_RATE_MODE_INVERSE_TIME) { // = G93 if (gc_block.modal.feed_rate == FEED_RATE_MODE_INVERSE_TIME) { // = G93
// NOTE: G38 can also operate in inverse time, but is undefined as an error. Missing F word check added here. // NOTE: G38 can also operate in inverse time, but is undefined as an error. Missing F word check added here.
if (axis_command == AXIS_COMMAND_MOTION_MODE) { if (axis_command == AXIS_COMMAND_MOTION_MODE) {
if ((gc_block.modal.motion != MOTION_MODE_NONE) || (gc_block.modal.motion != MOTION_MODE_SEEK)) { if ((gc_block.modal.motion != MOTION_MODE_NONE) && (gc_block.modal.motion != MOTION_MODE_SEEK)) {
if (bit_isfalse(value_words,bit(WORD_F))) { FAIL(STATUS_GCODE_UNDEFINED_FEED_RATE); } // [F word missing] if (bit_isfalse(value_words,bit(WORD_F))) { FAIL(STATUS_GCODE_UNDEFINED_FEED_RATE); } // [F word missing]
} }
} }
@ -434,7 +435,15 @@ uint8_t gc_execute_line(char *line)
// [6. Change tool ]: N/A // [6. Change tool ]: N/A
// [7. Spindle control ]: N/A // [7. Spindle control ]: N/A
// [8. Coolant control ]: N/A // [8. Coolant control ]: N/A
// [9. Enable/disable feed rate or spindle overrides ]: NOT SUPPORTED. // [9. Override control ]: Not supported except for a Grbl-only parking motion override control.
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
if (bit_istrue(command_words,bit(MODAL_GROUP_M9))) { // Already set as enabled in parser.
if (bit_istrue(value_words,bit(WORD_P))) {
if (gc_block.values.p == 0.0) { gc_block.modal.override = OVERRIDE_DISABLED; }
bit_false(value_words,bit(WORD_P));
}
}
#endif
// [10. Dwell ]: P value missing. P is negative (done.) NOTE: See below. // [10. Dwell ]: P value missing. P is negative (done.) NOTE: See below.
if (gc_block.non_modal_command == NON_MODAL_DWELL) { if (gc_block.non_modal_command == NON_MODAL_DWELL) {
@ -949,7 +958,13 @@ uint8_t gc_execute_line(char *line)
} }
pl_data->condition |= gc_state.modal.coolant; // Set condition flag for planner use. pl_data->condition |= gc_state.modal.coolant; // Set condition flag for planner use.
// [9. Enable/disable feed rate or spindle overrides ]: NOT SUPPORTED. Always enabled. // [9. Override control ]: NOT SUPPORTED. Always enabled. Except for a Grbl-only parking control.
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
if (gc_state.modal.override != gc_block.modal.override) {
gc_state.modal.override = gc_block.modal.override;
mc_override_ctrl_update(gc_state.modal.override);
}
#endif
// [10. Dwell ]: // [10. Dwell ]:
if (gc_block.non_modal_command == NON_MODAL_DWELL) { mc_dwell(gc_block.values.p); } if (gc_block.non_modal_command == NON_MODAL_DWELL) { mc_dwell(gc_block.values.p); }
@ -1087,7 +1102,13 @@ uint8_t gc_execute_line(char *line)
gc_state.modal.coord_select = 0; // G54 gc_state.modal.coord_select = 0; // G54
gc_state.modal.spindle = SPINDLE_DISABLE; gc_state.modal.spindle = SPINDLE_DISABLE;
gc_state.modal.coolant = COOLANT_DISABLE; gc_state.modal.coolant = COOLANT_DISABLE;
// gc_state.modal.override = OVERRIDE_DISABLE; // Not supported. #ifdef ENABLE_PARKING_OVERRIDE_CONTROL
#ifdef DEACTIVATE_PARKING_UPON_INIT
gc_state.modal.override = OVERRIDE_DISABLED;
#else
gc_state.modal.override = OVERRIDE_PARKING_MOTION;
#endif
#endif
#ifdef RESTORE_OVERRIDES_AFTER_PROGRAM_END #ifdef RESTORE_OVERRIDES_AFTER_PROGRAM_END
sys.f_override = DEFAULT_FEED_OVERRIDE; sys.f_override = DEFAULT_FEED_OVERRIDE;
@ -1133,7 +1154,7 @@ uint8_t gc_execute_line(char *line)
group 7 = {G41, G42} cutter radius compensation (G40 is supported) group 7 = {G41, G42} cutter radius compensation (G40 is supported)
group 8 = {G43} tool length offset (G43.1/G49 are supported) group 8 = {G43} tool length offset (G43.1/G49 are supported)
group 8 = {M7*} enable mist coolant (* Compile-option) group 8 = {M7*} enable mist coolant (* Compile-option)
group 9 = {M48, M49} enable/disable feed and speed override switches group 9 = {M48, M49, M56*} enable/disable override switches (* Compile-option)
group 10 = {G98, G99} return mode canned cycles group 10 = {G98, G99} return mode canned cycles
group 13 = {G61.1, G64} path control mode (G61 is supported) group 13 = {G61.1, G64} path control mode (G61 is supported)
*/ */

View File

@ -44,10 +44,7 @@
#define MODAL_GROUP_M4 11 // [M0,M1,M2,M30] Stopping #define MODAL_GROUP_M4 11 // [M0,M1,M2,M30] Stopping
#define MODAL_GROUP_M7 12 // [M3,M4,M5] Spindle turning #define MODAL_GROUP_M7 12 // [M3,M4,M5] Spindle turning
#define MODAL_GROUP_M8 13 // [M7,M8,M9] Coolant control #define MODAL_GROUP_M8 13 // [M7,M8,M9] Coolant control
#define MODAL_GROUP_M9 14 // [M56] Override control
// #define OTHER_INPUT_F 14
// #define OTHER_INPUT_S 15
// #define OTHER_INPUT_T 16
// Define command actions for within execution-type modal groups (motion, stopping, non-modal). Used // Define command actions for within execution-type modal groups (motion, stopping, non-modal). Used
// internally by the parser to know which command to execute. // internally by the parser to know which command to execute.
@ -126,6 +123,15 @@
#define TOOL_LENGTH_OFFSET_CANCEL 0 // G49 (Default: Must be zero) #define TOOL_LENGTH_OFFSET_CANCEL 0 // G49 (Default: Must be zero)
#define TOOL_LENGTH_OFFSET_ENABLE_DYNAMIC 1 // G43.1 #define TOOL_LENGTH_OFFSET_ENABLE_DYNAMIC 1 // G43.1
// Modal Group M9: Override control
#ifdef DEACTIVATE_PARKING_UPON_INIT
#define OVERRIDE_DISABLED 0 // (Default: Must be zero)
#define OVERRIDE_PARKING_MOTION 1 // M56
#else
#define OVERRIDE_PARKING_MOTION 0 // M56 (Default: Must be zero)
#define OVERRIDE_DISABLED 1 // Parking disabled.
#endif
// Modal Group G12: Active work coordinate system // Modal Group G12: Active work coordinate system
// N/A: Stores coordinate system value (54-59) to change to. // N/A: Stores coordinate system value (54-59) to change to.
@ -187,6 +193,7 @@ typedef struct {
uint8_t program_flow; // {M0,M1,M2,M30} uint8_t program_flow; // {M0,M1,M2,M30}
uint8_t coolant; // {M7,M8,M9} uint8_t coolant; // {M7,M8,M9}
uint8_t spindle; // {M3,M4,M5} uint8_t spindle; // {M3,M4,M5}
uint8_t override; // {M56}
} gc_modal_t; } gc_modal_t;
typedef struct { typedef struct {

View File

@ -22,8 +22,8 @@
#define grbl_h #define grbl_h
// Grbl versioning system // Grbl versioning system
#define GRBL_VERSION "1.1e" #define GRBL_VERSION "1.1f"
#define GRBL_VERSION_BUILD "20170114" #define GRBL_VERSION_BUILD "20170131"
// Define standard libraries used by Grbl. // Define standard libraries used by Grbl.
#include <avr/io.h> #include <avr/io.h>
@ -79,12 +79,22 @@
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor" #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
#endif #endif
#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
#error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
#endif
#if defined(PARKING_ENABLE) #if defined(PARKING_ENABLE)
#if defined(HOMING_FORCE_SET_ORIGIN) #if defined(HOMING_FORCE_SET_ORIGIN)
#error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time." #error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
#endif #endif
#endif #endif
#if defined(ENABLE_PARKING_OVERRIDE_CONTROL)
#if !defined(PARKING_ENABLE)
#error "ENABLE_PARKING_OVERRIDE_CONTROL must be enabled with PARKING_ENABLE."
#endif
#endif
/* restriction removed /* restriction removed
#if defined(SPINDLE_PWM_MIN_VALUE) #if defined(SPINDLE_PWM_MIN_VALUE)
#if !(SPINDLE_PWM_MIN_VALUE > 0) #if !(SPINDLE_PWM_MIN_VALUE > 0)
@ -105,6 +115,7 @@
#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1) #if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
#error "Override refresh must be greater than zero." #error "Override refresh must be greater than zero."
#endif #endif
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
#endif #endif

View File

@ -30,10 +30,8 @@ extern DummyReg PCIE1;
// Declare system global variable structure // Declare system global variable structure
system_t sys; system_t sys;
int32_t sys_position[N_AXIS]; // Real-time machine (aka home) position vector in steps. int32_t sys_position[N_AXIS]; // Real-time machine (aka home) position vector in steps.
int32_t sys_probe_position[N_AXIS]; // Last probe position in machine coordinates and steps. int32_t sys_probe_position[N_AXIS]; // Last probe position in machine coordinates and steps.
volatile uint8_t sys_probe_state; // Probing state value. Used to coordinate the probing cycle with stepper ISR. volatile uint8_t sys_probe_state; // Probing state value. Used to coordinate the probing cycle with stepper ISR.
volatile uint8_t sys_rt_exec_state; // Global realtime executor bitflag variable for state management. See EXEC bitmasks. volatile uint8_t sys_rt_exec_state; // Global realtime executor bitflag variable for state management. See EXEC bitmasks.
volatile uint8_t sys_rt_exec_alarm; // Global realtime executor bitflag variable for setting various alarms. volatile uint8_t sys_rt_exec_alarm; // Global realtime executor bitflag variable for setting various alarms.

View File

@ -310,32 +310,43 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
else { return(GC_PROBE_FAIL_END); } // Failed to trigger probe within travel. With or without error. else { return(GC_PROBE_FAIL_END); } // Failed to trigger probe within travel. With or without error.
} }
#ifdef PARKING_ENABLE
// Plans and executes the single special motion case for parking. Independent of main planner buffer. // Plans and executes the single special motion case for parking. Independent of main planner buffer.
// NOTE: Uses the always free planner ring buffer head to store motion parameters for execution. // NOTE: Uses the always free planner ring buffer head to store motion parameters for execution.
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data) #ifdef PARKING_ENABLE
{ void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data)
if (sys.abort) { return; } // Block during abort. {
if (sys.abort) { return; } // Block during abort.
uint8_t plan_status = plan_buffer_line(parking_target, pl_data); uint8_t plan_status = plan_buffer_line(parking_target, pl_data);
if (plan_status) {
bit_true(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
bit_false(sys.step_control, STEP_CONTROL_END_MOTION); // Allow parking motion to execute, if feed hold is active.
st_parking_setup_buffer(); // Setup step segment buffer for special parking motion case
st_prep_buffer();
st_wake_up();
do {
protocol_exec_rt_system();
if (sys.abort) { return; }
} while (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION);
st_parking_restore_buffer(); // Restore step segment buffer to normal run state.
} else {
bit_false(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
protocol_exec_rt_system();
}
if (plan_status) {
bit_true(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
bit_false(sys.step_control, STEP_CONTROL_END_MOTION); // Allow parking motion to execute, if feed hold is active.
st_parking_setup_buffer(); // Setup step segment buffer for special parking motion case
st_prep_buffer();
st_wake_up();
do {
protocol_exec_rt_system();
if (sys.abort) { return; }
} while (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION);
st_parking_restore_buffer(); // Restore step segment buffer to normal run state.
} else {
bit_false(sys.step_control, STEP_CONTROL_EXECUTE_SYS_MOTION);
protocol_exec_rt_system();
} }
#endif
}
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
void mc_override_ctrl_update(uint8_t override_state)
{
// Finish all queued commands before altering override control state
protocol_buffer_synchronize();
if (sys.abort) { return; }
sys.override_ctrl = override_state;
}
#endif #endif
// Method to ready the system to reset by setting the realtime reset command and killing any // Method to ready the system to reset by setting the realtime reset command and killing any

View File

@ -54,6 +54,9 @@ void mc_homing_cycle(uint8_t cycle_mask);
// Perform tool length probe cycle. Requires probe switch. // Perform tool length probe cycle. Requires probe switch.
uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_flags); uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_flags);
// Handles updating the override control state.
void mc_override_ctrl_update(uint8_t override_state);
// Plans and executes the single special motion case for parking. Independent of main planner buffer. // Plans and executes the single special motion case for parking. Independent of main planner buffer.
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data); void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data);

View File

@ -575,10 +575,16 @@ static void protocol_exec_rt_suspend()
// Execute slow pull-out parking retract motion. Parking requires homing enabled, the // Execute slow pull-out parking retract motion. Parking requires homing enabled, the
// current location not exceeding the parking target location, and laser mode disabled. // current location not exceeding the parking target location, and laser mode disabled.
// NOTE: State is will remain DOOR, until the de-energizing and retract is complete. // NOTE: State is will remain DOOR, until the de-energizing and retract is complete.
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
(parking_target[PARKING_AXIS] < PARKING_TARGET) &&
bit_isfalse(settings.flags,BITFLAG_LASER_MODE) &&
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
#else
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) && if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
(parking_target[PARKING_AXIS] < PARKING_TARGET) && (parking_target[PARKING_AXIS] < PARKING_TARGET) &&
bit_isfalse(settings.flags,BITFLAG_LASER_MODE)) { bit_isfalse(settings.flags,BITFLAG_LASER_MODE)) {
#endif
// Retract spindle by pullout distance. Ensure retraction motion moves away from // Retract spindle by pullout distance. Ensure retraction motion moves away from
// the workpiece and waypoint motion doesn't exceed the parking target location. // the workpiece and waypoint motion doesn't exceed the parking target location.
if (parking_target[PARKING_AXIS] < retract_waypoint) { if (parking_target[PARKING_AXIS] < retract_waypoint) {
@ -642,7 +648,12 @@ static void protocol_exec_rt_suspend()
#ifdef PARKING_ENABLE #ifdef PARKING_ENABLE
// Execute fast restore motion to the pull-out position. Parking requires homing enabled. // Execute fast restore motion to the pull-out position. Parking requires homing enabled.
// NOTE: State is will remain DOOR, until the de-energizing and retract is complete. // NOTE: State is will remain DOOR, until the de-energizing and retract is complete.
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
#else
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) { if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
#endif
// Check to ensure the motion doesn't move below pull-out position. // Check to ensure the motion doesn't move below pull-out position.
if (parking_target[PARKING_AXIS] <= PARKING_TARGET) { if (parking_target[PARKING_AXIS] <= PARKING_TARGET) {
parking_target[PARKING_AXIS] = retract_waypoint; parking_target[PARKING_AXIS] = retract_waypoint;
@ -676,7 +687,12 @@ static void protocol_exec_rt_suspend()
#ifdef PARKING_ENABLE #ifdef PARKING_ENABLE
// Execute slow plunge motion from pull-out position to resume position. // Execute slow plunge motion from pull-out position to resume position.
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
#else
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) { if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
#endif
// Block if safety door re-opened during prior restore actions. // Block if safety door re-opened during prior restore actions.
if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) { if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) {
// Regardless if the retract parking motion was a valid/safe motion or not, the // Regardless if the retract parking motion was a valid/safe motion or not, the

View File

@ -328,6 +328,13 @@ void report_gcode_modes()
else { serial_write('9'); } else { serial_write('9'); }
#endif #endif
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
if (sys.override_ctrl == OVERRIDE_PARKING_MOTION) {
report_util_gcode_modes_M();
print_uint8_base10(56);
}
#endif
printPgmString(PSTR(" T")); printPgmString(PSTR(" T"));
print_uint8_base10(gc_state.tool); print_uint8_base10(gc_state.tool);
@ -394,6 +401,18 @@ void report_build_info(char *line)
#ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES #ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES
serial_write('A'); serial_write('A');
#endif #endif
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
serial_write('D');
#endif
#ifdef SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED
serial_write('0');
#endif
#ifdef ENABLE_SOFTWARE_DEBOUNCE
serial_write('S');
#endif
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
serial_write('R');
#endif
#ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled. #ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled.
serial_write('*'); serial_write('*');
#endif #endif
@ -412,8 +431,15 @@ void report_build_info(char *line)
#ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled. #ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled.
serial_write('W'); serial_write('W');
#endif #endif
#ifndef HOMING_INIT_LOCK
serial_write('L');
#endif
// NOTE: Compiled values, like override increments/max/min values, may be added at some point later. // NOTE: Compiled values, like override increments/max/min values, may be added at some point later.
// These will likely have a comma delimiter to separate them. serial_write(',');
print_uint8_base10(BLOCK_BUFFER_SIZE-1);
serial_write(',');
print_uint32_base10(RX_BUFFER_SIZE);
report_util_feedback_line_feed(); report_util_feedback_line_feed();
} }

View File

@ -191,7 +191,8 @@ void spindle_stop()
} }
spindle_set_speed(spindle_compute_pwm_value(rpm)); spindle_set_speed(spindle_compute_pwm_value(rpm));
#endif #endif
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) || !defined(VARIABLE_SPINDLE) #if (defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && \
!defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)) || !defined(VARIABLE_SPINDLE)
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless // NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
// if the spindle speed value is zero, as its ignored anyhow. // if the spindle speed value is zero, as its ignored anyhow.
/* not ported /* not ported

View File

@ -44,11 +44,17 @@
// NOTE: AMASS cutoff frequency multiplied by ISR overdrive factor must not exceed maximum step frequency. // NOTE: AMASS cutoff frequency multiplied by ISR overdrive factor must not exceed maximum step frequency.
// NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead // NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead
// and timer accuracy. Do not alter these settings unless you know what you are doing. // and timer accuracy. Do not alter these settings unless you know what you are doing.
#define MAX_AMASS_LEVEL 3 #ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency. #define MAX_AMASS_LEVEL 3
#define AMASS_LEVEL1 (F_CPU/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz) // AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
#define AMASS_LEVEL2 (F_CPU/4000) // Over-drives ISR (x4) #define AMASS_LEVEL1 (F_CPU/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8) #define AMASS_LEVEL2 (F_CPU/4000) // Over-drives ISR (x4)
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8)
#if MAX_AMASS_LEVEL <= 0
error "AMASS must have 1 or more levels to operate correctly."
#endif
#endif
// Stores the planner block Bresenham algorithm execution data for the segments in the segment // Stores the planner block Bresenham algorithm execution data for the segments in the segment
@ -646,8 +652,8 @@ void st_prep_buffer()
st_prep_block->direction_bits = pl_block->direction_bits; st_prep_block->direction_bits = pl_block->direction_bits;
uint8_t idx; uint8_t idx;
#ifndef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING #ifndef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
for (idx=0; idx<N_AXIS; idx++) { st_prep_block->steps[idx] = pl_block->steps[idx]; } for (idx=0; idx<N_AXIS; idx++) { st_prep_block->steps[idx] = (pl_block->steps[idx] << 1); }
st_prep_block->step_event_count = pl_block->step_event_count; st_prep_block->step_event_count = (pl_block->step_event_count << 1);
#else #else
// With AMASS enabled, simply bit-shift multiply all Bresenham data by the max AMASS // With AMASS enabled, simply bit-shift multiply all Bresenham data by the max AMASS
// level, such that we never divide beyond the original data anywhere in the algorithm. // level, such that we never divide beyond the original data anywhere in the algorithm.

View File

@ -137,6 +137,9 @@ typedef struct {
uint8_t spindle_stop_ovr; // Tracks spindle stop override states uint8_t spindle_stop_ovr; // Tracks spindle stop override states
uint8_t report_ovr_counter; // Tracks when to add override data to status reports. uint8_t report_ovr_counter; // Tracks when to add override data to status reports.
uint8_t report_wco_counter; // Tracks when to add work coordinate offset data to status reports. uint8_t report_wco_counter; // Tracks when to add work coordinate offset data to status reports.
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
uint8_t override_ctrl; // Tracks override control states.
#endif
#ifdef VARIABLE_SPINDLE #ifdef VARIABLE_SPINDLE
float spindle_speed; float spindle_speed;
#endif #endif
@ -155,7 +158,7 @@ extern volatile uint8_t sys_rt_exec_accessory_override; // Global realtime execu
#ifdef DEBUG #ifdef DEBUG
#define EXEC_DEBUG_REPORT bit(0) #define EXEC_DEBUG_REPORT bit(0)
volatile uint8_t sys_rt_exec_debug; extern volatile uint8_t sys_rt_exec_debug;
#endif #endif
// Initialize the serial protocol // Initialize the serial protocol