blob: 1f7bf757cab6acd9540e5adead1645b69074596c [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"
Luigi Santivetti42a1b332019-11-17 22:31:46 +000063#ifdef USE_ADC
64 #include "cpu_map_adc.h"
65 #include "adc.h"
66#endif
Luigi Santivetti69972f92019-11-12 22:55:40 +000067
68// ---------------------------------------------------------------------------------------
69// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
70
71#ifndef HOMING_CYCLE_0
72 #error "Required HOMING_CYCLE_0 not defined."
73#endif
74
75#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
76 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
77#endif
78
79#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
80 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
81#endif
82
83#if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED)
84 #error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled"
85#endif
86
87#if defined(PARKING_ENABLE)
88 #if defined(HOMING_FORCE_SET_ORIGIN)
89 #error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
90 #endif
91#endif
92
93#if defined(ENABLE_PARKING_OVERRIDE_CONTROL)
94 #if !defined(PARKING_ENABLE)
95 #error "ENABLE_PARKING_OVERRIDE_CONTROL must be enabled with PARKING_ENABLE."
96 #endif
97#endif
98
99#if defined(SPINDLE_PWM_MIN_VALUE)
100 #if !(SPINDLE_PWM_MIN_VALUE > 0)
101 #error "SPINDLE_PWM_MIN_VALUE must be greater than zero."
102 #endif
103#endif
104
105#if (REPORT_WCO_REFRESH_BUSY_COUNT < REPORT_WCO_REFRESH_IDLE_COUNT)
106 #error "WCO busy refresh is less than idle refresh."
107#endif
108#if (REPORT_OVR_REFRESH_BUSY_COUNT < REPORT_OVR_REFRESH_IDLE_COUNT)
109 #error "Override busy refresh is less than idle refresh."
110#endif
111#if (REPORT_WCO_REFRESH_IDLE_COUNT < 2)
112 #error "WCO refresh must be greater than one."
113#endif
114#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
115 #error "Override refresh must be greater than zero."
116#endif
117
118#if defined(ENABLE_DUAL_AXIS)
119 #if !((DUAL_AXIS_SELECT == X_AXIS) || (DUAL_AXIS_SELECT == Y_AXIS))
120 #error "Dual axis currently supports X or Y axes only."
121 #endif
122 #if defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && defined(VARIABLE_SPINDLE)
123 #error "VARIABLE_SPINDLE not supported with DUAL_AXIS_CNC_SHIELD_CLONE."
124 #endif
125 #if defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && defined(DUAL_AXIS_CONFIG_PROTONEER_V3_51)
126 #error "More than one dual axis configuration found. Select one."
127 #endif
128 #if !defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && !defined(DUAL_AXIS_CONFIG_PROTONEER_V3_51)
129 #error "No supported dual axis configuration found. Select one."
130 #endif
131 #if defined(COREXY)
132 #error "CORE XY not supported with dual axis feature."
133 #endif
134 #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN)
135 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN not supported with dual axis feature."
136 #endif
137 #if defined(ENABLE_M7)
138 #error "ENABLE_M7 not supported with dual axis feature."
139 #endif
140#endif
141
142// ---------------------------------------------------------------------------------------
143
144#endif