/* config.h - compile time configuration Part of Grbl Copyright (c) 2012-2015 Sungeun K. Jeon Copyright (c) 2009-2011 Simen Svale Skogsrud Grbl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Grbl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Grbl. If not, see . */ // This file contains compile-time configurations for Grbl's internal system. For the most part, // users will not need to directly modify these, but they are here for specific needs, i.e. // performance tuning or adjusting to non-typical machines. // IMPORTANT: Any changes here requires a full re-compiling of the source code to propagate them. #ifndef config_h #define config_h #include "grbl.h" // For Arduino IDE compatibility. // Default settings. Used when resetting EEPROM. Change to desired name in defaults.h #define DEFAULTS_GENERIC // Serial baud rate #define BAUD_RATE 115200 // Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types // may exist from user-supplied templates or directly user-defined in cpu_map.h #define CPU_MAP_ATMEGA328P // Arduino Uno CPU // Define realtime command special characters. These characters are 'picked-off' directly from the // serial read data stream and are not passed to the grbl line execution parser. Select characters // that do not and must not exist in the streamed g-code program. ASCII control characters may be // used, if they are available per user setup. Also, extended ASCII codes (>127), which are never in // g-code programs, maybe selected for interface programs. // NOTE: If changed, manually update help message in report.c. #define CMD_STATUS_REPORT '?' #define CMD_FEED_HOLD '!' #define CMD_CYCLE_START '~' #define CMD_RESET 0x18 // ctrl-x. #define CMD_SAFETY_DOOR '@' // If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces // the user to perform the homing cycle (or override the locks) before doing anything else. This is // mainly a safety feature to remind the user to home, since position is unknown to Grbl. #define HOMING_INIT_LOCK // Comment to disable // Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode // to quickly engage the limit switches, followed by a slower locate mode, and finished by a short // pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed // in order starting with suffix 0 and completes the homing routine for the specified-axes only. If // an axis is omitted from the defines, it will not home, nor will the system update its position. // Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z, // with no y), to configure the homing cycle behavior to their needs. // NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same // cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing // cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles. // By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins // may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes // on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits // will not be affected by pin sharing. // NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y. #define HOMING_CYCLE_0 (1< 3us, and, when added with the // user-supplied step pulse time, the total time must not exceed 127us. Reported successful // values for certain setups have ranged from 5 to 20us. // #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled. // The number of linear motions in the planner buffer to be planned at any give time. The vast // majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra // available RAM, like when re-compiling for a Mega or Sanguino. Or decrease if the Arduino // begins to crash due to the lack of available RAM or if the CPU is having trouble keeping // up with planning new incoming motions as they are executed. // #define BLOCK_BUFFER_SIZE 18 // Uncomment to override default in planner.h. // Governs the size of the intermediary step segment buffer between the step execution algorithm // and the planner blocks. Each segment is set of steps executed at a constant velocity over a // fixed time defined by ACCELERATION_TICKS_PER_SECOND. They are computed such that the planner // block velocity profile is traced exactly. The size of this buffer governs how much step // execution lead time there is for other Grbl processes have to compute and do their thing // before having to come back and refill this buffer, currently at ~50msec of step moves. // #define SEGMENT_BUFFER_SIZE 6 // Uncomment to override default in stepper.h. // Line buffer size from the serial input stream to be executed. Also, governs the size of // each of the startup blocks, as they are each stored as a string of this size. Make sure // to account for the available EEPROM at the defined memory address in settings.h and for // the number of desired startup blocks. // NOTE: 80 characters is not a problem except for extreme cases, but the line buffer size // can be too small and g-code blocks can get truncated. Officially, the g-code standards // support up to 256 characters. In future versions, this default will be increased, when // we know how much extra memory space we can re-invest into this. // #define LINE_BUFFER_SIZE 80 // Uncomment to override default in protocol.h // Serial send and receive buffer size. The receive buffer is often used as another streaming // buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming // interfaces will character count and track each block send to each block response. So, // increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable // memory allows. The send buffer primarily handles messages in Grbl. Only increase if large // messages are sent and Grbl begins to stall, waiting to send the rest of the message. // NOTE: Buffer size values must be greater than zero and less than 256. // #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h // #define TX_BUFFER_SIZE 64 // Toggles XON/XOFF software flow control for serial communications. Not officially supported // due to problems involving the Atmega8U2 USB-to-serial chips on current Arduinos. The firmware // on these chips do not support XON/XOFF flow control characters and the intermediate buffer // in the chips cause latency and overflow problems with standard terminal programs. However, // using specifically-programmed UI's to manage this latency problem has been confirmed to work. // As well as, older FTDI FT232RL-based Arduinos(Duemilanove) are known to work with standard // terminal programs since their firmware correctly manage these XON/XOFF characters. In any // case, please report any successes to grbl administrators! // #define ENABLE_XONXOFF // Default disabled. Uncomment to enable. // A simple software debouncing feature for hard limit switches. When enabled, the interrupt // monitoring the hard limit switch pins will enable the Arduino's watchdog timer to re-check // the limit pin state after a delay of about 32msec. This can help with CNC machines with // problematic false triggering of their hard limit switches, but it WILL NOT fix issues with // electrical interference on the signal cables from external sources. It's recommended to first // use shielded signal cables with their shielding connected to ground (old USB/computer cables // work well and are cheap to find) and wire in a low-pass circuit into each limit pin. // #define ENABLE_SOFTWARE_DEBOUNCE // Default disabled. Uncomment to enable. // Force Grbl to check the state of the hard limit switches when the processor detects a pin // change inside the hard limit ISR routine. By default, Grbl will trigger the hard limits // alarm upon any pin change, since bouncing switches can cause a state check like this to // misread the pin. When hard limits are triggered, they should be 100% reliable, which is the // reason that this option is disabled by default. Only if your system/electronics can guarantee // that the switches don't bounce, we recommend enabling this option. This will help prevent // triggering a hard limit when the machine disengages from the switch. // NOTE: This option has no effect if SOFTWARE_DEBOUNCE is enabled. // #define HARD_LIMIT_FORCE_STATE_CHECK // Default disabled. Uncomment to enable. // --------------------------------------------------------------------------------------- // COMPILE-TIME ERROR CHECKING OF DEFINE VALUES: #ifndef HOMING_CYCLE_0 #error "Required HOMING_CYCLE_0 not defined." #endif #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE) #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled" #endif #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P) #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor" #endif // --------------------------------------------------------------------------------------- #endif