16 Commits

Author SHA1 Message Date
b48c3c7c51 Error corrected in config.h (missing ")" on LIMIT_MASK) 2017-05-10 18:11:28 +02:00
0471485259 Added $33 for PWM frequency and defaults for K40 2017-05-10 18:01:55 +02:00
063b1f6748 Config for K40 2017-05-10 17:16:17 +02:00
5a862a5e30 Fix #3: wrong port for limit switches 2017-04-08 14:57:31 -04:00
612b781e3e Update README.md 2017-03-19 09:33:40 -06:00
ee65b9a7e2 Merge tag 'v1.1f.20170131' 2017-03-11 10:09:48 -05:00
ed82dd90b6 Merge tag 'v1.1e.20170114' 2017-03-11 09:33:28 -05:00
f51268e855 Additional build info in the $I printout.
- [new] Added total available planner buffer blocks (15 shown, but
there are 16. one is used by the ring buffer and to execute system
motions) and serial RX buffer bytes. This information is useful for
GUIs to setup and optimize their streaming protocols easily.

[doc] Updated the interface document to reflect the change.
2017-01-31 18:46:20 -07:00
beaa40583c 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.
2017-01-29 11:35:51 -07:00
e455764079 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.
2017-01-28 17:13:06 -07:00
31a83558ad comment error: PWM1_CH6 secondary is P2.5. 2017-01-18 22:13:10 -05:00
a91c8b1b04 flash: only write when something changed 2017-01-18 13:51:47 -05:00
c66e549633 update readme 2017-01-17 21:00:37 -05:00
b1d83c2892 Clean up dummy regs 2017-01-17 14:46:12 -05:00
67ab9280d9 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.
2017-01-14 13:54:14 -07:00
30c0f79afd Spindle enable pin with variable spindle option fix.
- [fix] When USE_SPINDLE_DIR_AS_ENABLE_PIN is enabled in config.h, the
enable pin was not being set when spindle speed is zero. This behavior
should now be fixed.
2017-01-03 10:10:35 -07:00
30 changed files with 532 additions and 297 deletions

View File

