blob: 89db8295b4ff4f8682f7b9dd013577ff83eb93fb [file] [log] [blame]
Luigi Santivetti69972f92019-11-12 22:55:40 +00001/*
2 grbl.h - main Grbl include file
3 Part of Grbl
4
5 Copyright (c) 2015-2016 Sungeun K. Jeon for Gnea Research LLC
6
7 Grbl is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 Grbl is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Grbl. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef grbl_h
22#define grbl_h
23
24// Grbl versioning system
25#define GRBL_VERSION "1.1h"
26#define GRBL_VERSION_BUILD "20190825"
27
28// Define standard libraries used by Grbl.
29#include <avr/io.h>
30#include <avr/pgmspace.h>
31#include <avr/interrupt.h>
32#include <avr/wdt.h>
33#include <util/delay.h>
34#include <math.h>
35#include <inttypes.h>
36#include <string.h>
37#include <stdlib.h>
38#include <stdint.h>
39#include <stdbool.h>
40
41// Define the Grbl system include files. NOTE: Do not alter organization.
42#include "config.h"
43#include "nuts_bolts.h"
44#include "settings.h"
45#include "system.h"
46#include "defaults.h"
47#include "cpu_map.h"
48#include "planner.h"
49#include "coolant_control.h"
50#include "eeprom.h"
51#include "gcode.h"
52#include "limits.h"
53#include "motion_control.h"
54#include "planner.h"
55#include "print.h"
56#include "probe.h"
57#include "protocol.h"
58#include "report.h"
59#include "serial.h"
60#include "spindle_control.h"
61#include "stepper.h"
62#include "jog.h"
63
64// ---------------------------------------------------------------------------------------
65// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
66
67#ifndef HOMING_CYCLE_0
68 #error "Required HOMING_CYCLE_0 not defined."
69#endif
70
71#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
72 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
73#endif
74
75#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
76 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
77#endif
78
79#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
80 #error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
81#endif
82
83#if defined(PARKING_ENABLE)
84 #if defined(HOMING_FORCE_SET_ORIGIN)
85 #error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
86 #endif
87#endif
88
89#if defined(ENABLE_PARKING_OVERRIDE_CONTROL)
90 #if !defined(PARKING_ENABLE)
91 #error "ENABLE_PARKING_OVERRIDE_CONTROL must be enabled with PARKING_ENABLE."
92 #endif
93#endif
94
95#if defined(SPINDLE_PWM_MIN_VALUE)
96 #if !(SPINDLE_PWM_MIN_VALUE > 0)
97 #error "SPINDLE_PWM_MIN_VALUE must be greater than zero."
98 #endif
99#endif
100
101#if (REPORT_WCO_REFRESH_BUSY_COUNT < REPORT_WCO_REFRESH_IDLE_COUNT)
102 #error "WCO busy refresh is less than idle refresh."
103#endif
104#if (REPORT_OVR_REFRESH_BUSY_COUNT < REPORT_OVR_REFRESH_IDLE_COUNT)
105 #error "Override busy refresh is less than idle refresh."
106#endif
107#if (REPORT_WCO_REFRESH_IDLE_COUNT < 2)
108 #error "WCO refresh must be greater than one."
109#endif
110#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
111 #error "Override refresh must be greater than zero."
112#endif
113
114#if defined(ENABLE_DUAL_AXIS)
115 #if !((DUAL_AXIS_SELECT == X_AXIS) || (DUAL_AXIS_SELECT == Y_AXIS))
116 #error "Dual axis currently supports X or Y axes only."
117 #endif
118 #if defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && defined(VARIABLE_SPINDLE)
119 #error "VARIABLE_SPINDLE not supported with DUAL_AXIS_CNC_SHIELD_CLONE."
120 #endif
121 #if defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && defined(DUAL_AXIS_CONFIG_PROTONEER_V3_51)
122 #error "More than one dual axis configuration found. Select one."
123 #endif
124 #if !defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && !defined(DUAL_AXIS_CONFIG_PROTONEER_V3_51)
125 #error "No supported dual axis configuration found. Select one."
126 #endif
127 #if defined(COREXY)
128 #error "CORE XY not supported with dual axis feature."
129 #endif
130 #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN)
131 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN not supported with dual axis feature."
132 #endif
133 #if defined(ENABLE_M7)
134 #error "ENABLE_M7 not supported with dual axis feature."
135 #endif
136#endif
137
138// ---------------------------------------------------------------------------------------
139
140#endif