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 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.
This commit is contained in:
parent
67ab9280d9
commit
e455764079
@ -8,9 +8,14 @@
|
||||
"H","Homing single axis commands","Enabled"
|
||||
"L","Two limit switches on axis","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 EEPROM `$` settings command","Disabled"
|
||||
"#","Restore EEPROM parameter data command","Disabled"
|
||||
"I","Build info write user string command","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,3 +1,20 @@
|
||||
----------------
|
||||
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.
|
||||
Don’t rely on this data for streaming.
|
||||
|
||||
|
||||
----------------
|
||||
Date: 2017-01-03
|
||||
Author: Sonny Jeon
|
||||
|
@ -109,4 +109,6 @@ On a final note, these interface tweaks came about out of necessity, because mor
|
||||
- `$J=line` New jogging commands. This command behaves much like a normal G1 command, but there are some key differences. Jog commands don't alter the g-code parser state, meaning a GUI doesn't have to manage it anymore. Jog commands may be queued and cancelled at any time, where they are automatically flushed from the planner buffer without requiring a reset. See the jogging documentation on how they work and how they may be used to implement a low-latency joystick or rotary dial.
|
||||
|
||||
- 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.
|
@ -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.
|
||||
|
||||
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 |
|
||||
|:----:|:----:|
|
||||
@ -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|
|
||||
|Spindle State |M3, M4, **M5**|
|
||||
|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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
#### 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.
|
||||
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
For reference:
|
||||
* Grbl's EEPROM write commands: `G10 L2`, `G10 L20`, `G28.1`, `G30.1`, `$x=`, `$I=`, `$Nx=`, `$RST=`
|
||||
@ -429,6 +427,10 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
|
||||
| **`Z`** | Homing force origin enabled |
|
||||
| **`H`** | Homing single 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 |
|
||||
| **`*`** | Restore all EEPROM 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 |
|
||||
| **`E`** | Force sync upon EEPROM write 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.
|
||||
```
|
||||
|
@ -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
|
||||
|
||||
@ -29,16 +29,16 @@ The laser is enabled with the `M3` spindle CW and `M4` spindle CCW commands. The
|
||||
|
||||
- **`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.
|
||||
|
||||
- NOTE: `M3` can be used to keep the laser on for focusing.
|
||||
|
||||
- **`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.
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
- 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.
|
||||
|
||||
@ -78,12 +78,12 @@ Describe below are the operational changes to Grbl when laser mode is enabled. P
|
||||
-----
|
||||
###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.
|
||||
|
||||
- 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.
|
||||
|
@ -353,12 +353,20 @@
|
||||
// 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.
|
||||
// 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
|
||||
// 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!
|
||||
// #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
|
||||
// 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
|
||||
@ -563,6 +571,13 @@
|
||||
#define PARKING_PULLOUT_INCREMENT 5.0 // Spindle pull-out and plunge distance in mm. Incremental distance.
|
||||
// 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.
|
||||
// #define ENABLE_PARKING_OVERRIDE_CONTROL // Default disabled. Uncomment to enable
|
||||
|
||||
// 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
|
||||
// be reenabled by disabling the spindle stop override, if needed. This is purely a safety feature
|
||||
|
@ -38,9 +38,9 @@
|
||||
#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_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_Y_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Z_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 NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 225.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 125.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 170.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 225.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 125.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Z_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 NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 425.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 465.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 425.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 465.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 290.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 740.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 790.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 100.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 740.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 790.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 190.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 180.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 150.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 190.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 180.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 500.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 750.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm
|
||||
#define DEFAULT_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 750.0 // mm NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#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_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_X_MAX_TRAVEL 1000.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 1000.0 // mm
|
||||
#define DEFAULT_Z_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 NOTE: Must be a positive value.
|
||||
#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_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
|
35
grbl/gcode.c
35
grbl/gcode.c
@ -252,16 +252,11 @@ uint8_t gc_execute_line(char *line)
|
||||
default: gc_block.modal.program_flow = int_value; // Program end and reset
|
||||
}
|
||||
break;
|
||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
case 4:
|
||||
#endif
|
||||
case 3: case 5:
|
||||
case 3: case 4: case 5:
|
||||
word_bit = MODAL_GROUP_M7;
|
||||
switch(int_value) {
|
||||
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;
|
||||
#endif
|
||||
case 4: gc_block.modal.spindle = SPINDLE_ENABLE_CCW; break;
|
||||
case 5: gc_block.modal.spindle = SPINDLE_DISABLE; break;
|
||||
}
|
||||
break;
|
||||
@ -279,6 +274,12 @@ uint8_t gc_execute_line(char *line)
|
||||
case 9: gc_block.modal.coolant = COOLANT_DISABLE; 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]
|
||||
}
|
||||
|
||||
@ -395,7 +396,7 @@ uint8_t gc_execute_line(char *line)
|
||||
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.
|
||||
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]
|
||||
}
|
||||
}
|
||||
@ -434,7 +435,15 @@ uint8_t gc_execute_line(char *line)
|
||||
// [6. Change tool ]: N/A
|
||||
// [7. Spindle 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 (gc_block.modal.override == OVERRIDE_PARKING_MOTION) {
|
||||
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.
|
||||
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.
|
||||
|
||||
// [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 ]:
|
||||
if (gc_block.non_modal_command == NON_MODAL_DWELL) { mc_dwell(gc_block.values.p); }
|
||||
|
10
grbl/gcode.h
10
grbl/gcode.h
@ -44,10 +44,7 @@
|
||||
#define MODAL_GROUP_M4 11 // [M0,M1,M2,M30] Stopping
|
||||
#define MODAL_GROUP_M7 12 // [M3,M4,M5] Spindle turning
|
||||
#define MODAL_GROUP_M8 13 // [M7,M8,M9] Coolant control
|
||||
|
||||
// #define OTHER_INPUT_F 14
|
||||
// #define OTHER_INPUT_S 15
|
||||
// #define OTHER_INPUT_T 16
|
||||
#define MODAL_GROUP_M9 14 // [M56] Override control
|
||||
|
||||
// Define command actions for within execution-type modal groups (motion, stopping, non-modal). Used
|
||||
// internally by the parser to know which command to execute.
|
||||
@ -126,6 +123,10 @@
|
||||
#define TOOL_LENGTH_OFFSET_CANCEL 0 // G49 (Default: Must be zero)
|
||||
#define TOOL_LENGTH_OFFSET_ENABLE_DYNAMIC 1 // G43.1
|
||||
|
||||
// Modal Group M9: Override control
|
||||
#define OVERRIDE_DISABLED 0 // None (Default: Must be zero)
|
||||
#define OVERRIDE_PARKING_MOTION 1 // G56 (Default: Must be zero)
|
||||
|
||||
// Modal Group G12: Active work coordinate system
|
||||
// N/A: Stores coordinate system value (54-59) to change to.
|
||||
|
||||
@ -187,6 +188,7 @@ typedef struct {
|
||||
uint8_t program_flow; // {M0,M1,M2,M30}
|
||||
uint8_t coolant; // {M7,M8,M9}
|
||||
uint8_t spindle; // {M3,M4,M5}
|
||||
uint8_t override; // {M56}
|
||||
} gc_modal_t;
|
||||
|
||||
typedef struct {
|
||||
|
15
grbl/grbl.h
15
grbl/grbl.h
@ -22,8 +22,8 @@
|
||||
#define grbl_h
|
||||
|
||||
// Grbl versioning system
|
||||
#define GRBL_VERSION "1.1e"
|
||||
#define GRBL_VERSION_BUILD "20170114"
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#define GRBL_VERSION_BUILD "20170128"
|
||||
|
||||
// Define standard libraries used by Grbl.
|
||||
#include <avr/io.h>
|
||||
@ -76,12 +76,22 @@
|
||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
||||
#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(HOMING_FORCE_SET_ORIGIN)
|
||||
#error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
|
||||
#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
|
||||
|
||||
#if defined(SPINDLE_PWM_MIN_VALUE)
|
||||
#if !(SPINDLE_PWM_MIN_VALUE > 0)
|
||||
#error "SPINDLE_PWM_MIN_VALUE must be greater than zero."
|
||||
@ -100,6 +110,7 @@
|
||||
#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
|
||||
#error "Override refresh must be greater than zero."
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,13 @@
|
||||
|
||||
// Declare system global variable structure
|
||||
system_t sys;
|
||||
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.
|
||||
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_alarm; // Global realtime executor bitflag variable for setting various alarms.
|
||||
volatile uint8_t sys_rt_exec_motion_override; // Global realtime executor bitflag variable for motion-based overrides.
|
||||
volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bitflag variable for spindle/coolant overrides.
|
||||
|
||||
|
||||
int main(void)
|
||||
|
@ -313,29 +313,42 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
|
||||
|
||||
// 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.
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data)
|
||||
{
|
||||
if (sys.abort) { return; } // Block during abort.
|
||||
#ifdef PARKING_ENABLE
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data)
|
||||
{
|
||||
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
|
||||
|
||||
|
||||
// Method to ready the system to reset by setting the realtime reset command and killing any
|
||||
|
@ -54,6 +54,9 @@ void mc_homing_cycle(uint8_t cycle_mask);
|
||||
// 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);
|
||||
|
||||
// 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.
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data);
|
||||
|
||||
|
@ -575,10 +575,16 @@ static void protocol_exec_rt_suspend()
|
||||
// Execute slow pull-out parking retract motion. Parking requires homing enabled, the
|
||||
// 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.
|
||||
#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) {
|
||||
#else
|
||||
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
|
||||
(parking_target[PARKING_AXIS] < PARKING_TARGET) &&
|
||||
bit_isfalse(settings.flags,BITFLAG_LASER_MODE)) {
|
||||
|
||||
#endif
|
||||
// Retract spindle by pullout distance. Ensure retraction motion moves away from
|
||||
// the workpiece and waypoint motion doesn't exceed the parking target location.
|
||||
if (parking_target[PARKING_AXIS] < retract_waypoint) {
|
||||
@ -642,7 +648,12 @@ static void protocol_exec_rt_suspend()
|
||||
#ifdef PARKING_ENABLE
|
||||
// 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.
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
|
||||
!sys.override_ctrl) {
|
||||
#else
|
||||
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.
|
||||
if (parking_target[PARKING_AXIS] <= PARKING_TARGET) {
|
||||
parking_target[PARKING_AXIS] = retract_waypoint;
|
||||
@ -676,7 +687,12 @@ static void protocol_exec_rt_suspend()
|
||||
|
||||
#ifdef PARKING_ENABLE
|
||||
// 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) {
|
||||
#else
|
||||
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
|
||||
#endif
|
||||
// Block if safety door re-opened during prior restore actions.
|
||||
if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) {
|
||||
// Regardless if the retract parking motion was a valid/safe motion or not, the
|
||||
|
@ -327,6 +327,13 @@ void report_gcode_modes()
|
||||
else { serial_write('9'); }
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
if (sys.override_ctrl) {
|
||||
report_util_gcode_modes_M();
|
||||
print_uint8_base10(56);
|
||||
}
|
||||
#endif
|
||||
|
||||
printPgmString(PSTR(" T"));
|
||||
print_uint8_base10(gc_state.tool);
|
||||
|
||||
@ -393,6 +400,18 @@ void report_build_info(char *line)
|
||||
#ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES
|
||||
serial_write('A');
|
||||
#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.
|
||||
serial_write('*');
|
||||
#endif
|
||||
@ -411,6 +430,9 @@ void report_build_info(char *line)
|
||||
#ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled.
|
||||
serial_write('W');
|
||||
#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.
|
||||
// These will likely have a comma delimiter to separate them.
|
||||
|
||||
|
@ -116,11 +116,24 @@ void spindle_stop()
|
||||
void spindle_set_speed(uint8_t pwm_value)
|
||||
{
|
||||
SPINDLE_OCR_REGISTER = pwm_value; // Set PWM output level.
|
||||
if (pwm_value == SPINDLE_PWM_OFF_VALUE) {
|
||||
SPINDLE_TCCRA_REGISTER &= ~(1<<SPINDLE_COMB_BIT); // Disable PWM. Output voltage is zero.
|
||||
} else {
|
||||
SPINDLE_TCCRA_REGISTER |= (1<<SPINDLE_COMB_BIT); // Ensure PWM output is enabled.
|
||||
}
|
||||
#ifdef SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED
|
||||
if (pwm_value == SPINDLE_PWM_OFF_VALUE) {
|
||||
spindle_stop();
|
||||
} else {
|
||||
SPINDLE_TCCRA_REGISTER |= (1<<SPINDLE_COMB_BIT); // Ensure PWM output is enabled.
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
||||
#else
|
||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if (pwm_value == SPINDLE_PWM_OFF_VALUE) {
|
||||
SPINDLE_TCCRA_REGISTER &= ~(1<<SPINDLE_COMB_BIT); // Disable PWM. Output voltage is zero.
|
||||
} else {
|
||||
SPINDLE_TCCRA_REGISTER |= (1<<SPINDLE_COMB_BIT); // Ensure PWM output is enabled.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -187,7 +200,8 @@ void spindle_stop()
|
||||
}
|
||||
spindle_set_speed(spindle_compute_pwm_value(rpm));
|
||||
#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
|
||||
// if the spindle speed value is zero, as its ignored anyhow.
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
|
@ -44,11 +44,17 @@
|
||||
// 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
|
||||
// and timer accuracy. Do not alter these settings unless you know what you are doing.
|
||||
#define MAX_AMASS_LEVEL 3
|
||||
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
||||
#define AMASS_LEVEL1 (F_CPU/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
|
||||
#define AMASS_LEVEL2 (F_CPU/4000) // Over-drives ISR (x4)
|
||||
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8)
|
||||
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
#define MAX_AMASS_LEVEL 3
|
||||
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
||||
#define AMASS_LEVEL1 (F_CPU/8000) // Over-drives ISR (x2). Defined as F_CPU/(Cutoff frequency in Hz)
|
||||
#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
|
||||
@ -632,8 +638,8 @@ void st_prep_buffer()
|
||||
st_prep_block->direction_bits = pl_block->direction_bits;
|
||||
uint8_t idx;
|
||||
#ifndef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
for (idx=0; idx<N_AXIS; idx++) { st_prep_block->steps[idx] = pl_block->steps[idx]; }
|
||||
st_prep_block->step_event_count = pl_block->step_event_count;
|
||||
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 << 1);
|
||||
#else
|
||||
// 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.
|
||||
|
@ -137,6 +137,9 @@ typedef struct {
|
||||
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_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
|
||||
float spindle_speed;
|
||||
#endif
|
||||
@ -144,18 +147,18 @@ typedef struct {
|
||||
extern system_t sys;
|
||||
|
||||
// NOTE: These position variables may need to be declared as volatiles, if problems arise.
|
||||
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.
|
||||
extern int32_t sys_position[N_AXIS]; // Real-time machine (aka home) position vector in steps.
|
||||
extern 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_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_motion_override; // Global realtime executor bitflag variable for motion-based overrides.
|
||||
volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bitflag variable for spindle/coolant overrides.
|
||||
extern volatile uint8_t sys_probe_state; // Probing state value. Used to coordinate the probing cycle with stepper ISR.
|
||||
extern volatile uint8_t sys_rt_exec_state; // Global realtime executor bitflag variable for state management. See EXEC bitmasks.
|
||||
extern volatile uint8_t sys_rt_exec_alarm; // Global realtime executor bitflag variable for setting various alarms.
|
||||
extern volatile uint8_t sys_rt_exec_motion_override; // Global realtime executor bitflag variable for motion-based overrides.
|
||||
extern volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bitflag variable for spindle/coolant overrides.
|
||||
|
||||
#ifdef DEBUG
|
||||
#define EXEC_DEBUG_REPORT bit(0)
|
||||
volatile uint8_t sys_rt_exec_debug;
|
||||
extern volatile uint8_t sys_rt_exec_debug;
|
||||
#endif
|
||||
|
||||
// Initialize the serial protocol
|
||||
|
Loading…
Reference in New Issue
Block a user