Compare commits
41 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 | ||
|
f904fff7ba | ||
|
b24e01d588 | ||
|
ba4e83723f | ||
|
eeb206ec97 |
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
|
||||||
|
|
118
README.md
118
README.md
@ -6,120 +6,12 @@ Note: cprezzi's branch disables current control and has defaults more suitable f
|
|||||||
***
|
***
|
||||||
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
|
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 defaults for easy-to-change config values.
|
|
||||||
* WPos enabled for LaserWeb compatability ($10=0)
|
|
||||||
* Laser mode: ON ($32)
|
|
||||||
* Minimum S value: 0.0 ($31)
|
|
||||||
* Maximum S value: 1.0 ($30)
|
|
||||||
* Hard limits not yet ported
|
|
||||||
* Control inputs not yet ported (e.g. Cycle Start and Safety Door switches)
|
|
||||||
|
|
||||||
New configuration settings
|
**Settings for MKS sbase 1.3 and CoreXY**
|
||||||
* $33 is PWM frequency in Hz
|
|
||||||
* $34 is PWM off value in %
|
|
||||||
* $35 is PWM min value in %
|
|
||||||
* $36 is PWM max value in %
|
|
||||||
* $140, $141, $142 are X, Y, Z current (amps)
|
|
||||||
* Default to 0.0 A to avoid burning out your motors
|
|
||||||
* Your motors will likely stall if you don't set these!
|
|
||||||
|
|
||||||
Build notes:
|
![Wiring 1](./doc/media/48491571-d99a3080-e862-11e8-8367-4408a5589503.png)
|
||||||
* You should use virtual machines, if you use multiple toolchains on the same PC.
|
|
||||||
* Install make if not already there (for Windows see http://gnuwin32.sourceforge.net/packages/make.htm)
|
|
||||||
* Install the ARM embeded toolchain (see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads)
|
|
||||||
* Include ```make``` and the ```arm-none-eabi-*``` tools in your path.
|
|
||||||
* Run ```git submodule init``` and ```git submodule update``` before building.
|
|
||||||
* Make produces 2 files:
|
|
||||||
* ```build/firmware.bin```: this is compatible with the sdcard bootloader.
|
|
||||||
* ```build/grbl.hex```: this is not compatible with the sdcard bootloader. It loads using Flash Magic
|
|
||||||
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.
|
|
||||||
|
|
||||||
***
|
![Wiring 2](./doc/media/49279485-9aa2e680-f4c2-11e8-98bd-cce3caf5c8dd.jpeg)
|
||||||
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.
|
[Laser4Web .env Settings](https://github.com/LaserWeb/lw.comm-server/wiki/Environment-File-(.env))
|
||||||
|
|
||||||
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
|
|
||||||
![Official Supporters](https://github.com/gnea/gnea-Media/blob/master/Contributors.png?raw=true)
|
|
||||||
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
## 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!
|
|
||||||
|
|
||||||
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CUGXJHXA36BYW)
|
|
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 |
@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
void delay_init()
|
void delay_init()
|
||||||
{
|
{
|
||||||
LPC_TIM3->CTCR = 0; // timer mode
|
LPC_TIM3->CTCR = 0; // Count Control (0=TimerMode, 1-3=EdgeCounterMode)
|
||||||
LPC_TIM3->PR = 0; // no prescale
|
LPC_TIM3->PR = 0; // no Prescale (TC increments ever PR+1 clocks)
|
||||||
LPC_TIM3->MCR = 0; // no MR actions
|
LPC_TIM3->MCR = 0; // no Match Control actions
|
||||||
LPC_TIM3->CCR = 0; // no capture
|
LPC_TIM3->CCR = 0; // no Capture Control actions
|
||||||
LPC_TIM3->EMR = 0; // no external match
|
LPC_TIM3->EMR = 0; // no External Match (controls external match pins)
|
||||||
LPC_TIM3->TCR = 0b10; // reset
|
LPC_TIM3->TCR = 0b10; // reset Timer Control (0b10=Reset, 0b01=Enable)
|
||||||
LPC_TIM3->TCR = 0b01; // enable
|
LPC_TIM3->TCR = 0b01; // enable Timer Control (0b10=Reset, 0b01=Enable)
|
||||||
}
|
}
|
||||||
|
@ -25,37 +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 constexpr unsigned flash_size = 1024; // Only using 1k of a 4k sector
|
||||||
static char *flash_memory = (char *)flash_addr; // Flash memory
|
static char *flash_memory = (char *)flash_addr; // Flash memory
|
||||||
static char flash_buffer[flash_size] __attribute__((aligned(4))); // Copy of flash memory
|
static char flash_buffer[flash_size] __attribute__((aligned(4))); // Copy of flash memory
|
||||||
using Iap = void(unsigned[], unsigned[]); // IAP entry point
|
using Iap = void(unsigned[], unsigned[]); // IAP entry point function
|
||||||
static const Iap *iap = (Iap *)0x1FFF1FF1; // IAP entry point
|
static const Iap *iap = (Iap *)0x1FFF1FF1; // IAP entry point address
|
||||||
|
|
||||||
void eeprom_init()
|
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()
|
void eeprom_commit()
|
||||||
{
|
{
|
||||||
if (!memcmp(flash_buffer, flash_memory, flash_size))
|
if (!memcmp(flash_buffer, flash_memory, flash_size))
|
||||||
return;
|
return; // No changes to commit
|
||||||
unsigned prepCommand[5] = {
|
unsigned prepCommand[5] = {
|
||||||
50,
|
50, // Prepare sector(s) for write operation
|
||||||
flash_sector,
|
flash_sector, // Start sector
|
||||||
flash_sector,
|
flash_sector, // End sector
|
||||||
};
|
};
|
||||||
unsigned eraseCommand[5] = {
|
unsigned eraseCommand[5] = {
|
||||||
52,
|
52, // Erase sector(s)
|
||||||
flash_sector,
|
flash_sector, // Start sector
|
||||||
flash_sector,
|
flash_sector, // End sector
|
||||||
SystemCoreClock / 1000,
|
SystemCoreClock / 1000, // CPU clock frequency in kHz
|
||||||
};
|
};
|
||||||
unsigned writeCommand[5] = {
|
unsigned writeCommand[5] = {
|
||||||
51,
|
51, // Copy RAM to Flash
|
||||||
flash_addr,
|
flash_addr, // Destination flash address (256-byte boundary)
|
||||||
(unsigned)flash_buffer,
|
(unsigned)flash_buffer, // Source RAM address (word boundary)
|
||||||
flash_size,
|
flash_size, // Number of bytes to write (must be: 256, 512, 1024, 4096)
|
||||||
SystemCoreClock / 1000,
|
SystemCoreClock / 1000, // CPU clock frequency in kHz
|
||||||
};
|
};
|
||||||
unsigned output[5];
|
unsigned output[5];
|
||||||
|
// Run In-Application Programming (IAP) routines
|
||||||
iap(prepCommand, output);
|
iap(prepCommand, output);
|
||||||
iap(eraseCommand, output);
|
iap(eraseCommand, output);
|
||||||
iap(prepCommand, output);
|
iap(prepCommand, output);
|
||||||
|
@ -33,15 +33,20 @@
|
|||||||
|
|
||||||
// Define board type for pin map and default settings.
|
// Define board type for pin map and default settings.
|
||||||
//#define CPU_MAP_SMOOTHIEBOARD // Smoothieboard (NXP LPC1769 MCU)
|
//#define CPU_MAP_SMOOTHIEBOARD // Smoothieboard (NXP LPC1769 MCU)
|
||||||
#define CPU_MAP_C3D_REMIX // Cohesion3D Remix (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_C3D_MINI // Cohesion3D Mini (NXP LPC1769 MCU)
|
||||||
//#define CPU_MAP_MKS_SBASE // MKS SBASE Board (NXP LPC1768 MCU)
|
#define CPU_MAP_MKS_SBASE // MKS SBASE Board (NXP LPC1768 MCU)
|
||||||
//#define CPU_MAP_AZTEEG_X5 // Azteeg X5 Board (NXP LPC1769 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 machine type for machine specific defaults
|
||||||
//#define DEFAULTS_GENERIC
|
//#define DEFAULTS_GENERIC
|
||||||
#define DEFAULTS_K40
|
#define DEFAULTS_K40
|
||||||
//#define DEFAULTS_FABKIT
|
//#define DEFAULTS_FABKIT
|
||||||
|
//#define DEFAULTS_JONAS
|
||||||
|
|
||||||
// Serial baud rate
|
// Serial baud rate
|
||||||
// #define BAUD_RATE 230400
|
// #define BAUD_RATE 230400
|
||||||
@ -108,19 +113,19 @@
|
|||||||
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
|
// 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.
|
// 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.
|
// 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.
|
// NOTE: Homing cycle pattern is defined in Machine defaults!!!
|
||||||
//#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
|
// #define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace.
|
||||||
|
// #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.
|
||||||
// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
|
// #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.
|
// NOTE: The following are two examples to setup homing for 2-axis machines.
|
||||||
//#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
|
// #define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS)) // NOT COMPATIBLE WITH COREXY: Homes both X-Y in one cycle.
|
||||||
|
|
||||||
// #define HOMING_CYCLE_0 (1<<X_AXIS) // COREXY COMPATIBLE: First home X
|
// #define HOMING_CYCLE_0 (1<<X_AXIS) // COREXY COMPATIBLE: First home X
|
||||||
// #define HOMING_CYCLE_1 (1<<Y_AXIS) // COREXY COMPATIBLE: Then home Y
|
// #define HOMING_CYCLE_1 (1<<Y_AXIS) // COREXY COMPATIBLE: Then home Y
|
||||||
// Homing cycle pattern is defined in Machine defaults!!!
|
|
||||||
|
|
||||||
// Number of homing cycles performed after when the machine initially jogs to limit switches.
|
// 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.
|
// greater.
|
||||||
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)
|
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)
|
||||||
|
|
||||||
@ -136,7 +141,7 @@
|
|||||||
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
|
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
|
||||||
|
|
||||||
// Uncomment this define to force Grbl to always set the machine origin at bottom left.
|
// Uncomment this define to force Grbl to always set the machine origin at bottom left.
|
||||||
//#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
|
#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
|
||||||
|
|
||||||
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
|
// 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
|
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may
|
||||||
@ -182,7 +187,7 @@
|
|||||||
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
|
// 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
|
// 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.
|
// 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
|
// 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.
|
// between restoring the spindle and coolant and resuming the cycle.
|
||||||
@ -196,7 +201,7 @@
|
|||||||
// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
|
// 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
|
// described, if not, motions may move in strange directions. Grbl requires the CoreXY A and B motors
|
||||||
// have the same steps per mm internally.
|
// 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
|
// 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.
|
// normally-closed switches on the specified pins, rather than the default normally-open switches.
|
||||||
@ -218,7 +223,7 @@
|
|||||||
// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and
|
// 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,
|
// 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.
|
// 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
|
// Inverts the selected coolant pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
|
||||||
// for some pre-built electronic boards.
|
// for some pre-built electronic boards.
|
||||||
@ -381,13 +386,13 @@
|
|||||||
|
|
||||||
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
|
// 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
|
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
|
||||||
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
|
// the spindle direction pin (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 and a 328p processor (Uno).
|
// 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: Without a direction pin, M4 will not have a pin output to indicate a difference with M3.
|
||||||
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
|
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
|
||||||
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
|
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
|
||||||
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
|
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
|
||||||
// not ported #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.
|
#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,
|
// 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
|
// Grbl will not disable the enable pin if spindle speed is zero and M3/4 is active, but still sets the PWM
|
||||||
|
@ -64,6 +64,7 @@ void coolant_stop()
|
|||||||
#else
|
#else
|
||||||
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||||
#endif
|
#endif
|
||||||
|
delay_ms(1); // workaround for toolchain error
|
||||||
#ifdef ENABLE_M7
|
#ifdef ENABLE_M7
|
||||||
#ifdef INVERT_COOLANT_MIST_PIN
|
#ifdef INVERT_COOLANT_MIST_PIN
|
||||||
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
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);
|
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
delay_ms(1); // workaround for toolchain error
|
||||||
|
|
||||||
#ifdef ENABLE_M7
|
#ifdef ENABLE_M7
|
||||||
if (mode & COOLANT_MIST_ENABLE) {
|
if (mode & COOLANT_MIST_ENABLE) {
|
||||||
|
232
grbl/cpu_map.h
232
grbl/cpu_map.h
@ -63,7 +63,7 @@
|
|||||||
#define X_LIMIT_BIT 1 // Uno Digital Pin 9
|
#define X_LIMIT_BIT 1 // Uno Digital Pin 9
|
||||||
#define Y_LIMIT_BIT 2 // Uno Digital Pin 10
|
#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.
|
#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
|
#else
|
||||||
#define Z_LIMIT_BIT 3 // Uno Digital Pin 11
|
#define Z_LIMIT_BIT 3 // Uno Digital Pin 11
|
||||||
#endif
|
#endif
|
||||||
@ -96,9 +96,9 @@
|
|||||||
#define COOLANT_FLOOD_DDR DDRC
|
#define COOLANT_FLOOD_DDR DDRC
|
||||||
#define COOLANT_FLOOD_PORT PORTC
|
#define COOLANT_FLOOD_PORT PORTC
|
||||||
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
|
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
|
||||||
#define COOLANT_MIST_DDR DDRC
|
#define COOLANT_MIST_DDR DDRC
|
||||||
#define COOLANT_MIST_PORT PORTC
|
#define COOLANT_MIST_PORT PORTC
|
||||||
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 4
|
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 4
|
||||||
|
|
||||||
// Define user-control controls (cycle start, reset, feed hold) input pins.
|
// 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).
|
// 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
|
#endif
|
||||||
#define SPINDLE_PWM_OFF_VALUE 0
|
#define SPINDLE_PWM_OFF_VALUE 0
|
||||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||||
#define SPINDLE_OCR_REGISTER OCR2A
|
#define SPINDLE_OCR_REGISTER OCR2A
|
||||||
#define SPINDLE_COMB_BIT COM2A1
|
#define SPINDLE_COMB_BIT COM2A1
|
||||||
|
|
||||||
// Prescaled, 8-bit Fast PWM mode.
|
// Prescaled, 8-bit Fast PWM mode.
|
||||||
#define SPINDLE_TCCRA_INIT_MASK ((1<<WGM20) | (1<<WGM21)) // Configures fast PWM mode.
|
#define SPINDLE_TCCRA_INIT_MASK ((1<<WGM20) | (1<<WGM21)) // Configures fast PWM mode.
|
||||||
@ -143,11 +143,11 @@
|
|||||||
#define SPINDLE_TCCRB_INIT_MASK (1<<CS22) // 1/64 prescaler -> 0.98kHz (J-tech laser)
|
#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.
|
// NOTE: On the 328p, these must be the same as the SPINDLE_ENABLE settings.
|
||||||
#define SPINDLE_PWM_DDR DDRB
|
#define SPINDLE_PWM_DDR DDRB
|
||||||
#define SPINDLE_PWM_PORT PORTB
|
#define SPINDLE_PWM_PORT PORTB
|
||||||
#define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11
|
#define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11
|
||||||
|
|
||||||
#endif
|
#endif // end of CPU_MAP_ATMEGA328P
|
||||||
|
|
||||||
|
|
||||||
#ifdef CPU_MAP_SMOOTHIEBOARD // (Smoothieboards)
|
#ifdef CPU_MAP_SMOOTHIEBOARD // (Smoothieboards)
|
||||||
@ -191,26 +191,39 @@
|
|||||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
||||||
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
||||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||||
#define A_LIMIT_BIT 29 // reuse p1.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 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 flood and mist coolant enable output pins.
|
||||||
#define COOLANT_FLOOD_DDR NotUsed
|
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_FLOOD_PORT NotUsed
|
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_FLOOD_BIT 6 // MOSFET 2.6
|
#ifndef SPINDLE_PWM_PIN_2_4
|
||||||
#define COOLANT_MIST_DDR NotUsed
|
#define COOLANT_FLOOD_BIT 4 // SMALL MOSFET Q8 (P2.4)
|
||||||
#define COOLANT_MIST_PORT NotUsed
|
#else
|
||||||
#define COOLANT_MIST_BIT 7 // MOSFET 2.7
|
#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.
|
// 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).
|
// 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_DDR LPC_GPIO1->FIODIR
|
||||||
#define CONTROL_PIN NotUsed
|
#define CONTROL_PIN LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_PORT NotUsed
|
#define CONTROL_PORT LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_RESET_BIT 0 // Uno Analog Pin 0
|
#define CONTROL_RESET_BIT NotUsed // Not needed as there is a special RESET pin on the Smoothiebaord
|
||||||
#define CONTROL_FEED_HOLD_BIT 1 // Uno Analog Pin 1
|
#define CONTROL_FEED_HOLD_BIT 22 // P1.22
|
||||||
#define CONTROL_CYCLE_START_BIT 2 // Uno Analog Pin 2
|
#define CONTROL_CYCLE_START_BIT 23 // P1.23
|
||||||
#define CONTROL_SAFETY_DOOR_BIT 1 // Uno Analog Pin 1 NOTE: Safety door is shared with feed hold. Enabled by config define.
|
#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 PCIE1 // Pin change interrupt enable pin
|
||||||
#define CONTROL_INT_vect PCINT1_vect
|
#define CONTROL_INT_vect PCINT1_vect
|
||||||
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
||||||
@ -218,10 +231,10 @@
|
|||||||
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
||||||
|
|
||||||
// Define probe switch input pin.
|
// Define probe switch input pin.
|
||||||
#define PROBE_DDR NotUsed
|
#define PROBE_DDR LPC_GPIO2->FIODIR
|
||||||
#define PROBE_PIN NotUsed
|
#define PROBE_PIN LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_PORT NotUsed
|
#define PROBE_PORT LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
#define PROBE_BIT 11 // P2.11
|
||||||
#define PROBE_MASK (1<<PROBE_BIT)
|
#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.
|
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||||
@ -229,7 +242,11 @@
|
|||||||
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
|
// 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
|
// 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
|
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
|
||||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6
|
#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_PRIMARY_PIN false
|
||||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||||
|
|
||||||
@ -247,11 +264,11 @@
|
|||||||
#endif
|
#endif
|
||||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||||
#define SPINDLE_OCR_REGISTER OCR2A
|
#define SPINDLE_OCR_REGISTER OCR2A
|
||||||
#define SPINDLE_COMB_BIT COM2A1
|
#define SPINDLE_COMB_BIT COM2A1
|
||||||
#endif
|
#endif // end of CPU_MAP_SMOOTHIEBOARD
|
||||||
|
|
||||||
|
|
||||||
#ifdef CPU_MAP_C3D_REMIX // (Cohesion3D Remix Boards)
|
#ifdef CPU_MAP_C3D_REMIX // (Cohesion3D Remix Boards)
|
||||||
@ -294,7 +311,7 @@
|
|||||||
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
||||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
||||||
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
||||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||||
#define A_LIMIT_BIT 29 // reuse p1.29 from Z-MAX
|
#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 LIMIT_MASK ((1<<X_LIMIT_BIT)|(1<<Y_LIMIT_BIT)|(1<<Z_LIMIT_BIT)|(1<<A_LIMIT_BIT)) // All limit bits
|
||||||
|
|
||||||
@ -302,10 +319,10 @@
|
|||||||
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_FLOOD_BIT 6 // MOSFET 2.6
|
#define COOLANT_FLOOD_BIT 6 // MOSFET 2.6
|
||||||
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_MIST_BIT 7 // MOSFET 2.7
|
#define COOLANT_MIST_BIT 7 // MOSFET 2.7
|
||||||
#define ENABLE_M7 // enables COOLANT MIST
|
#define ENABLE_M7 // enables COOLANT MIST
|
||||||
|
|
||||||
// Define user-control controls (cycle start, reset, feed hold) input pins.
|
// 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).
|
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
||||||
@ -334,7 +351,11 @@
|
|||||||
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
|
// 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
|
// 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
|
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
|
||||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6
|
#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_PRIMARY_PIN false
|
||||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||||
|
|
||||||
@ -346,11 +367,11 @@
|
|||||||
#endif
|
#endif
|
||||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||||
#define SPINDLE_OCR_REGISTER OCR2A
|
#define SPINDLE_OCR_REGISTER OCR2A
|
||||||
#define SPINDLE_COMB_BIT COM2A1
|
#define SPINDLE_COMB_BIT COM2A1
|
||||||
#endif
|
#endif // end of CPU_MAP_C3D_REMIX
|
||||||
|
|
||||||
|
|
||||||
#ifdef CPU_MAP_C3D_MINI // (Cohesion3D Mini Boards)
|
#ifdef CPU_MAP_C3D_MINI // (Cohesion3D Mini Boards)
|
||||||
@ -393,17 +414,18 @@
|
|||||||
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
||||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
||||||
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
||||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||||
#define A_LIMIT_BIT 29 // reuse p1.29 from Z-MAX
|
#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 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 flood and mist coolant enable output pins.
|
||||||
#define COOLANT_FLOOD_DDR NotUsed
|
#define COOLANT_FLOOD_DDR NotUsed
|
||||||
#define COOLANT_FLOOD_PORT NotUsed
|
#define COOLANT_FLOOD_PORT NotUsed
|
||||||
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
|
#define COOLANT_FLOOD_BIT 6 // MOSFET 3 (P2.6)
|
||||||
#define COOLANT_MIST_DDR NotUsed
|
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_MIST_PORT NotUsed
|
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 3
|
#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.
|
// 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).
|
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
||||||
@ -432,7 +454,11 @@
|
|||||||
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
|
// 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
|
// 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
|
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
|
||||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6
|
#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_PRIMARY_PIN false
|
||||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||||
|
|
||||||
@ -444,11 +470,11 @@
|
|||||||
#endif
|
#endif
|
||||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||||
#define SPINDLE_OCR_REGISTER OCR2A
|
#define SPINDLE_OCR_REGISTER OCR2A
|
||||||
#define SPINDLE_COMB_BIT COM2A1
|
#define SPINDLE_COMB_BIT COM2A1
|
||||||
#endif
|
#endif // end of CPU_MAP_C3D_MINI
|
||||||
|
|
||||||
|
|
||||||
#ifdef CPU_MAP_MKS_SBASE // (MKS SBASE Boards)
|
#ifdef CPU_MAP_MKS_SBASE // (MKS SBASE Boards)
|
||||||
@ -491,27 +517,36 @@
|
|||||||
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
||||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=25
|
||||||
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
#define Y_LIMIT_BIT 26 // Y-MIN=26, Y-MAX=27
|
||||||
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
#define Z_LIMIT_BIT 28 // Z-MIN=28, Z-MAX=29
|
||||||
#define A_LIMIT_BIT 29 // reuse p1.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 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 flood and mist coolant enable output pins.
|
||||||
#define COOLANT_FLOOD_DDR NotUsed
|
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_FLOOD_PORT NotUsed
|
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
|
#define COOLANT_FLOOD_BIT 6 // MOSFET 2.6
|
||||||
#define COOLANT_MIST_DDR NotUsed
|
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_MIST_PORT NotUsed
|
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 3
|
#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.
|
// 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).
|
// 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_DDR LPC_GPIO1->FIODIR
|
||||||
#define CONTROL_PIN NotUsed
|
#define CONTROL_PIN LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_PORT NotUsed
|
#define CONTROL_PORT LPC_GPIO1->FIOPIN
|
||||||
#define CONTROL_RESET_BIT 0 // Uno Analog Pin 0
|
#define CONTROL_RESET_BIT NotUsed // Not needed as there is a special RESET pin on the Smoothiebaord
|
||||||
#define CONTROL_FEED_HOLD_BIT 1 // Uno Analog Pin 1
|
#define CONTROL_FEED_HOLD_BIT 22 // P1.22
|
||||||
#define CONTROL_CYCLE_START_BIT 2 // Uno Analog Pin 2
|
#define CONTROL_CYCLE_START_BIT 23 // P1.23
|
||||||
#define CONTROL_SAFETY_DOOR_BIT 1 // Uno Analog Pin 1 NOTE: Safety door is shared with feed hold. Enabled by config define.
|
#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 PCIE1 // Pin change interrupt enable pin
|
||||||
#define CONTROL_INT_vect PCINT1_vect
|
#define CONTROL_INT_vect PCINT1_vect
|
||||||
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
#define CONTROL_PCMSK NotUsed // Pin change interrupt register
|
||||||
@ -519,10 +554,10 @@
|
|||||||
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
|
||||||
|
|
||||||
// Define probe switch input pin.
|
// Define probe switch input pin.
|
||||||
#define PROBE_DDR NotUsed
|
#define PROBE_DDR LPC_GPIO2->FIODIR
|
||||||
#define PROBE_PIN NotUsed
|
#define PROBE_PIN LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_PORT NotUsed
|
#define PROBE_PORT LPC_GPIO2->FIOPIN
|
||||||
#define PROBE_BIT 5 // Uno Analog Pin 5
|
#define PROBE_BIT 11 // P2.11
|
||||||
#define PROBE_MASK (1<<PROBE_BIT)
|
#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.
|
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
||||||
@ -530,9 +565,19 @@
|
|||||||
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
|
// 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
|
// 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
|
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
|
||||||
#define SPINDLE_PWM_CHANNEL PWM1_CH6
|
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // BED MOSFET (P2.5)
|
||||||
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
#define SPINDLE_PWM_USE_PRIMARY_PIN false
|
||||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
#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
|
// Stepper current control
|
||||||
#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable (for C3d boards!)
|
#define CURRENT_I2C Driver_I2C1 // I2C driver for current control. Comment out to disable (for C3d boards!)
|
||||||
@ -548,11 +593,11 @@
|
|||||||
#endif
|
#endif
|
||||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||||
#define SPINDLE_OCR_REGISTER OCR2A
|
#define SPINDLE_OCR_REGISTER OCR2A
|
||||||
#define SPINDLE_COMB_BIT COM2A1
|
#define SPINDLE_COMB_BIT COM2A1
|
||||||
#endif
|
#endif // end of CPU_MAP_MKS_SBASE
|
||||||
|
|
||||||
|
|
||||||
#ifdef CPU_MAP_AZTEEG_X5 // (Azteeg X5 Boards) not tested yet!
|
#ifdef CPU_MAP_AZTEEG_X5 // (Azteeg X5 Boards) not tested yet!
|
||||||
@ -595,17 +640,18 @@
|
|||||||
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
#define LIMIT_PORT LPC_GPIO1->FIOPIN
|
||||||
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=27
|
#define X_LIMIT_BIT 24 // X-MIN=24, X-MAX=27
|
||||||
#define Y_LIMIT_BIT 25 // Y-MIN=25, Y-MAX=28
|
#define Y_LIMIT_BIT 25 // Y-MIN=25, Y-MAX=28
|
||||||
#define Z_LIMIT_BIT 26 // Z-MIN=26, Z-MAX=29
|
#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 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 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 flood and mist coolant enable output pins.
|
||||||
#define COOLANT_FLOOD_DDR NotUsed
|
#define COOLANT_FLOOD_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_FLOOD_PORT NotUsed
|
#define COOLANT_FLOOD_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_FLOOD_BIT 3 // Uno Analog Pin 3
|
#define COOLANT_FLOOD_BIT 4 // FAN MOSFET (P2.4)
|
||||||
#define COOLANT_MIST_DDR NotUsed
|
#define COOLANT_MIST_DDR LPC_GPIO2->FIODIR
|
||||||
#define COOLANT_MIST_PORT NotUsed
|
#define COOLANT_MIST_PORT LPC_GPIO2->FIOPIN
|
||||||
#define COOLANT_MIST_BIT 4 // Uno Analog Pin 3
|
#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.
|
// 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).
|
// NOTE: All CONTROLs pins must be on the same port and not on a port with other input pins (limits).
|
||||||
@ -631,10 +677,14 @@
|
|||||||
|
|
||||||
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
|
// 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 PWM1_CH7 PWM1_CH8
|
// 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 ? ?
|
// 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 P2.6 P2.7
|
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
|
||||||
#define SPINDLE_PWM_CHANNEL PWM1_CH8
|
#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_PRIMARY_PIN false
|
||||||
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
#define SPINDLE_PWM_USE_SECONDARY_PIN true
|
||||||
|
|
||||||
@ -648,11 +698,11 @@
|
|||||||
#endif
|
#endif
|
||||||
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
//#define SPINDLE_PWM_OFF_VALUE 0 // Defined in config.h
|
||||||
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
#define SPINDLE_PWM_RANGE (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)
|
||||||
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
#define SPINDLE_TCCRA_REGISTER TCCR2A
|
||||||
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
#define SPINDLE_TCCRB_REGISTER TCCR2B
|
||||||
#define SPINDLE_OCR_REGISTER OCR2A
|
#define SPINDLE_OCR_REGISTER OCR2A
|
||||||
#define SPINDLE_COMB_BIT COM2A1
|
#define SPINDLE_COMB_BIT COM2A1
|
||||||
#endif
|
#endif // end of CPU_MAP_AZTEEG_X5
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
184
grbl/defaults.h
184
grbl/defaults.h
@ -29,54 +29,57 @@
|
|||||||
|
|
||||||
#ifdef DEFAULTS_GENERIC
|
#ifdef DEFAULTS_GENERIC
|
||||||
// Grbl generic default settings. Should work across different machines.
|
// Grbl generic default settings. Should work across different machines.
|
||||||
#define DEFAULT_X_STEPS_PER_MM 250.0
|
// See https://github.com/gnea/grbl/wiki/Grbl-v1.1-Configuration for setting descriptions.
|
||||||
#define DEFAULT_Y_STEPS_PER_MM 250.0
|
#define DEFAULT_X_STEPS_PER_MM 160.0 // $100 steps (X steps per mm)
|
||||||
#define DEFAULT_Z_STEPS_PER_MM 250.0
|
#define DEFAULT_Y_STEPS_PER_MM 160.0 // $101 steps (Y steps per mm)
|
||||||
#define DEFAULT_A_STEPS_PER_MM 160.0
|
#define DEFAULT_Z_STEPS_PER_MM 160.0 // $102 steps (Z steps per mm)
|
||||||
#define DEFAULT_X_MAX_RATE 500.0 // mm/min
|
#define DEFAULT_A_STEPS_PER_MM 160.0 // $103 steps (A steps per mm)
|
||||||
#define DEFAULT_Y_MAX_RATE 500.0 // mm/min
|
#define DEFAULT_X_MAX_RATE 30000.0 // $110 mm/min (X max speed)
|
||||||
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
|
#define DEFAULT_Y_MAX_RATE 30000.0 // $111 mm/min (Y max speed)
|
||||||
#define DEFAULT_A_MAX_RATE 500.0 // mm/min
|
#define DEFAULT_Z_MAX_RATE 30000.0 // $112 mm/min (Z max speed)
|
||||||
#define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
#define DEFAULT_A_MAX_RATE 30000.0 // $113 mm/min (A max speed)
|
||||||
#define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
#define DEFAULT_X_ACCELERATION (10.0*60*60)// $120 mm/min^2 (X max acceleration)
|
||||||
#define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
#define DEFAULT_Y_ACCELERATION (10.0*60*60)// $121 mm/min^2 (Y max acceleration)
|
||||||
#define DEFAULT_A_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
|
#define DEFAULT_Z_ACCELERATION (10.0*60*60)// $122 mm/min^2 (Z max acceleration)
|
||||||
#define DEFAULT_X_CURRENT 0.6 // amps
|
#define DEFAULT_A_ACCELERATION (10.0*60*60)// $123 mm/min^2 (A max acceleration)
|
||||||
#define DEFAULT_Y_CURRENT 0.6 // amps
|
#define DEFAULT_X_MAX_TRAVEL 500.0 // $130 mm (X max travel; must be positive)
|
||||||
#define DEFAULT_Z_CURRENT 0.0 // amps
|
#define DEFAULT_Y_MAX_TRAVEL 500.0 // $131 mm (Y max travel; must be positive)
|
||||||
#define DEFAULT_A_CURRENT 0.0 // amps
|
#define DEFAULT_Z_MAX_TRAVEL 500.0 // $132 mm (Z max travel; must be positive)
|
||||||
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
#define DEFAULT_A_MAX_TRAVEL 1.0 // $133 mm (A max travel; must be positive)
|
||||||
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
#define DEFAULT_X_CURRENT 0.7 // $140 amps (X stepper current [disabled])
|
||||||
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
|
#define DEFAULT_Y_CURRENT 0.7 // $141 amps (Y stepper current [disabled])
|
||||||
#define DEFAULT_A_MAX_TRAVEL 1.0 // mm NOTE: Must be a positive value.
|
#define DEFAULT_Z_CURRENT 0.0 // $142 amps (Z stepper current [disabled])
|
||||||
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
|
#define DEFAULT_A_CURRENT 0.0 // $143 amps (A stepper current [disabled])
|
||||||
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0 // %
|
|
||||||
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 1 // %
|
#define DEFAULT_STEP_PULSE_MICROSECONDS 10 // $0 usec (stepper pulse time)
|
||||||
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100 // %
|
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // $1 msec (0-254, 255 keeps steppers enabled)
|
||||||
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm (S-value)
|
#define DEFAULT_STEPPING_INVERT_MASK 0 // $2 ZYX (e.g., 0x5 inverts Z and X stepper pulses)
|
||||||
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm (S-value)
|
#define DEFAULT_DIRECTION_INVERT_MASK 0 // $3 ZYX (e.g., 0x2 inverts Y stepper direction)
|
||||||
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
|
#define DEFAULT_INVERT_ST_ENABLE 0 // $4 bool (inverts stepper enable pin)
|
||||||
#define DEFAULT_STEPPING_INVERT_MASK 0
|
#define DEFAULT_INVERT_LIMIT_PINS 0 // $5 bool (inverts limit switches to trigger on high)
|
||||||
#define DEFAULT_DIRECTION_INVERT_MASK 0
|
#define DEFAULT_INVERT_PROBE_PIN 0 // $6 bool (inverts probe to trigger on high)
|
||||||
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)
|
#define DEFAULT_STATUS_REPORT_MASK 0 // $10 bits (Reports: [0=WPos or 1=MPos] and [2=Buffer])
|
||||||
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
|
#define DEFAULT_JUNCTION_DEVIATION 0.01 // $11 mm (determines machine speed through corners)
|
||||||
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
|
#define DEFAULT_ARC_TOLERANCE 0.002 // $12 mm (error tolerance on arcs/cicles)
|
||||||
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
|
#define DEFAULT_REPORT_INCHES 0 // $13 bool (sets position reporting to inches)
|
||||||
#define DEFAULT_REPORT_INCHES 0 // false
|
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // $20 bool (prevents moves outside *_MAX_TRAVEL; requires $23=1)
|
||||||
#define DEFAULT_INVERT_ST_ENABLE 0 // false
|
#define DEFAULT_HARD_LIMIT_ENABLE 0 // $21 bool ([ignored] stops moving when limit switches triggered)
|
||||||
#define DEFAULT_INVERT_LIMIT_PINS 0 // false
|
#define DEFAULT_HOMING_ENABLE 0 // $22 bool (enables homing on startup)
|
||||||
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
|
#define DEFAULT_HOMING_DIR_MASK 0 // $23 ZYX (e.g., 0x3 reverses XY homing to negative direction)
|
||||||
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
|
#define DEFAULT_HOMING_FEED_RATE 25.0 // $24 mm/min (homing precision location speed)
|
||||||
#define DEFAULT_INVERT_PROBE_PIN 0 // false
|
#define DEFAULT_HOMING_SEEK_RATE 500.0 // $25 mm/min (homing search speed)
|
||||||
#define DEFAULT_LASER_MODE 0 // false
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // $26 msec (homing switch debounce: 0-65k)
|
||||||
#define DEFAULT_HOMING_ENABLE 0 // false
|
#define DEFAULT_HOMING_PULLOFF 1.0 // $27 mm (retracts this far from homing switch)
|
||||||
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
|
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // $30 RPM (spindle speed for max 5V PWM output)
|
||||||
#define DEFAULT_HOMING_FEED_RATE 25.0 // mm/min
|
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // $31 RPM (spindle speed for min 20mV PWM output)
|
||||||
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
#define DEFAULT_LASER_MODE 0 // $32 bool (adjusts spindle power with speed for lasers)
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // $33 Hz (PWM frequency for spindle)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#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))
|
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))
|
||||||
#endif
|
#endif // end of DEFAULTS_GENERIC
|
||||||
|
|
||||||
#ifdef DEFAULTS_K40
|
#ifdef DEFAULTS_K40
|
||||||
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
|
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
|
||||||
@ -84,10 +87,10 @@
|
|||||||
#define DEFAULT_Y_STEPS_PER_MM 160.0
|
#define DEFAULT_Y_STEPS_PER_MM 160.0
|
||||||
#define DEFAULT_Z_STEPS_PER_MM 160.0
|
#define DEFAULT_Z_STEPS_PER_MM 160.0
|
||||||
#define DEFAULT_A_STEPS_PER_MM 160.0
|
#define DEFAULT_A_STEPS_PER_MM 160.0
|
||||||
#define DEFAULT_X_MAX_RATE 24000.0 // mm/min
|
#define DEFAULT_X_MAX_RATE 30000.0 // mm/min
|
||||||
#define DEFAULT_Y_MAX_RATE 24000.0 // mm/min
|
#define DEFAULT_Y_MAX_RATE 30000.0 // mm/min
|
||||||
#define DEFAULT_Z_MAX_RATE 24000.0 // mm/min
|
#define DEFAULT_Z_MAX_RATE 30000.0 // mm/min
|
||||||
#define DEFAULT_A_MAX_RATE 24000.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_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_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_Z_ACCELERATION (2500.0*60*60) // 2500*60*60 mm/min^2 = 2500 mm/sec^2
|
||||||
@ -96,8 +99,8 @@
|
|||||||
#define DEFAULT_Y_CURRENT 0.6 // amps
|
#define DEFAULT_Y_CURRENT 0.6 // amps
|
||||||
#define DEFAULT_Z_CURRENT 0.0 // amps
|
#define DEFAULT_Z_CURRENT 0.0 // amps
|
||||||
#define DEFAULT_A_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_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
|
||||||
#define DEFAULT_Y_MAX_TRAVEL 200.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_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_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_FREQ 5000 // Hz (2000 - 20000)
|
||||||
@ -127,7 +130,7 @@
|
|||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
|
||||||
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))
|
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))
|
||||||
#endif
|
#endif // end of DEFAULTS_K40
|
||||||
|
|
||||||
#ifdef DEFAULTS_FABKIT
|
#ifdef DEFAULTS_FABKIT
|
||||||
// Paste default settings definitions here.
|
// Paste default settings definitions here.
|
||||||
@ -179,7 +182,7 @@
|
|||||||
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
|
||||||
#define HOMING_CYCLE_0 (1<<Z_AXIS)
|
#define HOMING_CYCLE_0 (1<<Z_AXIS)
|
||||||
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))
|
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))
|
||||||
#endif
|
#endif // end of DEFAULTS_FABKIT
|
||||||
|
|
||||||
#ifdef DEFAULTS_SHERLINE_5400
|
#ifdef DEFAULTS_SHERLINE_5400
|
||||||
// Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors,
|
// Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors,
|
||||||
@ -222,7 +225,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 635.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 635.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_SHERLINE_5400
|
||||||
|
|
||||||
#ifdef DEFAULTS_SHAPEOKO
|
#ifdef DEFAULTS_SHAPEOKO
|
||||||
// Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
|
// Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
|
||||||
@ -268,7 +271,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_SHAPEOKO
|
||||||
|
|
||||||
#ifdef DEFAULTS_SHAPEOKO_2
|
#ifdef DEFAULTS_SHAPEOKO_2
|
||||||
// Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
|
// Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
|
||||||
@ -314,7 +317,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_SHAPEOKO_2
|
||||||
|
|
||||||
#ifdef DEFAULTS_SHAPEOKO_3
|
#ifdef DEFAULTS_SHAPEOKO_3
|
||||||
// Description: Shapeoko CNC mill with three NEMA 23 stepper motors, driven by CarbideMotion
|
// Description: Shapeoko CNC mill with three NEMA 23 stepper motors, driven by CarbideMotion
|
||||||
@ -359,7 +362,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 25 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 25 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 5.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 5.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_SHAPEOKO_3
|
||||||
|
|
||||||
#ifdef DEFAULTS_X_CARVE_500MM
|
#ifdef DEFAULTS_X_CARVE_500MM
|
||||||
// Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
|
// Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
|
||||||
@ -405,7 +408,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 750.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 750.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_X_CARVE_500MM
|
||||||
|
|
||||||
#ifdef DEFAULTS_X_CARVE_1000MM
|
#ifdef DEFAULTS_X_CARVE_1000MM
|
||||||
// Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
|
// Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
|
||||||
@ -451,7 +454,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 750.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 750.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_X_CARVE_1000MM
|
||||||
|
|
||||||
#ifdef DEFAULTS_ZEN_TOOLWORKS_7x7
|
#ifdef DEFAULTS_ZEN_TOOLWORKS_7x7
|
||||||
// Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors.
|
// Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors.
|
||||||
@ -495,7 +498,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 250.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_ZEN_TOOLWORKS_7x7
|
||||||
|
|
||||||
#ifdef DEFAULTS_OXCNC
|
#ifdef DEFAULTS_OXCNC
|
||||||
// Grbl settings for OpenBuilds OX CNC Machine
|
// Grbl settings for OpenBuilds OX CNC Machine
|
||||||
@ -535,7 +538,7 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
||||||
#endif
|
#endif // end of DEFAULTS_OXCNC
|
||||||
|
|
||||||
#ifdef DEFAULTS_SIMULATOR
|
#ifdef DEFAULTS_SIMULATOR
|
||||||
// Settings only for Grbl Simulator (www.github.com/grbl/grbl-sim)
|
// Settings only for Grbl Simulator (www.github.com/grbl/grbl-sim)
|
||||||
@ -575,6 +578,59 @@
|
|||||||
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
#define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
|
||||||
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
|
||||||
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
|
#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
|
#endif
|
||||||
|
@ -313,9 +313,9 @@ uint8_t gc_execute_line(char *line)
|
|||||||
case 'R': word_bit = WORD_R; gc_block.values.r = value; break;
|
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 'S': word_bit = WORD_S; gc_block.values.s = value; break;
|
||||||
case 'T': word_bit = WORD_T;
|
case 'T': word_bit = WORD_T;
|
||||||
if (value > MAX_TOOL_NUMBER) { FAIL(STATUS_GCODE_MAX_VALUE_EXCEEDED); }
|
if (value > MAX_TOOL_NUMBER) { FAIL(STATUS_GCODE_MAX_VALUE_EXCEEDED); }
|
||||||
gc_block.values.t = int_value;
|
gc_block.values.t = int_value;
|
||||||
break;
|
break;
|
||||||
case 'X': word_bit = WORD_X; gc_block.values.xyza[X_AXIS] = value; axis_words |= (1<<X_AXIS); 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 '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;
|
case 'Z': word_bit = WORD_Z; gc_block.values.xyza[Z_AXIS] = value; axis_words |= (1<<Z_AXIS); break;
|
||||||
|
@ -199,7 +199,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float f; // Feed
|
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
|
uint8_t l; // G10 or canned cycles parameters
|
||||||
int32_t n; // Line number
|
int32_t n; // Line number
|
||||||
float p; // G10 or dwell parameters
|
float p; // G10 or dwell parameters
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
// Grbl versioning system
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "1.1f"
|
#define GRBL_VERSION "1.1f"
|
||||||
#define GRBL_VERSION_BUILD "20170511"
|
#define GRBL_VERSION_BUILD "20171008"
|
||||||
|
|
||||||
// Define standard libraries used by Grbl.
|
// Define standard libraries used by Grbl.
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
@ -75,9 +75,11 @@
|
|||||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
|
#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"
|
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
|
#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"
|
#error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
|
||||||
|
@ -158,9 +158,9 @@ void limits_go_home(uint8_t cycle_mask)
|
|||||||
|
|
||||||
// Initialize variables used for homing computations.
|
// Initialize variables used for homing computations.
|
||||||
uint8_t n_cycle = (2*N_HOMING_LOCATE_CYCLE+1);
|
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 target[N_AXIS];
|
||||||
float max_travel = 0.0;
|
float max_travel = 0.0; // Maximum travel distance to move searching for limits
|
||||||
uint8_t idx;
|
uint8_t idx;
|
||||||
for (idx=0; idx<N_AXIS; idx++) {
|
for (idx=0; idx<N_AXIS; idx++) {
|
||||||
// Initialize step pin masks
|
// Initialize step pin masks
|
||||||
@ -183,11 +183,12 @@ void limits_go_home(uint8_t cycle_mask)
|
|||||||
uint32_t limit_state, axislock, n_active_axis;
|
uint32_t limit_state, axislock, n_active_axis;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
|
// convert current sys_position (steps) to target (mm) so unused axes remain in place
|
||||||
system_convert_array_steps_to_mpos(target,sys_position);
|
system_convert_array_steps_to_mpos(target,sys_position);
|
||||||
|
|
||||||
// Initialize and declare variables needed for homing routine.
|
// Initialize and declare variables needed for homing routine.
|
||||||
axislock = 0;
|
axislock = 0; // Track which pins still need to find limits. Lock these axes by clearing these bits.
|
||||||
n_active_axis = 0;
|
n_active_axis = 0; // Track number of axes being homed
|
||||||
for (idx=0; idx<N_AXIS; idx++) {
|
for (idx=0; idx<N_AXIS; idx++) {
|
||||||
// Set target location for active axes and setup computation for homing rate.
|
// Set target location for active axes and setup computation for homing rate.
|
||||||
if (bit_istrue(cycle_mask,bit(idx))) {
|
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; }
|
if (approach) { target[idx] = max_travel; }
|
||||||
else { 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];
|
axislock |= step_pin[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,12 +238,13 @@ void limits_go_home(uint8_t cycle_mask)
|
|||||||
for (idx=0; idx<N_AXIS; idx++) {
|
for (idx=0; idx<N_AXIS; idx++) {
|
||||||
if (axislock & step_pin[idx]) {
|
if (axislock & step_pin[idx]) {
|
||||||
if (limit_state & (1 << idx)) {
|
if (limit_state & (1 << idx)) {
|
||||||
#ifdef COREXY
|
// Clear the axislock bits to prevent axis from moving after limit is hit
|
||||||
if (idx==Z_AXIS) { axislock &= ~(step_pin[Z_AXIS]); }
|
#ifdef COREXY
|
||||||
else { axislock &= ~(step_pin[A_MOTOR]|step_pin[B_MOTOR]); }
|
if (idx==Z_AXIS) { axislock &= ~(step_pin[Z_AXIS]); }
|
||||||
#else
|
else { axislock &= ~(step_pin[A_MOTOR]|step_pin[B_MOTOR]); }
|
||||||
axislock &= ~(step_pin[idx]);
|
#else
|
||||||
#endif
|
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,
|
// 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
|
// 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
|
// 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;
|
int32_t set_axis_position;
|
||||||
// Set machine positions for homed limit switches. Don't update non-homed axes.
|
// Set machine positions for homed limit switches. Don't update non-homed axes.
|
||||||
for (idx=0; idx<N_AXIS; idx++) {
|
for (idx=0; idx<N_AXIS; idx++) {
|
||||||
|
34
grbl/main.c
34
grbl/main.c
@ -42,13 +42,13 @@ int main(void)
|
|||||||
{
|
{
|
||||||
// Initialize system upon power-up.
|
// Initialize system upon power-up.
|
||||||
debug_init(); // Initialize debug leds
|
debug_init(); // Initialize debug leds
|
||||||
isr_init(); // Set ISR priorities
|
isr_init(); // Set ISR priorities (stepper ISR uses Timer1)
|
||||||
delay_init(); // Setup delay timer
|
delay_init(); // Setup delay timer (uses Timer3)
|
||||||
serial_init(); // Setup serial baud rate and interrupts
|
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
|
settings_init(); // Load Grbl settings from EEPROM
|
||||||
current_init(); // Configure stepper driver current
|
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
|
system_init(); // Configure pinout pins and pin-change interrupt
|
||||||
|
|
||||||
memset(sys_position,0,sizeof(sys_position)); // Clear machine position.
|
memset(sys_position,0,sizeof(sys_position)); // Clear machine position.
|
||||||
@ -61,7 +61,7 @@ int main(void)
|
|||||||
#else
|
#else
|
||||||
sys.state = STATE_IDLE;
|
sys.state = STATE_IDLE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check for power-up and set system alarm if homing is enabled to force homing cycle
|
// 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
|
// 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
|
// startup scripts, but allows access to settings and internal commands. Only a homing
|
||||||
@ -84,26 +84,26 @@ int main(void)
|
|||||||
sys.f_override = DEFAULT_FEED_OVERRIDE; // Set to 100%
|
sys.f_override = DEFAULT_FEED_OVERRIDE; // Set to 100%
|
||||||
sys.r_override = DEFAULT_RAPID_OVERRIDE; // Set to 100%
|
sys.r_override = DEFAULT_RAPID_OVERRIDE; // Set to 100%
|
||||||
sys.spindle_speed_ovr = DEFAULT_SPINDLE_SPEED_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.
|
memset(sys_probe_position,0,sizeof(sys_probe_position)); // Clear probe position.
|
||||||
sys_probe_state = 0;
|
sys_probe_state = 0; // PROBE_OFF
|
||||||
sys_rt_exec_state = 0;
|
sys_rt_exec_state = 0; // EXEC_STATUS_REPORT
|
||||||
sys_rt_exec_alarm = 0;
|
sys_rt_exec_alarm = 0;
|
||||||
sys_rt_exec_motion_override = 0;
|
sys_rt_exec_motion_override = 0;
|
||||||
sys_rt_exec_accessory_override = 0;
|
sys_rt_exec_accessory_override = 0;
|
||||||
|
|
||||||
// Reset Grbl primary systems.
|
// Reset Grbl primary systems.
|
||||||
serial_reset_read_buffer(); // Clear serial read buffer
|
serial_reset_read_buffer(); // Clear serial read buffer
|
||||||
gc_init(); // Set g-code parser to default state
|
gc_init(); // Set g-code parser to default state
|
||||||
spindle_init();
|
spindle_init(); // Configure spindle pins and PWM values
|
||||||
coolant_init();
|
coolant_init(); // Configure coolant pins
|
||||||
limits_init();
|
limits_init(); // Configure limit input pins and interrupts
|
||||||
probe_init();
|
probe_init(); // Configure probe input pin
|
||||||
plan_reset(); // Clear block buffer and planner variables
|
plan_reset(); // Clear block buffer and planner variables
|
||||||
st_reset(); // Clear stepper subsystem variables.
|
st_reset(); // Clear stepper subsystem variables.
|
||||||
|
|
||||||
// Sync cleared gcode and planner positions to current system position.
|
// Sync cleared gcode and planner positions to current system position.
|
||||||
plan_sync_position();
|
plan_sync_position(); // Synchronize plan position with (actual) system position
|
||||||
gc_sync_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.
|
// Print welcome message. Indicates an initialization has occured at power-up or with a reset.
|
||||||
report_init_message();
|
report_init_message();
|
||||||
|
@ -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.
|
// 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
|
// Monitors probe pin state and records the system position when detected. Called by the
|
||||||
|
@ -100,14 +100,14 @@ void settings_restore(uint8_t restore_flag) {
|
|||||||
settings.homing_pulloff = DEFAULT_HOMING_PULLOFF;
|
settings.homing_pulloff = DEFAULT_HOMING_PULLOFF;
|
||||||
|
|
||||||
settings.flags = 0;
|
settings.flags = 0;
|
||||||
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
||||||
if (DEFAULT_LASER_MODE) { settings.flags |= BITFLAG_LASER_MODE; }
|
if (DEFAULT_LASER_MODE) { settings.flags |= BITFLAG_LASER_MODE; }
|
||||||
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
||||||
if (DEFAULT_HARD_LIMIT_ENABLE) { settings.flags |= BITFLAG_HARD_LIMIT_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_SOFT_LIMIT_ENABLE) { settings.flags |= BITFLAG_SOFT_LIMIT_ENABLE; }
|
||||||
if (DEFAULT_INVERT_LIMIT_PINS) { settings.flags |= BITFLAG_INVERT_LIMIT_PINS; }
|
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[X_AXIS] = DEFAULT_X_STEPS_PER_MM;
|
||||||
settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM;
|
settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM;
|
||||||
@ -177,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))) {
|
if (!(memcpy_from_eeprom_with_checksum((char*)line, addr, LINE_BUFFER_SIZE))) {
|
||||||
// Reset line with default value
|
// Reset line with default value
|
||||||
line[0] = 0; // Empty line
|
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(false);
|
||||||
}
|
}
|
||||||
return(true);
|
return(true);
|
||||||
@ -190,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))) {
|
if (!(memcpy_from_eeprom_with_checksum((char*)line, EEPROM_ADDR_BUILD_INFO, LINE_BUFFER_SIZE))) {
|
||||||
// Reset line with default value
|
// Reset line with default value
|
||||||
line[0] = 0; // Empty line
|
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(false);
|
||||||
}
|
}
|
||||||
return(true);
|
return(true);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Version of the EEPROM data. Will be used to migrate existing data from older versions of Grbl
|
// 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
|
// 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 SETTINGS_VERSION 11 // NOTE: Check settings_reset() when moving to next version.
|
||||||
|
|
||||||
// Define bit flag masks for the boolean settings in settings.flag.
|
// Define bit flag masks for the boolean settings in settings.flag.
|
||||||
@ -44,10 +44,10 @@
|
|||||||
#define BITFLAG_RT_STATUS_BUFFER_STATE bit(1)
|
#define BITFLAG_RT_STATUS_BUFFER_STATE bit(1)
|
||||||
|
|
||||||
// Define settings restore bitflags.
|
// Define settings restore bitflags.
|
||||||
#define SETTINGS_RESTORE_DEFAULTS bit(0)
|
#define SETTINGS_RESTORE_DEFAULTS bit(0)
|
||||||
#define SETTINGS_RESTORE_PARAMETERS bit(1)
|
#define SETTINGS_RESTORE_PARAMETERS bit(1)
|
||||||
#define SETTINGS_RESTORE_STARTUP_LINES bit(2)
|
#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
|
#ifndef SETTINGS_RESTORE_ALL
|
||||||
#define SETTINGS_RESTORE_ALL 0xFF // All bitflags
|
#define SETTINGS_RESTORE_ALL 0xFF // All bitflags
|
||||||
#endif
|
#endif
|
||||||
@ -56,6 +56,7 @@
|
|||||||
// NOTE: The Atmega328p has 1KB EEPROM. The upper half is reserved for parameters and
|
// 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
|
// the startup script. The lower half contains the global settings and space for future
|
||||||
// developments.
|
// developments.
|
||||||
|
// Note: Address 0 of EEPROM is reserved for SETTINGS_VERSION.
|
||||||
#define EEPROM_ADDR_GLOBAL 1U
|
#define EEPROM_ADDR_GLOBAL 1U
|
||||||
#define EEPROM_ADDR_PARAMETERS 512U
|
#define EEPROM_ADDR_PARAMETERS 512U
|
||||||
#define EEPROM_ADDR_STARTUP_BLOCK 768U
|
#define EEPROM_ADDR_STARTUP_BLOCK 768U
|
||||||
@ -80,7 +81,7 @@ typedef struct {
|
|||||||
float steps_per_mm[N_AXIS];
|
float steps_per_mm[N_AXIS];
|
||||||
float max_rate[N_AXIS];
|
float max_rate[N_AXIS];
|
||||||
float acceleration[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];
|
float current[N_AXIS];
|
||||||
|
|
||||||
// Remaining Grbl settings
|
// Remaining Grbl settings
|
||||||
|
@ -42,7 +42,6 @@ void spindle_init()
|
|||||||
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0);
|
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0);
|
||||||
pwm_enable(&SPINDLE_PWM_CHANNEL);
|
pwm_enable(&SPINDLE_PWM_CHANNEL);
|
||||||
|
|
||||||
/* not ported
|
|
||||||
// Configure variable spindle PWM and enable pin, if requried. On the Uno, PWM and enable are
|
// Configure variable spindle PWM and enable pin, if requried. On the Uno, PWM and enable are
|
||||||
// combined unless configured otherwise.
|
// combined unless configured otherwise.
|
||||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
@ -50,16 +49,13 @@ void spindle_init()
|
|||||||
#else
|
#else
|
||||||
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
||||||
#endif
|
#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
|
#else
|
||||||
/* not ported
|
|
||||||
// Configure no variable spindle and only enable pin.
|
// Configure no variable spindle and only enable pin.
|
||||||
SPINDLE_ENABLE_DDR |= (1<<SPINDLE_ENABLE_BIT); // Configure as output pin.
|
SPINDLE_ENABLE_DDR |= (1<<SPINDLE_ENABLE_BIT); // Configure as output pin.
|
||||||
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT); // Configure as output pin.
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spindle_stop();
|
spindle_stop();
|
||||||
@ -68,32 +64,30 @@ void spindle_init()
|
|||||||
|
|
||||||
uint8_t spindle_get_state()
|
uint8_t spindle_get_state()
|
||||||
{
|
{
|
||||||
/* not ported
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
// No spindle direction output pin.
|
// No spindle direction output pin.
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||||
#else
|
#else
|
||||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) { return(SPINDLE_STATE_CW); }
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if (SPINDLE_TCCRA_REGISTER & (1<<SPINDLE_COMB_BIT)) { // Check if PWM is enabled.
|
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); }
|
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||||
else { return(SPINDLE_STATE_CW); }
|
else { return(SPINDLE_STATE_CW); }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
if (bit_isfalse(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||||
#else
|
#else
|
||||||
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
if (bit_istrue(SPINDLE_ENABLE_PORT,(1<<SPINDLE_ENABLE_BIT))) {
|
||||||
#endif
|
#endif
|
||||||
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
if (SPINDLE_DIRECTION_PORT & (1<<SPINDLE_DIRECTION_BIT)) { return(SPINDLE_STATE_CCW); }
|
||||||
else { return(SPINDLE_STATE_CW); }
|
else { return(SPINDLE_STATE_CW); }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
return(SPINDLE_STATE_DISABLE);
|
return(SPINDLE_STATE_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,26 +97,22 @@ uint8_t spindle_get_state()
|
|||||||
// Called by spindle_init(), spindle_set_speed(), spindle_set_state(), and mc_reset().
|
// Called by spindle_init(), spindle_set_speed(), spindle_set_state(), and mc_reset().
|
||||||
void spindle_stop()
|
void spindle_stop()
|
||||||
{
|
{
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
pwm_set_width(&SPINDLE_PWM_CHANNEL, 0);
|
pwm_set_width(&SPINDLE_PWM_CHANNEL, 0);
|
||||||
/* not ported
|
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
#ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
||||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
#else
|
||||||
#else
|
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
||||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT); // Set pin to low
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
#else
|
|
||||||
/* not ported
|
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
|
||||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT); // Set pin to high
|
|
||||||
#else
|
#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
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -183,13 +173,11 @@ void spindle_stop()
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
#ifndef USE_SPINDLE_DIR_AS_ENABLE_PIN
|
||||||
/* not ported
|
|
||||||
if (state == SPINDLE_ENABLE_CW) {
|
if (state == SPINDLE_ENABLE_CW) {
|
||||||
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
||||||
} else {
|
} else {
|
||||||
SPINDLE_DIRECTION_PORT |= (1<<SPINDLE_DIRECTION_BIT);
|
SPINDLE_DIRECTION_PORT |= (1<<SPINDLE_DIRECTION_BIT);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
@ -203,13 +191,11 @@ void spindle_stop()
|
|||||||
!defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)) || !defined(VARIABLE_SPINDLE)
|
!defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)) || !defined(VARIABLE_SPINDLE)
|
||||||
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
|
// NOTE: Without variable spindle, the enable bit should just turn on or off, regardless
|
||||||
// if the spindle speed value is zero, as its ignored anyhow.
|
// if the spindle speed value is zero, as its ignored anyhow.
|
||||||
/* not ported
|
|
||||||
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
#ifdef INVERT_SPINDLE_ENABLE_PIN
|
||||||
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
||||||
#else
|
#else
|
||||||
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
|
SPINDLE_ENABLE_PORT |= (1<<SPINDLE_ENABLE_BIT);
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
182
grbl/stepper.c
182
grbl/stepper.c
@ -30,10 +30,10 @@
|
|||||||
#define RAMP_DECEL 2
|
#define RAMP_DECEL 2
|
||||||
#define RAMP_DECEL_OVERRIDE 3
|
#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_HOLD_PARTIAL_BLOCK bit(1)
|
||||||
#define PREP_FLAG_PARKING bit(2)
|
#define PREP_FLAG_PARKING bit(2)
|
||||||
#define PREP_FLAG_DECEL_OVERRIDE bit(3)
|
#define PREP_FLAG_DECEL_OVERRIDE bit(3)
|
||||||
|
|
||||||
// Define Adaptive Multi-Axis Step-Smoothing(AMASS) levels and cutoff frequencies. The highest level
|
// 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
|
// frequency bin starts at 0Hz and ends at its cutoff frequency. The next lower level frequency bin
|
||||||
@ -45,11 +45,11 @@
|
|||||||
// NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead
|
// NOTE: Current settings are set to overdrive the ISR to no more than 16kHz, balancing CPU overhead
|
||||||
// and timer accuracy. Do not alter these settings unless you know what you are doing.
|
// and timer accuracy. Do not alter these settings unless you know what you are doing.
|
||||||
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
#ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING
|
||||||
#define MAX_AMASS_LEVEL 3
|
#define MAX_AMASS_LEVEL 3
|
||||||
// AMASS_LEVEL0: Normal operation. No AMASS. No upper cutoff frequency. Starts at LEVEL1 cutoff frequency.
|
// 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_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_LEVEL2 (F_CPU/4000) // Over-drives ISR (x4)
|
||||||
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8)
|
#define AMASS_LEVEL3 (F_CPU/2000) // Over-drives ISR (x8)
|
||||||
|
|
||||||
#if MAX_AMASS_LEVEL <= 0
|
#if MAX_AMASS_LEVEL <= 0
|
||||||
error "AMASS must have 1 or more levels to operate correctly."
|
error "AMASS must have 1 or more levels to operate correctly."
|
||||||
@ -167,7 +167,7 @@ typedef struct {
|
|||||||
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
float inv_rate; // Used by PWM laser mode to speed up segment calculations.
|
float inv_rate; // Used by PWM laser mode to speed up segment calculations.
|
||||||
uint32_t current_spindle_pwm;
|
uint32_t current_spindle_pwm;
|
||||||
#endif
|
#endif
|
||||||
} st_prep_t;
|
} st_prep_t;
|
||||||
static st_prep_t prep;
|
static st_prep_t prep;
|
||||||
@ -235,9 +235,9 @@ void st_wake_up()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable Stepper Driver Interrupt Timer
|
// Enable Stepper Driver Interrupt Timer
|
||||||
LPC_TIM1->TCR = 0b10; // reset
|
LPC_TIM1->TCR = 0b10; // reset Timer Control (0b10=Reset, 0b01=Enable)
|
||||||
LPC_TIM1->MR0 = 4000; // Generate first interrupt soon
|
LPC_TIM1->MR0 = 4000; // Generate first interrupt soon (Match Register for TC)
|
||||||
LPC_TIM1->TCR = 0b01; // enable
|
LPC_TIM1->TCR = 0b01; // enable Timer Control (0b10=Reset, 0b01=Enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -245,11 +245,11 @@ void st_wake_up()
|
|||||||
void st_go_idle()
|
void st_go_idle()
|
||||||
{
|
{
|
||||||
// Disable Stepper Driver Interrupt. Allow Stepper Port Reset Interrupt to finish, if active.
|
// 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;
|
busy = false;
|
||||||
|
|
||||||
// Set stepper driver idle state, disabled or enabled, depending on settings and circumstances.
|
// 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) {
|
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
|
// 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.
|
// stop and not drift from residual inertial forces at the end of the last movement.
|
||||||
@ -355,7 +355,7 @@ extern "C" void TIMER1_IRQHandler()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize step segment timing per step and load number of steps to execute.
|
// 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.
|
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.
|
// 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.
|
// NOTE: When the segment data index changes, this indicates a new planner block.
|
||||||
@ -503,7 +503,7 @@ extern "C" void TIMER1_IRQHandler()
|
|||||||
cause issues at high step rates if another high frequency asynchronous interrupt is
|
cause issues at high step rates if another high frequency asynchronous interrupt is
|
||||||
added to Grbl.
|
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.
|
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
|
// 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)
|
// a step. This ISR resets the motor port after a short period (settings.pulse_microseconds)
|
||||||
@ -570,17 +570,17 @@ void st_reset()
|
|||||||
void stepper_init()
|
void stepper_init()
|
||||||
{
|
{
|
||||||
// Configure step and direction interface pins
|
// Configure step and direction interface pins
|
||||||
STEP_DDR |= STEP_MASK;
|
STEP_DDR |= STEP_MASK; // Set selected stepper step pins as outputs
|
||||||
STEPPERS_DISABLE_DDR |= STEPPERS_DISABLE_MASK;
|
STEPPERS_DISABLE_DDR |= STEPPERS_DISABLE_MASK; // Set selected stepper disable pins as outputs
|
||||||
DIRECTION_DDR |= DIRECTION_MASK;
|
DIRECTION_DDR |= DIRECTION_MASK; // Set selected stepper direction pins as outputs
|
||||||
|
|
||||||
// Configure Timer 1: Stepper Driver Interrupt
|
// Configure Timer 1: Stepper Driver Interrupt
|
||||||
LPC_TIM1->TCR = 0; // disable
|
LPC_TIM1->TCR = 0; // disable Timer Control (0b10=Reset, 0b01=Enable)
|
||||||
LPC_TIM1->CTCR = 0; // timer mode
|
LPC_TIM1->CTCR = 0; // Count Control (0=TimerMode, 1-3=EdgeCounterMode)
|
||||||
LPC_TIM1->PR = 0; // no prescale
|
LPC_TIM1->PR = 0; // no Prescale (TC increments every PR+1 clocks)
|
||||||
LPC_TIM1->MCR = 0b011; // MR0: !stop, reset, interrupt
|
LPC_TIM1->MCR = 0b011; // Match Control (0b001=InterruptEnbl, 0b010=Reset_Enbl, 0b100=Stop_Enbl)
|
||||||
LPC_TIM1->CCR = 0; // no capture
|
LPC_TIM1->CCR = 0; // no Capture Control actions
|
||||||
LPC_TIM1->EMR = 0; // no external match
|
LPC_TIM1->EMR = 0; // no External Match (controls external match pins)
|
||||||
NVIC_EnableIRQ(TIMER1_IRQn); // Enable Stepper Driver Interrupt
|
NVIC_EnableIRQ(TIMER1_IRQn); // Enable Stepper Driver Interrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,49 +717,49 @@ void st_prep_buffer()
|
|||||||
} else {
|
} else {
|
||||||
prep.current_speed = sqrt(pl_block->entry_speed_sqr);
|
prep.current_speed = sqrt(pl_block->entry_speed_sqr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
// Setup laser mode variables. PWM rate adjusted motions will always complete a motion with the
|
// 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;
|
st_prep_block->is_pwm_rate_adjusted = false;
|
||||||
if (settings.flags & BITFLAG_LASER_MODE) {
|
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.
|
// Pre-compute inverse programmed rate to speed up PWM updating per step segment.
|
||||||
prep.inv_rate = 1.0/pl_block->programmed_rate;
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------------
|
||||||
Compute the velocity profile of a new planner block based on its entry and exit
|
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
|
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
|
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.
|
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.
|
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;
|
float inv_2_accel = 0.5/pl_block->acceleration;
|
||||||
if (sys.step_control & STEP_CONTROL_EXECUTE_HOLD) { // [Forced Deceleration to Zero Velocity]
|
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
|
// Compute velocity profile parameters for a feed hold in-progress. This profile overrides
|
||||||
// the planner block profile, enforcing a deceleration to zero speed.
|
// the planner block profile, enforcing a deceleration to zero speed.
|
||||||
prep.ramp_type = RAMP_DECEL;
|
prep.ramp_type = RAMP_DECEL;
|
||||||
// Compute decelerate distance relative to end of block.
|
// Compute decelerate distance relative to end of block.
|
||||||
float decel_dist = pl_block->millimeters - inv_2_accel*pl_block->entry_speed_sqr;
|
float decel_dist = pl_block->millimeters - inv_2_accel*pl_block->entry_speed_sqr;
|
||||||
if (decel_dist < 0.0) {
|
if (decel_dist < 0.0) {
|
||||||
// Deceleration through entire planner block. End of feed hold is not in this block.
|
// 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);
|
prep.exit_speed = sqrt(pl_block->entry_speed_sqr-2*pl_block->acceleration*pl_block->millimeters);
|
||||||
} else {
|
} else {
|
||||||
prep.mm_complete = decel_dist; // End of feed hold.
|
prep.mm_complete = decel_dist; // End of feed hold.
|
||||||
prep.exit_speed = 0.0;
|
prep.exit_speed = 0.0;
|
||||||
}
|
}
|
||||||
} else { // [Normal Operation]
|
} else { // [Normal Operation]
|
||||||
// Compute or recompute velocity profile parameters of the prepped planner block.
|
// Compute or recompute velocity profile parameters of the prepped planner block.
|
||||||
prep.ramp_type = RAMP_ACCEL; // Initialize as acceleration ramp.
|
prep.ramp_type = RAMP_ACCEL; // Initialize as acceleration ramp.
|
||||||
prep.accelerate_until = pl_block->millimeters;
|
prep.accelerate_until = pl_block->millimeters;
|
||||||
|
|
||||||
float exit_speed_sqr;
|
float exit_speed_sqr;
|
||||||
float nominal_speed;
|
float nominal_speed;
|
||||||
if (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION) {
|
if (sys.step_control & STEP_CONTROL_EXECUTE_SYS_MOTION) {
|
||||||
prep.exit_speed = exit_speed_sqr = 0.0; // Enforce stop at end of system motion.
|
prep.exit_speed = exit_speed_sqr = 0.0; // Enforce stop at end of system motion.
|
||||||
} else {
|
} else {
|
||||||
@ -768,9 +768,9 @@ void st_prep_buffer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
nominal_speed = plan_compute_profile_nominal_speed(pl_block);
|
nominal_speed = plan_compute_profile_nominal_speed(pl_block);
|
||||||
float nominal_speed_sqr = nominal_speed*nominal_speed;
|
float nominal_speed_sqr = nominal_speed*nominal_speed;
|
||||||
float intersect_distance =
|
float intersect_distance =
|
||||||
0.5*(pl_block->millimeters+inv_2_accel*(pl_block->entry_speed_sqr-exit_speed_sqr));
|
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.
|
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);
|
prep.accelerate_until = pl_block->millimeters - inv_2_accel*(pl_block->entry_speed_sqr-nominal_speed_sqr);
|
||||||
@ -793,41 +793,41 @@ void st_prep_buffer()
|
|||||||
prep.maximum_speed = nominal_speed;
|
prep.maximum_speed = nominal_speed;
|
||||||
prep.ramp_type = RAMP_DECEL_OVERRIDE;
|
prep.ramp_type = RAMP_DECEL_OVERRIDE;
|
||||||
}
|
}
|
||||||
} else if (intersect_distance > 0.0) {
|
} else if (intersect_distance > 0.0) {
|
||||||
if (intersect_distance < pl_block->millimeters) { // Either trapezoid or triangle types
|
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.
|
// 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);
|
prep.decelerate_after = inv_2_accel*(nominal_speed_sqr-exit_speed_sqr);
|
||||||
if (prep.decelerate_after < intersect_distance) { // Trapezoid type
|
if (prep.decelerate_after < intersect_distance) { // Trapezoid type
|
||||||
prep.maximum_speed = nominal_speed;
|
prep.maximum_speed = nominal_speed;
|
||||||
if (pl_block->entry_speed_sqr == nominal_speed_sqr) {
|
if (pl_block->entry_speed_sqr == nominal_speed_sqr) {
|
||||||
// Cruise-deceleration or cruise-only type.
|
// Cruise-deceleration or cruise-only type.
|
||||||
prep.ramp_type = RAMP_CRUISE;
|
prep.ramp_type = RAMP_CRUISE;
|
||||||
} else {
|
} else {
|
||||||
// Full-trapezoid or acceleration-cruise types
|
// Full-trapezoid or acceleration-cruise types
|
||||||
prep.accelerate_until -= inv_2_accel*(nominal_speed_sqr-pl_block->entry_speed_sqr);
|
prep.accelerate_until -= inv_2_accel*(nominal_speed_sqr-pl_block->entry_speed_sqr);
|
||||||
}
|
}
|
||||||
} else { // Triangle type
|
} else { // Triangle type
|
||||||
prep.accelerate_until = intersect_distance;
|
prep.accelerate_until = intersect_distance;
|
||||||
prep.decelerate_after = intersect_distance;
|
prep.decelerate_after = intersect_distance;
|
||||||
prep.maximum_speed = sqrt(2.0*pl_block->acceleration*intersect_distance+exit_speed_sqr);
|
prep.maximum_speed = sqrt(2.0*pl_block->acceleration*intersect_distance+exit_speed_sqr);
|
||||||
}
|
}
|
||||||
} else { // Deceleration-only type
|
} else { // Deceleration-only type
|
||||||
prep.ramp_type = RAMP_DECEL;
|
prep.ramp_type = RAMP_DECEL;
|
||||||
// prep.decelerate_after = pl_block->millimeters;
|
// prep.decelerate_after = pl_block->millimeters;
|
||||||
// prep.maximum_speed = prep.current_speed;
|
// prep.maximum_speed = prep.current_speed;
|
||||||
}
|
}
|
||||||
} else { // Acceleration-only type
|
} else { // Acceleration-only type
|
||||||
prep.accelerate_until = 0.0;
|
prep.accelerate_until = 0.0;
|
||||||
// prep.decelerate_after = 0.0;
|
// prep.decelerate_after = 0.0;
|
||||||
prep.maximum_speed = prep.exit_speed;
|
prep.maximum_speed = prep.exit_speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VARIABLE_SPINDLE
|
#ifdef VARIABLE_SPINDLE
|
||||||
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM); // Force update whenever updating block.
|
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM); // Force update whenever updating block.
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize new segment
|
// Initialize new segment
|
||||||
segment_t *prep_segment = &segment_buffer[segment_buffer_head];
|
segment_t *prep_segment = &segment_buffer[segment_buffer_head];
|
||||||
|
|
||||||
@ -937,16 +937,16 @@ void st_prep_buffer()
|
|||||||
/* -----------------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------------
|
||||||
Compute spindle speed PWM output for step segment
|
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 (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)) {
|
if (pl_block->condition & (PL_COND_FLAG_SPINDLE_CW | PL_COND_FLAG_SPINDLE_CCW)) {
|
||||||
float rpm = pl_block->spindle_speed;
|
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 (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)
|
// 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.
|
// but this would be instantaneous only and during a motion. May not matter at all.
|
||||||
prep.current_spindle_pwm = spindle_compute_pwm_value(rpm);
|
prep.current_spindle_pwm = spindle_compute_pwm_value(rpm);
|
||||||
} else {
|
} else {
|
||||||
sys.spindle_speed = 0.0;
|
sys.spindle_speed = 0.0;
|
||||||
prep.current_spindle_pwm = spindle_pwm_off_value;
|
prep.current_spindle_pwm = spindle_pwm_off_value;
|
||||||
}
|
}
|
||||||
@ -955,7 +955,7 @@ void st_prep_buffer()
|
|||||||
prep_segment->spindle_pwm = prep.current_spindle_pwm; // Reload segment PWM value
|
prep_segment->spindle_pwm = prep.current_spindle_pwm; // Reload segment PWM value
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------------
|
||||||
Compute segment step rate, steps to execute, and apply necessary rate corrections.
|
Compute segment step rate, steps to execute, and apply necessary rate corrections.
|
||||||
NOTE: Steps are computed by direct scalar conversion of the millimeter distance
|
NOTE: Steps are computed by direct scalar conversion of the millimeter distance
|
||||||
|
@ -23,14 +23,15 @@
|
|||||||
|
|
||||||
void system_init()
|
void system_init()
|
||||||
{
|
{
|
||||||
|
// Configure user control pins (for cycle start, reset, feed hold, etc.)
|
||||||
CONTROL_DDR &= ~(CONTROL_MASK); // Configure as input pins
|
CONTROL_DDR &= ~(CONTROL_MASK); // Configure as input pins
|
||||||
#ifdef DISABLE_CONTROL_PIN_PULL_UP
|
#ifdef DISABLE_CONTROL_PIN_PULL_UP
|
||||||
CONTROL_PORT &= ~(CONTROL_MASK); // Normal low operation. Requires external pull-down.
|
CONTROL_PORT &= ~(CONTROL_MASK); // Normal low operation. Requires external pull-down.
|
||||||
#else
|
#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
|
#endif
|
||||||
CONTROL_PCMSK |= CONTROL_MASK; // Enable specific pins of the Pin Change Interrupt
|
CONTROL_PCMSK |= CONTROL_MASK; // Enable specific pins of the Pin Change Interrupt
|
||||||
PCICR |= (1 << CONTROL_INT); // Enable Pin Change Interrupt
|
PCICR |= (1 << CONTROL_INT); // Enable Pin Change Interrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +196,7 @@ uint8_t system_execute_line(char *line)
|
|||||||
if (!sys.abort) { // Execute startup scripts after successful homing.
|
if (!sys.abort) { // Execute startup scripts after successful homing.
|
||||||
sys.state = STATE_IDLE; // Set to IDLE when complete.
|
sys.state = STATE_IDLE; // Set to IDLE when complete.
|
||||||
st_go_idle(); // Set steppers to the settings idle state before returning.
|
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;
|
break;
|
||||||
case 'S' : // Puts Grbl to sleep [IDLE/ALARM]
|
case 'S' : // Puts Grbl to sleep [IDLE/ALARM]
|
||||||
|
Loading…
Reference in New Issue
Block a user