@ -1,4 +1,5 @@
![GitHub Logo](/doc/media/Grbl Logo 250px.png)
![GitHub Logo](https://github.com/gnea/gnea-Media/blob/master/Grbl%20Logo/Grbl%20Logo%20250px.png?raw=true)
***
_Click the `Release` tab to download pre-compiled `.bin` files or just [click here](https://github.com/gnea/grbl-LPC/releases)_
***
@ -9,27 +10,29 @@ Usage notes:
If it doesn't, try installing VCOM_lib/usbser.inf.
* This doesn't pass the sdcard to the host. Once installed you need to use a micro sdcard adaptor to replace or change it.
* Only tested with lasers with PWM. Non-PWM spindle control not ported.
* These are fixed PWM config values. To change these you'll have to change ```SPINDLE_PWM_*``` in config.h and rebuild.
* Pin 2.4
* 40 kHz
* This special version supports setting PWM frequency by $33. Default is 5000 Hz. Pin can only be changes in config.h.
* Pin 2.5
* 5 kHz
* PWM off value: 0%
* Mimimum PWM value: 0%
* Maximum PWM value: 100%
* These are defaults for easy-to-change config values.
* Laser mode: ON ($32)
* Maximum S value: 1000.0 ($30)
* Minimum S value: 0.0 ($31)
* Maximum S value: 1.0 ($30)
* Homing not tested
* Laser mode: 1 ($32)
* Laser PWM frequency: 5000 ($33)
* Hard limits not yet ported
* Control inputs not yet ported (e.g. Cycle Start and Safety Door switches)
New configuration settings
* $33 is PWM frequency in Hz
* $140, $141, $142 are X, Y, Z current (amps)
* Default to 0.0 A to avoid burning out your motors
* Your motors will likely stall if you don't set these!
Build notes:
* Include ```make``` and the ```arm-none-eabi-*``` tools in your path.
* Run ```git submodule init``` and ```git submodule update``` before building.
* Make produces 2 files:
* ```build/firmware.bin```: this is compatible with the sdcard bootloader.
* ```build/grbl.hex```: this is not compatible with the sdcard bootloader. It loads using Flash Magic
@ -56,12 +59,12 @@ Grbl includes full acceleration management with look ahead. That means the contr
***
### Official Supporters of the Grbl CNC Project
![Official Supporters](https://dl.dropboxusercontent.com/u/2221997/Contributors.png)
![Official Supporters](https://github.com/gnea/gnea-Media/blob/master/Contributors.png?raw=true)
***
##Update Summary for v1.1
## Update Summary for v1.1
- **IMPORTANT:** Your EEPROM will be wiped and restored with new settings. This is due to the addition of two new spindle speed '$' settings.
- **Real-time Overrides** : Alters the machine running state immediately with feed, rapid, spindle speed, spindle stop, and coolant toggle controls. This awesome new feature is common only on industrial machines, often used to optimize speeds and feeds while a job is running. Most hobby CNC's try to mimic this behavior, but usually have large amounts of lag. Grbl executes overrides in realtime and within tens of milliseconds.

View File

@ -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 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,35 +1,36 @@
"Error Code in v1.1+ ","Error Message in v1.0-"," Error Description"
"1","Expected command letter","G-code words consist of a letter and a value. Letter was not found."
"2","Bad number format","Missing the expected G-code word value or numeric value format is not valid."
"3","Invalid statement","Grbl '$' system command was not recognized or supported."
"4","Value < 0","Negative value received for an expected positive value."
"5","Setting disabled","Homing cycle failure. Homing is not enabled via settings."
"6","Value < 3 usec","Minimum step pulse time must be greater than 3usec."
"7","EEPROM read fail. Using defaults","An EEPROM read failed. Auto-restoring affected EEPROM to default values."
"8","Not idle","Grbl '$' command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job."
"9","G-code lock","G-code commands are locked out during alarm or jog state."
"10","Homing not enabled","Soft limits cannot be enabled without homing also enabled."
"11","Line overflow","Max characters per line exceeded. Received command line was not executed."
"12","Step rate > 30kHz","Grbl '$' setting value cause the step rate to exceed the maximum supported."
"13","Check Door","Safety door detected as opened and door state initiated."
"14","Line length exceeded","Build info or startup line exceeded EEPROM line length limit. Line not stored."
"15","Travel exceeded","Jog target exceeds machine travel. Jog command has been ignored."
"16","Invalid jog command","Jog command has no '=' or contains prohibited g-code."
"20","Unsupported command","Unsupported or invalid g-code command found in block."
"21","Modal group violation","More than one g-code command from same modal group found in block."
"22","Undefined feed rate","Feed rate has not yet been set or is undefined."
"23","Invalid gcode ID:23","G-code command in block requires an integer value."
"24","Invalid gcode ID:24","More than one g-code command that requires axis words found in block."
"25","Invalid gcode ID:25","Repeated g-code word found in block."
"26","Invalid gcode ID:26","No axis words found in block for g-code command or current modal state which requires them."
"27","Invalid gcode ID:27","Line number value is invalid."
"28","Invalid gcode ID:28","G-code command is missing a required value word."
"29","Invalid gcode ID:29","G59.x work coordinate systems are not supported."
"30","Invalid gcode ID:30","G53 only allowed with G0 and G1 motion modes."
"31","Invalid gcode ID:31","Axis words found in block when no command or current modal state uses them."
"32","Invalid gcode ID:32","G2 and G3 arcs require at least one in-plane axis word."
"33","Invalid gcode ID:33","Motion command target is invalid."
"34","Invalid gcode ID:34","Arc radius value is invalid."
"35","Invalid gcode ID:35","G2 and G3 arcs require at least one in-plane offset word."
"36","Invalid gcode ID:36","Unused value words found in block."
"37","Invalid gcode ID:37","G43.1 dynamic tool length offset is not assigned to configured tool length axis."
Error Code in v1.1+ ,Error Message in v1.0-, Error Description
1,Expected command letter,G-code words consist of a letter and a value. Letter was not found.
2,Bad number format,Missing the expected G-code word value or numeric value format is not valid.
3,Invalid statement,Grbl '$' system command was not recognized or supported.
4,Value < 0,Negative value received for an expected positive value.
5,Setting disabled,Homing cycle failure. Homing is not enabled via settings.
6,Value < 3 usec,Minimum step pulse time must be greater than 3usec.
7,EEPROM read fail. Using defaults,An EEPROM read failed. Auto-restoring affected EEPROM to default values.
8,Not idle,Grbl '$' command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job.
9,G-code lock,G-code commands are locked out during alarm or jog state.
10,Homing not enabled,Soft limits cannot be enabled without homing also enabled.
11,Line overflow,Max characters per line exceeded. Received command line was not executed.
12,Step rate > 30kHz,Grbl '$' setting value cause the step rate to exceed the maximum supported.
13,Check Door,Safety door detected as opened and door state initiated.
14,Line length exceeded,Build info or startup line exceeded EEPROM line length limit. Line not stored.
15,Travel exceeded,Jog target exceeds machine travel. Jog command has been ignored.
16,Invalid jog command,Jog command has no '=' or contains prohibited g-code.
20,Unsupported command,Unsupported or invalid g-code command found in block.
21,Modal group violation,More than one g-code command from same modal group found in block.
22,Undefined feed rate,Feed rate has not yet been set or is undefined.
23,Invalid gcode ID:23,G-code command in block requires an integer value.
24,Invalid gcode ID:24,More than one g-code command that requires axis words found in block.
25,Invalid gcode ID:25,Repeated g-code word found in block.
26,Invalid gcode ID:26,No axis words found in block for g-code command or current modal state which requires them.
27,Invalid gcode ID:27,Line number value is invalid.
28,Invalid gcode ID:28,G-code command is missing a required value word.
29,Invalid gcode ID:29,G59.x work coordinate systems are not supported.
30,Invalid gcode ID:30,G53 only allowed with G0 and G1 motion modes.
31,Invalid gcode ID:31,Axis words found in block when no command or current modal state uses them.
32,Invalid gcode ID:32,G2 and G3 arcs require at least one in-plane axis word.
33,Invalid gcode ID:33,Motion command target is invalid.
34,Invalid gcode ID:34,Arc radius value is invalid.
35,Invalid gcode ID:35,G2 and G3 arcs require at least one in-plane offset word.
36,Invalid gcode ID:36,Unused value words found in block.
37,Invalid gcode ID:37,G43.1 dynamic tool length offset is not assigned to configured tool length axis.
38,Invalid gcode ID:38,Tool number greater than max supported value.
1 Error Code in v1.1+ Error Message in v1.0- Error Description Error Description
2 1 Expected command letter G-code words consist of a letter and a value. Letter was not found.
3 2 Bad number format Missing the expected G-code word value or numeric value format is not valid.
4 3 Invalid statement Grbl '$' system command was not recognized or supported.
5 4 Value < 0 Negative value received for an expected positive value.
6 5 Setting disabled Homing cycle failure. Homing is not enabled via settings.
7 6 Value < 3 usec Minimum step pulse time must be greater than 3usec.
8 7 EEPROM read fail. Using defaults An EEPROM read failed. Auto-restoring affected EEPROM to default values.
9 8 Not idle Grbl '$' command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job.
10 9 G-code lock G-code commands are locked out during alarm or jog state.
11 10 Homing not enabled Soft limits cannot be enabled without homing also enabled.
12 11 Line overflow Max characters per line exceeded. Received command line was not executed.
13 12 Step rate > 30kHz Grbl '$' setting value cause the step rate to exceed the maximum supported.
14 13 Check Door Safety door detected as opened and door state initiated.
15 14 Line length exceeded Build info or startup line exceeded EEPROM line length limit. Line not stored.
16 15 Travel exceeded Jog target exceeds machine travel. Jog command has been ignored.
17 16 Invalid jog command Jog command has no '=' or contains prohibited g-code.
18 20 Unsupported command Unsupported or invalid g-code command found in block.
19 21 Modal group violation More than one g-code command from same modal group found in block.
20 22 Undefined feed rate Feed rate has not yet been set or is undefined.
21 23 Invalid gcode ID:23 G-code command in block requires an integer value.
22 24 Invalid gcode ID:24 More than one g-code command that requires axis words found in block.
23 25 Invalid gcode ID:25 Repeated g-code word found in block.
24 26 Invalid gcode ID:26 No axis words found in block for g-code command or current modal state which requires them.
25 27 Invalid gcode ID:27 Line number value is invalid.
26 28 Invalid gcode ID:28 G-code command is missing a required value word.
27 29 Invalid gcode ID:29 G59.x work coordinate systems are not supported.
28 30 Invalid gcode ID:30 G53 only allowed with G0 and G1 motion modes.
29 31 Invalid gcode ID:31 Axis words found in block when no command or current modal state uses them.
30 32 Invalid gcode ID:32 G2 and G3 arcs require at least one in-plane axis word.
31 33 Invalid gcode ID:33 Motion command target is invalid.
32 34 Invalid gcode ID:34 Arc radius value is invalid.
33 35 Invalid gcode ID:35 G2 and G3 arcs require at least one in-plane offset word.
34 36 Invalid gcode ID:36 Unused value words found in block.
35 37 Invalid gcode ID:37 G43.1 dynamic tool length offset is not assigned to configured tool length axis.
36 38 Invalid gcode ID:38 Tool number greater than max supported value.

View File

@ -1,3 +1,110 @@
----------------
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
Author: Sonny Jeon
Subject: Spindle enable pin with variable spindle option fix.
- [fix] When USE_SPINDLE_DIR_AS_ENABLE_PIN is enabled in config.h, the
enable pin was not being set when spindle speed is zero. This behavior
should now be fixed.
----------------
Date: 2016-12-19
Author: Sonny Jeon
Subject: Fixed homing fail alarm handling. Re-integrated software debouncing.
- [bug] Fixed a homing fail issue, where the alarm was not being set
right, not cleared correctly. It would report the wrong code and enter
an infinite alarm loop. This was due to how alarm codes were altered a
while back. Now updated and fixed to show the right codes.
- [feature] Re-installed optional software debouncing for hard limit
switches. By request.
----------------
Date: 2016-12-18
Author: Sonny Jeon

View File

@ -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.

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.
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.

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.
#### 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=`
@ -174,6 +172,7 @@ Every G-code block sent to Grbl and Grbl `$` system command that is terminated w
| **`35`** | A `G2` or `G3` arc, traced with the offset definition, is missing the `IJK` offset word in the selected plane to trace the arc.|
| **`36`** | There are unused, leftover G-code words that aren't used by any command in the block.|
| **`37`** | The `G43.1` dynamic tool length offset command cannot apply an offset to an axis other than its configured axis. The Grbl default axis is the Z-axis.|
| **`38`** | Tool number greater than max supported value.|
----------------------
@ -409,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:v1.1d.20161014:Some string]
[OPT:VL]
[VER:v1.1f.20170131:Some string]
[OPT:VL,16,128]
ok
```
- 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.
- 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 |
| **`N`** | Line numbers enabled |
@ -428,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 |
@ -435,7 +438,8 @@ 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.
```
[echo:G1X0.540Y10.4F100]
@ -567,6 +571,8 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
- The usage of this data is generally for debugging an interface, but is known to be used to control some GUI-specific tasks. While this is disabled by default, GUIs should expect this data field to appear, but they may ignore it, if desired.
- IMPORTANT: Do not use this buffer data to control streaming. During a stream, the reported buffer will often be out-dated and may be incorrect by the time it has been received by the GUI. Instead, please use the streaming protocols outlined. They use Grbl's responses as a direct way to accurately determine the buffer state.
- NOTE: The buffer state values changed from showing "in-use" blocks or bytes to "available". This change does not require the GUI knowing how many block/bytes Grbl has been compiled with.
- This data field appears:

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
@ -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.

View File

@ -8,64 +8,7 @@ struct DummyReg {
uint8_t operator|=(uint8_t x) {return *this = *this | x;}
};
extern DummyReg DDRA;
extern DummyReg DDRB;
extern DummyReg DDRC;
extern DummyReg DDRD;
extern DummyReg PORTA;
extern DummyReg PORTB;
extern DummyReg PORTC;
extern DummyReg PORTD;
extern DummyReg PINA;
extern DummyReg PINB;
extern DummyReg PINC;
extern DummyReg PIND;
extern DummyReg EEAR;
extern DummyReg EECR;
extern DummyReg EEDR;
extern DummyReg EEMPE;
extern DummyReg EEPE;
extern DummyReg OCR2A;
extern DummyReg NotUsed;
extern DummyReg PCICR;
extern DummyReg PCIE0;
extern DummyReg PCIE1;
extern DummyReg PCMSK0;
extern DummyReg PCMSK1;
extern DummyReg TCCR2A;
extern DummyReg TCCR2B;
extern DummyReg UCSR0A;
extern DummyReg UCSR0B;
extern DummyReg U2X0;
extern DummyReg UBRR0H;
extern DummyReg UBRR0L;
extern DummyReg UDR0;
static const int COM1A0 = 0;
static const int COM1A1 = 0;
static const int COM1B0 = 0;
static const int COM1B1 = 0;
static const int COM2A0 = 0;
static const int COM2A1 = 0;
static const int COM2B0 = 0;
static const int COM2B1 = 0;
static const int CS22 = 0;
static const int EEMWE = 0;
static const int EERE = 0;
static const int EEWE = 0;
static const int WGM10 = 0;
static const int WGM11 = 0;
static const int WGM12 = 0;
static const int WGM13 = 0;
static const int WGM20 = 0;
static const int WGM21 = 0;
static const int RXEN0 = 0;
static const int TXEN0 = 0;
static const int RXCIE0 = 0;
static const int UDRIE0 = 0;

View File

@ -35,6 +35,8 @@ void eeprom_init()
void eeprom_commit()
{
if (!memcmp(flash_buffer, flash_memory, flash_size))
return;
unsigned prepCommand[5] = {
50,
flash_sector,

View File

@ -88,7 +88,7 @@ const PWM_Channel_Config PWM1_CH6 = {
(1 << 14), //PWM Enable
(1 << 6), //Latch Enable Register
(0x2 << 20), //PINSEL3 - P1.26
(0x1 << 10) //PINSEL4 - P2.6
(0x1 << 10) //PINSEL4 - P2.5
};

View File

@ -28,7 +28,7 @@ typedef struct _PWM_Channel_Config {
uint32_t LER_Enable_Mask;
//PWM Output Mapping PWM1 PWM2 PWM3 PWM4 PWM5 PWM6
uint32_t PINSEL3_Enable_Mask; //For PWM support on (P1.18, P1.20, P1.21, P1.23, P1.24, P1.26)
uint32_t PINSEL4_Enable_Mask; //For PWM support on (P2.0, P2.1, P2.2, P2.3, P2.4, P2.6)
uint32_t PINSEL4_Enable_Mask; //For PWM support on (P2.0, P2.1, P2.2, P2.3, P2.4, P2.5)
} const PWM_Channel_Config;
extern PWM_Channel_Config PWM1_CH1;

View File

@ -103,12 +103,12 @@
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
// will not be affected by pin sharing.
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
//#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
//#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
// NOTE: The following are two examples to setup homing for 2-axis machines.
// #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
// #define HOMING_CYCLE_0 (1<<X_AXIS) // COREXY COMPATIBLE: First home X
// #define HOMING_CYCLE_1 (1<<Y_AXIS) // COREXY COMPATIBLE: Then home Y
@ -359,10 +359,10 @@
// pwm = scaled value. settings.rpm_min scales to SPINDLE_PWM_MIN_VALUE. settings.rpm_max
// scales to SPINDLE_PWM_MAX_VALUE.
#define SPINDLE_PWM_PERIOD (SystemCoreClock / 40000) // SystemCoreClock / frequency
#define SPINDLE_PWM_OFF_VALUE (SPINDLE_PWM_PERIOD * 0.0) // SPINDLE_PWM_PERIOD * fraction
#define SPINDLE_PWM_MIN_VALUE (SPINDLE_PWM_PERIOD * 0.0) // SPINDLE_PWM_PERIOD * fraction
#define SPINDLE_PWM_MAX_VALUE (SPINDLE_PWM_PERIOD * 1.0) // SPINDLE_PWM_PERIOD * fraction
//#define SPINDLE_PWM_PERIOD (SystemCoreClock / 40000) // SystemCoreClock / frequency
#define SPINDLE_PWM_OFF_VALUE 0.0 // SPINDLE_PWM_PERIOD * fraction
//#define SPINDLE_PWM_MIN_VALUE (SPINDLE_PWM_PERIOD * 0.0) // SPINDLE_PWM_PERIOD * fraction
//#define SPINDLE_PWM_MAX_VALUE (SPINDLE_PWM_PERIOD * 1.0) // SPINDLE_PWM_PERIOD * fraction
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
// The PWM pin will still read 0V when the spindle is disabled. Most users will not need this option, but
@ -379,12 +379,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!
// 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
// 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
@ -597,6 +605,15 @@
#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. 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
// 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
@ -643,13 +660,13 @@
// Define homing/hard limit switch input pins and limit interrupt vectors.
// NOTE: All limit bit pins must be on the same port, but not on a port with other input pins (CONTROL).
#define LIMIT_DDR LPC_GPIO0->FIODIR
#define LIMIT_PIN LPC_GPIO0->FIOPIN
#define LIMIT_PORT LPC_GPIO0->FIOPIN
#define X_LIMIT_BIT 25 // X-MIN=24, X-MAX=25
#define LIMIT_DDR LPC_GPIO1->FIODIR
#define LIMIT_PIN LPC_GPIO1->FIOPIN
#define LIMIT_PORT LPC_GPIO1->FIOPIN
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
#define Y_LIMIT_BIT 27 // Y-MIN=26, Y-MAX=27
#define Z_LIMIT_BIT 29 // Z-MIN=28, Z-MAX=29
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)) // All limit bits
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)) //|(1<<Z_LIMIT_BIT)) // All limit bits
// hard limits not ported #define LIMIT_INT PCIE0 // Pin change interrupt enable pin
// hard limits not ported #define LIMIT_INT_vect PCINT0_vect
// hard limits not ported #define LIMIT_PCMSK PCMSK0 // Pin change interrupt register
@ -677,32 +694,32 @@
*/
// Define flood and mist coolant enable output pins.
#define COOLANT_FLOOD_DDR DDRC
#define COOLANT_FLOOD_PORT PORTC
#define COOLANT_FLOOD_DDR NotUsed
#define COOLANT_FLOOD_PORT NotUsed
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
#define COOLANT_MIST_DDR DDRC
#define COOLANT_MIST_PORT PORTC
#define COOLANT_MIST_DDR NotUsed
#define COOLANT_MIST_PORT NotUsed
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 3
// Define user-control controls (cycle start, reset, feed hold) input pins.
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
#define CONTROL_DDR DDRC
#define CONTROL_PIN PINC
#define CONTROL_PORT PORTC
#define CONTROL_DDR NotUsed
#define CONTROL_PIN NotUsed
#define CONTROL_PORT NotUsed
#define CONTROL_RESET_BIT 0 // Uno Analog Pin 0
#define CONTROL_FEED_HOLD_BIT 1 // Uno Analog Pin 1
#define CONTROL_CYCLE_START_BIT 2 // Uno Analog Pin 2
#define CONTROL_SAFETY_DOOR_BIT 1 // Uno Analog Pin 1 NOTE: Safety door is shared with feed hold. Enabled by config define.
#define CONTROL_INT PCIE1 // Pin change interrupt enable pin
#define CONTROL_INT_vect PCINT1_vect
#define CONTROL_PCMSK PCMSK1 // Pin change interrupt register
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
#define CONTROL_MASK ((1<<CONTROL_RESET_BIT)|(1<<CONTROL_FEED_HOLD_BIT)|(1<<CONTROL_CYCLE_START_BIT)|(1<<CONTROL_SAFETY_DOOR_BIT))
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
// Define probe switch input pin.
#define PROBE_DDR DDRC
#define PROBE_PIN PINC
#define PROBE_PORT PORTC
#define PROBE_DDR NotUsed
#define PROBE_PIN NotUsed
#define PROBE_PORT NotUsed
#define PROBE_BIT 5 // Uno Analog Pin 5
#define PROBE_MASK (1<<PROBE_BIT)
@ -710,54 +727,55 @@
//
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
// Primary pin P1.18 P1.20 P1.21 P1.23 P1.24 P1.26
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.6
#define SPINDLE_PWM_CHANNEL PWM1_CH5
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
#define SPINDLE_PWM_CHANNEL PWM1_CH6
#define SPINDLE_PWM_USE_PRIMARY_PIN false
#define SPINDLE_PWM_USE_SECONDARY_PIN true
// Stepper current control
#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable.
//#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable.
#define CURRENT_MCP44XX_ADDR 0b0101100 // Address of MCP44XX
#define CURRENT_WIPERS {0, 1, 6, 7}; // Wiper registers (X, Y, Z, A)
#define CURRENT_FACTOR 113.33 // Convert amps to digipot value
// Paste default settings definitions here.
#define DEFAULT_X_STEPS_PER_MM 158.0
#define DEFAULT_Y_STEPS_PER_MM 158.0
#define DEFAULT_Z_STEPS_PER_MM 158.0
#define DEFAULT_X_MAX_RATE 30000 // mm/min
#define DEFAULT_Y_MAX_RATE 30000 // mm/min
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
#define DEFAULT_X_ACCELERATION (5000.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_Y_ACCELERATION (5000.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_Z_ACCELERATION (5000.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_X_STEPS_PER_MM 160.0
#define DEFAULT_Y_STEPS_PER_MM 160.0
#define DEFAULT_Z_STEPS_PER_MM 160.0
#define DEFAULT_X_MAX_RATE 24000 // mm/min
#define DEFAULT_Y_MAX_RATE 24000 // mm/min
#define DEFAULT_Z_MAX_RATE 24000 // mm/min
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
#define DEFAULT_X_CURRENT 0.0 // amps
#define DEFAULT_Y_CURRENT 0.0 // amps
#define DEFAULT_Z_CURRENT 0.0 // amps
#define DEFAULT_A_CURRENT 0.0 // amps
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1.0 // rpm
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 1
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
#define DEFAULT_STEPPING_INVERT_MASK 0
#define DEFAULT_DIRECTION_INVERT_MASK 0
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)
#define DEFAULT_STATUS_REPORT_MASK 1 // MPos enabled
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_INVERT_PROBE_PIN 0 // false
#define DEFAULT_LASER_MODE 1 // true
#define DEFAULT_HOMING_ENABLE 0 // false
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
#define DEFAULT_HOMING_FEED_RATE 25.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 1.0 // mm

