Compare commits
77 Commits
Author | SHA1 | Date | |
---|---|---|---|
cf6dd107c1 | |||
c284649b04 | |||
427943e224 | |||
d21a05192c | |||
035ac54393 | |||
4e3dd7ae0e | |||
99b0441562 | |||
58aead3980 | |||
47880f153d | |||
62fe6d61e3 | |||
57d4b642ab | |||
23e140075f | |||
db50f0a023 | |||
a506a8936a | |||
4e191e8679 | |||
ddb59cb335 | |||
0f9c02842c | |||
1ae790ee6c | |||
84070bf791 | |||
843c7b01d6 | |||
04f8621ef9 | |||
e21a807008 | |||
ffdd368642 | |||
9b6300a872 | |||
b09170d1b5 | |||
8ff3d5322c | |||
a7ba369987 | |||
ac6817f7e2 | |||
86875c21da | |||
fb20eeb1ea | |||
0721e573ef | |||
f1976d8726 | |||
97f22ffa1e | |||
92b093ee43 | |||
5ad7af8dfb | |||
96ad0afdda | |||
4252f75a84 | |||
dc92bf565e | |||
436615095f | |||
a661778252 | |||
54ae403094 | |||
06e9bf8f82 | |||
f904fff7ba | |||
b24e01d588 | |||
ba4e83723f | |||
14983881ee | |||
eeb206ec97 | |||
83c1b57c41 | |||
50c13a1868 | |||
8856b3fef4 | |||
73cdb2f722 | |||
b28fd39e7d | |||
1f0ab33787 | |||
d85bfa8c83 | |||
da946353c8 | |||
b1ecb47bec | |||
f7083b9491 | |||
17121a2652 | |||
b48c3c7c51 | |||
0471485259 | |||
063b1f6748 | |||
5a862a5e30 | |||
612b781e3e | |||
ee65b9a7e2 | |||
ed82dd90b6 | |||
f51268e855 | |||
beaa40583c | |||
e455764079 | |||
31a83558ad | |||
a91c8b1b04 | |||
c66e549633 | |||
b1d83c2892 | |||
3ebbfa4dd3 | |||
e0438230b5 | |||
0fe1caff33 | |||
67ab9280d9 | |||
30c0f79afd |
21
DOCKER_LICENSE
Normal file
21
DOCKER_LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Ryan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
32
DOCKER_README.md
Normal file
32
DOCKER_README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# Arm Embedded Docker Environment
|
||||
Minimal docker environment for building arm-embedded projects
|
||||
|
||||
## Usage
|
||||
Run interactively with ```docker run -it --rm -v `pwd`:/root ryankurte/docker-arm-embedded /bin/bash```.
|
||||
This will create a temporal instance (changes will be dropped on exit) with a binding from the current directory to the root user home directory.
|
||||
|
||||
If you are using selinux you may need to add a ```:z``` to the end of the -v parameter to indicate the mount is shared.
|
||||
|
||||
```docker run -it --rm -v `pwd`:/root:z ryankurte/docker-arm-embedded /bin/bash```
|
||||
|
||||
https://docs.docker.com/storage/bind-mounts/
|
||||
|
||||
### Building grbl-LPC
|
||||
Update the grbl/config.h and uncomment the CPU_MAP define statement for the board you are compiling for
|
||||
|
||||
```
|
||||
git submodule init
|
||||
git submodule update
|
||||
make
|
||||
```
|
||||
|
||||
The resulting firmware file is build/firmware.bin
|
||||
|
||||
## Includes:
|
||||
- build-essential (native)
|
||||
- make, cmake
|
||||
- gawk, genromfs, ccache
|
||||
- arm-none-eabi from [launchpad.net](https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded)
|
||||
- [Yotta](http://yotta.mbed.com/)
|
||||
|
||||
|
62
Dockerfile
Normal file
62
Dockerfile
Normal file
@ -0,0 +1,62 @@
|
||||
FROM ubuntu:latest
|
||||
MAINTAINER Ryan Kurte <ryankurte@gmail.com>
|
||||
LABEL Description="Docker image for building arm-embedded projects"
|
||||
|
||||
# General dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
subversion \
|
||||
curl \
|
||||
cmake \
|
||||
make \
|
||||
automake \
|
||||
autoconf \
|
||||
python-setuptools \
|
||||
ninja-build \
|
||||
python-dev \
|
||||
libtool \
|
||||
unzip \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0.0 \
|
||||
libusb-1.0.0-dev \
|
||||
software-properties-common \
|
||||
python-software-properties \
|
||||
gawk \
|
||||
genromfs \
|
||||
ccache \
|
||||
clang \
|
||||
build-essential \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
libprotobuf-dev \
|
||||
protobuf-compiler \
|
||||
libprotobuf-c-dev \
|
||||
protobuf-c-compiler \
|
||||
python-protobuf
|
||||
|
||||
# arm-none-eabi custom ppa
|
||||
RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
|
||||
apt-get update && \
|
||||
apt-get install -y gcc-arm-embedded
|
||||
|
||||
# Yotta
|
||||
RUN easy_install pip && \
|
||||
pip install yotta && \
|
||||
mkdir -p /usr/local/lib/yotta_modules \
|
||||
chown $USER /usr/local/lib/yotta_modules \
|
||||
chmod 755 /usr/local/lib/yotta_modules
|
||||
|
||||
# Pyserial for serial programming
|
||||
RUN pip install pyserial
|
||||
|
||||
# STLink util
|
||||
RUN git clone https://github.com/texane/stlink.git && \
|
||||
cd stlink && mkdir build && cd build && \
|
||||
cmake .. && make && make install
|
||||
|
||||
# Cleanup
|
||||
RUN apt-get clean && \
|
||||
rm -rf /var/lib/apt
|
||||
|
2
Makefile
2
Makefile
@ -157,7 +157,7 @@ build/%.hex : build/%.elf
|
||||
|
||||
.PHONY: flash
|
||||
flash: build/grbl.hex
|
||||
fm COM(13, 115200) DEVICE(LPC1769, 0.000000, 0) HARDWARE(BOOTEXEC, 50, 100) ERASEUSED(build\grbl.hex, PROTECTISP) HEXFILE(build\grbl.hex, NOCHECKSUMS, NOFILL, PROTECTISP)
|
||||
fm COM(15, 115200) DEVICE(LPC1769, 0.000000, 0) HARDWARE(BOOTEXEC, 50, 100) ERASEUSED(build\grbl.hex, PROTECTISP) HEXFILE(build\grbl.hex, NOCHECKSUMS, NOFILL, PROTECTISP)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
121
README.md
121
README.md
@ -1,118 +1,17 @@
|
||||

|
||||

|
||||
|
||||
***
|
||||
Old releases are in the `Release` tab. See [cprezzi's branch](https://github.com/cprezzi/grbl-LPC) for more recent releases.
|
||||
Note: cprezzi's branch disables current control and has defaults more suitable for other boards.
|
||||
***
|
||||
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
|
||||
|
||||
Usage notes:
|
||||
* This uses a different usb-serial driver than Smoothieware. Windows 10 should recognize it automatically.
|
||||
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
|
||||
* 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)
|
||||
* Minimum S value: 0.0 ($31)
|
||||
* Maximum S value: 1.0 ($30)
|
||||
* Homing not tested
|
||||
* Hard limits not yet ported
|
||||
* Control inputs not yet ported (e.g. Cycle Start and Safety Door switches)
|
||||
-----
|
||||
|
||||
New configuration settings
|
||||
* $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!
|
||||
**Settings for MKS sbase 1.3 and CoreXY**
|
||||
|
||||
Build notes:
|
||||
* Include ```make``` and the ```arm-none-eabi-*``` tools in your path.
|
||||
* 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
|
||||
and is primarilly for developers who don't want to keep swapping sdcards. If you flash this,
|
||||
then you'll have to reflash the bootloader if you want to go back.
|
||||
***
|
||||
Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. This version of Grbl runs on an Arduino with a 328p processor (Uno, Duemilanove, Nano, Micro, etc).
|
||||

|
||||
|
||||
The controller is written in highly optimized C utilizing every clever feature of the AVR-chips to achieve precise timing and asynchronous operation. It is able to maintain up to 30kHz of stable, jitter free control pulses.
|
||||

|
||||
|
||||
It accepts standards-compliant g-code and has been tested with the output of several CAM tools with no problems. Arcs, circles and helical motion are fully supported, as well as, all other primary g-code commands. Macro functions, variables, and most canned cycles are not supported, but we think GUIs can do a much better job at translating them into straight g-code anyhow.
|
||||
|
||||
Grbl includes full acceleration management with look ahead. That means the controller will look up to 16 motions into the future and plan its velocities ahead to deliver smooth acceleration and jerk-free cornering.
|
||||
|
||||
* [Licensing](https://github.com/gnea/grbl/wiki/Licensing): Grbl is free software, released under the GPLv3 license.
|
||||
|
||||
* For more information and help, check out our **[Wiki pages!](https://github.com/gnea/grbl/wiki)** If you find that the information is out-dated, please to help us keep it updated by editing it or notifying our community! Thanks!
|
||||
|
||||
* Lead Developer: Sungeun "Sonny" Jeon, Ph.D. (USA) aka @chamnit
|
||||
|
||||
* Built on the wonderful Grbl v0.6 (2011) firmware written by Simen Svale Skogsrud (Norway).
|
||||
|
||||
***
|
||||
|
||||
### Official Supporters of the Grbl CNC Project
|
||||

|
||||
|
||||
|
||||
***
|
||||
|
||||
##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.
|
||||
|
||||
- **Jogging Mode** : The new jogging commands are independent of the g-code parser, so that the parser state doesn't get altered and cause a potential crash if not restored properly. Documentation is included on how this works and how it can be used to control your machine via a joystick or rotary dial with a low-latency, satisfying response.
|
||||
|
||||
- **Laser Mode** : The new "laser" mode will cause Grbl to move continuously through consecutive G1, G2, and G3 commands with spindle speed changes. When "laser" mode is disabled, Grbl will instead come to a stop to ensure a spindle comes up to speed properly. Spindle speed overrides also work with laser mode so you can tweak the laser power, if you need to during the job. Switch between "laser" mode and "normal" mode via a `$` setting.
|
||||
|
||||
- **Dynamic Laser Power Scaling with Speed** : If your machine has low accelerations, Grbl will automagically scale the laser power based on how fast Grbl is traveling, so you won't have burnt corners when your CNC has to make a turn! Enabled by the `M4` spindle CCW command when laser mode is enabled!
|
||||
|
||||
- **Sleep Mode** : Grbl may now be put to "sleep" via a `$SLP` command. This will disable everything, including the stepper drivers. Nice to have when you are leaving your machine unattended and want to power down everything automatically. Only a reset exits the sleep state.
|
||||
|
||||
- **Significant Interface Improvements**: Tweaked to increase overall performance, include lots more real-time data, and to simplify maintaining and writing GUIs. Based on direct feedback from multiple GUI developers and bench performance testing. _NOTE: GUIs need to specifically update their code to be compatible with v1.1 and later._
|
||||
|
||||
- **New Status Reports**: To account for the additional override data, status reports have been tweaked to cram more data into it, while still being smaller than before. Documentation is included, outlining how it has been changed.
|
||||
- **Improved Error/Alarm Feedback** : All Grbl error and alarm messages have been changed to providing a code. Each code is associated with a specific problem, so users will know exactly what is wrong without having to guess. Documentation and an easy to parse CSV is included in the repo.
|
||||
- **Extended-ASCII realtime commands** : All overrides and future real-time commands are defined in the extended-ASCII character space. Unfortunately not easily type-able on a keyboard, but helps prevent accidental commands from a g-code file having these characters and gives lots of space for future expansion.
|
||||
- **Message Prefixes** : Every message type from Grbl has a unique prefix to help GUIs immediately determine what the message is and parse it accordingly without having to know context. The prior interface had several instances of GUIs having to figure out the meaning of a message, which made everything more complicated than it needed to be.
|
||||
|
||||
- New OEM specific features, such as safety door parking, single configuration file build option, EEPROM restrictions and restoring controls, and storing product data information.
|
||||
|
||||
- New safety door parking motion as a compile-option. Grbl will retract, disable the spindle/coolant, and park near Z max. When resumed, it will perform these task in reverse order and continue the program. Highly configurable, even to add more than one parking motion. See config.h for details.
|
||||
|
||||
- New '$' Grbl settings for max and min spindle rpm. Allows for tweaking the PWM output to more closely match true spindle rpm. When max rpm is set to zero or less than min rpm, the PWM pin D11 will act like a simple enable on/off output.
|
||||
|
||||
- Updated G28 and G30 behavior from NIST to LinuxCNC g-code description. In short, if a intermediate motion is specified, only the axes specified will move to the stored coordinates, not all axes as before.
|
||||
|
||||
- Lots of minor bug fixes and refactoring to make the code more efficient and flexible.
|
||||
|
||||
- **NOTE:** Arduino Mega2560 support has been moved to an active, official Grbl-Mega [project](http://www.github.com/gnea/grbl-Mega/). All new developments here and there will be synced when it makes sense to.
|
||||
|
||||
|
||||
-
|
||||
|
||||
```
|
||||
List of Supported G-Codes in Grbl v1.1:
|
||||
- Non-Modal Commands: G4, G10L2, G10L20, G28, G30, G28.1, G30.1, G53, G92, G92.1
|
||||
- Motion Modes: G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80
|
||||
- Feed Rate Modes: G93, G94
|
||||
- Unit Modes: G20, G21
|
||||
- Distance Modes: G90, G91
|
||||
- Arc IJK Distance Modes: G91.1
|
||||
- Plane Select Modes: G17, G18, G19
|
||||
- Tool Length Offset Modes: G43.1, G49
|
||||
- Cutter Compensation Modes: G40
|
||||
- Coordinate System Modes: G54, G55, G56, G57, G58, G59
|
||||
- Control Modes: G61
|
||||
- Program Flow: M0, M1, M2, M30*
|
||||
- Coolant Control: M7*, M8, M9
|
||||
- Spindle Control: M3, M4, M5
|
||||
- Valid Non-Command Words: F, I, J, K, L, N, P, R, S, T, X, Y, Z
|
||||
```
|
||||
|
||||
-------------
|
||||
Grbl is an open-source project and fueled by the free-time of our intrepid administrators and altruistic users. If you'd like to donate, all proceeds will be used to help fund supporting hardware and testing equipment. Thank you!
|
||||
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CUGXJHXA36BYW)
|
||||
[Laser4Web .env Settings](https://github.com/LaserWeb/lw.comm-server/wiki/Environment-File-(.env))
|
@ -86,6 +86,7 @@ static U8 txdata[VCOM_FIFO_SIZE];
|
||||
static fifo_t txfifo;
|
||||
//static fifo_t rxfifo;
|
||||
|
||||
static UsbSerialLineStateCallback* usbSerialLineStateCallback = nullptr;
|
||||
static UsbSerialReadCallback* usbSerialReadCallback = nullptr;
|
||||
|
||||
// forward declaration of interrupt handler
|
||||
@ -299,10 +300,13 @@ static BOOL HandleClassRequest(TSetupPacket *pSetup, int *piLen, U8 **ppbData)
|
||||
break;
|
||||
|
||||
// set control line state
|
||||
case SET_CONTROL_LINE_STATE:
|
||||
// bit0 = DTR, bit = RTS
|
||||
|
||||
break;
|
||||
case SET_CONTROL_LINE_STATE: {
|
||||
bool dtr = (pSetup->wValue >> 0) & 1;
|
||||
bool rts = (pSetup->wValue >> 1) & 1;
|
||||
if (usbSerialLineStateCallback)
|
||||
usbSerialLineStateCallback(dtr, rts);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
@ -376,8 +380,9 @@ void enable_USB_interrupts(void);
|
||||
main
|
||||
====
|
||||
**************************************************************************/
|
||||
int usbSerialInit(UsbSerialReadCallback* usbSerialReadCallback)
|
||||
int usbSerialInit(UsbSerialLineStateCallback* usbSerialLineStateCallback, UsbSerialReadCallback* usbSerialReadCallback)
|
||||
{
|
||||
::usbSerialLineStateCallback = usbSerialLineStateCallback;
|
||||
::usbSerialReadCallback = usbSerialReadCallback;
|
||||
|
||||
// initialise stack
|
||||
|
@ -98,10 +98,13 @@ void VCOM_gets_echo(char *str); // gets string terminated in '\r' or '\n' and ec
|
||||
|
||||
#include "serial_fifo.h"
|
||||
|
||||
// Receives line state. Called by an interrupt.
|
||||
typedef void UsbSerialLineStateCallback(bool dtr, bool rts);
|
||||
|
||||
// Receives serial data. Called by an interrupt.
|
||||
typedef void UsbSerialReadCallback(const U8* data, unsigned len);
|
||||
|
||||
int usbSerialInit(UsbSerialReadCallback* usbSerialReadCallback); // run once in main b4 main loop starts.
|
||||
int usbSerialInit(UsbSerialLineStateCallback* usbSerialLineStateCallback, UsbSerialReadCallback* usbSerialReadCallback); // run once in main b4 main loop starts.
|
||||
|
||||
/*
|
||||
Writes one character to VCOM port
|
||||
|
@ -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,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,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 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.
|
||||
|
||||
|
||||
----------------
|
||||
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
|
||||
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
|
||||
|
@ -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=`
|
||||
@ -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:
|
||||
|
@ -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.
|
||||
|
@ -51,6 +51,7 @@ $27=1.000
|
||||
$30=1000.
|
||||
$31=0.
|
||||
$32=0
|
||||
$33=5000
|
||||
$100=250.000
|
||||
$101=250.000
|
||||
$102=250.000
|
||||
@ -63,6 +64,9 @@ $122=10.000
|
||||
$130=200.000
|
||||
$131=200.000
|
||||
$132=200.000
|
||||
$140=0.000
|
||||
$141=0.000
|
||||
$142=0.000
|
||||
```
|
||||
|
||||
#### $x=val - Save Grbl setting
|
||||
@ -227,6 +231,10 @@ When enabled, Grbl will move continuously through consecutive `G1`, `G2`, or `G3
|
||||
|
||||
When disabled, Grbl will operate as it always has, stopping motion with every `S` spindle speed command. This is the default operation of a milling machine to allow a pause to let the spindle change speeds.
|
||||
|
||||
#### $33 - Spindle/Laser PWM frequency
|
||||
|
||||
This sets the PWM frequency.
|
||||
|
||||
#### $100, $101 and $102 – [X,Y,Z] steps/mm
|
||||
|
||||
Grbl needs to know how far each step will take the tool in reality. To calculate steps/mm for an axis of your machine you need to know:
|
||||
|
BIN
doc/media/48491571-d99a3080-e862-11e8-8367-4408a5589503.png
Normal file
BIN
doc/media/48491571-d99a3080-e862-11e8-8367-4408a5589503.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
BIN
doc/media/49279485-9aa2e680-f4c2-11e8-98bd-cce3caf5c8dd.jpeg
Normal file
BIN
doc/media/49279485-9aa2e680-f4c2-11e8-98bd-cce3caf5c8dd.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 114 KiB |
BIN
doc/media/Thumbs.db
Normal file
BIN
doc/media/Thumbs.db
Normal file
Binary file not shown.
@ -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;
|
||||
|
@ -55,7 +55,7 @@ void current_init()
|
||||
set_current(0, settings.current[0]);
|
||||
set_current(1, settings.current[1]);
|
||||
set_current(2, settings.current[2]);
|
||||
set_current(3, DEFAULT_A_CURRENT);
|
||||
set_current(3, settings.current[3]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,11 @@
|
||||
|
||||
void delay_init()
|
||||
{
|
||||
LPC_TIM3->CTCR = 0; // timer mode
|
||||
LPC_TIM3->PR = 0; // no prescale
|
||||
LPC_TIM3->MCR = 0; // no MR actions
|
||||
LPC_TIM3->CCR = 0; // no capture
|
||||
LPC_TIM3->EMR = 0; // no external match
|
||||
LPC_TIM3->TCR = 0b10; // reset
|
||||
LPC_TIM3->TCR = 0b01; // enable
|
||||
LPC_TIM3->CTCR = 0; // Count Control (0=TimerMode, 1-3=EdgeCounterMode)
|
||||
LPC_TIM3->PR = 0; // no Prescale (TC increments ever PR+1 clocks)
|
||||
LPC_TIM3->MCR = 0; // no Match Control actions
|
||||
LPC_TIM3->CCR = 0; // no Capture Control actions
|
||||
LPC_TIM3->EMR = 0; // no External Match (controls external match pins)
|
||||
LPC_TIM3->TCR = 0b10; // reset Timer Control (0b10=Reset, 0b01=Enable)
|
||||
LPC_TIM3->TCR = 0b01; // enable Timer Control (0b10=Reset, 0b01=Enable)
|
||||
}
|
||||
|
@ -25,35 +25,38 @@ static constexpr unsigned flash_addr = 0xF000; // Last 4k sec
|
||||
static constexpr unsigned flash_size = 1024; // Only using 1k of a 4k sector
|
||||
static char *flash_memory = (char *)flash_addr; // Flash memory
|
||||
static char flash_buffer[flash_size] __attribute__((aligned(4))); // Copy of flash memory
|
||||
using Iap = void(unsigned[], unsigned[]); // IAP entry point
|
||||
static const Iap *iap = (Iap *)0x1FFF1FF1; // IAP entry point
|
||||
using Iap = void(unsigned[], unsigned[]); // IAP entry point function
|
||||
static const Iap *iap = (Iap *)0x1FFF1FF1; // IAP entry point address
|
||||
|
||||
void eeprom_init()
|
||||
{
|
||||
memcpy(flash_buffer, flash_memory, flash_size);
|
||||
memcpy(flash_buffer, flash_memory, flash_size); // Copy flash memory into local flash buffer
|
||||
}
|
||||
|
||||
void eeprom_commit()
|
||||
{
|
||||
if (!memcmp(flash_buffer, flash_memory, flash_size))
|
||||
return; // No changes to commit
|
||||
unsigned prepCommand[5] = {
|
||||
50,
|
||||
flash_sector,
|
||||
flash_sector,
|
||||
50, // Prepare sector(s) for write operation
|
||||
flash_sector, // Start sector
|
||||
flash_sector, // End sector
|
||||
};
|
||||
unsigned eraseCommand[5] = {
|
||||
52,
|
||||
flash_sector,
|
||||
flash_sector,
|
||||
SystemCoreClock / 1000,
|
||||
52, // Erase sector(s)
|
||||
flash_sector, // Start sector
|
||||
flash_sector, // End sector
|
||||
SystemCoreClock / 1000, // CPU clock frequency in kHz
|
||||
};
|
||||
unsigned writeCommand[5] = {
|
||||
51,
|
||||
flash_addr,
|
||||
(unsigned)flash_buffer,
|
||||
flash_size,
|
||||
SystemCoreClock / 1000,
|
||||
51, // Copy RAM to Flash
|
||||
flash_addr, // Destination flash address (256-byte boundary)
|
||||
(unsigned)flash_buffer, // Source RAM address (word boundary)
|
||||
flash_size, // Number of bytes to write (must be: 256, 512, 1024, 4096)
|
||||
SystemCoreClock / 1000, // CPU clock frequency in kHz
|
||||
};
|
||||
unsigned output[5];
|
||||
// Run In-Application Programming (IAP) routines
|
||||
iap(prepCommand, output);
|
||||
iap(eraseCommand, output);
|
||||
iap(prepCommand, output);
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
220
grbl/config.h
220
grbl/config.h
@ -31,12 +31,22 @@
|
||||
#include "LPC17xx.h"
|
||||
|
||||
|
||||
// Define CPU pin map and default settings.
|
||||
// NOTE: OEMs can avoid the need to maintain/update the defaults.h and cpu_map.h files and use only
|
||||
// one configuration file by placing their specific defaults and pin map at the bottom of this file.
|
||||
// If doing so, simply comment out these two defines and see instructions below.
|
||||
// #define DEFAULTS_GENERIC
|
||||
// #define CPU_MAP_ATMEGA328P // Arduino Uno CPU
|
||||
// Define board type for pin map and default settings.
|
||||
//#define CPU_MAP_SMOOTHIEBOARD // Smoothieboard (NXP LPC1769 MCU)
|
||||
//#define CPU_MAP_C3D_REMIX // Cohesion3D Remix (NXP LPC1769 MCU)
|
||||
//#define CPU_MAP_C3D_MINI // Cohesion3D Mini (NXP LPC1769 MCU)
|
||||
#define CPU_MAP_MKS_SBASE // MKS SBASE Board (NXP LPC1768 MCU)
|
||||
//#define CPU_MAP_AZTEEG_X5 // Azteeg X5 Board (NXP LPC1769 MCU)
|
||||
|
||||
// Force other Spindle PWM Pin (default is P2.5)
|
||||
//#define SPINDLE_PWM_PIN_1_23
|
||||
//#define SPINDLE_PWM_PIN_2_4
|
||||
|
||||
// Define machine type for machine specific defaults
|
||||
//#define DEFAULTS_GENERIC
|
||||
#define DEFAULTS_K40
|
||||
//#define DEFAULTS_FABKIT
|
||||
//#define DEFAULTS_JONAS
|
||||
|
||||
// Serial baud rate
|
||||
// #define BAUD_RATE 230400
|
||||
@ -103,8 +113,9 @@
|
||||
// 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.
|
||||
// NOTE: Homing cycle pattern is defined in Machine defaults!!!
|
||||
// #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.
|
||||
@ -114,7 +125,7 @@
|
||||
// #define HOMING_CYCLE_1 (1<<Y_AXIS) // COREXY COMPATIBLE: Then home Y
|
||||
|
||||
// Number of homing cycles performed after when the machine initially jogs to limit switches.
|
||||
// This help in preventing overshoot and should improve repeatability. This value should be one or
|
||||
// This helps in preventing overshoot and should improve repeatability. This value should be one or
|
||||
// greater.
|
||||
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)
|
||||
|
||||
@ -129,6 +140,9 @@
|
||||
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
|
||||
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
|
||||
|
||||
// Uncomment this define to force Grbl to always set the machine origin at bottom left.
|
||||
#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
|
||||
|
||||
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
|
||||
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may
|
||||
// be stored and executed in order. These startup blocks would typically be used to set the g-code
|
||||
@ -167,13 +181,13 @@
|
||||
// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno
|
||||
// analog pin 4. Only use this option if you require a second coolant control pin.
|
||||
// NOTE: The M8 flood coolant control pin on analog pin 3 will still be functional regardless.
|
||||
// #define ENABLE_M7 // Disabled by default. Uncomment to enable.
|
||||
//#define ENABLE_M7 // Disabled by default. Uncomment to enable.
|
||||
|
||||
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,
|
||||
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
|
||||
// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the
|
||||
// previous tool path, as if nothing happened.
|
||||
// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
|
||||
//#define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
|
||||
|
||||
// After the safety door switch has been toggled and restored, this setting sets the power-up delay
|
||||
// between restoring the spindle and coolant and resuming the cycle.
|
||||
@ -187,7 +201,7 @@
|
||||
// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
|
||||
// described, if not, motions may move in strange directions. Grbl requires the CoreXY A and B motors
|
||||
// have the same steps per mm internally.
|
||||
// #define COREXY // Default disabled. Uncomment to enable.
|
||||
#define COREXY // Default disabled. Uncomment to enable.
|
||||
|
||||
// Inverts pin logic of the control command pins based on a mask. This essentially means you can use
|
||||
// normally-closed switches on the specified pins, rather than the default normally-open switches.
|
||||
@ -209,7 +223,7 @@
|
||||
// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and
|
||||
// spindle enable are combined to one pin. If you need both this option and spindle speed PWM,
|
||||
// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.
|
||||
// not ported #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
|
||||
#define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
|
||||
|
||||
// Inverts the selected coolant pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
|
||||
// for some pre-built electronic boards.
|
||||
@ -359,11 +373,6 @@
|
||||
// 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
|
||||
|
||||
// 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
|
||||
// it may be useful in certain scenarios. This minimum PWM settings coincides with the spindle rpm minimum
|
||||
@ -377,13 +386,21 @@
|
||||
|
||||
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
|
||||
// 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.
|
||||
// the spindle direction pin (defined in cpu-map.h) as a separate spindle enable pin along with spindle speed PWM pin.
|
||||
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled.
|
||||
// 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.
|
||||
#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
|
||||
@ -557,7 +574,7 @@
|
||||
|
||||
// LPC176x flash blocks have a rating of 10,000 write cycles. To prevent excess wear, we don't
|
||||
// write G10, G28.1, and G30.1. Uncomment to enable these writes.
|
||||
// #define STORE_COORD_DATA // Default disabled. Uncomment to enable.
|
||||
#define STORE_COORD_DATA // Default disabled. Uncomment to enable.
|
||||
|
||||
// In Grbl v0.9 and prior, there is an old outstanding bug where the `WPos:` work position reported
|
||||
// may not correlate to what is executing, because `WPos:` is based on the g-code parser state, which
|
||||
@ -597,6 +614,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
|
||||
@ -612,153 +638,5 @@
|
||||
below.
|
||||
*/
|
||||
|
||||
// Paste CPU_MAP definitions here.
|
||||
// Define serial port pins and interrupt vectors.
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
|
||||
#define STEP_DDR LPC_GPIO2->FIODIR
|
||||
#define STEP_PORT LPC_GPIO2->FIOPIN
|
||||
#define X_STEP_BIT 0
|
||||
#define Y_STEP_BIT 1
|
||||
#define Z_STEP_BIT 2
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)) // All step bits
|
||||
|
||||
// Define step direction output pins. NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR LPC_GPIO0->FIODIR
|
||||
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DIRECTION_BIT 5
|
||||
#define Y_DIRECTION_BIT 11
|
||||
#define Z_DIRECTION_BIT 20
|
||||
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)) // All direction bits
|
||||
|
||||
// Define stepper driver enable/disable output pin.
|
||||
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
|
||||
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DISABLE_BIT 4
|
||||
#define Y_DISABLE_BIT 10
|
||||
#define Z_DISABLE_BIT 19
|
||||
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT))
|
||||
|
||||
// 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 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
|
||||
// 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
|
||||
|
||||
// Define spindle enable and spindle direction output pins.
|
||||
/* not ported
|
||||
#define SPINDLE_ENABLE_DDR DDRB
|
||||
#define SPINDLE_ENABLE_PORT PORTB
|
||||
// Z Limit pin and spindle PWM/enable pin swapped to access hardware PWM on Pin 11.
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
// If enabled, spindle direction pin now used as spindle enable, while PWM remains on D11.
|
||||
#define SPINDLE_ENABLE_BIT 5 // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
|
||||
#else
|
||||
#define SPINDLE_ENABLE_BIT 3 // Uno Digital Pin 11
|
||||
#endif
|
||||
#else
|
||||
#define SPINDLE_ENABLE_BIT 4 // Uno Digital Pin 12
|
||||
#endif
|
||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
#define SPINDLE_DIRECTION_DDR DDRB
|
||||
#define SPINDLE_DIRECTION_PORT PORTB
|
||||
#define SPINDLE_DIRECTION_BIT 5 // Uno Digital Pin 13 (NOTE: D13 can't be pulled-high input due to LED.)
|
||||
#endif
|
||||
*/
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_DDR DDRC
|
||||
#define COOLANT_FLOOD_PORT PORTC
|
||||
#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 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_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_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_BIT 5 // Uno Analog Pin 5
|
||||
#define PROBE_MASK (1<<PROBE_BIT)
|
||||
|
||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||
//
|
||||
// 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
|
||||
#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_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_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_Y_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 1
|
||||
#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_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_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_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
|
||||
#endif
|
||||
|
@ -64,6 +64,7 @@ void coolant_stop()
|
||||
#else
|
||||
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||
#endif
|
||||
delay_ms(1); // workaround for toolchain error
|
||||
#ifdef ENABLE_M7
|
||||
#ifdef INVERT_COOLANT_MIST_PIN
|
||||
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
||||
@ -95,6 +96,7 @@ void coolant_set_state(uint8_t mode)
|
||||
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||
#endif
|
||||
}
|
||||
delay_ms(1); // workaround for toolchain error
|
||||
|
||||
#ifdef ENABLE_M7
|
||||
if (mode & COOLANT_MIST_ENABLE) {
|
||||
|
578
grbl/cpu_map.h
578
grbl/cpu_map.h
@ -63,7 +63,7 @@
|
||||
#define X_LIMIT_BIT 1 // Uno Digital Pin 9
|
||||
#define Y_LIMIT_BIT 2 // Uno Digital Pin 10
|
||||
#ifdef VARIABLE_SPINDLE // Z Limit pin and spindle enabled swapped to access hardware PWM on Pin 11.
|
||||
#define Z_LIMIT_BIT 4 // Uno Digital Pin 12
|
||||
#define Z_LIMIT_BIT 4 // Uno Digital Pin 12
|
||||
#else
|
||||
#define Z_LIMIT_BIT 3 // Uno Digital Pin 11
|
||||
#endif
|
||||
@ -96,9 +96,9 @@
|
||||
#define COOLANT_FLOOD_DDR DDRC
|
||||
#define COOLANT_FLOOD_PORT PORTC
|
||||
#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_DDR DDRC
|
||||
#define COOLANT_MIST_PORT PORTC
|
||||
#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).
|
||||
@ -130,10 +130,10 @@
|
||||
#endif
|
||||
#define SPINDLE_PWM_OFF_VALUE 0
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
|
||||
// Prescaled, 8-bit Fast PWM mode.
|
||||
#define SPINDLE_TCCRA_INIT_MASK ((1<<WGM20) | (1<<WGM21)) // Configures fast PWM mode.
|
||||
@ -143,11 +143,567 @@
|
||||
#define SPINDLE_TCCRB_INIT_MASK (1<<CS22) // 1/64 prescaler -> 0.98kHz (J-tech laser)
|
||||
|
||||
// NOTE: On the 328p, these must be the same as the SPINDLE_ENABLE settings.
|
||||
#define SPINDLE_PWM_DDR DDRB
|
||||
#define SPINDLE_PWM_PORT PORTB
|
||||
#define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11
|
||||
#define SPINDLE_PWM_DDR DDRB
|
||||
#define SPINDLE_PWM_PORT PORTB
|
||||
#define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11
|
||||
|
||||
#endif // end of CPU_MAP_ATMEGA328P
|
||||
|
||||
|
||||
#ifdef CPU_MAP_SMOOTHIEBOARD // (Smoothieboards)
|
||||
|
||||
// Define serial port pins and interrupt vectors.
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
|
||||
#define STEP_DDR LPC_GPIO2->FIODIR
|
||||
#define STEP_PORT LPC_GPIO2->FIOPIN
|
||||
#define X_STEP_BIT 0
|
||||
#define Y_STEP_BIT 1
|
||||
#define Z_STEP_BIT 2
|
||||
#define A_STEP_BIT 3
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)|(1<<A_STEP_BIT)) // All step bits
|
||||
|
||||
// Define step direction output pins. NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR LPC_GPIO0->FIODIR
|
||||
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DIRECTION_BIT 5
|
||||
#define Y_DIRECTION_BIT 11
|
||||
#define Z_DIRECTION_BIT 20
|
||||
#define A_DIRECTION_BIT 22
|
||||
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)|(1<<A_DIRECTION_BIT)) // All direction bits
|
||||
|
||||
// Define stepper driver enable/disable output pin.
|
||||
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
|
||||
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DISABLE_BIT 4
|
||||
#define Y_DISABLE_BIT 10
|
||||
#define Z_DISABLE_BIT 19
|
||||
#define A_DISABLE_BIT 21
|
||||
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT)|(1<<A_DISABLE_BIT))
|
||||
|
||||
// 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_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 26 // Y-MIN=26, Y-MAX=27
|
||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||
#define A_LIMIT_BIT 29 // reuse Z-MAX (P1.29)
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||
|
||||
// Define spindle enable and spindle direction output pins.
|
||||
#define SPINDLE_ENABLE_DDR LPC_GPIO1->FIODIR
|
||||
#define SPINDLE_ENABLE_PORT LPC_GPIO1->FIOPIN
|
||||
#define SPINDLE_ENABLE_BIT 30 // P1.30
|
||||
#define SPINDLE_DIRECTION_DDR LPC_GPIO1->FIODIR
|
||||
#define SPINDLE_DIRECTION_PORT LPC_GPIO1->FIOPIN
|
||||
#define SPINDLE_DIRECTION_BIT 31 // P1.31
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||
#ifndef SPINDLE_PWM_PIN_2_4
|
||||
#define COOLANT_FLOOD_BIT 4 // SMALL MOSFET Q8 (P2.4)
|
||||
#else
|
||||
#define COOLANT_FLOOD_BIT 5 // SMALL MOSFET Q8 (P2.5)
|
||||
#endif
|
||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_MIST_BIT 6 // SMALL MOSFET Q9 (P2.6)
|
||||
#define ENABLE_M7 // enables COOLANT MIST
|
||||
|
||||
// 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 LPC_GPIO1->FIODIR
|
||||
#define CONTROL_PIN LPC_GPIO1->FIOPIN
|
||||
#define CONTROL_PORT LPC_GPIO1->FIOPIN
|
||||
#define CONTROL_RESET_BIT NotUsed // Not needed as there is a special RESET pin on the Smoothiebaord
|
||||
#define CONTROL_FEED_HOLD_BIT 22 // P1.22
|
||||
#define CONTROL_CYCLE_START_BIT 23 // P1.23
|
||||
#define CONTROL_SAFETY_DOOR_BIT 22 // P1.22 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 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 LPC_GPIO2->FIODIR
|
||||
#define PROBE_PIN LPC_GPIO2->FIOPIN
|
||||
#define PROBE_PORT LPC_GPIO2->FIOPIN
|
||||
#define PROBE_BIT 11 // P2.11
|
||||
#define PROBE_MASK (1<<PROBE_BIT)
|
||||
|
||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||
//
|
||||
// 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.5
|
||||
#ifdef SPINDLE_PWM_PIN_2_4
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH5 // MOSFET3 (P2.4)
|
||||
#else
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // BED MOSFET (P2.5)
|
||||
#endif
|
||||
#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 (for C3d boards!)
|
||||
#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
|
||||
|
||||
// Variable spindle configuration below. Do not change unless you know what you are doing.
|
||||
// NOTE: Only used when variable spindle is enabled.
|
||||
#define SPINDLE_PWM_MAX_VALUE 255 // Don't change. 328p fast PWM mode fixes top value as 255.
|
||||
#ifndef SPINDLE_PWM_MIN_VALUE
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
#endif // end of CPU_MAP_SMOOTHIEBOARD
|
||||
|
||||
|
||||
#ifdef CPU_MAP_C3D_REMIX // (Cohesion3D Remix Boards)
|
||||
|
||||
// Define serial port pins and interrupt vectors.
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
|
||||
#define STEP_DDR LPC_GPIO2->FIODIR
|
||||
#define STEP_PORT LPC_GPIO2->FIOPIN
|
||||
#define X_STEP_BIT 0
|
||||
#define Y_STEP_BIT 1
|
||||
#define Z_STEP_BIT 2
|
||||
#define A_STEP_BIT 3
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)|(1<<A_STEP_BIT)) // All step bits
|
||||
|
||||
// Define step direction output pins. NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR LPC_GPIO0->FIODIR
|
||||
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DIRECTION_BIT 5
|
||||
#define Y_DIRECTION_BIT 11
|
||||
#define Z_DIRECTION_BIT 20
|
||||
#define A_DIRECTION_BIT 22
|
||||
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)|(1<<A_DIRECTION_BIT)) // All direction bits
|
||||
|
||||
// Define stepper driver enable/disable output pin.
|
||||
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
|
||||
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DISABLE_BIT 4
|
||||
#define Y_DISABLE_BIT 10
|
||||
#define Z_DISABLE_BIT 19
|
||||
#define A_DISABLE_BIT 21
|
||||
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT)|(1<<A_DISABLE_BIT))
|
||||
|
||||
// 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_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 26 // Y-MIN=26, Y-MAX=27
|
||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||
#define A_LIMIT_BIT 29 // reuse p1.29 from Z-MAX
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_FLOOD_BIT 6 // MOSFET 2.6
|
||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_MIST_BIT 7 // MOSFET 2.7
|
||||
#define ENABLE_M7 // enables COOLANT MIST
|
||||
|
||||
// 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 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 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 NotUsed
|
||||
#define PROBE_PIN NotUsed
|
||||
#define PROBE_PORT NotUsed
|
||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
||||
#define PROBE_MASK (1<<PROBE_BIT)
|
||||
|
||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||
//
|
||||
// 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.5
|
||||
#ifdef SPINDLE_PWM_PIN_2_4
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH5 // MOSFET3 (P2.4)
|
||||
#else
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // BED MOSFET (P2.5)
|
||||
#endif
|
||||
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||
|
||||
// Variable spindle configuration below. Do not change unless you know what you are doing.
|
||||
// NOTE: Only used when variable spindle is enabled.
|
||||
#define SPINDLE_PWM_MAX_VALUE 255 // Don't change. 328p fast PWM mode fixes top value as 255.
|
||||
#ifndef SPINDLE_PWM_MIN_VALUE
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
#endif // end of CPU_MAP_C3D_REMIX
|
||||
|
||||
|
||||
#ifdef CPU_MAP_C3D_MINI // (Cohesion3D Mini Boards)
|
||||
|
||||
// Define serial port pins and interrupt vectors.
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
|
||||
#define STEP_DDR LPC_GPIO2->FIODIR
|
||||
#define STEP_PORT LPC_GPIO2->FIOPIN
|
||||
#define X_STEP_BIT 0
|
||||
#define Y_STEP_BIT 1
|
||||
#define Z_STEP_BIT 2
|
||||
#define A_STEP_BIT 3
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)|(1<<A_STEP_BIT)) // All step bits
|
||||
|
||||
// Define step direction output pins. NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR LPC_GPIO0->FIODIR
|
||||
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DIRECTION_BIT 5
|
||||
#define Y_DIRECTION_BIT 11
|
||||
#define Z_DIRECTION_BIT 20
|
||||
#define A_DIRECTION_BIT 22
|
||||
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)|(1<<A_DIRECTION_BIT)) // All direction bits
|
||||
|
||||
// Define stepper driver enable/disable output pin.
|
||||
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
|
||||
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DISABLE_BIT 4
|
||||
#define Y_DISABLE_BIT 10
|
||||
#define Z_DISABLE_BIT 19
|
||||
#define A_DISABLE_BIT 21
|
||||
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT)|(1<<A_DISABLE_BIT))
|
||||
|
||||
// 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_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 26 // Y-MIN=26, Y-MAX=27
|
||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||
#define A_LIMIT_BIT 29 // reuse p1.29 from Z-MAX
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_DDR NotUsed
|
||||
#define COOLANT_FLOOD_PORT NotUsed
|
||||
#define COOLANT_FLOOD_BIT 6 // MOSFET 3 (P2.6)
|
||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_MIST_BIT 7 // MOSFET 2 (P2.7)
|
||||
#define ENABLE_M7 // enables COOLANT MIST
|
||||
|
||||
// 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 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 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 NotUsed
|
||||
#define PROBE_PIN NotUsed
|
||||
#define PROBE_PORT NotUsed
|
||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
||||
#define PROBE_MASK (1<<PROBE_BIT)
|
||||
|
||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||
//
|
||||
// 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.5
|
||||
#ifdef SPINDLE_PWM_PIN_2_4
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH5 // MOSFET3 (P2.4)
|
||||
#else
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // BED MOSFET (P2.5)
|
||||
#endif
|
||||
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||
|
||||
// Variable spindle configuration below. Do not change unless you know what you are doing.
|
||||
// NOTE: Only used when variable spindle is enabled.
|
||||
#define SPINDLE_PWM_MAX_VALUE 255 // Don't change. 328p fast PWM mode fixes top value as 255.
|
||||
#ifndef SPINDLE_PWM_MIN_VALUE
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
#endif // end of CPU_MAP_C3D_MINI
|
||||
|
||||
|
||||
#ifdef CPU_MAP_MKS_SBASE // (MKS SBASE Boards)
|
||||
|
||||
// Define serial port pins and interrupt vectors.
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
|
||||
#define STEP_DDR LPC_GPIO2->FIODIR
|
||||
#define STEP_PORT LPC_GPIO2->FIOPIN
|
||||
#define X_STEP_BIT 0
|
||||
#define Y_STEP_BIT 1
|
||||
#define Z_STEP_BIT 2
|
||||
#define A_STEP_BIT 3
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)|(1<<A_STEP_BIT)) // All step bits
|
||||
|
||||
// Define step direction output pins. NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR LPC_GPIO0->FIODIR
|
||||
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DIRECTION_BIT 5
|
||||
#define Y_DIRECTION_BIT 11
|
||||
#define Z_DIRECTION_BIT 20
|
||||
#define A_DIRECTION_BIT 22
|
||||
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)|(1<<A_DIRECTION_BIT)) // All direction bits
|
||||
|
||||
// Define stepper driver enable/disable output pin.
|
||||
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
|
||||
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DISABLE_BIT 4
|
||||
#define Y_DISABLE_BIT 10
|
||||
#define Z_DISABLE_BIT 19
|
||||
#define A_DISABLE_BIT 21
|
||||
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT)|(1<<A_DISABLE_BIT))
|
||||
|
||||
// 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_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 26 // Y-MIN=26, Y-MAX=27
|
||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||
#define A_LIMIT_BIT 29 // reuse p1.29
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||
|
||||
// Define spindle enable and spindle direction output pins.
|
||||
#define SPINDLE_ENABLE_DDR LPC_GPIO1->FIODIR
|
||||
#define SPINDLE_ENABLE_PORT LPC_GPIO1->FIOPIN
|
||||
#define SPINDLE_ENABLE_BIT 30 // P1.30
|
||||
#define SPINDLE_DIRECTION_DDR LPC_GPIO1->FIODIR
|
||||
#define SPINDLE_DIRECTION_PORT LPC_GPIO1->FIOPIN
|
||||
#define SPINDLE_DIRECTION_BIT 31 // P1.31
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_FLOOD_BIT 6 // MOSFET 2.6
|
||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_MIST_BIT 7 // MOSFET 2.7
|
||||
#define ENABLE_M7 // enables COOLANT MIST
|
||||
|
||||
// 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 LPC_GPIO1->FIODIR
|
||||
#define CONTROL_PIN LPC_GPIO1->FIOPIN
|
||||
#define CONTROL_PORT LPC_GPIO1->FIOPIN
|
||||
#define CONTROL_RESET_BIT NotUsed // Not needed as there is a special RESET pin on the Smoothiebaord
|
||||
#define CONTROL_FEED_HOLD_BIT 22 // P1.22
|
||||
#define CONTROL_CYCLE_START_BIT 23 // P1.23
|
||||
#define CONTROL_SAFETY_DOOR_BIT 22 // P1.22 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 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 LPC_GPIO2->FIODIR
|
||||
#define PROBE_PIN LPC_GPIO2->FIOPIN
|
||||
#define PROBE_PORT LPC_GPIO2->FIOPIN
|
||||
#define PROBE_BIT 11 // P2.11
|
||||
#define PROBE_MASK (1<<PROBE_BIT)
|
||||
|
||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||
//
|
||||
// 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.5
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // BED MOSFET (P2.5)
|
||||
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||
#ifdef SPINDLE_PWM_PIN_1_23
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH4 // MOSFET3 (P1.23)
|
||||
#define SPINDLE_PWM_USE_PRIMARY_PIN true
|
||||
#define SPINDLE_PWM_USE_SECONDARY_PIN false
|
||||
#endif
|
||||
#ifdef SPINDLE_PWM_PIN_2_4
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH5 // MOSFET3 (P1.23)
|
||||
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||
#endif
|
||||
|
||||
// Stepper current control
|
||||
#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable (for C3d boards!)
|
||||
#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
|
||||
|
||||
// Variable spindle configuration below. Do not change unless you know what you are doing.
|
||||
// NOTE: Only used when variable spindle is enabled.
|
||||
#define SPINDLE_PWM_MAX_VALUE 255 // Don't change. 328p fast PWM mode fixes top value as 255.
|
||||
#ifndef SPINDLE_PWM_MIN_VALUE
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
#endif // end of CPU_MAP_MKS_SBASE
|
||||
|
||||
|
||||
#ifdef CPU_MAP_AZTEEG_X5 // (Azteeg X5 Boards) not tested yet!
|
||||
|
||||
// Define serial port pins and interrupt vectors.
|
||||
#define SERIAL_RX USART_RX_vect
|
||||
#define SERIAL_UDRE USART_UDRE_vect
|
||||
|
||||
// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
|
||||
#define STEP_DDR LPC_GPIO2->FIODIR
|
||||
#define STEP_PORT LPC_GPIO2->FIOPIN
|
||||
#define X_STEP_BIT 1
|
||||
#define Y_STEP_BIT 2
|
||||
#define Z_STEP_BIT 3
|
||||
#define A_STEP_BIT 0
|
||||
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)|(1<<A_STEP_BIT)) // All step bits
|
||||
|
||||
// Define step direction output pins. NOTE: All direction pins must be on the same port.
|
||||
#define DIRECTION_DDR LPC_GPIO0->FIODIR
|
||||
#define DIRECTION_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DIRECTION_BIT 11
|
||||
#define Y_DIRECTION_BIT 20
|
||||
#define Z_DIRECTION_BIT 22
|
||||
#define A_DIRECTION_BIT 5
|
||||
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)|(1<<A_DIRECTION_BIT)) // All direction bits
|
||||
|
||||
// Define stepper driver enable/disable output pin.
|
||||
#define STEPPERS_DISABLE_DDR LPC_GPIO0->FIODIR
|
||||
#define STEPPERS_DISABLE_PORT LPC_GPIO0->FIOPIN
|
||||
#define X_DISABLE_BIT 10
|
||||
#define Y_DISABLE_BIT 19
|
||||
#define Z_DISABLE_BIT 21
|
||||
#define A_DISABLE_BIT 4
|
||||
#define STEPPERS_DISABLE_MASK ((1<<X_DISABLE_BIT)|(1<<Y_DISABLE_BIT)|(1<<Z_DISABLE_BIT)|(1<<A_DISABLE_BIT))
|
||||
|
||||
// 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_GPIO1->FIODIR
|
||||
#define LIMIT_PIN LPC_GPIO1->FIOPIN
|
||||
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=27
|
||||
#define Y_LIMIT_BIT 25 // Y-MIN=25, Y-MAX=28
|
||||
#define Z_LIMIT_BIT 26 // Z-MIN=26, Z-MAX=29
|
||||
#define A_LIMIT_BIT 27 // reuse p1.27, as X-MAX is not used
|
||||
#define LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||
|
||||
// Define flood and mist coolant enable output pins.
|
||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_FLOOD_BIT 4 // FAN MOSFET (P2.4)
|
||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||
#define COOLANT_MIST_BIT 7 // BED MOSFET (P2.7)
|
||||
#define ENABLE_M7 // enables COOLANT MIST
|
||||
|
||||
// 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 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 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 NotUsed
|
||||
#define PROBE_PIN NotUsed
|
||||
#define PROBE_PORT NotUsed
|
||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
||||
#define PROBE_MASK (1<<PROBE_BIT)
|
||||
|
||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||
//
|
||||
// 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.5
|
||||
#ifdef SPINDLE_PWM_PIN_2_4
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH5 // MOSFET3 (P2.4)
|
||||
#else
|
||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // BED MOSFET (P2.5)
|
||||
#endif
|
||||
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||
|
||||
// Stepper current control via SPI not ported yet!
|
||||
|
||||
// Variable spindle configuration below. Do not change unless you know what you are doing.
|
||||
// NOTE: Only used when variable spindle is enabled.
|
||||
#define SPINDLE_PWM_MAX_VALUE 255 // Don't change. 328p fast PWM mode fixes top value as 255.
|
||||
#ifndef SPINDLE_PWM_MIN_VALUE
|
||||
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
|
||||
#endif
|
||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||
#define SPINDLE_OCR_REGISTER OCR2A
|
||||
#define SPINDLE_COMB_BIT COM2A1
|
||||
#endif // end of CPU_MAP_AZTEEG_X5
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef CPU_MAP_CUSTOM_PROC
|
||||
|
317
grbl/defaults.h
317
grbl/defaults.h
@ -29,41 +29,160 @@
|
||||
|
||||
#ifdef DEFAULTS_GENERIC
|
||||
// Grbl generic default settings. Should work across different machines.
|
||||
#define DEFAULT_X_STEPS_PER_MM 250.0
|
||||
#define DEFAULT_Y_STEPS_PER_MM 250.0
|
||||
#define DEFAULT_Z_STEPS_PER_MM 250.0
|
||||
#define DEFAULT_X_MAX_RATE 500.0 // mm/min
|
||||
#define DEFAULT_Y_MAX_RATE 500.0 // mm/min
|
||||
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
|
||||
#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_SPINDLE_RPM_MAX 1000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
// See https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration for setting descriptions.
|
||||
#define DEFAULT_X_STEPS_PER_MM 160.0 // $100 steps (X steps per mm)
|
||||
#define DEFAULT_Y_STEPS_PER_MM 160.0 // $101 steps (Y steps per mm)
|
||||
#define DEFAULT_Z_STEPS_PER_MM 160.0 // $102 steps (Z steps per mm)
|
||||
#define DEFAULT_A_STEPS_PER_MM 160.0 // $103 steps (A steps per mm)
|
||||
#define DEFAULT_X_MAX_RATE 30000.0 // $110 mm/min (X max speed)
|
||||
#define DEFAULT_Y_MAX_RATE 30000.0 // $111 mm/min (Y max speed)
|
||||
#define DEFAULT_Z_MAX_RATE 30000.0 // $112 mm/min (Z max speed)
|
||||
#define DEFAULT_A_MAX_RATE 30000.0 // $113 mm/min (A max speed)
|
||||
#define DEFAULT_X_ACCELERATION (10.0*60*60)// $120 mm/min^2 (X max acceleration)
|
||||
#define DEFAULT_Y_ACCELERATION (10.0*60*60)// $121 mm/min^2 (Y max acceleration)
|
||||
#define DEFAULT_Z_ACCELERATION (10.0*60*60)// $122 mm/min^2 (Z max acceleration)
|
||||
#define DEFAULT_A_ACCELERATION (10.0*60*60)// $123 mm/min^2 (A max acceleration)
|
||||
#define DEFAULT_X_MAX_TRAVEL 500.0 // $130 mm (X max travel; must be positive)
|
||||
#define DEFAULT_Y_MAX_TRAVEL 500.0 // $131 mm (Y max travel; must be positive)
|
||||
#define DEFAULT_Z_MAX_TRAVEL 500.0 // $132 mm (Z max travel; must be positive)
|
||||
#define DEFAULT_A_MAX_TRAVEL 1.0 // $133 mm (A max travel; must be positive)
|
||||
#define DEFAULT_X_CURRENT 0.7 // $140 amps (X stepper current [disabled])
|
||||
#define DEFAULT_Y_CURRENT 0.7 // $141 amps (Y stepper current [disabled])
|
||||
#define DEFAULT_Z_CURRENT 0.0 // $142 amps (Z stepper current [disabled])
|
||||
#define DEFAULT_A_CURRENT 0.0 // $143 amps (A stepper current [disabled])
|
||||
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 // $0 usec (stepper pulse time)
|
||||
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // $1 msec (0-254, 255 keeps steppers enabled)
|
||||
#define DEFAULT_STEPPING_INVERT_MASK 0 // $2 ZYX (e.g., 0x5 inverts Z and X stepper pulses)
|
||||
#define DEFAULT_DIRECTION_INVERT_MASK 0 // $3 ZYX (e.g., 0x2 inverts Y stepper direction)
|
||||
#define DEFAULT_INVERT_ST_ENABLE 0 // $4 bool (inverts stepper enable pin)
|
||||
#define DEFAULT_INVERT_LIMIT_PINS 0 // $5 bool (inverts limit switches to trigger on high)
|
||||
#define DEFAULT_INVERT_PROBE_PIN 0 // $6 bool (inverts probe to trigger on high)
|
||||
#define DEFAULT_STATUS_REPORT_MASK 0 // $10 bits (Reports: [0=WPos or 1=MPos] and [2=Buffer])
|
||||
#define DEFAULT_JUNCTION_DEVIATION 0.01 // $11 mm (determines machine speed through corners)
|
||||
#define DEFAULT_ARC_TOLERANCE 0.002 // $12 mm (error tolerance on arcs/cicles)
|
||||
#define DEFAULT_REPORT_INCHES 0 // $13 bool (sets position reporting to inches)
|
||||
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // $20 bool (prevents moves outside *_MAX_TRAVEL; requires $23=1)
|
||||
#define DEFAULT_HARD_LIMIT_ENABLE 0 // $21 bool ([ignored] stops moving when limit switches triggered)
|
||||
#define DEFAULT_HOMING_ENABLE 0 // $22 bool (enables homing on startup)
|
||||
#define DEFAULT_HOMING_DIR_MASK 0 // $23 ZYX (e.g., 0x3 reverses XY homing to negative direction)
|
||||
#define DEFAULT_HOMING_FEED_RATE 25.0 // $24 mm/min (homing precision location speed)
|
||||
#define DEFAULT_HOMING_SEEK_RATE 500.0 // $25 mm/min (homing search speed)
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // $26 msec (homing switch debounce: 0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // $27 mm (retracts this far from homing switch)
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // $30 RPM (spindle speed for max 5V PWM output)
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // $31 RPM (spindle speed for min 20mV PWM output)
|
||||
#define DEFAULT_LASER_MODE 0 // $32 bool (adjusts spindle power with speed for lasers)
|
||||
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // $33 Hz (PWM frequency for spindle)
|
||||
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0 // $34 % (% of PWM when spindle is off)
|
||||
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 1 // $35 % (% of PWM when spindle is at lowest setting)
|
||||
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100 // $36 % (% of PWM when spindle is at highest setting)
|
||||
// Up to 4 HOMING_CYCLE_x can be defined (0-3), specifying which axes are homed and in which order
|
||||
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))
|
||||
#endif // end of DEFAULTS_GENERIC
|
||||
|
||||
#ifdef DEFAULTS_K40
|
||||
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
|
||||
#define DEFAULT_X_STEPS_PER_MM 160.0 // 200 stepps/rev. * 32 microstepps / 40mm/rev
|
||||
#define DEFAULT_Y_STEPS_PER_MM 160.0
|
||||
#define DEFAULT_Z_STEPS_PER_MM 160.0
|
||||
#define DEFAULT_A_STEPS_PER_MM 160.0
|
||||
#define DEFAULT_X_MAX_RATE 30000.0 // mm/min
|
||||
#define DEFAULT_Y_MAX_RATE 30000.0 // mm/min
|
||||
#define DEFAULT_Z_MAX_RATE 30000.0 // mm/min
|
||||
#define DEFAULT_A_MAX_RATE 30000.0 // mm/min
|
||||
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_A_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_X_CURRENT 0.6 // amps
|
||||
#define DEFAULT_Y_CURRENT 0.6 // amps
|
||||
#define DEFAULT_Z_CURRENT 0.0 // amps
|
||||
#define DEFAULT_A_CURRENT 0.0 // amps
|
||||
#define DEFAULT_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Y_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_A_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz (2000 - 20000)
|
||||
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0 // %
|
||||
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 1 // %
|
||||
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100 // %
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm (S-value)
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm (S-value)
|
||||
#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_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_SOFT_LIMIT_ENABLE 0 // false
|
||||
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
|
||||
#define DEFAULT_INVERT_PROBE_PIN 0 // false
|
||||
#define DEFAULT_LASER_MODE 0 // false
|
||||
#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_DIRECTION_INVERT_MASK 3 // 3 = invert X+Y
|
||||
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255// 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 // true for microswitches / false for optical sensors
|
||||
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // true
|
||||
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
|
||||
#define DEFAULT_INVERT_PROBE_PIN 0 // false
|
||||
#define DEFAULT_LASER_MODE 1 // true
|
||||
#define DEFAULT_HOMING_ENABLE 1 // true
|
||||
#define DEFAULT_HOMING_DIR_MASK 1 // move top/left
|
||||
#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
|
||||
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
|
||||
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))
|
||||
#endif // end of DEFAULTS_K40
|
||||
|
||||
#ifdef DEFAULTS_FABKIT
|
||||
// Paste default settings definitions here.
|
||||
#define DEFAULT_X_STEPS_PER_MM 80.0
|
||||
#define DEFAULT_Y_STEPS_PER_MM 80.0
|
||||
#define DEFAULT_Z_STEPS_PER_MM 640.0
|
||||
#define DEFAULT_A_STEPS_PER_MM 160.0
|
||||
#define DEFAULT_X_MAX_RATE 30000 // mm/min
|
||||
#define DEFAULT_Y_MAX_RATE 4500 // mm/min
|
||||
#define DEFAULT_Z_MAX_RATE 1200 // mm/min
|
||||
#define DEFAULT_A_MAX_RATE 24000.0 // mm/min
|
||||
#define DEFAULT_X_ACCELERATION (4000.0*60*60) // 4000*60*60 mm/min^2 = 4000 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (250.0*60*60) // 250*60*60 mm/min^2 = 250 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (150.0*60*60) // 150*60*60 mm/min^2 = 150 mm/sec^2
|
||||
#define DEFAULT_A_ACCELERATION (150.0*60*60) // 150*60*60 mm/min^2 = 150 mm/sec^2
|
||||
#define DEFAULT_X_CURRENT 1.5 // amps
|
||||
#define DEFAULT_Y_CURRENT 1.5 // amps
|
||||
#define DEFAULT_Z_CURRENT 1.5 // amps
|
||||
#define DEFAULT_A_CURRENT 0.0 // amps
|
||||
#define DEFAULT_X_MAX_TRAVEL 680.0 // mm
|
||||
#define DEFAULT_Y_MAX_TRAVEL 460.0 // mm
|
||||
#define DEFAULT_Z_MAX_TRAVEL 150.0 // mm
|
||||
#define DEFAULT_A_MAX_TRAVEL 150.0 // mm
|
||||
#define DEFAULT_SPINDLE_PWM_FREQ 50000 // Hz
|
||||
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0 // %
|
||||
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 0 // %
|
||||
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100 // %
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 0.7 // rpm (S-value)
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.08 // rpm (S-value)
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 1
|
||||
#define DEFAULT_STEPPING_INVERT_MASK 0
|
||||
#define DEFAULT_DIRECTION_INVERT_MASK 2 // 2 = invert Y
|
||||
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255// 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 // true
|
||||
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // true
|
||||
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
|
||||
#define DEFAULT_INVERT_PROBE_PIN 0 // false
|
||||
#define DEFAULT_LASER_MODE 1 // true
|
||||
#define DEFAULT_HOMING_ENABLE 1 // true
|
||||
#define DEFAULT_HOMING_DIR_MASK 1 // move top/left
|
||||
#define DEFAULT_HOMING_FEED_RATE 60.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 2.0 // mm
|
||||
#define HOMING_CYCLE_0 (1<<Z_AXIS)
|
||||
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))
|
||||
#endif // end of DEFAULTS_FABKIT
|
||||
|
||||
#ifdef DEFAULTS_SHERLINE_5400
|
||||
// Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors,
|
||||
@ -80,9 +199,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 2800.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -105,7 +225,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 635.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_SHERLINE_5400
|
||||
|
||||
#ifdef DEFAULTS_SHAPEOKO
|
||||
// Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
|
||||
@ -125,9 +245,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -150,7 +271,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_SHAPEOKO
|
||||
|
||||
#ifdef DEFAULTS_SHAPEOKO_2
|
||||
// Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
|
||||
@ -170,9 +291,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -195,7 +317,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_SHAPEOKO_2
|
||||
|
||||
#ifdef DEFAULTS_SHAPEOKO_3
|
||||
// Description: Shapeoko CNC mill with three NEMA 23 stepper motors, driven by CarbideMotion
|
||||
@ -214,9 +336,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -239,7 +362,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 25 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 5.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_SHAPEOKO_3
|
||||
|
||||
#ifdef DEFAULTS_X_CARVE_500MM
|
||||
// Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
|
||||
@ -259,9 +382,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -284,7 +408,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 750.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_X_CARVE_500MM
|
||||
|
||||
#ifdef DEFAULTS_X_CARVE_1000MM
|
||||
// Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
|
||||
@ -304,9 +428,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -329,7 +454,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 750.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_X_CARVE_1000MM
|
||||
|
||||
#ifdef DEFAULTS_ZEN_TOOLWORKS_7x7
|
||||
// Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors.
|
||||
@ -347,9 +472,10 @@
|
||||
#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_PWM_FREQ 5000 // Hz
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 10000.0 // rpm
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
@ -372,7 +498,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_ZEN_TOOLWORKS_7x7
|
||||
|
||||
#ifdef DEFAULTS_OXCNC
|
||||
// Grbl settings for OpenBuilds OX CNC Machine
|
||||
@ -386,9 +512,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 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_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
|
||||
@ -411,7 +538,7 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_OXCNC
|
||||
|
||||
#ifdef DEFAULTS_SIMULATOR
|
||||
// Settings only for Grbl Simulator (www.github.com/grbl/grbl-sim)
|
||||
@ -425,9 +552,10 @@
|
||||
#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_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
|
||||
@ -450,6 +578,59 @@
|
||||
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||
#endif
|
||||
#endif // end of DEFAULTS_SIMULATOR
|
||||
|
||||
#ifdef DEFAULTS_JONAS
|
||||
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
|
||||
#define DEFAULT_X_STEPS_PER_MM 160.0 // 200 stepps/rev. * 32 microstepps / 40mm/rev
|
||||
#define DEFAULT_Y_STEPS_PER_MM 160.0
|
||||
#define DEFAULT_Z_STEPS_PER_MM 160.0
|
||||
#define DEFAULT_A_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_A_MAX_RATE 24000.0 // mm/min
|
||||
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_A_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||
#define DEFAULT_X_CURRENT 0.6 // amps
|
||||
#define DEFAULT_Y_CURRENT 0.6 // 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_A_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
|
||||
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz (2000 - 20000)
|
||||
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0 // %
|
||||
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 1 // %
|
||||
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100 // %
|
||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm (S-value)
|
||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm (S-value)
|
||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
||||
#define DEFAULT_STEPPING_INVERT_MASK 0
|
||||
#define DEFAULT_DIRECTION_INVERT_MASK 3 // 3 = invert X+Y
|
||||
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255// 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 // true for microswitches / false for optical sensors
|
||||
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // true
|
||||
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
|
||||
#define DEFAULT_INVERT_PROBE_PIN 0 // false
|
||||
#define DEFAULT_LASER_MODE 1 // true
|
||||
#define DEFAULT_HOMING_ENABLE 1 // true
|
||||
#define DEFAULT_HOMING_DIR_MASK 1 // move top/left
|
||||
#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 2.0 // mm
|
||||
#define HOMING_CYCLE_0 (1<<Z_AXIS) // First home Z to clear workspace
|
||||
#define HOMING_CYCLE_1 (1<<X_AXIS) // Then home X
|
||||
#define HOMING_CYCLE_2 (1<<Y_AXIS) // Then home Y
|
||||
#endif // end of DEFAULTS_JONAS
|
||||
|
||||
#endif
|
||||
|
115
grbl/gcode.c
115
grbl/gcode.c
@ -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
|
||||
@ -79,7 +80,7 @@ uint8_t gc_execute_line(char *line)
|
||||
uint8_t coord_select = 0; // Tracks G10 P coordinate selection for execution
|
||||
|
||||
// Initialize bitflag tracking variables for axis indices compatible operations.
|
||||
uint8_t axis_words = 0; // XYZ tracking
|
||||
uint8_t axis_words = 0; // XYZA tracking
|
||||
uint8_t ijk_words = 0; // IJK tracking
|
||||
|
||||
// Initialize command and value words and parser flags variables.
|
||||
@ -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]
|
||||
}
|
||||
|
||||
@ -294,7 +296,7 @@ uint8_t gc_execute_line(char *line)
|
||||
legal g-code words and stores their value. Error-checking is performed later since some
|
||||
words (I,J,K,L,P,R) have multiple connotations and/or depend on the issued commands. */
|
||||
switch(letter){
|
||||
// case 'A': // Not supported
|
||||
case 'A': word_bit = WORD_A; gc_block.values.xyza[A_AXIS] = value; axis_words |= (1<<A_AXIS); break;
|
||||
// case 'B': // Not supported
|
||||
// case 'C': // Not supported
|
||||
// case 'D': // Not supported
|
||||
@ -310,10 +312,13 @@ 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 '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;
|
||||
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.xyza[X_AXIS] = value; axis_words |= (1<<X_AXIS); break;
|
||||
case 'Y': word_bit = WORD_Y; gc_block.values.xyza[Y_AXIS] = value; axis_words |= (1<<Y_AXIS); break;
|
||||
case 'Z': word_bit = WORD_Z; gc_block.values.xyza[Z_AXIS] = value; axis_words |= (1<<Z_AXIS); break;
|
||||
default: FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND);
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
@ -462,7 +475,7 @@ uint8_t gc_execute_line(char *line)
|
||||
if (gc_block.modal.units == UNITS_MODE_INCHES) {
|
||||
for (idx=0; idx<N_AXIS; idx++) { // Axes indices are consistent, so loop may be used.
|
||||
if (bit_istrue(axis_words,bit(idx)) ) {
|
||||
gc_block.values.xyz[idx] *= MM_PER_INCH;
|
||||
gc_block.values.xyza[idx] *= MM_PER_INCH;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -536,11 +549,11 @@ uint8_t gc_execute_line(char *line)
|
||||
if (gc_block.values.l == 20) {
|
||||
// L20: Update coordinate system axis at current position (with modifiers) with programmed value
|
||||
// WPos = MPos - WCS - G92 - TLO -> WCS = MPos - G92 - TLO - WPos
|
||||
gc_block.values.ijk[idx] = gc_state.position[idx]-gc_state.coord_offset[idx]-gc_block.values.xyz[idx];
|
||||
gc_block.values.ijk[idx] = gc_state.position[idx]-gc_state.coord_offset[idx]-gc_block.values.xyza[idx];
|
||||
if (idx == TOOL_LENGTH_OFFSET_AXIS) { gc_block.values.ijk[idx] -= gc_state.tool_length_offset; }
|
||||
} else {
|
||||
// L2: Update coordinate system axis to programmed value.
|
||||
gc_block.values.ijk[idx] = gc_block.values.xyz[idx];
|
||||
gc_block.values.ijk[idx] = gc_block.values.xyza[idx];
|
||||
}
|
||||
} // Else, keep current stored value.
|
||||
}
|
||||
@ -554,10 +567,10 @@ uint8_t gc_execute_line(char *line)
|
||||
for (idx=0; idx<N_AXIS; idx++) { // Axes indices are consistent, so loop may be used.
|
||||
if (bit_istrue(axis_words,bit(idx)) ) {
|
||||
// WPos = MPos - WCS - G92 - TLO -> G92 = MPos - WCS - TLO - WPos
|
||||
gc_block.values.xyz[idx] = gc_state.position[idx]-block_coord_system[idx]-gc_block.values.xyz[idx];
|
||||
if (idx == TOOL_LENGTH_OFFSET_AXIS) { gc_block.values.xyz[idx] -= gc_state.tool_length_offset; }
|
||||
gc_block.values.xyza[idx] = gc_state.position[idx]-block_coord_system[idx]-gc_block.values.xyza[idx];
|
||||
if (idx == TOOL_LENGTH_OFFSET_AXIS) { gc_block.values.xyza[idx] -= gc_state.tool_length_offset; }
|
||||
} else {
|
||||
gc_block.values.xyz[idx] = gc_state.coord_offset[idx];
|
||||
gc_block.values.xyza[idx] = gc_state.coord_offset[idx];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -572,17 +585,17 @@ uint8_t gc_execute_line(char *line)
|
||||
if (axis_words) {
|
||||
for (idx=0; idx<N_AXIS; idx++) { // Axes indices are consistent, so loop may be used to save flash space.
|
||||
if ( bit_isfalse(axis_words,bit(idx)) ) {
|
||||
gc_block.values.xyz[idx] = gc_state.position[idx]; // No axis word in block. Keep same axis position.
|
||||
gc_block.values.xyza[idx] = gc_state.position[idx]; // No axis word in block. Keep same axis position.
|
||||
} else {
|
||||
// Update specified value according to distance mode or ignore if absolute override is active.
|
||||
// NOTE: G53 is never active with G28/30 since they are in the same modal group.
|
||||
if (gc_block.non_modal_command != NON_MODAL_ABSOLUTE_OVERRIDE) {
|
||||
// Apply coordinate offsets based on distance mode.
|
||||
if (gc_block.modal.distance == DISTANCE_MODE_ABSOLUTE) {
|
||||
gc_block.values.xyz[idx] += block_coord_system[idx] + gc_state.coord_offset[idx];
|
||||
if (idx == TOOL_LENGTH_OFFSET_AXIS) { gc_block.values.xyz[idx] += gc_state.tool_length_offset; }
|
||||
gc_block.values.xyza[idx] += block_coord_system[idx] + gc_state.coord_offset[idx];
|
||||
if (idx == TOOL_LENGTH_OFFSET_AXIS) { gc_block.values.xyza[idx] += gc_state.tool_length_offset; }
|
||||
} else { // Incremental mode
|
||||
gc_block.values.xyz[idx] += gc_state.position[idx];
|
||||
gc_block.values.xyza[idx] += gc_state.position[idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -671,12 +684,12 @@ uint8_t gc_execute_line(char *line)
|
||||
|
||||
// Calculate the change in position along each selected axis
|
||||
float x,y;
|
||||
x = gc_block.values.xyz[axis_0]-gc_state.position[axis_0]; // Delta x between current position and target
|
||||
y = gc_block.values.xyz[axis_1]-gc_state.position[axis_1]; // Delta y between current position and target
|
||||
x = gc_block.values.xyza[axis_0]-gc_state.position[axis_0]; // Delta x between current position and target
|
||||
y = gc_block.values.xyza[axis_1]-gc_state.position[axis_1]; // Delta y between current position and target
|
||||
|
||||
if (value_words & bit(WORD_R)) { // Arc Radius Mode
|
||||
bit_false(value_words,bit(WORD_R));
|
||||
if (isequal_position_vector(gc_state.position, gc_block.values.xyz)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Invalid target]
|
||||
if (isequal_position_vector(gc_state.position, gc_block.values.xyza)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Invalid target]
|
||||
|
||||
// Convert radius value to proper units.
|
||||
if (gc_block.modal.units == UNITS_MODE_INCHES) { gc_block.values.r *= MM_PER_INCH; }
|
||||
@ -803,7 +816,7 @@ uint8_t gc_execute_line(char *line)
|
||||
// an error, it issues an alarm to prevent further motion to the probe. It's also done there to
|
||||
// allow the planner buffer to empty and move off the probe trigger before another probing cycle.
|
||||
if (!axis_words) { FAIL(STATUS_GCODE_NO_AXIS_WORDS); } // [No axis words]
|
||||
if (isequal_position_vector(gc_state.position, gc_block.values.xyz)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Invalid target]
|
||||
if (isequal_position_vector(gc_state.position, gc_block.values.xyza)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Invalid target]
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -819,7 +832,7 @@ uint8_t gc_execute_line(char *line)
|
||||
} else {
|
||||
bit_false(value_words,(bit(WORD_N)|bit(WORD_F)|bit(WORD_S)|bit(WORD_T))); // Remove single-meaning value words.
|
||||
}
|
||||
if (axis_command) { bit_false(value_words,(bit(WORD_X)|bit(WORD_Y)|bit(WORD_Z))); } // Remove axis words.
|
||||
if (axis_command) { bit_false(value_words,(bit(WORD_X)|bit(WORD_Y)|bit(WORD_Z)|bit(WORD_A))); } // Remove axis words.
|
||||
if (value_words) { FAIL(STATUS_GCODE_UNUSED_WORDS); } // [Unused words]
|
||||
|
||||
/* -------------------------------------------------------------------------------------
|
||||
@ -848,7 +861,7 @@ uint8_t gc_execute_line(char *line)
|
||||
plan_data.condition = (gc_state.modal.spindle | gc_state.modal.coolant);
|
||||
|
||||
uint8_t status = jog_execute(&plan_data, &gc_block);
|
||||
if (status == STATUS_OK) { memcpy(gc_state.position, gc_block.values.xyz, sizeof(gc_block.values.xyz)); }
|
||||
if (status == STATUS_OK) { memcpy(gc_state.position, gc_block.values.xyza, sizeof(gc_block.values.xyza)); }
|
||||
return(status);
|
||||
}
|
||||
|
||||
@ -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); }
|
||||
@ -966,10 +985,10 @@ uint8_t gc_execute_line(char *line)
|
||||
if (axis_command == AXIS_COMMAND_TOOL_LENGTH_OFFSET ) { // Indicates a change.
|
||||
gc_state.modal.tool_length = gc_block.modal.tool_length;
|
||||
if (gc_state.modal.tool_length == TOOL_LENGTH_OFFSET_CANCEL) { // G49
|
||||
gc_block.values.xyz[TOOL_LENGTH_OFFSET_AXIS] = 0.0;
|
||||
gc_block.values.xyza[TOOL_LENGTH_OFFSET_AXIS] = 0.0;
|
||||
} // else G43.1
|
||||
if ( gc_state.tool_length_offset != gc_block.values.xyz[TOOL_LENGTH_OFFSET_AXIS] ) {
|
||||
gc_state.tool_length_offset = gc_block.values.xyz[TOOL_LENGTH_OFFSET_AXIS];
|
||||
if ( gc_state.tool_length_offset != gc_block.values.xyza[TOOL_LENGTH_OFFSET_AXIS] ) {
|
||||
gc_state.tool_length_offset = gc_block.values.xyza[TOOL_LENGTH_OFFSET_AXIS];
|
||||
system_flag_wco_change();
|
||||
}
|
||||
}
|
||||
@ -1003,7 +1022,7 @@ uint8_t gc_execute_line(char *line)
|
||||
// Move to intermediate position before going home. Obeys current coordinate system and offsets
|
||||
// and absolute and incremental modes.
|
||||
pl_data->condition |= PL_COND_FLAG_RAPID_MOTION; // Set rapid motion condition flag.
|
||||
if (axis_command) { mc_line(gc_block.values.xyz, pl_data); }
|
||||
if (axis_command) { mc_line(gc_block.values.xyza, pl_data); }
|
||||
mc_line(gc_block.values.ijk, pl_data);
|
||||
memcpy(gc_state.position, gc_block.values.ijk, N_AXIS*sizeof(float));
|
||||
break;
|
||||
@ -1014,7 +1033,7 @@ uint8_t gc_execute_line(char *line)
|
||||
settings_write_coord_data(SETTING_INDEX_G30,gc_state.position,false,true);
|
||||
break;
|
||||
case NON_MODAL_SET_COORDINATE_OFFSET:
|
||||
memcpy(gc_state.coord_offset,gc_block.values.xyz,sizeof(gc_block.values.xyz));
|
||||
memcpy(gc_state.coord_offset,gc_block.values.xyza,sizeof(gc_block.values.xyza));
|
||||
system_flag_wco_change();
|
||||
break;
|
||||
case NON_MODAL_RESET_COORDINATE_OFFSET:
|
||||
@ -1032,27 +1051,27 @@ uint8_t gc_execute_line(char *line)
|
||||
if (axis_command == AXIS_COMMAND_MOTION_MODE) {
|
||||
uint8_t gc_update_pos = GC_UPDATE_POS_TARGET;
|
||||
if (gc_state.modal.motion == MOTION_MODE_LINEAR) {
|
||||
mc_line(gc_block.values.xyz, pl_data);
|
||||
mc_line(gc_block.values.xyza, pl_data);
|
||||
} else if (gc_state.modal.motion == MOTION_MODE_SEEK) {
|
||||
pl_data->condition |= PL_COND_FLAG_RAPID_MOTION; // Set rapid motion condition flag.
|
||||
mc_line(gc_block.values.xyz, pl_data);
|
||||
mc_line(gc_block.values.xyza, pl_data);
|
||||
} else if ((gc_state.modal.motion == MOTION_MODE_CW_ARC) || (gc_state.modal.motion == MOTION_MODE_CCW_ARC)) {
|
||||
mc_arc(gc_block.values.xyz, pl_data, gc_state.position, gc_block.values.ijk, gc_block.values.r,
|
||||
mc_arc(gc_block.values.xyza, pl_data, gc_state.position, gc_block.values.ijk, gc_block.values.r,
|
||||
axis_0, axis_1, axis_linear, bit_istrue(gc_parser_flags,GC_PARSER_ARC_IS_CLOCKWISE));
|
||||
} else {
|
||||
// NOTE: gc_block.values.xyz is returned from mc_probe_cycle with the updated position value. So
|
||||
// NOTE: gc_block.values.xyza is returned from mc_probe_cycle with the updated position value. So
|
||||
// upon a successful probing cycle, the machine position and the returned value should be the same.
|
||||
#ifndef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES
|
||||
pl_data->condition |= PL_COND_FLAG_NO_FEED_OVERRIDE;
|
||||
#endif
|
||||
gc_update_pos = mc_probe_cycle(gc_block.values.xyz, pl_data, gc_parser_flags);
|
||||
gc_update_pos = mc_probe_cycle(gc_block.values.xyza, pl_data, gc_parser_flags);
|
||||
}
|
||||
|
||||
// As far as the parser is concerned, the position is now == target. In reality the
|
||||
// motion control system might still be processing the action and the real tool position
|
||||
// in any intermediate location.
|
||||
if (gc_update_pos == GC_UPDATE_POS_TARGET) {
|
||||
memcpy(gc_state.position, gc_block.values.xyz, sizeof(gc_block.values.xyz)); // gc_state.position[] = gc_block.values.xyz[]
|
||||
memcpy(gc_state.position, gc_block.values.xyza, sizeof(gc_block.values.xyza)); // gc_state.position[] = gc_block.values.xyza[]
|
||||
} else if (gc_update_pos == GC_UPDATE_POS_SYSTEM) {
|
||||
gc_sync_position(); // gc_state.position[] = sys_position
|
||||
} // == GC_UPDATE_POS_NONE
|
||||
@ -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)
|
||||
*/
|
||||
|
20
grbl/gcode.h
20
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,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.
|
||||
|
||||
@ -143,6 +149,7 @@
|
||||
#define WORD_X 10
|
||||
#define WORD_Y 11
|
||||
#define WORD_Z 12
|
||||
#define WORD_A 13
|
||||
|
||||
// Define g-code parser position updating flags
|
||||
#define GC_UPDATE_POS_TARGET 0 // Must be zero
|
||||
@ -187,11 +194,12 @@ 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 {
|
||||
float f; // Feed
|
||||
float ijk[3]; // I,J,K Axis arc offsets
|
||||
float ijk[N_AXIS]; // I,J,K Axis arc offsets
|
||||
uint8_t l; // G10 or canned cycles parameters
|
||||
int32_t n; // Line number
|
||||
float p; // G10 or dwell parameters
|
||||
@ -199,7 +207,7 @@ typedef struct {
|
||||
float r; // Arc radius
|
||||
float s; // Spindle speed
|
||||
uint8_t t; // Tool selection
|
||||
float xyz[3]; // X,Y,Z Translational axes
|
||||
float xyza[N_AXIS]; // X,Y,Z,A Translational axes
|
||||
} gc_values_t;
|
||||
|
||||
|
||||
|
17
grbl/grbl.h
17
grbl/grbl.h
@ -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 "20171008"
|
||||
|
||||
// Define standard libraries used by Grbl.
|
||||
#include <avr/io.h>
|
||||
@ -75,9 +75,15 @@
|
||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
|
||||
#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)
|
||||
@ -85,6 +91,12 @@
|
||||
#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 +117,7 @@
|
||||
#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
|
||||
#error "Override refresh must be greater than zero."
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
@ -33,11 +33,11 @@ uint8_t jog_execute(plan_line_data_t *pl_data, parser_block_t *gc_block)
|
||||
#endif
|
||||
|
||||
if (bit_istrue(settings.flags,BITFLAG_SOFT_LIMIT_ENABLE)) {
|
||||
if (system_check_travel_limits(gc_block->values.xyz)) { return(STATUS_TRAVEL_EXCEEDED); }
|
||||
if (system_check_travel_limits(gc_block->values.xyza)) { return(STATUS_TRAVEL_EXCEEDED); }
|
||||
}
|
||||
|
||||
// Valid jog command. Plan, set state, and execute.
|
||||
mc_line(gc_block->values.xyz,pl_data);
|
||||
mc_line(gc_block->values.xyza,pl_data);
|
||||
if (sys.state == STATE_IDLE) {
|
||||
if (plan_get_current_block() != NULL) { // Check if there is a block to execute.
|
||||
sys.state = STATE_JOG;
|
||||
|
@ -158,9 +158,9 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
|
||||
// Initialize variables used for homing computations.
|
||||
uint8_t n_cycle = (2*N_HOMING_LOCATE_CYCLE+1);
|
||||
uint32_t step_pin[N_AXIS];
|
||||
uint32_t step_pin[N_AXIS]; // Tracks which pins correspond to which axes (reduces calls to get_step_pin_mask())
|
||||
float target[N_AXIS];
|
||||
float max_travel = 0.0;
|
||||
float max_travel = 0.0; // Maximum travel distance to move searching for limits
|
||||
uint8_t idx;
|
||||
for (idx=0; idx<N_AXIS; idx++) {
|
||||
// Initialize step pin masks
|
||||
@ -183,11 +183,12 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
uint32_t limit_state, axislock, n_active_axis;
|
||||
do {
|
||||
|
||||
// convert current sys_position (steps) to target (mm) so unused axes remain in place
|
||||
system_convert_array_steps_to_mpos(target,sys_position);
|
||||
|
||||
// Initialize and declare variables needed for homing routine.
|
||||
axislock = 0;
|
||||
n_active_axis = 0;
|
||||
axislock = 0; // Track which pins still need to find limits. Lock these axes by clearing these bits.
|
||||
n_active_axis = 0; // Track number of axes being homed
|
||||
for (idx=0; idx<N_AXIS; idx++) {
|
||||
// Set target location for active axes and setup computation for homing rate.
|
||||
if (bit_istrue(cycle_mask,bit(idx))) {
|
||||
@ -215,7 +216,7 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
if (approach) { target[idx] = max_travel; }
|
||||
else { target[idx] = -max_travel; }
|
||||
}
|
||||
// Apply axislock to the step port pins active in this cycle.
|
||||
// Apply axislock to the step port pins active in this cycle, allowing motion
|
||||
axislock |= step_pin[idx];
|
||||
}
|
||||
|
||||
@ -237,12 +238,13 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
for (idx=0; idx<N_AXIS; idx++) {
|
||||
if (axislock & step_pin[idx]) {
|
||||
if (limit_state & (1 << idx)) {
|
||||
#ifdef COREXY
|
||||
if (idx==Z_AXIS) { axislock &= ~(step_pin[Z_AXIS]); }
|
||||
else { axislock &= ~(step_pin[A_MOTOR]|step_pin[B_MOTOR]); }
|
||||
#else
|
||||
axislock &= ~(step_pin[idx]);
|
||||
#endif
|
||||
// Clear the axislock bits to prevent axis from moving after limit is hit
|
||||
#ifdef COREXY
|
||||
if (idx==Z_AXIS) { axislock &= ~(step_pin[Z_AXIS]); }
|
||||
else { axislock &= ~(step_pin[A_MOTOR]|step_pin[B_MOTOR]); }
|
||||
#else
|
||||
axislock &= ~(step_pin[idx]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -297,7 +299,7 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
// can be on either side of an axes, check and set axes machine zero appropriately. Also,
|
||||
// set up pull-off maneuver from axes limit switches that have been homed. This provides
|
||||
// some initial clearance off the switches and should also help prevent them from falsely
|
||||
// triggering when hard limits are enabled or when more than one axes shares a limit pin.
|
||||
// triggering when hard limits are enabled or when more than one axis shares a limit pin.
|
||||
int32_t set_axis_position;
|
||||
// Set machine positions for homed limit switches. Don't update non-homed axes.
|
||||
for (idx=0; idx<N_AXIS; idx++) {
|
||||
@ -307,9 +309,17 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
set_axis_position = 0;
|
||||
#else
|
||||
if ( bit_istrue(settings.homing_dir_mask,bit(idx)) ) {
|
||||
set_axis_position = lround((settings.max_travel[idx]+settings.homing_pulloff)*settings.steps_per_mm[idx]);
|
||||
#ifdef HOMING_FORCE_POSITIVE_SPACE
|
||||
set_axis_position = 0; //lround(settings.homing_pulloff*settings.steps_per_mm[idx]);
|
||||
#else
|
||||
set_axis_position = lround((settings.max_travel[idx]-settings.homing_pulloff)*settings.steps_per_mm[idx]);
|
||||
#endif
|
||||
} else {
|
||||
set_axis_position = lround(-settings.homing_pulloff*settings.steps_per_mm[idx]);
|
||||
#ifdef HOMING_FORCE_POSITIVE_SPACE
|
||||
set_axis_position = lround(-settings.max_travel[idx]*settings.steps_per_mm[idx]);
|
||||
#else
|
||||
set_axis_position = lround(-settings.homing_pulloff*settings.steps_per_mm[idx]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
74
grbl/main.c
74
grbl/main.c
@ -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.
|
||||
@ -76,13 +42,13 @@ int main(void)
|
||||
{
|
||||
// Initialize system upon power-up.
|
||||
debug_init(); // Initialize debug leds
|
||||
isr_init(); // Set ISR priorities
|
||||
delay_init(); // Setup delay timer
|
||||
isr_init(); // Set ISR priorities (stepper ISR uses Timer1)
|
||||
delay_init(); // Setup delay timer (uses Timer3)
|
||||
serial_init(); // Setup serial baud rate and interrupts
|
||||
eeprom_init(); // Init EEPROM or FLASH
|
||||
eeprom_init(); // Init EEPROM or Flash
|
||||
settings_init(); // Load Grbl settings from EEPROM
|
||||
current_init(); // Configure stepper driver current
|
||||
stepper_init(); // Configure stepper pins and interrupt timers
|
||||
stepper_init(); // Configure stepper pins and interrupt timers (uses Timer1)
|
||||
system_init(); // Configure pinout pins and pin-change interrupt
|
||||
|
||||
memset(sys_position,0,sizeof(sys_position)); // Clear machine position.
|
||||
@ -95,7 +61,7 @@ int main(void)
|
||||
#else
|
||||
sys.state = STATE_IDLE;
|
||||
#endif
|
||||
|
||||
|
||||
// Check for power-up and set system alarm if homing is enabled to force homing cycle
|
||||
// by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
|
||||
// startup scripts, but allows access to settings and internal commands. Only a homing
|
||||
@ -118,26 +84,26 @@ int main(void)
|
||||
sys.f_override = DEFAULT_FEED_OVERRIDE; // Set to 100%
|
||||
sys.r_override = DEFAULT_RAPID_OVERRIDE; // Set to 100%
|
||||
sys.spindle_speed_ovr = DEFAULT_SPINDLE_SPEED_OVERRIDE; // Set to 100%
|
||||
memset(sys_probe_position,0,sizeof(sys_probe_position)); // Clear probe position.
|
||||
sys_probe_state = 0;
|
||||
sys_rt_exec_state = 0;
|
||||
memset(sys_probe_position,0,sizeof(sys_probe_position)); // Clear probe position.
|
||||
sys_probe_state = 0; // PROBE_OFF
|
||||
sys_rt_exec_state = 0; // EXEC_STATUS_REPORT
|
||||
sys_rt_exec_alarm = 0;
|
||||
sys_rt_exec_motion_override = 0;
|
||||
sys_rt_exec_accessory_override = 0;
|
||||
|
||||
// Reset Grbl primary systems.
|
||||
serial_reset_read_buffer(); // Clear serial read buffer
|
||||
gc_init(); // Set g-code parser to default state
|
||||
spindle_init();
|
||||
coolant_init();
|
||||
limits_init();
|
||||
probe_init();
|
||||
plan_reset(); // Clear block buffer and planner variables
|
||||
st_reset(); // Clear stepper subsystem variables.
|
||||
gc_init(); // Set g-code parser to default state
|
||||
spindle_init(); // Configure spindle pins and PWM values
|
||||
coolant_init(); // Configure coolant pins
|
||||
limits_init(); // Configure limit input pins and interrupts
|
||||
probe_init(); // Configure probe input pin
|
||||
plan_reset(); // Clear block buffer and planner variables
|
||||
st_reset(); // Clear stepper subsystem variables.
|
||||
|
||||
// Sync cleared gcode and planner positions to current system position.
|
||||
plan_sync_position();
|
||||
gc_sync_position();
|
||||
plan_sync_position(); // Synchronize plan position with (actual) system position
|
||||
gc_sync_position(); // Synchronize g-code position with (actual) system position
|
||||
|
||||
// Print welcome message. Indicates an initialization has occured at power-up or with a reset.
|
||||
report_init_message();
|
||||
|
@ -227,6 +227,9 @@ void mc_homing_cycle(uint8_t cycle_mask)
|
||||
#ifdef HOMING_CYCLE_2
|
||||
limits_go_home(HOMING_CYCLE_2); // Homing cycle 2
|
||||
#endif
|
||||
#ifdef HOMING_CYCLE_3
|
||||
limits_go_home(HOMING_CYCLE_3); // Homing cycle 3
|
||||
#endif
|
||||
}
|
||||
|
||||
protocol_execute_realtime(); // Check for reset and set system abort.
|
||||
@ -310,32 +313,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
|
||||
|
@ -31,6 +31,9 @@
|
||||
#define HOMING_CYCLE_X bit(X_AXIS)
|
||||
#define HOMING_CYCLE_Y bit(Y_AXIS)
|
||||
#define HOMING_CYCLE_Z bit(Z_AXIS)
|
||||
#define HOMING_CYCLE_A bit(A_AXIS)
|
||||
//#define HOMING_CYCLE_B bit(B_AXIS)
|
||||
//#define HOMING_CYCLE_C bit(C_AXIS)
|
||||
|
||||
|
||||
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
|
||||
@ -54,6 +57,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);
|
||||
|
||||
|
@ -30,11 +30,13 @@
|
||||
#define SOME_LARGE_VALUE 1.0E+38
|
||||
|
||||
// Axis array index values. Must start with 0 and be continuous.
|
||||
#define N_AXIS 3 // Number of axes
|
||||
#define N_AXIS 4 // Number of axes
|
||||
#define X_AXIS 0 // Axis indexing value.
|
||||
#define Y_AXIS 1
|
||||
#define Z_AXIS 2
|
||||
// #define A_AXIS 3
|
||||
#define A_AXIS 3
|
||||
//#define B_AXIS 4
|
||||
//#define C_AXIS 5
|
||||
|
||||
// CoreXY motor assignments. DO NOT ALTER.
|
||||
// NOTE: If the A and B motor axis bindings are changed, this effects the CoreXY equations.
|
||||
|
@ -336,6 +336,7 @@ uint8_t plan_buffer_line(float *target, plan_line_data_t *pl_data)
|
||||
position_steps[X_AXIS] = system_convert_corexy_to_x_axis_steps(sys_position);
|
||||
position_steps[Y_AXIS] = system_convert_corexy_to_y_axis_steps(sys_position);
|
||||
position_steps[Z_AXIS] = sys_position[Z_AXIS];
|
||||
position_steps[A_AXIS] = sys_position[A_AXIS];
|
||||
#else
|
||||
memcpy(position_steps, sys_position, sizeof(sys_position));
|
||||
#endif
|
||||
|
@ -50,7 +50,13 @@ void probe_configure_invert_mask(uint8_t is_probe_away)
|
||||
|
||||
|
||||
// Returns the probe pin state. Triggered = true. Called by gcode parser and probe state monitor.
|
||||
uint8_t probe_get_state() { return((PROBE_PIN & PROBE_MASK) ^ probe_invert_mask); }
|
||||
uint8_t probe_get_state() {
|
||||
if ((PROBE_PIN & PROBE_MASK) ^ probe_invert_mask) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Monitors probe pin state and records the system position when detected. Called by the
|
||||
|
@ -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
|
||||
|
@ -208,6 +208,10 @@ void report_grbl_settings() {
|
||||
#else
|
||||
report_util_uint8_setting(32,0);
|
||||
#endif
|
||||
report_util_float_setting(33,settings.spindle_pwm_freq,N_DECIMAL_SETTINGVALUE);
|
||||
report_util_float_setting(34,settings.spindle_pwm_off_value,N_DECIMAL_SETTINGVALUE);
|
||||
report_util_float_setting(35,settings.spindle_pwm_min_value,N_DECIMAL_SETTINGVALUE);
|
||||
report_util_float_setting(36,settings.spindle_pwm_max_value,N_DECIMAL_SETTINGVALUE);
|
||||
// Print axis settings
|
||||
uint8_t idx, set_idx;
|
||||
uint8_t val = AXIS_SETTINGS_START_VAL;
|
||||
@ -328,6 +332,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 +405,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 +435,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();
|
||||
}
|
||||
|
||||
@ -545,6 +575,9 @@ void report_realtime_status()
|
||||
if (bit_istrue(lim_pin_state,bit(X_AXIS))) { serial_write('X'); }
|
||||
if (bit_istrue(lim_pin_state,bit(Y_AXIS))) { serial_write('Y'); }
|
||||
if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); }
|
||||
if (bit_istrue(lim_pin_state,bit(A_AXIS))) { serial_write('A'); }
|
||||
//if (bit_istrue(lim_pin_state,bit(B_AXIS))) { serial_write('B'); }
|
||||
//if (bit_istrue(lim_pin_state,bit(C_AXIS))) { serial_write('C'); }
|
||||
}
|
||||
if (ctrl_pin_state) {
|
||||
#ifdef ENABLE_SAFETY_DOOR_INPUT_PIN
|
||||
|
@ -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
|
||||
|
@ -49,6 +49,8 @@ void serialInterrupt(uint32_t event);
|
||||
void legacy_ISR(uint8_t data);
|
||||
uint8_t arm_rx_buf[1];
|
||||
|
||||
bool lastDtr = false;
|
||||
|
||||
// Returns the number of bytes available in the RX serial buffer.
|
||||
uint16_t serial_get_rx_buffer_available()
|
||||
{
|
||||
@ -80,10 +82,18 @@ uint8_t serial_get_tx_buffer_count()
|
||||
void serial_init()
|
||||
{
|
||||
#ifdef USE_USB
|
||||
usbSerialInit([](const U8* data, unsigned len) {
|
||||
while(len--)
|
||||
legacy_ISR(*data++);
|
||||
});
|
||||
usbSerialInit(
|
||||
[](bool dtr, bool rts) {
|
||||
if (dtr != lastDtr)
|
||||
{
|
||||
lastDtr = dtr;
|
||||
mc_reset();
|
||||
}
|
||||
},
|
||||
[](const U8* data, unsigned len) {
|
||||
while (len--)
|
||||
legacy_ISR(*data++);
|
||||
});
|
||||
#else
|
||||
int32_t uartFlags = ARM_USART_MODE_ASYNCHRONOUS |
|
||||
ARM_USART_DATA_BITS_8 |
|
||||
@ -102,6 +112,7 @@ void serial_init()
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
void legacy_serial_init()
|
||||
{
|
||||
// Set baud rate
|
||||
@ -120,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) {
|
||||
@ -144,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
|
||||
@ -164,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.
|
||||
@ -180,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)
|
||||
@ -196,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()
|
||||
|
@ -86,6 +86,10 @@ 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.spindle_pwm_off_value = DEFAULT_SPINDLE_PWM_OFF_VALUE;
|
||||
settings.spindle_pwm_min_value = DEFAULT_SPINDLE_PWM_MIN_VALUE;
|
||||
settings.spindle_pwm_max_value = DEFAULT_SPINDLE_PWM_MAX_VALUE;
|
||||
settings.rpm_max = DEFAULT_SPINDLE_RPM_MAX;
|
||||
settings.rpm_min = DEFAULT_SPINDLE_RPM_MIN;
|
||||
|
||||
@ -96,30 +100,45 @@ void settings_restore(uint8_t restore_flag) {
|
||||
settings.homing_pulloff = DEFAULT_HOMING_PULLOFF;
|
||||
|
||||
settings.flags = 0;
|
||||
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
||||
if (DEFAULT_LASER_MODE) { settings.flags |= BITFLAG_LASER_MODE; }
|
||||
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
||||
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
||||
if (DEFAULT_LASER_MODE) { settings.flags |= BITFLAG_LASER_MODE; }
|
||||
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
||||
if (DEFAULT_HARD_LIMIT_ENABLE) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; }
|
||||
if (DEFAULT_HOMING_ENABLE) { settings.flags |= BITFLAG_HOMING_ENABLE; }
|
||||
if (DEFAULT_HOMING_ENABLE) { settings.flags |= BITFLAG_HOMING_ENABLE; }
|
||||
if (DEFAULT_SOFT_LIMIT_ENABLE) { settings.flags |= BITFLAG_SOFT_LIMIT_ENABLE; }
|
||||
if (DEFAULT_INVERT_LIMIT_PINS) { settings.flags |= BITFLAG_INVERT_LIMIT_PINS; }
|
||||
if (DEFAULT_INVERT_PROBE_PIN) { settings.flags |= BITFLAG_INVERT_PROBE_PIN; }
|
||||
if (DEFAULT_INVERT_PROBE_PIN) { settings.flags |= BITFLAG_INVERT_PROBE_PIN; }
|
||||
|
||||
settings.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM;
|
||||
settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM;
|
||||
settings.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM;
|
||||
settings.steps_per_mm[A_AXIS] = DEFAULT_A_STEPS_PER_MM;
|
||||
//settings.steps_per_mm[B_AXIS] = DEFAULT_B_STEPS_PER_MM;
|
||||
//settings.steps_per_mm[C_AXIS] = DEFAULT_C_STEPS_PER_MM;
|
||||
settings.max_rate[X_AXIS] = DEFAULT_X_MAX_RATE;
|
||||
settings.max_rate[Y_AXIS] = DEFAULT_Y_MAX_RATE;
|
||||
settings.max_rate[Z_AXIS] = DEFAULT_Z_MAX_RATE;
|
||||
settings.max_rate[A_AXIS] = DEFAULT_A_MAX_RATE;
|
||||
//settings.max_rate[B_AXIS] = DEFAULT_B_MAX_RATE;
|
||||
//settings.max_rate[C_AXIS] = DEFAULT_C_MAX_RATE;
|
||||
settings.acceleration[X_AXIS] = DEFAULT_X_ACCELERATION;
|
||||
settings.acceleration[Y_AXIS] = DEFAULT_Y_ACCELERATION;
|
||||
settings.acceleration[Z_AXIS] = DEFAULT_Z_ACCELERATION;
|
||||
settings.acceleration[A_AXIS] = DEFAULT_A_ACCELERATION;
|
||||
//settings.acceleration[B_AXIS] = DEFAULT_B_ACCELERATION;
|
||||
//settings.acceleration[C_AXIS] = DEFAULT_C_ACCELERATION;
|
||||
settings.max_travel[X_AXIS] = (-DEFAULT_X_MAX_TRAVEL);
|
||||
settings.max_travel[Y_AXIS] = (-DEFAULT_Y_MAX_TRAVEL);
|
||||
settings.max_travel[Z_AXIS] = (-DEFAULT_Z_MAX_TRAVEL);
|
||||
settings.max_travel[A_AXIS] = (-DEFAULT_A_MAX_TRAVEL);
|
||||
//settings.max_travel[B_AXIS] = (-DEFAULT_B_MAX_TRAVEL);
|
||||
//settings.max_travel[C_AXIS] = (-DEFAULT_C_MAX_TRAVEL);
|
||||
settings.current[X_AXIS] = DEFAULT_X_CURRENT;
|
||||
settings.current[Y_AXIS] = DEFAULT_Y_CURRENT;
|
||||
settings.current[Z_AXIS] = DEFAULT_Z_CURRENT;
|
||||
settings.current[A_AXIS] = DEFAULT_A_CURRENT;
|
||||
//settings.current[B_AXIS] = DEFAULT_B_CURRENT;
|
||||
//settings.current[C_AXIS] = DEFAULT_C_CURRENT;
|
||||
|
||||
write_global_settings(false);
|
||||
}
|
||||
@ -158,7 +177,7 @@ uint8_t settings_read_startup_line(uint8_t n, char *line)
|
||||
if (!(memcpy_from_eeprom_with_checksum((char*)line, addr, LINE_BUFFER_SIZE))) {
|
||||
// Reset line with default value
|
||||
line[0] = 0; // Empty line
|
||||
settings_store_startup_line(n, line);
|
||||
settings_store_startup_line(n, line); // Clear this startup line because it's corrupted
|
||||
return(false);
|
||||
}
|
||||
return(true);
|
||||
@ -171,7 +190,7 @@ uint8_t settings_read_build_info(char *line)
|
||||
if (!(memcpy_from_eeprom_with_checksum((char*)line, EEPROM_ADDR_BUILD_INFO, LINE_BUFFER_SIZE))) {
|
||||
// Reset line with default value
|
||||
line[0] = 0; // Empty line
|
||||
settings_store_build_info(line);
|
||||
settings_store_build_info(line); // Clear out build info string because it's corrupted
|
||||
return(false);
|
||||
}
|
||||
return(true);
|
||||
@ -317,6 +336,10 @@ 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
|
||||
case 34: settings.spindle_pwm_off_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
case 35: settings.spindle_pwm_min_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
case 36: settings.spindle_pwm_max_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
|
||||
default:
|
||||
return(STATUS_INVALID_STATEMENT);
|
||||
}
|
||||
@ -341,7 +364,11 @@ uint32_t get_step_pin_mask(uint8_t axis_idx)
|
||||
{
|
||||
if ( axis_idx == X_AXIS ) { return((1<<X_STEP_BIT)); }
|
||||
if ( axis_idx == Y_AXIS ) { return((1<<Y_STEP_BIT)); }
|
||||
return((1<<Z_STEP_BIT));
|
||||
if ( axis_idx == Z_AXIS ) { return((1<<Z_STEP_BIT)); }
|
||||
return((1<<A_STEP_BIT));
|
||||
//if ( axis_idx == A_AXIS ) { return((1<<A_STEP_BIT)); }
|
||||
//if ( axis_idx == B_AXIS ) { return((1<<B_STEP_BIT)); }
|
||||
//return((1<<C_STEP_BIT));
|
||||
}
|
||||
|
||||
|
||||
@ -350,7 +377,11 @@ uint32_t get_direction_pin_mask(uint8_t axis_idx)
|
||||
{
|
||||
if ( axis_idx == X_AXIS ) { return((1<<X_DIRECTION_BIT)); }
|
||||
if ( axis_idx == Y_AXIS ) { return((1<<Y_DIRECTION_BIT)); }
|
||||
return((1<<Z_DIRECTION_BIT));
|
||||
if ( axis_idx == Z_AXIS ) { return((1<<Z_DIRECTION_BIT)); }
|
||||
return((1<<A_DIRECTION_BIT));
|
||||
//if ( axis_idx == A_AXIS ) { return((1<<A_DIRECTION_BIT)); }
|
||||
//if ( axis_idx == B_AXIS ) { return((1<<B_DIRECTION_BIT)); }
|
||||
//return((1<<C_DIRECTION_BIT));
|
||||
}
|
||||
|
||||
|
||||
@ -359,5 +390,9 @@ uint32_t get_limit_pin_mask(uint8_t axis_idx)
|
||||
{
|
||||
if ( axis_idx == X_AXIS ) { return((1<<X_LIMIT_BIT)); }
|
||||
if ( axis_idx == Y_AXIS ) { return((1<<Y_LIMIT_BIT)); }
|
||||
return((1<<Z_LIMIT_BIT));
|
||||
if ( axis_idx == Z_AXIS ) { return((1<<Z_LIMIT_BIT)); }
|
||||
return((1<<A_LIMIT_BIT));
|
||||
//if ( axis_idx == A_AXIS ) { return((1<<A_LIMIT_BIT)); }
|
||||
//if ( axis_idx == B_AXIS ) { return((1<<B_LIMIT_BIT)); }
|
||||
//return((1<<C_LIMIT_BIT));
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
|
||||
// Version of the EEPROM data. Will be used to migrate existing data from older versions of Grbl
|
||||
// when firmware is upgraded. Always stored in byte 0 of eeprom
|
||||
#define SETTINGS_VERSION 10 // NOTE: Check settings_reset() when moving to next version.
|
||||
// when firmware is upgraded. Always stored in byte 0 of EEPROM.
|
||||
#define SETTINGS_VERSION 11 // NOTE: Check settings_reset() when moving to next version.
|
||||
|
||||
// Define bit flag masks for the boolean settings in settings.flag.
|
||||
#define BITFLAG_REPORT_INCHES bit(0)
|
||||
@ -44,10 +44,10 @@
|
||||
#define BITFLAG_RT_STATUS_BUFFER_STATE bit(1)
|
||||
|
||||
// Define settings restore bitflags.
|
||||
#define SETTINGS_RESTORE_DEFAULTS bit(0)
|
||||
#define SETTINGS_RESTORE_PARAMETERS bit(1)
|
||||
#define SETTINGS_RESTORE_DEFAULTS bit(0)
|
||||
#define SETTINGS_RESTORE_PARAMETERS bit(1)
|
||||
#define SETTINGS_RESTORE_STARTUP_LINES bit(2)
|
||||
#define SETTINGS_RESTORE_BUILD_INFO bit(3)
|
||||
#define SETTINGS_RESTORE_BUILD_INFO bit(3)
|
||||
#ifndef SETTINGS_RESTORE_ALL
|
||||
#define SETTINGS_RESTORE_ALL 0xFF // All bitflags
|
||||
#endif
|
||||
@ -56,6 +56,7 @@
|
||||
// NOTE: The Atmega328p has 1KB EEPROM. The upper half is reserved for parameters and
|
||||
// the startup script. The lower half contains the global settings and space for future
|
||||
// developments.
|
||||
// Note: Address 0 of EEPROM is reserved for SETTINGS_VERSION.
|
||||
#define EEPROM_ADDR_GLOBAL 1U
|
||||
#define EEPROM_ADDR_PARAMETERS 512U
|
||||
#define EEPROM_ADDR_STARTUP_BLOCK 768U
|
||||
@ -80,7 +81,7 @@ typedef struct {
|
||||
float steps_per_mm[N_AXIS];
|
||||
float max_rate[N_AXIS];
|
||||
float acceleration[N_AXIS];
|
||||
float max_travel[N_AXIS];
|
||||
float max_travel[N_AXIS]; // NOTE: Stored as a negative value
|
||||
float current[N_AXIS];
|
||||
|
||||
// Remaining Grbl settings
|
||||
@ -92,6 +93,10 @@ typedef struct {
|
||||
float junction_deviation;
|
||||
float arc_tolerance;
|
||||
|
||||
float spindle_pwm_freq; // Hz
|
||||
float spindle_pwm_off_value; // Percent
|
||||
float spindle_pwm_min_value; // Percent
|
||||
float spindle_pwm_max_value; // Percent
|
||||
float rpm_max;
|
||||
float rpm_min;
|
||||
|
||||
|
@ -25,16 +25,23 @@
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
static float pwm_gradient; // Precalulated value to speed up rpm to PWM conversions.
|
||||
float spindle_pwm_period;
|
||||
float spindle_pwm_off_value;
|
||||
float spindle_pwm_min_value;
|
||||
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 * settings.spindle_pwm_off_value / 100);
|
||||
spindle_pwm_min_value = (spindle_pwm_period * settings.spindle_pwm_min_value / 100);
|
||||
spindle_pwm_max_value = (spindle_pwm_period * settings.spindle_pwm_max_value / 100);
|
||||
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0);
|
||||
pwm_enable(&SPINDLE_PWM_CHANNEL);
|
||||
|
||||
/* not ported
|
||||
// Configure variable spindle PWM and enable pin, if requried. On the Uno, PWM and enable are
|
||||
// combined unless configured otherwise.
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
@ -42,16 +49,13 @@ void spindle_init()
|
||||
#else
|
||||
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
||||
#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);
|
||||
|
||||
#else
|
||||
/* not ported
|
||||
// Configure no variable spindle and only enable pin.
|
||||
SPINDLE_ENABLE_DDR |= (1<<SPINDLE_ENABLE_BIT); // Configure as output pin.
|
||||
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
||||
*/
|
||||
#endif
|
||||
|
||||
spindle_stop();
|
||||
@ -60,32 +64,30 @@ void spindle_init()
|
||||
|
||||
uint8_t spindle_get_state()
|
||||
{
|
||||
/* not ported
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
// No spindle direction output pin.
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||
#else
|
||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||
#endif
|
||||
#else
|
||||
if (SPINDLE_TCCRA_REGISTER & (1<<SPINDLE_COMB_BIT)) { // Check if PWM is enabled.
|
||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||
else { return(SPINDLE_STATE_CW); }
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
// No spindle direction output pin.
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||
#else
|
||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||
#endif
|
||||
#else
|
||||
if (SPINDLE_TCCRA_REGISTER & (1<<SPINDLE_COMB_BIT)) { // Check if PWM is enabled.
|
||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||
else { return(SPINDLE_STATE_CW); }
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||
#else
|
||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||
#endif
|
||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||
else { return(SPINDLE_STATE_CW); }
|
||||
}
|
||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||
else { return(SPINDLE_STATE_CW); }
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
return(SPINDLE_STATE_DISABLE);
|
||||
}
|
||||
|
||||
@ -95,26 +97,22 @@ uint8_t spindle_get_state()
|
||||
// Called by spindle_init(), spindle_set_speed(), spindle_set_state(), and mc_reset().
|
||||
void spindle_stop()
|
||||
{
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
pwm_set_width(&SPINDLE_PWM_CHANNEL, 0);
|
||||
/* not ported
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||
#else
|
||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
#else
|
||||
/* not ported
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
pwm_set_width(&SPINDLE_PWM_CHANNEL, 0);
|
||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||
#else
|
||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||
#else
|
||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -134,21 +132,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;
|
||||
}
|
||||
else if (rpm <= settings.rpm_min) {
|
||||
sys.spindle_speed = settings.rpm_min;
|
||||
pwm_value = SPINDLE_PWM_MIN_VALUE;
|
||||
pwm_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;
|
||||
}
|
||||
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;
|
||||
if(pwm_value >= spindle_pwm_max_value)
|
||||
pwm_value = spindle_pwm_max_value - 1;
|
||||
}
|
||||
return(pwm_value);
|
||||
}
|
||||
@ -175,13 +173,11 @@ void spindle_stop()
|
||||
} else {
|
||||
|
||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||
/* not ported
|
||||
if (state == SPINDLE_ENABLE_CW) {
|
||||
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
||||
} else {
|
||||
SPINDLE_DIRECTION_PORT |= (1<<SPINDLE_DIRECTION_BIT);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
@ -190,16 +186,16 @@ 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
|
||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
||||
#else
|
||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ uint8_t spindle_get_state();
|
||||
// Immediately sets spindle running state with direction and spindle rpm via PWM, if enabled.
|
||||
// Called by spindle_sync() after sync and parking motion/spindle stop override during restore.
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
extern float spindle_pwm_period;
|
||||
extern float spindle_pwm_off_value;
|
||||
extern float spindle_pwm_min_value;
|
||||
extern float spindle_pwm_max_value;
|
||||
|
||||
// Called by g-code parser when setting spindle state and requires a buffer sync.
|
||||
void spindle_sync(uint8_t state, float rpm);
|
||||
|
239
grbl/stepper.c
239
grbl/stepper.c
@ -30,10 +30,10 @@
|
||||
#define RAMP_DECEL 2
|
||||
#define RAMP_DECEL_OVERRIDE 3
|
||||
|
||||
#define PREP_FLAG_RECALCULATE bit(0)
|
||||
#define PREP_FLAG_RECALCULATE bit(0)
|
||||
#define PREP_FLAG_HOLD_PARTIAL_BLOCK bit(1)
|
||||
#define PREP_FLAG_PARKING bit(2)
|
||||
#define PREP_FLAG_DECEL_OVERRIDE bit(3)
|
||||
#define PREP_FLAG_PARKING bit(2)
|
||||
#define PREP_FLAG_DECEL_OVERRIDE bit(3)
|
||||
|
||||
// Define Adaptive Multi-Axis Step-Smoothing(AMASS) levels and cutoff frequencies. The highest level
|
||||
// frequency bin starts at 0Hz and ends at its cutoff frequency. The next lower level frequency bin
|
||||
@ -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
|
||||
@ -91,7 +97,10 @@ typedef struct {
|
||||
// Used by the bresenham line algorithm
|
||||
uint32_t counter_x, // Counter variables for the bresenham line tracer
|
||||
counter_y,
|
||||
counter_z;
|
||||
counter_z,
|
||||
counter_a;
|
||||
//counter_b,
|
||||
//counter_c;
|
||||
#ifdef STEP_PULSE_DELAY
|
||||
uint32_t step_bits; // Stores out_bits output to complete the step pulse delay
|
||||
#endif
|
||||
@ -158,7 +167,7 @@ typedef struct {
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
float inv_rate; // Used by PWM laser mode to speed up segment calculations.
|
||||
uint32_t current_spindle_pwm;
|
||||
uint32_t current_spindle_pwm;
|
||||
#endif
|
||||
} st_prep_t;
|
||||
static st_prep_t prep;
|
||||
@ -226,9 +235,9 @@ void st_wake_up()
|
||||
#endif
|
||||
|
||||
// Enable Stepper Driver Interrupt Timer
|
||||
LPC_TIM1->TCR = 0b10; // reset
|
||||
LPC_TIM1->MR0 = 4000; // Generate first interrupt soon
|
||||
LPC_TIM1->TCR = 0b01; // enable
|
||||
LPC_TIM1->TCR = 0b10; // reset Timer Control (0b10=Reset, 0b01=Enable)
|
||||
LPC_TIM1->MR0 = 4000; // Generate first interrupt soon (Match Register for TC)
|
||||
LPC_TIM1->TCR = 0b01; // enable Timer Control (0b10=Reset, 0b01=Enable)
|
||||
}
|
||||
|
||||
|
||||
@ -236,11 +245,11 @@ void st_wake_up()
|
||||
void st_go_idle()
|
||||
{
|
||||
// Disable Stepper Driver Interrupt. Allow Stepper Port Reset Interrupt to finish, if active.
|
||||
LPC_TIM1->TCR = 0; // Disable Timer1
|
||||
LPC_TIM1->TCR = 0; // Disable Timer1 Control (0b10=Reset, 0b01=Enable)
|
||||
busy = false;
|
||||
|
||||
// Set stepper driver idle state, disabled or enabled, depending on settings and circumstances.
|
||||
bool pin_state = false; // Keep enabled.
|
||||
bool pin_state = false; // Stepper is disabled when pin_state is true. Keep enabled by default.
|
||||
if (((settings.stepper_idle_lock_time != 0xff) || sys_rt_exec_alarm || sys.state == STATE_SLEEP) && sys.state != STATE_HOMING) {
|
||||
// Force stepper dwell to lock axes for a defined amount of time to ensure the axes come to a complete
|
||||
// stop and not drift from residual inertial forces at the end of the last movement.
|
||||
@ -346,7 +355,7 @@ extern "C" void TIMER1_IRQHandler()
|
||||
#endif
|
||||
|
||||
// Initialize step segment timing per step and load number of steps to execute.
|
||||
LPC_TIM1->MR0 = st.exec_segment->cycles_per_tick;
|
||||
LPC_TIM1->MR0 = st.exec_segment->cycles_per_tick; // Set Match Register to wait one tick
|
||||
st.step_count = st.exec_segment->n_step; // NOTE: Can sometimes be zero when moving slow.
|
||||
// If the new segment starts a new planner block, initialize stepper variables and counters.
|
||||
// NOTE: When the segment data index changes, this indicates a new planner block.
|
||||
@ -364,6 +373,9 @@ extern "C" void TIMER1_IRQHandler()
|
||||
st.steps[X_AXIS] = st.exec_block->steps[X_AXIS] >> st.exec_segment->amass_level;
|
||||
st.steps[Y_AXIS] = st.exec_block->steps[Y_AXIS] >> st.exec_segment->amass_level;
|
||||
st.steps[Z_AXIS] = st.exec_block->steps[Z_AXIS] >> st.exec_segment->amass_level;
|
||||
st.steps[A_AXIS] = st.exec_block->steps[A_AXIS] >> st.exec_segment->amass_level;
|
||||
//st.steps[B_AXIS] = st.exec_block->steps[B_AXIS] >> st.exec_segment->amass_level;
|
||||
//st.steps[C_AXIS] = st.exec_block->steps[C_AXIS] >> st.exec_segment->amass_level;
|
||||
#endif
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
@ -379,7 +391,7 @@ extern "C" void TIMER1_IRQHandler()
|
||||
st_go_idle();
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
// Ensure pwm is set properly upon completion of rate-controlled motion.
|
||||
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(SPINDLE_PWM_OFF_VALUE); }
|
||||
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(spindle_pwm_off_value); }
|
||||
#endif
|
||||
system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end
|
||||
return; // Nothing to do but exit.
|
||||
@ -427,6 +439,41 @@ extern "C" void TIMER1_IRQHandler()
|
||||
if (st.exec_block->direction_bits & (1<<Z_DIRECTION_BIT)) { sys_position[Z_AXIS]--; }
|
||||
else { sys_position[Z_AXIS]++; }
|
||||
}
|
||||
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
st.counter_a += st.steps[A_AXIS];
|
||||
#else
|
||||
st.counter_a += st.exec_block->steps[A_AXIS];
|
||||
#endif
|
||||
if (st.counter_a > st.exec_block->step_event_count) {
|
||||
st.step_outbits |= (1<<A_STEP_BIT);
|
||||
st.counter_a -= st.exec_block->step_event_count;
|
||||
if (st.exec_block->direction_bits & (1<<A_DIRECTION_BIT)) { sys_position[A_AXIS]--; }
|
||||
else { sys_position[A_AXIS]++; }
|
||||
}
|
||||
/*
|
||||
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
st.counter_b += st.steps[B_AXIS];
|
||||
#else
|
||||
st.counter_b += st.exec_block->steps[B_AXIS];
|
||||
#endif
|
||||
if (st.counter_b > st.exec_block->step_event_count) {
|
||||
st.step_outbits |= (1<<B_STEP_BIT);
|
||||
st.counter_b -= st.exec_block->step_event_count;
|
||||
if (st.exec_block->direction_bits & (1<<B_DIRECTION_BIT)) { sys_position[B_AXIS]--; }
|
||||
else { sys_position[B_AXIS]++; }
|
||||
}
|
||||
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||
st.counter_c += st.steps[C_AXIS];
|
||||
#else
|
||||
st.counter_c += st.exec_block->steps[C_AXIS];
|
||||
#endif
|
||||
if (st.counter_c > st.exec_block->step_event_count) {
|
||||
st.step_outbits |= (1<<C_STEP_BIT);
|
||||
st.counter_c -= st.exec_block->step_event_count;
|
||||
if (st.exec_block->direction_bits & (1<<C_DIRECTION_BIT)) { sys_position[C_AXIS]--; }
|
||||
else { sys_position[C_AXIS]++; }
|
||||
}
|
||||
*/
|
||||
|
||||
// During a homing cycle, lock out and prevent desired axes from moving.
|
||||
if (sys.state == STATE_HOMING) { st.step_outbits &= sys.homing_axis_lock; }
|
||||
@ -456,7 +503,7 @@ extern "C" void TIMER1_IRQHandler()
|
||||
cause issues at high step rates if another high frequency asynchronous interrupt is
|
||||
added to Grbl.
|
||||
*/
|
||||
/* Not ported; the main ISR assumes short pulse widths and handles it. Stepper drivers with
|
||||
/* Not ported; the main ISR assumes short pulse widths and handles it. Stepper drivers with
|
||||
long pulse widths may need this instead if they cause the main ISR to consume too much time.
|
||||
// This interrupt is enabled by ISR_TIMER1_COMPAREA when it sets the motor port bits to execute
|
||||
// a step. This ISR resets the motor port after a short period (settings.pulse_microseconds)
|
||||
@ -523,17 +570,17 @@ void st_reset()
|
||||
void stepper_init()
|
||||
{
|
||||
// Configure step and direction interface pins
|
||||
STEP_DDR |= STEP_MASK;
|
||||
STEPPERS_DISABLE_DDR |= STEPPERS_DISABLE_MASK;
|
||||
DIRECTION_DDR |= DIRECTION_MASK;
|
||||
STEP_DDR |= STEP_MASK; // Set selected stepper step pins as outputs
|
||||
STEPPERS_DISABLE_DDR |= STEPPERS_DISABLE_MASK; // Set selected stepper disable pins as outputs
|
||||
DIRECTION_DDR |= DIRECTION_MASK; // Set selected stepper direction pins as outputs
|
||||
|
||||
// Configure Timer 1: Stepper Driver Interrupt
|
||||
LPC_TIM1->TCR = 0; // disable
|
||||
LPC_TIM1->CTCR = 0; // timer mode
|
||||
LPC_TIM1->PR = 0; // no prescale
|
||||
LPC_TIM1->MCR = 0b011; // MR0: !stop, reset, interrupt
|
||||
LPC_TIM1->CCR = 0; // no capture
|
||||
LPC_TIM1->EMR = 0; // no external match
|
||||
LPC_TIM1->TCR = 0; // disable Timer Control (0b10=Reset, 0b01=Enable)
|
||||
LPC_TIM1->CTCR = 0; // Count Control (0=TimerMode, 1-3=EdgeCounterMode)
|
||||
LPC_TIM1->PR = 0; // no Prescale (TC increments every PR+1 clocks)
|
||||
LPC_TIM1->MCR = 0b011; // Match Control (0b001=InterruptEnbl, 0b010=Reset_Enbl, 0b100=Stop_Enbl)
|
||||
LPC_TIM1->CCR = 0; // no Capture Control actions
|
||||
LPC_TIM1->EMR = 0; // no External Match (controls external match pins)
|
||||
NVIC_EnableIRQ(TIMER1_IRQn); // Enable Stepper Driver Interrupt
|
||||
}
|
||||
|
||||
@ -646,8 +693,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.
|
||||
@ -670,49 +717,49 @@ void st_prep_buffer()
|
||||
} else {
|
||||
prep.current_speed = sqrt(pl_block->entry_speed_sqr);
|
||||
}
|
||||
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
// Setup laser mode variables. PWM rate adjusted motions will always complete a motion with the
|
||||
// spindle off.
|
||||
// spindle off.
|
||||
st_prep_block->is_pwm_rate_adjusted = false;
|
||||
if (settings.flags & BITFLAG_LASER_MODE) {
|
||||
if (pl_block->condition & PL_COND_FLAG_SPINDLE_CCW) {
|
||||
if (pl_block->condition & PL_COND_FLAG_SPINDLE_CCW) {
|
||||
// Pre-compute inverse programmed rate to speed up PWM updating per step segment.
|
||||
prep.inv_rate = 1.0/pl_block->programmed_rate;
|
||||
st_prep_block->is_pwm_rate_adjusted = true;
|
||||
st_prep_block->is_pwm_rate_adjusted = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------
|
||||
Compute the velocity profile of a new planner block based on its entry and exit
|
||||
speeds, or recompute the profile of a partially-completed planner block if the
|
||||
planner has updated it. For a commanded forced-deceleration, such as from a feed
|
||||
hold, override the planner velocities and decelerate to the target exit speed.
|
||||
*/
|
||||
prep.mm_complete = 0.0; // Default velocity profile complete at 0.0mm from end of block.
|
||||
float inv_2_accel = 0.5/pl_block->acceleration;
|
||||
if (sys.step_control & STEP_CONTROL_EXECUTE_HOLD) { // [Forced Deceleration to Zero Velocity]
|
||||
// Compute velocity profile parameters for a feed hold in-progress. This profile overrides
|
||||
// the planner block profile, enforcing a deceleration to zero speed.
|
||||
prep.ramp_type = RAMP_DECEL;
|
||||
// Compute decelerate distance relative to end of block.
|
||||
float decel_dist = pl_block->millimeters - inv_2_accel*pl_block->entry_speed_sqr;
|
||||
if (decel_dist < 0.0) {
|
||||
// Deceleration through entire planner block. End of feed hold is not in this block.
|
||||
prep.exit_speed = sqrt(pl_block->entry_speed_sqr-2*pl_block->acceleration*pl_block->millimeters);
|
||||
} else {
|
||||
prep.mm_complete = decel_dist; // End of feed hold.
|
||||
prep.exit_speed = 0.0;
|
||||
}
|
||||
} else { // [Normal Operation]
|
||||
// Compute or recompute velocity profile parameters of the prepped planner block.
|
||||
prep.ramp_type = RAMP_ACCEL; // Initialize as acceleration ramp.
|
||||
prep.accelerate_until = pl_block->millimeters;
|
||||
/* ---------------------------------------------------------------------------------
|
||||
Compute the velocity profile of a new planner block based on its entry and exit
|
||||
speeds, or recompute the profile of a partially-completed planner block if the
|
||||
planner has updated it. For a commanded forced-deceleration, such as from a feed
|
||||
hold, override the planner velocities and decelerate to the target exit speed.
|
||||
*/
|
||||
prep.mm_complete = 0.0; // Default velocity profile complete at 0.0mm from end of block.
|
||||
float inv_2_accel = 0.5/pl_block->acceleration;
|
||||
if (sys.step_control & STEP_CONTROL_EXECUTE_HOLD) { // [Forced Deceleration to Zero Velocity]
|
||||
// Compute velocity profile parameters for a feed hold in-progress. This profile overrides
|
||||
// the planner block profile, enforcing a deceleration to zero speed.
|
||||
prep.ramp_type = RAMP_DECEL;
|
||||
// Compute decelerate distance relative to end of block.
|
||||
float decel_dist = pl_block->millimeters - inv_2_accel*pl_block->entry_speed_sqr;
|
||||
if (decel_dist < 0.0) {
|
||||
// Deceleration through entire planner block. End of feed hold is not in this block.
|
||||
prep.exit_speed = sqrt(pl_block->entry_speed_sqr-2*pl_block->acceleration*pl_block->millimeters);
|
||||
} else {
|
||||
prep.mm_complete = decel_dist; // End of feed hold.
|
||||
prep.exit_speed = 0.0;
|
||||
}
|
||||
} else { // [Normal Operation]
|
||||
// Compute or recompute velocity profile parameters of the prepped planner block.
|
||||
prep.ramp_type = RAMP_ACCEL; // Initialize as acceleration ramp.
|
||||
prep.accelerate_until = pl_block->millimeters;
|
||||
|
||||
float exit_speed_sqr;
|
||||
float nominal_speed;
|
||||
float exit_speed_sqr;
|
||||
float nominal_speed;
|
||||
if (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION) {
|
||||
prep.exit_speed = exit_speed_sqr = 0.0; // Enforce stop at end of system motion.
|
||||
} else {
|
||||
@ -721,9 +768,9 @@ void st_prep_buffer()
|
||||
}
|
||||
|
||||
nominal_speed = plan_compute_profile_nominal_speed(pl_block);
|
||||
float nominal_speed_sqr = nominal_speed*nominal_speed;
|
||||
float intersect_distance =
|
||||
0.5*(pl_block->millimeters+inv_2_accel*(pl_block->entry_speed_sqr-exit_speed_sqr));
|
||||
float nominal_speed_sqr = nominal_speed*nominal_speed;
|
||||
float intersect_distance =
|
||||
0.5*(pl_block->millimeters+inv_2_accel*(pl_block->entry_speed_sqr-exit_speed_sqr));
|
||||
|
||||
if (pl_block->entry_speed_sqr > nominal_speed_sqr) { // Only occurs during override reductions.
|
||||
prep.accelerate_until = pl_block->millimeters - inv_2_accel*(pl_block->entry_speed_sqr-nominal_speed_sqr);
|
||||
@ -746,41 +793,41 @@ void st_prep_buffer()
|
||||
prep.maximum_speed = nominal_speed;
|
||||
prep.ramp_type = RAMP_DECEL_OVERRIDE;
|
||||
}
|
||||
} else if (intersect_distance > 0.0) {
|
||||
if (intersect_distance < pl_block->millimeters) { // Either trapezoid or triangle types
|
||||
// NOTE: For acceleration-cruise and cruise-only types, following calculation will be 0.0.
|
||||
prep.decelerate_after = inv_2_accel*(nominal_speed_sqr-exit_speed_sqr);
|
||||
if (prep.decelerate_after < intersect_distance) { // Trapezoid type
|
||||
prep.maximum_speed = nominal_speed;
|
||||
if (pl_block->entry_speed_sqr == nominal_speed_sqr) {
|
||||
// Cruise-deceleration or cruise-only type.
|
||||
prep.ramp_type = RAMP_CRUISE;
|
||||
} else {
|
||||
// Full-trapezoid or acceleration-cruise types
|
||||
prep.accelerate_until -= inv_2_accel*(nominal_speed_sqr-pl_block->entry_speed_sqr);
|
||||
}
|
||||
} else { // Triangle type
|
||||
prep.accelerate_until = intersect_distance;
|
||||
prep.decelerate_after = intersect_distance;
|
||||
prep.maximum_speed = sqrt(2.0*pl_block->acceleration*intersect_distance+exit_speed_sqr);
|
||||
}
|
||||
} else { // Deceleration-only type
|
||||
} else if (intersect_distance > 0.0) {
|
||||
if (intersect_distance < pl_block->millimeters) { // Either trapezoid or triangle types
|
||||
// NOTE: For acceleration-cruise and cruise-only types, following calculation will be 0.0.
|
||||
prep.decelerate_after = inv_2_accel*(nominal_speed_sqr-exit_speed_sqr);
|
||||
if (prep.decelerate_after < intersect_distance) { // Trapezoid type
|
||||
prep.maximum_speed = nominal_speed;
|
||||
if (pl_block->entry_speed_sqr == nominal_speed_sqr) {
|
||||
// Cruise-deceleration or cruise-only type.
|
||||
prep.ramp_type = RAMP_CRUISE;
|
||||
} else {
|
||||
// Full-trapezoid or acceleration-cruise types
|
||||
prep.accelerate_until -= inv_2_accel*(nominal_speed_sqr-pl_block->entry_speed_sqr);
|
||||
}
|
||||
} else { // Triangle type
|
||||
prep.accelerate_until = intersect_distance;
|
||||
prep.decelerate_after = intersect_distance;
|
||||
prep.maximum_speed = sqrt(2.0*pl_block->acceleration*intersect_distance+exit_speed_sqr);
|
||||
}
|
||||
} else { // Deceleration-only type
|
||||
prep.ramp_type = RAMP_DECEL;
|
||||
// prep.decelerate_after = pl_block->millimeters;
|
||||
// prep.maximum_speed = prep.current_speed;
|
||||
}
|
||||
} else { // Acceleration-only type
|
||||
prep.accelerate_until = 0.0;
|
||||
// prep.decelerate_after = 0.0;
|
||||
prep.maximum_speed = prep.exit_speed;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else { // Acceleration-only type
|
||||
prep.accelerate_until = 0.0;
|
||||
// prep.decelerate_after = 0.0;
|
||||
prep.maximum_speed = prep.exit_speed;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VARIABLE_SPINDLE
|
||||
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM); // Force update whenever updating block.
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Initialize new segment
|
||||
segment_t *prep_segment = &segment_buffer[segment_buffer_head];
|
||||
|
||||
@ -890,25 +937,25 @@ void st_prep_buffer()
|
||||
/* -----------------------------------------------------------------------------------
|
||||
Compute spindle speed PWM output for step segment
|
||||
*/
|
||||
|
||||
|
||||
if (st_prep_block->is_pwm_rate_adjusted || (sys.step_control & STEP_CONTROL_UPDATE_SPINDLE_PWM)) {
|
||||
if (pl_block->condition & (PL_COND_FLAG_SPINDLE_CW | PL_COND_FLAG_SPINDLE_CCW)) {
|
||||
float rpm = pl_block->spindle_speed;
|
||||
// NOTE: Feed and rapid overrides are independent of PWM value and do not alter laser power/rate.
|
||||
// NOTE: Feed and rapid overrides are independent of PWM value and do not alter laser power/rate.
|
||||
if (st_prep_block->is_pwm_rate_adjusted) { rpm *= (prep.current_speed * prep.inv_rate); }
|
||||
// If current_speed is zero, then may need to be rpm_min*(100/MAX_SPINDLE_SPEED_OVERRIDE)
|
||||
// but this would be instantaneous only and during a motion. May not matter at all.
|
||||
prep.current_spindle_pwm = spindle_compute_pwm_value(rpm);
|
||||
} else {
|
||||
} else {
|
||||
sys.spindle_speed = 0.0;
|
||||
prep.current_spindle_pwm = SPINDLE_PWM_OFF_VALUE;
|
||||
prep.current_spindle_pwm = spindle_pwm_off_value;
|
||||
}
|
||||
bit_false(sys.step_control,STEP_CONTROL_UPDATE_SPINDLE_PWM);
|
||||
}
|
||||
prep_segment->spindle_pwm = prep.current_spindle_pwm; // Reload segment PWM value
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------------
|
||||
Compute segment step rate, steps to execute, and apply necessary rate corrections.
|
||||
NOTE: Steps are computed by direct scalar conversion of the millimeter distance
|
||||
|
@ -23,14 +23,15 @@
|
||||
|
||||
void system_init()
|
||||
{
|
||||
// Configure user control pins (for cycle start, reset, feed hold, etc.)
|
||||
CONTROL_DDR &= ~(CONTROL_MASK); // Configure as input pins
|
||||
#ifdef DISABLE_CONTROL_PIN_PULL_UP
|
||||
CONTROL_PORT &= ~(CONTROL_MASK); // Normal low operation. Requires external pull-down.
|
||||
#else
|
||||
CONTROL_PORT |= CONTROL_MASK; // Enable internal pull-up resistors. Normal high operation.
|
||||
CONTROL_PORT |= CONTROL_MASK; // Enable internal pull-up resistors. Normal high operation.
|
||||
#endif
|
||||
CONTROL_PCMSK |= CONTROL_MASK; // Enable specific pins of the Pin Change Interrupt
|
||||
PCICR |= (1 << CONTROL_INT); // Enable Pin Change Interrupt
|
||||
CONTROL_PCMSK |= CONTROL_MASK; // Enable specific pins of the Pin Change Interrupt
|
||||
PCICR |= (1 << CONTROL_INT); // Enable Pin Change Interrupt
|
||||
}
|
||||
|
||||
|
||||
@ -185,6 +186,9 @@ uint8_t system_execute_line(char *line)
|
||||
case 'X': mc_homing_cycle(HOMING_CYCLE_X); break;
|
||||
case 'Y': mc_homing_cycle(HOMING_CYCLE_Y); break;
|
||||
case 'Z': mc_homing_cycle(HOMING_CYCLE_Z); break;
|
||||
case 'A': mc_homing_cycle(HOMING_CYCLE_A); break;
|
||||
//case 'B': mc_homing_cycle(HOMING_CYCLE_B); break;
|
||||
//case 'C': mc_homing_cycle(HOMING_CYCLE_C); break;
|
||||
default: return(STATUS_INVALID_STATEMENT);
|
||||
}
|
||||
#endif
|
||||
@ -192,7 +196,7 @@ uint8_t system_execute_line(char *line)
|
||||
if (!sys.abort) { // Execute startup scripts after successful homing.
|
||||
sys.state = STATE_IDLE; // Set to IDLE when complete.
|
||||
st_go_idle(); // Set steppers to the settings idle state before returning.
|
||||
if (line[2] == 0) { system_execute_startup(line); }
|
||||
if (line[2] == 0) { system_execute_startup(line); } // Execute startup script again.
|
||||
}
|
||||
break;
|
||||
case 'S' : // Puts Grbl to sleep [IDLE/ALARM]
|
||||
@ -342,7 +346,11 @@ uint8_t system_check_travel_limits(float *target)
|
||||
}
|
||||
#else
|
||||
// NOTE: max_travel is stored as negative
|
||||
if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { return(true); }
|
||||
#ifdef HOMING_FORCE_POSITIVE_SPACE
|
||||
if (target[idx] < 0 || target[idx] > -settings.max_travel[idx]) { return(true); }
|
||||
#else
|
||||
if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { return(true); }
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return(false);
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user