diff --git a/.gitignore b/.gitignore
index 44cc0076d..a0b781f31 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,4 @@ __vm/
*.vcxproj.filters
*.suo
Grbl_Esp32.ino.cpp
-/packages
+/packages
\ No newline at end of file
diff --git a/Grbl_Esp32/Grbl_Esp32.ino b/Grbl_Esp32/Grbl_Esp32.ino
index 9c907733c..c3ec139ca 100644
--- a/Grbl_Esp32/Grbl_Esp32.ino
+++ b/Grbl_Esp32/Grbl_Esp32.ino
@@ -21,9 +21,9 @@
#include "src/Grbl.h"
void setup() {
- grbl_init();
+ grbl_init();
}
void loop() {
- run_once();
+ run_once();
}
diff --git a/Grbl_Esp32/Grbl_Esp32.ino.esp32.bin b/Grbl_Esp32/Grbl_Esp32.ino.esp32.bin
new file mode 100644
index 000000000..c0d7e1362
Binary files /dev/null and b/Grbl_Esp32/Grbl_Esp32.ino.esp32.bin differ
diff --git a/Grbl_Esp32/src/Eeprom.cpp b/Grbl_Esp32/src/Eeprom.cpp
new file mode 100644
index 000000000..083570c16
--- /dev/null
+++ b/Grbl_Esp32/src/Eeprom.cpp
@@ -0,0 +1,81 @@
+/*
+ Eeprom.cpp - Coordinate data stored in EEPROM
+ Part of Grbl
+ Copyright (c) 2014-2016 Sungeun K. Jeon for Gnea Research LLC
+
+ 2018 - Bart Dring This file was modifed 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"
+
+void memcpy_to_eeprom_with_checksum(unsigned int destination, const char* source, unsigned int size) {
+ unsigned char checksum = 0;
+ for (; size > 0; size--) {
+ unsigned char data = static_cast(*source++);
+ // Note: This checksum calculation is broken as described below.
+ checksum = (checksum << 1) || (checksum >> 7);
+ checksum += data;
+ EEPROM.write(destination++, *(source++));
+ }
+ EEPROM.write(destination, checksum);
+ EEPROM.commit();
+}
+
+int memcpy_from_eeprom_with_old_checksum(char* destination, unsigned int source, unsigned int size) {
+ unsigned char data, checksum = 0;
+ for (; size > 0; size--) {
+ data = EEPROM.read(source++);
+ // Note: This checksum calculation is broken - the || should be just | -
+ // thus making the checksum very weak.
+ // We leave it as-is so we can read old data after a firmware upgrade.
+ // The new storage format uses the tagged NVS mechanism, avoiding this bug.
+ checksum = (checksum << 1) || (checksum >> 7);
+ checksum += data;
+ *(destination++) = data;
+ }
+ return (checksum == EEPROM.read(source));
+}
+int memcpy_from_eeprom_with_checksum(char* destination, unsigned int source, unsigned int size) {
+ unsigned char data, checksum = 0;
+ for (; size > 0; size--) {
+ data = EEPROM.read(source++);
+ checksum = (checksum << 1) | (checksum >> 7);
+ checksum += data;
+ *(destination++) = data;
+ }
+ return (checksum == EEPROM.read(source));
+}
+
+// Read selected coordinate data from EEPROM. Updates pointed coord_data value.
+// This is now a compatibility routine that is used to propagate coordinate data
+// in the old EEPROM format to the new tagged NVS format.
+bool old_settings_read_coord_data(uint8_t coord_select, float* coord_data) {
+ uint32_t addr = coord_select * (sizeof(float) * N_AXIS + 1) + EEPROM_ADDR_PARAMETERS;
+ if (!(memcpy_from_eeprom_with_old_checksum((char*)coord_data, addr, sizeof(float) * N_AXIS)) &&
+ !(memcpy_from_eeprom_with_checksum((char*)coord_data, addr, sizeof(float) * MAX_N_AXIS))) {
+ // Reset with default zero vector
+ clear_vector_float(coord_data);
+ // The old code used to rewrite the zeroed data but now that is done
+ // elsewhere, in a different format.
+ return false;
+ }
+ return true;
+}
+
+// Allow iteration over CoordIndex values
+CoordIndex& operator ++ (CoordIndex& i) {
+ i = static_cast(static_cast(i) + 1);
+ return i;
+}
diff --git a/Grbl_Esp32/src/Eeprom.h b/Grbl_Esp32/src/Eeprom.h
new file mode 100644
index 000000000..32d66c657
--- /dev/null
+++ b/Grbl_Esp32/src/Eeprom.h
@@ -0,0 +1,61 @@
+#pragma once
+
+/*
+ Eeprom.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 modifed 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"
+
+// Define EEPROM memory address location values for saved coordinate data.
+const int EEPROM_SIZE = 1024U;
+const int EEPROM_ADDR_PARAMETERS = 512U;
+
+//unsigned char eeprom_get_char(unsigned int addr);
+//void eeprom_put_char(unsigned int addr, unsigned char new_value);
+void memcpy_to_eeprom_with_checksum(unsigned int destination, const char* source, unsigned int size);
+int memcpy_from_eeprom_with_checksum(char* destination, unsigned int source, unsigned int size);
+int memcpy_from_eeprom_with_old_checksum(char* destination, unsigned int source, unsigned int size);
+
+// Reads selected coordinate data from EEPROM
+bool old_settings_read_coord_data(uint8_t coord_select, float* coord_data);
+
+// Various places in the code access saved coordinate system data
+// by a small integer index according to the values below.
+enum CoordIndex : uint8_t{
+ Begin = 0,
+ G54 = Begin,
+ G55,
+ G56,
+ G57,
+ G58,
+ G59,
+ // To support 9 work coordinate systems it would be necessary to define
+ // the following 3 and modify GCode.cpp to support G59.1, G59.2, G59.3
+ // G59_1,
+ // G59_2,
+ // G59_3,
+ NWCSystems,
+ G28 = NWCSystems,
+ G30,
+ // G92_2,
+ // G92_3,
+ End,
+};
+// Allow iteration over CoordIndex values
+CoordIndex& operator ++ (CoordIndex& i);
diff --git a/Grbl_Esp32/src/Machine.h b/Grbl_Esp32/src/Machine.h
index 11ab84065..37bac9aa7 100644
--- a/Grbl_Esp32/src/Machine.h
+++ b/Grbl_Esp32/src/Machine.h
@@ -8,7 +8,7 @@
// !!! For initial testing, start with test_drive.h which disables
// all I/O pins
// #include "Machines/atari_1020.h"
-# include "Machines/test_drive.h"
+# include "Machines/lmi.h"
// !!! For actual use, change the line above to select a board
// from Machines/, for example:
diff --git a/Grbl_Esp32/src/Machines/3axis_rs485.h b/Grbl_Esp32/src/Machines/3axis_rs485.h
new file mode 100644
index 000000000..39a565cb5
--- /dev/null
+++ b/Grbl_Esp32/src/Machines/3axis_rs485.h
@@ -0,0 +1,59 @@
+#pragma once
+// clang-format off
+
+/*
+ 3axis_xyx.h
+ Part of Grbl_ESP32
+
+ This is a general XYZ-axis RS-485 CNC machine. The schematic is quite
+ easy, you basically need a MAX485 wired through a logic level converter
+ for the VFD, and a few pins wired through an ULN2803A to the external
+ stepper drivers. It's common to have a dual gantry for the Y axis.
+
+ Optional limit pins are slightly more difficult, as these require a
+ Schmitt trigger and optocouplers.
+
+ 2020 - Stefan de Bruijn
+
+ Grbl_ESP32 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_ESP32. If not, see .
+*/
+
+#define MACHINE_NAME "ESP32_XYZ_RS485"
+#define X_STEP_PIN GPIO_NUM_4 // labeled X
+#define X_DIRECTION_PIN GPIO_NUM_16 // labeled X
+#define Y_STEP_PIN GPIO_NUM_17 // labeled Y
+#define Y_DIRECTION_PIN GPIO_NUM_18 // labeled Y
+#define Y2_STEP_PIN GPIO_NUM_19 // labeled Y2
+#define Y2_DIRECTION_PIN GPIO_NUM_21 // labeled Y2
+#define Z_STEP_PIN GPIO_NUM_22 // labeled Z
+#define Z_DIRECTION_PIN GPIO_NUM_23 // labeled Z
+
+#define SPINDLE_TYPE SpindleType::H2A
+#define VFD_RS485_TXD_PIN GPIO_NUM_13 // RS485 TX
+#define VFD_RS485_RTS_PIN GPIO_NUM_15 // RS485 RTS
+#define VFD_RS485_RXD_PIN GPIO_NUM_2 // RS485 RX
+
+#define X_LIMIT_PIN GPIO_NUM_33
+#define Y_LIMIT_PIN GPIO_NUM_32
+#define Y2_LIMIT_PIN GPIO_NUM_35
+#define Z_LIMIT_PIN GPIO_NUM_34
+
+// Set $Homing/Cycle0=X and $Homing/Cycle=XY
+
+#define PROBE_PIN GPIO_NUM_14 // labeled Probe
+#define CONTROL_RESET_PIN GPIO_NUM_27 // labeled Reset
+#define CONTROL_FEED_HOLD_PIN GPIO_NUM_26 // labeled Hold
+#define CONTROL_CYCLE_START_PIN GPIO_NUM_25 // labeled Start
+
+// #define VFD_DEBUG_MODE
diff --git a/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_v1.h b/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_v1.h
new file mode 100644
index 000000000..b86c0c260
--- /dev/null
+++ b/Grbl_Esp32/src/Machines/6_pack_stepstick_XYZ_v1.h
@@ -0,0 +1,126 @@
+#pragma once
+// clang-format off
+
+/*
+ 6_pack_stepstick_XYZ_v1.h
+
+ Covers all V1 versions V1p0, V1p1, etc
+
+ Part of Grbl_ESP32
+ Pin assignments for the ESP32 I2S 6-axis board
+ 2018 - Bart Dring
+ 2020 - Mitch Bradley
+ 2020 - Michiyasu Odaki
+ Grbl_ESP32 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_ESP32. If not, see .
+*/
+#define MACHINE_NAME "6 Pack Controller StepStick XYZ"
+
+#define N_AXIS 3
+
+// === Special Features
+
+// I2S (steppers & other output-only pins)
+#define USE_I2S_OUT
+#define USE_I2S_STEPS
+//#define DEFAULT_STEPPER ST_I2S_STATIC
+// === Default settings
+#define DEFAULT_STEP_PULSE_MICROSECONDS I2S_OUT_USEC_PER_PULSE
+
+#define USE_STEPSTICK // makes sure MS1,2,3 !reset and !sleep are set
+
+#define I2S_OUT_BCK GPIO_NUM_22
+#define I2S_OUT_WS GPIO_NUM_17
+#define I2S_OUT_DATA GPIO_NUM_21
+
+
+// Motor Socket #1
+#define X_DISABLE_PIN I2SO(0)
+#define X_DIRECTION_PIN I2SO(1)
+#define X_STEP_PIN I2SO(2)
+#define X_STEPPER_MS3 I2SO(3)
+
+// Motor Socket #2
+#define Y_DIRECTION_PIN I2SO(4)
+#define Y_STEP_PIN I2SO(5)
+#define Y_STEPPER_MS3 I2SO(6)
+#define Y_DISABLE_PIN I2SO(7)
+
+// Motor Socket #3
+#define Z_DISABLE_PIN I2SO(8)
+#define Z_DIRECTION_PIN I2SO(9)
+#define Z_STEP_PIN I2SO(10)
+#define Z_STEPPER_MS3 I2SO(11)
+
+/*
+ Socket I/O reference
+ The list of modules is here...
+ https://github.com/bdring/6-Pack_CNC_Controller/wiki/CNC-I-O-Module-List
+ Click on each module to get example for using the modules in the sockets
+
+
+Socket #1
+#1 GPIO_NUM_33
+#2 GPIO_NUM_32
+#3 GPIO_NUM_35 (input only)
+#4 GPIO_NUM_34 (input only)
+
+Socket #2
+#1 GPIO_NUM_2
+#2 GPIO_NUM_25
+#3 GPIO_NUM_39 (input only)
+#4 GPIO_NUM_36 (input only)
+
+Socket #3
+#1 GPIO_NUM_26
+#2 GPIO_NUM_4
+#3 GPIO_NUM_16
+#4 GPIO_NUM_27
+
+Socket #4
+#1 GPIO_NUM_14
+#2 GPIO_NUM_13
+#3 GPIO_NUM_15
+#4 GPIO_NUM_12
+
+Socket #5
+#1 I2SO(24) (output only)
+#2 I2SO(25) (output only)
+#3 I2SO26) (output only)
+
+*/
+
+
+// 4x Input Module in Socket #1
+// https://github.com/bdring/6-Pack_CNC_Controller/wiki/4x-Switch-Input-module
+#define X_LIMIT_PIN GPIO_NUM_33
+#define Y_LIMIT_PIN GPIO_NUM_32
+#define Z_LIMIT_PIN GPIO_NUM_35
+
+
+// // 4x Input Module in Socket #2
+// // https://github.com/bdring/6-Pack_CNC_Controller/wiki/4x-Switch-Input-module
+// #define X_LIMIT_PIN GPIO_NUM_2
+// #define Y_LIMIT_PIN GPIO_NUM_25
+// #define Z_LIMIT_PIN GPIO_NUM_39
+
+// // 4x Input Module in Socket #3
+// // https://github.com/bdring/6-Pack_CNC_Controller/wiki/4x-Switch-Input-module
+// #define CONTROL_CYCLE_START_PIN GPIO_NUM_26
+// #define CONTROL_FEED_HOLD_PIN GPIO_NUM_4
+// #define CONTROL_RESET_PIN GPIO_NUM_16
+// #define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_27
+// //#define INVERT_CONTROL_PIN_MASK B0000
+
+// ================= Setting Defaults ==========================
+#define DEFAULT_X_STEPS_PER_MM 800
+#define DEFAULT_Y_STEPS_PER_MM 800
+#define DEFAULT_Z_STEPS_PER_MM 800
diff --git a/Grbl_Esp32/src/Machines/lmi.h b/Grbl_Esp32/src/Machines/lmi.h
new file mode 100644
index 000000000..f3a71b3c3
--- /dev/null
+++ b/Grbl_Esp32/src/Machines/lmi.h
@@ -0,0 +1,136 @@
+#pragma once
+// clang-format off
+/*
+ 6_pack_SE2050_laser.h
+ Covers all V1 versions V1p0, V1p1, etc
+ Part of Grbl_ESP32
+ Pin assignments for the ESP32 I2S 6-axis board
+ 2020-11-21 B. Dring for Taylor F.
+ Grbl_ESP32 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_ESP32. If not, see .
+*/
+#define MACHINE_NAME "X820xY316xZ246 50w RF Laser"
+#define N_AXIS 3 // change to 4 to include A axis
+// === Special Features
+// I2S (steppers & other output-only pins)
+#define USE_I2S_OUT
+#define USE_I2S_STEPS
+//#define DEFAULT_STEPPER ST_I2S_STATIC
+// === Default settings
+#define DEFAULT_STEP_PULSE_MICROSECONDS I2S_OUT_USEC_PER_PULSE
+#define USE_STEPSTICK // makes sure MS1,2,3 !reset and !sleep are set
+#define I2S_OUT_BCK GPIO_NUM_22
+#define I2S_OUT_WS GPIO_NUM_17
+#define I2S_OUT_DATA GPIO_NUM_21
+// Motor Socket #1
+#define X_DISABLE_PIN I2SO(0)
+#define X_DIRECTION_PIN I2SO(1)
+#define X_STEP_PIN I2SO(2)
+#define X_STEPPER_MS3 I2SO(3)
+// Motor Socket #2
+#define Y_DIRECTION_PIN I2SO(4)
+#define Y_STEP_PIN I2SO(5)
+#define Y_STEPPER_MS3 I2SO(6)
+#define Y_DISABLE_PIN I2SO(7)
+// Motor Socket #3
+#define Z_DISABLE_PIN I2SO(8)
+#define Z_DIRECTION_PIN I2SO(9)
+#define Z_STEP_PIN I2SO(10)
+#define Z_STEPPER_MS3 I2SO(11)
+#if (N_AXIS == 4)
+ // Motor Socket #4
+ #define A_DIRECTION_PIN I2SO(12)
+ #define A_STEP_PIN I2SO(13)
+ #define A_STEPPER_MS3 I2SO(14)
+ #define A_DISABLE_PIN I2SO(15)
+#endif
+/*
+ Socket I/O reference
+ The list of modules is here...
+ https://github.com/bdring/6-Pack_CNC_Controller/wiki/CNC-I-O-Module-List
+ Click on each module to get example for using the modules in the sockets
+*/
+// 4x Input Module in Socket #1
+// https://github.com/bdring/6-Pack_CNC_Controller/wiki/4x-Switch-Input-module
+#define X_LIMIT_PIN GPIO_NUM_33
+#define Y_LIMIT_PIN GPIO_NUM_32
+#define Z_LIMIT_PIN GPIO_NUM_35
+// #define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_34
+
+#define DEFAULT_INVERT_LIMIT_PINS 1 // Sets the default for N.O. switches
+// 4x Input in socket #2 for future custom buttons.
+// 4x Switch Input module in socket #2
+/*
+#define MACRO_BUTTON_0_PIN GPIO_NUM_2
+#define MACRO_BUTTON_1_PIN GPIO_NUM_25
+#define MACRO_BUTTON_2_PIN GPIO_NUM_39
+#define MACRO_BUTTON_3_PIN GPIO_NUM_36
+*/
+// Example 5V output CNC module in socket #3
+// https://github.com/bdring/6-Pack_CNC_Controller/wiki/4x-5V-Buffered-Output-Module
+#define SPINDLE_TYPE SpindleType::LASER
+// #define SPINDLE_TYPE SpindleType::PWM
+#define SPINDLE_PWM_BASE_FREQ 20000
+#define SPINDLE_PWM_BIT_PRECISION 12
+#define SPINDLE_PWM_MAX_VALUE 4096
+
+#define SPINDLE_OUTPUT_PIN GPIO_NUM_16 // 1st channel
+#define SPINDLE_ENABLE_PIN GPIO_NUM_4 // 2nd channel Enable Pin
+#define COOLANT_MIST_PIN GPIO_NUM_27 // 3nd channel Air Assist using M7 on M9 off
+// Socket #4
+// https://github.com/bdring/6-Pack_CNC_Controller/wiki/Quad-MOSFET-Module
+#define USER_DIGITAL_PIN_0 GPIO_NUM_14 // Laser shutter using M62P0 on M63P0 Off
+#define USER_DIGITAL_PIN_1 GPIO_NUM_13 // Aim Guide control using M62P1 on M63P1 Off
+
+#define DEFAULT_HOMING_ENABLE 1
+#define DEFAULT_SOFT_LIMIT_ENABLE 1
+#define DEFAULT_HOMING_DIR_MASK 7
+#define DEFAULT_HOMING_FEED_RATE 100.0 // mm/min
+#define DEFAULT_HOMING_SEEK_RATE 200.0 // mm/min
+#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
+#define DEFAULT_HOMING_PULLOFF 0.75 // mm
+
+#define DEFAULT_X_STEPS_PER_MM 80
+#define DEFAULT_Y_STEPS_PER_MM 314.96
+#define DEFAULT_Z_STEPS_PER_MM 314.96
+
+#define DEFAULT_X_MAX_RATE 1000
+#define DEFAULT_Y_MAX_RATE 600 // mm/min
+#define DEFAULT_Z_MAX_RATE 200 // mm/min
+
+#define DEFAULT_X_ACCELERATION 200.0 // mm/sec^2
+#define DEFAULT_Y_ACCELERATION 175.0 // mm/sec^2
+#define DEFAULT_Z_ACCELERATION 100.0 // mm/sec^2
+
+#define DEFAULT_X_MAX_TRAVEL 820 // mm NOTE: Must be a positive value.
+#define DEFAULT_Y_MAX_TRAVEL 316 // mm NOTE: Must be a positive value.
+#define DEFAULT_Z_MAX_TRAVEL 246 // mm NOTE: Must be a positive value.
+
+
+//x steps 80
+//y steps 314.96
+//z steps 314.96
+// laser mode
+//accel 200
+//100
+//100
+//distance820
+//316
+//246*
+
+//homing cycle
+// soft limits
+// homing seek
+// homing feed
+//homing mask 7
+//max spd 1500
+//600
+//100
diff --git a/Grbl_Esp32/src/Machines/template.h b/Grbl_Esp32/src/Machines/template.h
new file mode 100644
index 000000000..7672d31f6
--- /dev/null
+++ b/Grbl_Esp32/src/Machines/template.h
@@ -0,0 +1,233 @@
+#pragma once
+// clang-format off
+
+/*
+ template.h
+ Part of Grbl_ESP32
+
+ Template for a machine configuration file.
+
+ 2020 - Mitch Bradley
+
+ Grbl_ESP32 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_ESP32. If not, see .
+*/
+
+// This contains a long list of things that might possibly be
+// configured. Most machines - especially simple cartesian machines
+// that use stepper motors - will only need to define a few of the
+// options herein, often just the pin assignments.
+
+// Pin assignments depend on how the ESP32 is connected to
+// the external machine. Typically the ESP32 module plugs into
+// an adapter board that wires specific ESP32 GPIO pins to
+// other connectors on the board, such as Pololu sockets for
+// stepper drivers or connectors for external drivers, limit
+// pins, spindle control, etc. This file describes how those
+// GPIO pins are wired to those other connectors.
+
+// Some machines might choose to use an adapter board in a
+// non-standard way, for example a 3-axis board might have axes
+// labeled XYZ, but the machine might have only 2 axes one of which is
+// driven by two ganged motors. In that case, you would need
+// a custom version of this file that assigns the pins differently
+// from the adapter board labels.
+
+// In addition to pin assignments, many other aspects of Grbl
+// can be configured, such as spindle speeds, special motor
+// types like servos and unipolars, homing order, default values
+// for $$ settings, etc. A detailed list of such options is
+// given below.
+
+// Furthermore, it is possible to implement special complex
+// behavior in custom C++ code, for non-Cartesian machines,
+// unusual homing cycles, etc. See the Special Features section
+// below for additional instructions.
+
+// === Machine Name
+// Change TEMPLATE to some name of your own choosing. That name
+// will be shown in a Grbl startup message to identify your
+// configuration.
+
+#define MACHINE_NAME "TEMPLATE"
+
+// If your machine requires custom code as described below in
+// Special Features, you must copy Custom/custom_code_template.cpp
+// to a new name like Custom/my_custom_code.cpp, implement the
+// functions therein, and enable its use by defining:
+// #define CUSTOM_CODE_FILENAME "Custom/my_custom_code.cpp"
+
+// === Number of axes
+
+// You can set the number of axes that the machine supports
+// by defining N_AXIS. If you do not define it, 3 will be
+// used. The value must be at least 3, even if your machine
+// has fewer axes.
+// #define N_AXIS 4
+
+
+// == Pin Assignments
+
+// Step and direction pins; these must be output-capable pins,
+// specifically ESP32 GPIO numbers 0..31
+// #define X_STEP_PIN GPIO_NUM_12
+// #define X_DIRECTION_PIN GPIO_NUM_14
+// #define Y_STEP_PIN GPIO_NUM_26
+// #define Y_DIRECTION_PIN GPIO_NUM_15
+// #define Z_STEP_PIN GPIO_NUM_27
+// #define Z_DIRECTION_PIN GPIO_NUM_33
+
+// #define X_LIMIT_PIN GPIO_NUM_17
+// #define Y_LIMIT_PIN GPIO_NUM_4
+// #define Z_LIMIT_PIN GPIO_NUM_16
+
+// Common enable for all steppers. If it is okay to leave
+// your drivers enabled at all times, you can leave
+// STEPPERS_DISABLE_PIN undefined and use the pin for something else.
+// #define STEPPERS_DISABLE_PIN GPIO_NUM_13
+
+// Pins for controlling various aspects of the machine. If your
+// machine does not support one of these features, you can leave
+// the corresponding pin undefined.
+
+// #define SPINDLE_OUTPUT_PIN GPIO_NUM_2 // labeled SpinPWM
+// #define SPINDLE_ENABLE_PIN GPIO_NUM_22 // labeled SpinEnbl
+// #define COOLANT_MIST_PIN GPIO_NUM_21 // labeled Mist
+// #define COOLANT_FLOOD_PIN GPIO_NUM_25 // labeled Flood
+// #define PROBE_PIN GPIO_NUM_32 // labeled Probe
+
+// Input pins for various functions. If the corresponding pin is not defined,
+// the function will not be available.
+
+// CONTROL_SAFETY_DOOR_PIN shuts off the machine when a door is opened
+// or some other unsafe condition exists.
+// #define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35 // labeled Door, needs external pullup
+
+// RESET, FEED_HOLD, and CYCLE_START can control GCode execution at
+// the push of a button.
+
+// #define CONTROL_RESET_PIN GPIO_NUM_34 // labeled Reset, needs external pullup
+// #define CONTROL_FEED_HOLD_PIN GPIO_NUM_36 // labeled Hold, needs external pullup
+// #define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // labeled Start, needs external pullup
+
+// === Ganging
+// If you need to use two motors on one axis, you can "gang" the motors by
+// defining a second pin to control the other motor on the axis. For example:
+
+// #define Y2_STEP_PIN GPIO_NUM_27 /* labeled Z */
+// #define Y2_DIRECTION_PIN GPIO_NUM_33 /* labeled Z */
+
+// === Servos
+// To use a servo motor on an axis, do not define step and direction
+// pins for that axis, but instead include a block like this:
+
+// #define SERVO_Z_PIN GPIO_NUM_22
+
+// === Homing cycles
+// Set them using $Homing/Cycle0= optionally up to $Homing/Cycle5=
+
+// === Default settings
+// Grbl has many run-time settings that the user can changed by
+// commands like $110=2000 . Their values are stored in non-volatile
+// storage so they persist after the controller has been powered down.
+// Those settings have default values that are used if the user
+// has not altered them, or if the settings are explicitly reset
+// to the default values wth $RST=$.
+//
+// The default values are established in defaults.h, but you
+// can override any one of them by definining it here, for example:
+
+//#define DEFAULT_INVERT_LIMIT_PINS 1
+//#define DEFAULT_REPORT_INCHES 1
+
+// === Control Pins
+
+// If some of the control pin switches are normally closed
+// (the default is normally open), you can invert some of them
+// with INVERT_CONTROL_PIN_MASK. The bits in the mask are
+// Cycle Start, Feed Hold, Reset, Safety Door. To use a
+// normally open switch on Reset, you would say
+// #define INVERT_CONTROL_PIN_MASK B1101
+
+// If your control pins do not have adequate hardware signal
+// conditioning, you can define these to use software to
+// reduce false triggering.
+// #define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
+// #define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
+
+
+// Grbl_ESP32 use the ESP32's special RMT (IR remote control) hardware
+// engine to achieve more precise high step rates than can be done
+// in software. That feature is enabled by default, but there are
+// some machines that might not want to use it, such as machines that
+// do not use ordinary stepper motors. To turn it off, do this:
+// #undef USE_RMT_STEPS
+
+// === Special Features
+// Grbl_ESP32 can support non-Cartesian machines and some other
+// scenarios that cannot be handled by choosing from a set of
+// predefined selections. Instead they require machine-specific
+// C++ code functions. There are callouts in the core code for
+// such code, guarded by ifdefs that enable calling the individual
+// functions. custom_code_template.cpp describes the functions
+// that you can implement. The ifdef guards are described below:
+//
+// USE_CUSTOM_HOMING enables the user_defined_homing(uint8_t cycle_mask) function
+// that can implement an arbitrary homing sequence.
+// #define USE_CUSTOM_HOMING
+
+// USE_KINEMATICS enables the functions inverse_kinematics(),
+// kinematics_pre_homing(), and kinematics_post_homing(),
+// so non-Cartesian machines can be implemented.
+// #define USE_KINEMATICS
+
+// USE_FWD_KINEMATICS enables the forward_kinematics() function
+// that converts motor positions in non-Cartesian coordinate
+// systems back to Cartesian form, for status reports.
+//#define USE_FWD_KINEMATICS
+
+// USE_TOOL_CHANGE enables the user_tool_change() function
+// that implements custom tool change procedures.
+// #define USE_TOOL_CHANGE
+
+// Any one of MACRO_BUTTON_0_PIN, MACRO_BUTTON_1_PIN, and MACRO_BUTTON_2_PIN
+// enables the user_defined_macro(number) function which
+// implements custom behavior at the press of a button
+// #define MACRO_BUTTON_0_PIN
+
+// USE_M30 enables the user_m30() function which implements
+// custom behavior when a GCode programs stops at the end
+// #define USE_M30
+
+// USE_TRIAMINIC enables a suite of functions that are defined
+// in grbl_triaminic.cpp, allowing the use of Triaminic stepper
+// drivers that require software configuration at startup.
+// There are several options that control the details of such
+// drivers; inspect the code in grbl_triaminic.cpp to see them.
+// #define USE_TRIAMINIC
+// #define X_TRIAMINIC
+// #define X_DRIVER_TMC2209
+// #define TRIAMINIC_DAISY_CHAIN
+
+// USE_MACHINE_TRINAMIC_INIT enables the machine_triaminic_setup()
+// function that replaces the normal setup of Triaminic drivers.
+// It could, for, example, setup StallGuard or other special modes.
+// #define USE_MACHINE_TRINAMIC_INIT
+
+
+// === Grbl behavior options
+// There are quite a few options that control aspects of Grbl that
+// are not specific to particular machines. They are listed and
+// described in config.h after it includes the file machine.h.
+// Normally you would not need to change them, but if you do,
+// it will be necessary to make the change in config.h
diff --git a/Grbl_Esp32/src/SettingsDefinitions.cpp b/Grbl_Esp32/src/SettingsDefinitions.cpp
index b98da4e35..7ade67ca2 100644
--- a/Grbl_Esp32/src/SettingsDefinitions.cpp
+++ b/Grbl_Esp32/src/SettingsDefinitions.cpp
@@ -67,6 +67,7 @@ enum_opt_t spindleTypes = {
{ "NONE", int8_t(SpindleType::NONE) },
{ "PWM", int8_t(SpindleType::PWM) },
{ "RELAY", int8_t(SpindleType::RELAY) },
+ { "TickleMeLaser", int8_t(SpindleType::TickleMeLaser) },
{ "LASER", int8_t(SpindleType::LASER) },
{ "DAC", int8_t(SpindleType::DAC) },
{ "HUANYANG", int8_t(SpindleType::HUANYANG) },
diff --git a/Grbl_Esp32/src/Spindles/Spindle.h b/Grbl_Esp32/src/Spindles/Spindle.h
index 200e99cdb..33af76c46 100644
--- a/Grbl_Esp32/src/Spindles/Spindle.h
+++ b/Grbl_Esp32/src/Spindles/Spindle.h
@@ -33,6 +33,7 @@ enum class SpindleType : int8_t {
PWM,
RELAY,
LASER,
+ TickleMeLaser,
DAC,
HUANYANG,
BESC,
diff --git a/Grbl_Esp32/src/Spindles/TickleMeLaser.cpp b/Grbl_Esp32/src/Spindles/TickleMeLaser.cpp
new file mode 100644
index 000000000..1f499a170
--- /dev/null
+++ b/Grbl_Esp32/src/Spindles/TickleMeLaser.cpp
@@ -0,0 +1,77 @@
+/*
+ TickleMeLaser.h
+
+ This is similar to the Laser except that it allows for a tickle pulse
+ to meet the requirements to keep RF CO2 lasers (like Synrad tubes)
+ primed for operation.
+
+ Add on Spindle Code for Grbl_ESP32
+ 2020 - Taylor Fry
+
+ 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 "TickleMeLaser.h"
+
+// ===================================== Laser ==============================================
+
+namespace Spindles {
+
+ uint32_t TickleMeLaser::set_rpm(uint32_t rpm) {
+ uint32_t pwm_value;
+
+ if (_output_pin == UNDEFINED_PIN) {
+ return rpm;
+ }
+
+ //grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "set_rpm(%d)", rpm);
+
+ // apply override
+ rpm = rpm * sys.spindle_speed_ovr / 100; // Scale by spindle speed override value (uint8_t percent)
+
+ // apply limits
+ if ((_min_rpm >= _max_rpm) || (rpm >= _max_rpm)) {
+ rpm = _max_rpm;
+ } else if (rpm != 0 && rpm <= _min_rpm) {
+ rpm = _min_rpm;
+ }
+
+ sys.spindle_speed = rpm;
+
+ if (_piecewide_linear) {
+ //pwm_value = piecewise_linear_fit(rpm); TODO
+ pwm_value = 0;
+ grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Warning: Linear fit not implemented yet.");
+
+ } else {
+ if (rpm == 0) {
+ //TICKLE BUSINESS HERE, I just set it to 5, as at 5khz 5/1000 is a duty cycle of .5% which
+ //is 1us of a 200us 5khz pulse. The machine still expects this 5khz pulse even if a different
+ //frequency is used to fire the laser. This would involve changing the pwm frequency on the fly
+
+ //for the branch that allows on the fly frequency changes, set it to 5k here.
+ pwm_value = 5;
+ } else {
+ //for the branch that allows on the fly frequency changes, set it to desired frequency here.
+ //the biggest gain for rf lasers on changing frequency is getting rid of lines on edges during fast cuts
+ //ultimatley the frequency value should be driven by the velocity of the move
+ pwm_value = map_uint32_t(rpm, _min_rpm, _max_rpm, _pwm_min_value, _pwm_max_value);
+ }
+ }
+
+ set_enable_pin(_current_state != SpindleState::Disable);
+ set_output(pwm_value);
+
+ return 0;
+ }
+
+}
diff --git a/Grbl_Esp32/src/Spindles/TickleMeLaser.h b/Grbl_Esp32/src/Spindles/TickleMeLaser.h
new file mode 100644
index 000000000..b6a81bd26
--- /dev/null
+++ b/Grbl_Esp32/src/Spindles/TickleMeLaser.h
@@ -0,0 +1,41 @@
+#pragma once
+
+/*
+ TickleMeLaser.h
+
+ This is similar to the Laser except that it allows for a tickle pulse
+ to meet the requirements to keep RF CO2 lasers (like Synrad tubes)
+ primed for operation.
+
+ Add on Spindle Code for Grbl_ESP32
+ 2020 - Taylor Fry
+
+ 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 "Laser.h"
+
+namespace Spindles {
+ class TickleMeLaser : public Laser {
+ public:
+ TickleMeLaser() = default;
+
+ TickleMeLaser(const TickleMeLaser&) = delete;
+ TickleMeLaser(TickleMeLaser&&) = delete;
+ TickleMeLaser& operator=(const TickleMeLaser&) = delete;
+ TickleMeLaser& operator=(TickleMeLaser&&) = delete;
+
+ uint32_t set_rpm(uint32_t rpm) override;
+
+ virtual ~TickleMeLaser() {}
+ };
+}
diff --git a/Grbl_Esp32/src/data/favicon.ico b/Grbl_Esp32/src/data/favicon.ico
new file mode 100644
index 000000000..6794fd9f7
Binary files /dev/null and b/Grbl_Esp32/src/data/favicon.ico differ
diff --git a/Grbl_Esp32/src/data/index.html.gz b/Grbl_Esp32/src/data/index.html.gz
new file mode 100644
index 000000000..1cb7e416e
Binary files /dev/null and b/Grbl_Esp32/src/data/index.html.gz differ