View File

@ -98,7 +98,7 @@
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
#define COOLANT_MIST_DDR DDRC
#define COOLANT_MIST_PORT PORTC
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 3
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 4
// Define user-control controls (cycle start, reset, feed hold) input pins.
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).

View File

@ -38,9 +38,10 @@
#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_PWM_FREQ 5000 // Hz
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
@ -65,6 +66,49 @@
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#endif
#ifdef DEFAULTS_K40
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
#define DEFAULT_X_STEPS_PER_MM 160.0
#define DEFAULT_Y_STEPS_PER_MM 160.0
#define DEFAULT_Z_STEPS_PER_MM 160.0
#define DEFAULT_X_MAX_RATE 24000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 24000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 24000.0 // mm/min
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_CURRENT 0.0 // amps
#define DEFAULT_Y_CURRENT 0.0 // amps
#define DEFAULT_Z_CURRENT 0.0 // amps
#define DEFAULT_A_CURRENT 0.0 // amps
#define DEFAULT_X_MAX_TRAVEL 300.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 50.0 // mm NOTE: Must be a positive value.
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
#define DEFAULT_STEPPING_INVERT_MASK 0
#define DEFAULT_DIRECTION_INVERT_MASK 0
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_INVERT_ST_ENABLE 0 // false
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_INVERT_PROBE_PIN 0 // false
#define DEFAULT_LASER_MODE 1 // false
#define DEFAULT_HOMING_ENABLE 0 // false
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
#endif
#ifdef DEFAULTS_SHERLINE_5400
// Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors,
// driven by three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding.
@ -80,9 +124,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 +169,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 +214,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 +258,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 +303,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 +348,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 +391,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 +430,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 +469,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

