diff --git a/Grbl_Esp32/Grbl_Esp32.ino b/Grbl_Esp32/Grbl_Esp32.ino
index 441afdb6..13762b6b 100644
--- a/Grbl_Esp32/Grbl_Esp32.ino
+++ b/Grbl_Esp32/Grbl_Esp32.ino
@@ -36,6 +36,7 @@ volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bit
volatile uint8_t sys_rt_exec_debug;
#endif
+NullSpindle my_spindle;
void setup() {
diff --git a/Grbl_Esp32/grbl.h b/Grbl_Esp32/grbl.h
index 9abb374d..067bcd55 100644
--- a/Grbl_Esp32/grbl.h
+++ b/Grbl_Esp32/grbl.h
@@ -51,7 +51,7 @@
#include "protocol.h"
#include "report.h"
#include "serial.h"
-#include "spindle_control.h"
+#include "tools/SpindleClass.h"
#include "stepper.h"
#include "jog.h"
#include "inputbuffer.h"
diff --git a/Grbl_Esp32/spindle_control.cpp b/Grbl_Esp32/spindle_control.cpp
deleted file mode 100644
index 1c4f960f..00000000
--- a/Grbl_Esp32/spindle_control.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- spindle_control.cpp - Header for system level commands and real-time processes
- Part of Grbl
- Copyright (c) 2014-2016 Sungeun K. Jeon for Gnea Research LLC
-
- 2018 - Bart Dring This file was modified for use on the ESP32
- CPU. Do not use this with Grbl for atMega328P
-
- 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 .
-*/
-#include "grbl.h"
-//#include "tools/SpindleClass.h"
-
-// TODO Get rid of these intermediary functions and directly access object from Grbl
-// This saves me from touching the grbl_esp32 code as much right now.
-
-// define a spindle type
-NullSpindle my_spindle;
diff --git a/Grbl_Esp32/spindle_control.h b/Grbl_Esp32/spindle_control.h
deleted file mode 100644
index d8892224..00000000
--- a/Grbl_Esp32/spindle_control.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- spindle.h - Header for system level commands and real-time processes
- Part of Grbl
- Copyright (c) 2014-2016 Sungeun K. Jeon for Gnea Research LLC
-
- 2018 - Bart Dring This file was modified for use on the ESP32
- CPU. Do not use this with Grbl for atMega328P
-
- 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 .
-*/
-
-#ifndef spindle_control_h
-#define spindle_control_h
-
-#include "grbl.h"
-#include "tools/SpindleClass.h"
-
-extern NullSpindle my_spindle;
-
-#endif
diff --git a/Grbl_Esp32/tools/SpindleClass.h b/Grbl_Esp32/tools/SpindleClass.h
index 7dae8c8c..3cc76959 100644
--- a/Grbl_Esp32/tools/SpindleClass.h
+++ b/Grbl_Esp32/tools/SpindleClass.h
@@ -21,9 +21,6 @@
along with Grbl. If not, see .
*/
-#include "grbl.h"
-#include
-
#define SPINDLE_STATE_DISABLE 0 // Must be zero.
#define SPINDLE_STATE_CW bit(0)
@@ -32,6 +29,11 @@
#ifndef SPINDLE_CLASS_H
#define SPINDLE_CLASS_H
+#include "grbl.h"
+#include
+
+
+
// This is the base class. Do not use this as your spindle
class Spindle {
public:
@@ -118,5 +120,7 @@ class DacSpindle : public PWMSpindle {
void set_pwm(uint32_t duty); // sets DAC instead of PWM
};
+extern NullSpindle my_spindle;
+
#endif