View File

@ -25,6 +25,7 @@
// arbitrary value, and some GUIs may require more. So we increased it based on a max safe
// value when converting a float (7.2 digit precision)s to an integer.
#define MAX_LINE_NUMBER 10000000
#define MAX_TOOL_NUMBER 255 // Limited by max unsigned 8-bit value
#define AXIS_COMMAND_NONE 0
#define AXIS_COMMAND_NON_MODAL 1
@ -251,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;
@ -278,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]
}
@ -310,7 +312,10 @@ uint8_t gc_execute_line(char *line)
// case 'Q': // Not supported
case 'R': word_bit = WORD_R; gc_block.values.r = value; break;
case 'S': word_bit = WORD_S; gc_block.values.s = value; break;
case 'T': word_bit = WORD_T; break; // gc.values.t = int_value;
case 'T': word_bit = WORD_T;
if (value > MAX_TOOL_NUMBER) { FAIL(STATUS_GCODE_MAX_VALUE_EXCEEDED); }
gc_block.values.t = int_value;
break;
case 'X': word_bit = WORD_X; gc_block.values.xyz[X_AXIS] = value; axis_words |= (1<<X_AXIS); break;
case 'Y': word_bit = WORD_Y; gc_block.values.xyz[Y_AXIS] = value; axis_words |= (1<<Y_AXIS); break;
case 'Z': word_bit = WORD_Z; gc_block.values.xyz[Z_AXIS] = value; axis_words |= (1<<Z_AXIS); break;
@ -391,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]
}
}
@ -430,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 (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.
if (gc_block.non_modal_command == NON_MODAL_DWELL) {
@ -945,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); }
@ -1083,7 +1102,13 @@ uint8_t gc_execute_line(char *line)
gc_state.modal.coord_select = 0; // G54
gc_state.modal.spindle = SPINDLE_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
sys.f_override = DEFAULT_FEED_OVERRIDE;
@ -1129,7 +1154,7 @@ uint8_t gc_execute_line(char *line)
group 7 = {G41, G42} cutter radius compensation (G40 is supported)
group 8 = {G43} tool length offset (G43.1/G49 are supported)
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 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_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,15 @@
#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
#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
// 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 coolant; // {M7,M8,M9}
uint8_t spindle; // {M3,M4,M5}
uint8_t override; // {M56}
} gc_modal_t;
typedef struct {

View File

@ -22,8 +22,8 @@
#define grbl_h
// Grbl versioning system
#define GRBL_VERSION "1.1e"
#define GRBL_VERSION_BUILD "20161219"
#define GRBL_VERSION "1.1f"
#define GRBL_VERSION_BUILD "20170131"
// Define standard libraries used by Grbl.
#include <avr/io.h>
@ -79,12 +79,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
/* restriction removed
#if defined(SPINDLE_PWM_MIN_VALUE)
#if !(SPINDLE_PWM_MIN_VALUE > 0)
@ -105,6 +115,7 @@
#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
#error "Override refresh must be greater than zero."
#endif
// ---------------------------------------------------------------------------------------
#endif

View File

@ -24,48 +24,14 @@
void isr_init();
/*Holding space for dummy registers*/
DummyReg DDRA;
DummyReg DDRB;
DummyReg DDRC;
DummyReg DDRD;
DummyReg PORTA;
DummyReg PORTB;
DummyReg PORTC;
DummyReg PORTD;
DummyReg PINA;
DummyReg PINB;
DummyReg PINC;
DummyReg PIND;
DummyReg EEAR;
DummyReg EECR;
DummyReg EEDR;
DummyReg EEMPE;
DummyReg EEPE;
DummyReg OCR2A;
DummyReg PCICR;
DummyReg PCIE0;
DummyReg PCIE1;
DummyReg PCMSK0;
DummyReg PCMSK1;
DummyReg TCCR2A;
DummyReg TCCR2B;
DummyReg UCSR0A;
DummyReg UCSR0B;
DummyReg U2X0;
DummyReg UBRR0H;
DummyReg UBRR0L;
DummyReg UDR0;
extern DummyReg NotUsed;
extern DummyReg PCICR;
extern DummyReg PCIE1;
// 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.

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.
}
#ifdef PARKING_ENABLE
// 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

View File

@ -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);

View File

@ -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 == OVERRIDE_PARKING_MOTION)) {
#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 == OVERRIDE_PARKING_MOTION)) {
#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 == OVERRIDE_PARKING_MOTION)) {
#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

View File

@ -71,6 +71,7 @@ static void report_util_setting_string(uint8_t n) {
case 30: printPgmString(PSTR("rpm max")); break;
case 31: printPgmString(PSTR("rpm min")); break;
case 32: printPgmString(PSTR("laser")); break;
case 33: printPgmString(PSTR("spindle_pwm_freq")); break;
default:
n -= AXIS_SETTINGS_START_VAL;
uint8_t idx = 0;
@ -96,6 +97,11 @@ static void report_util_uint8_setting(uint8_t n, int val) {
print_uint8_base10(val);
report_util_line_feed(); // report_util_setting_string(n);
}
static void report_util_uint32_setting(uint8_t n, int val) {
report_util_setting_prefix(n);
print_uint32_base10(val);
report_util_line_feed(); // report_util_setting_string(n);
}
static void report_util_float_setting(uint8_t n, float val, uint8_t n_decimal) {
report_util_setting_prefix(n);
printFloat(val,n_decimal);
@ -208,6 +214,7 @@ void report_grbl_settings() {
#else
report_util_uint8_setting(32,0);
#endif
report_util_uint32_setting(33,settings.spindle_pwm_freq);
// Print axis settings
uint8_t idx, set_idx;
uint8_t val = AXIS_SETTINGS_START_VAL;
@ -328,6 +335,13 @@ void report_gcode_modes()
else { serial_write('9'); }
#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"));
print_uint8_base10(gc_state.tool);
@ -394,6 +408,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
@ -412,9 +438,16 @@ 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.
serial_write(',');
print_uint8_base10(BLOCK_BUFFER_SIZE-1);
serial_write(',');
print_uint32_base10(RX_BUFFER_SIZE);
report_util_feedback_line_feed();
}

View File

@ -57,6 +57,7 @@
#define STATUS_GCODE_NO_OFFSETS_IN_PLANE 35
#define STATUS_GCODE_UNUSED_WORDS 36
#define STATUS_GCODE_G43_DYNAMIC_AXIS_ERROR 37
#define STATUS_GCODE_MAX_VALUE_EXCEEDED 38
// Define Grbl alarm codes. Valid values (1-255). 0 is reserved.
#define ALARM_HARD_LIMIT_ERROR EXEC_ALARM_HARD_LIMIT

View File

@ -112,6 +112,7 @@ void serial_init()
#endif
}
/*
void legacy_serial_init()
{
// Set baud rate
@ -130,6 +131,7 @@ void legacy_serial_init()
// defaults to 8-bit, no parity, 1 stop bit
}
*/
// Writes one byte to the TX serial buffer. Called by main program.
void serial_write(uint8_t data) {
@ -154,7 +156,7 @@ void serial_write(uint8_t data) {
serialDriver.Send(serial_tx_buffer, 1);
#endif
}
/*
// Writes one byte to the TX serial buffer. Called by main program.
void legacy_serial_write(uint8_t data) {
// Calculate next head
@ -174,7 +176,7 @@ void legacy_serial_write(uint8_t data) {
// Enable Data Register Empty Interrupt to make sure tx-streaming is running
UCSR0B |= (1 << UDRIE0);
}
*/
//Device driver interrupt
// The CMSIS Driver doesn't have seperate interrupts/callbacks available for TX and RX but instead
// is a single composite interrupt.
@ -190,6 +192,7 @@ void serialInterrupt(uint32_t event) {
//We don't use TX interrupts directly with the ARM Driver.
// Data Register Empty Interrupt handler
/*
void legacy_TX_ISR(void* SERIAL_UDRE)
{
uint8_t tail = serial_tx_buffer_tail; // Temporary serial_tx_buffer_tail (to optimize for volatile)
@ -206,7 +209,7 @@ void legacy_TX_ISR(void* SERIAL_UDRE)
// Turn off Data Register Empty Interrupt to stop tx-streaming if this concludes the transfer
if (tail == serial_tx_buffer_head) { UCSR0B &= ~(1 << UDRIE0); }
}
*/
// Fetches the first byte in the serial read buffer. Called by main program.
uint8_t serial_read()

View File

@ -86,6 +86,7 @@ void settings_restore(uint8_t restore_flag) {
settings.junction_deviation = DEFAULT_JUNCTION_DEVIATION;
settings.arc_tolerance = DEFAULT_ARC_TOLERANCE;
settings.spindle_pwm_freq = DEFAULT_SPINDLE_PWM_FREQ;
settings.rpm_max = DEFAULT_SPINDLE_RPM_MAX;
settings.rpm_min = DEFAULT_SPINDLE_RPM_MIN;
@ -317,6 +318,7 @@ uint8_t settings_store_global_setting(uint8_t parameter, float value) {
return(STATUS_SETTING_DISABLED);
#endif
break;
case 33: settings.spindle_pwm_freq = value; spindle_init(); break; // Re-initialize spindle pwm calibration
default:
return(STATUS_INVALID_STATEMENT);
}

View File

@ -92,6 +92,7 @@ typedef struct {
float junction_deviation;
float arc_tolerance;
uint16_t spindle_pwm_freq;
float rpm_max;
float rpm_min;

View File

@ -25,13 +25,23 @@
#ifdef VARIABLE_SPINDLE
static float pwm_gradient; // Precalulated value to speed up rpm to PWM conversions.
static float spindle_pwm_period;
static float spindle_pwm_off_value;
static float spindle_pwm_min_value;
static float spindle_pwm_max_value;
#endif
void spindle_init()
{
#ifdef VARIABLE_SPINDLE
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, SPINDLE_PWM_PERIOD, 0);
spindle_pwm_period = (SystemCoreClock / settings.spindle_pwm_freq);
spindle_pwm_off_value = (spindle_pwm_period * 0.0); // SPINDLE_PWM_PERIOD * fraction
spindle_pwm_min_value = (spindle_pwm_period * 0.0); // SPINDLE_PWM_PERIOD * fraction
spindle_pwm_max_value = (spindle_pwm_period * 1.0); // SPINDLE_PWM_PERIOD * fraction
//pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, SPINDLE_PWM_PERIOD, 0);
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0); //SPINDLE_PWM_PERIOD
pwm_enable(&SPINDLE_PWM_CHANNEL);
/* not ported
@ -44,7 +54,8 @@ void spindle_init()
#endif
*/
pwm_gradient = (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)/(settings.rpm_max-settings.rpm_min);
//pwm_gradient = (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)/(settings.rpm_max-settings.rpm_min);
pwm_gradient = (spindle_pwm_max_value-spindle_pwm_min_value)/(settings.rpm_max-settings.rpm_min);
#else
/* not ported
@ -134,21 +145,21 @@ void spindle_stop()
rpm *= (0.010*sys.spindle_speed_ovr); // Scale by spindle speed override value.
if (rpm <= 0) {
sys.spindle_speed = 0;
pwm_value = SPINDLE_PWM_OFF_VALUE;
pwm_value = spindle_pwm_off_value; //SPINDLE_PWM_OFF_VALUE
}
else if (rpm <= settings.rpm_min) {
sys.spindle_speed = settings.rpm_min;
pwm_value = SPINDLE_PWM_MIN_VALUE;
pwm_value = spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE
}
else if (rpm >= settings.rpm_max) {
sys.spindle_speed = settings.rpm_max;
pwm_value = SPINDLE_PWM_MAX_VALUE - 1;
pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE
}
else {
sys.spindle_speed = rpm;
pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + SPINDLE_PWM_MIN_VALUE;
if(pwm_value >= SPINDLE_PWM_MAX_VALUE)
pwm_value = SPINDLE_PWM_MAX_VALUE - 1;
pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE
if(pwm_value >= spindle_pwm_max_value) //SPINDLE_PWM_MAX_VALUE
pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE
}
return(pwm_value);
}
@ -190,7 +201,9 @@ void spindle_stop()
if (state == SPINDLE_ENABLE_CCW) { rpm = 0.0; } // TODO: May need to be rpm_min*(100/MAX_SPINDLE_SPEED_OVERRIDE);
}
spindle_set_speed(spindle_compute_pwm_value(rpm));
#else
#endif
#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.
/* not ported

View File

@ -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
@ -646,8 +652,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.

View File

@ -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
@ -155,7 +158,7 @@ extern volatile uint8_t sys_rt_exec_accessory_override; // Global realtime execu
#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