-
-
Notifications
You must be signed in to change notification settings - Fork 532
Custom Machine Functions
If you have a machine that needs some special features there are some hooks in Grbl_ESP32 that can call custom functions for your machine. You need to write these functions. The Atari 1020 machine is a good example. See that for reference (atari_1020.h & atari_1020.cpp) in the existing source code files.
Note: If you are using a machine definition that includes files from the Custom folder. You must compile using PlatformIO.
You should create a custom .h and .cpp file for your machine, like atari_1020.h and atari_1020.cpp. Put the .h file in the Machines folder and the .cpp file in the Custom folder. Inside your cpu_map definition in cpu_map.h place an include like #include "atari_1020.h". Try to do everything using those 2 files only.
If your machine needs some initial setup, like defining some I/O or starting a background task you can put #define USE_MACHINE_INIT in your header file. It will call a function void machine_init() that you must provide.
If normal homing won't work for you or you need to do something special before homing, you can write your own function. Put #define USE_CUSTOM_HOMING in your header file. Grbl_ESP32 will see this when it goes to home the machine. It will call a function, **bool user_defined_homing() ** that you must provide. If you return true from this function, it tells Grbl_ESP32 that you are handling all of the homing. If you return false, Grbl_ESP32 will then run its normal homing sequence.
User Defined Macro Buttons
Normally Grbl_ESP32 ignores tool changes. It just tracks the current tool number. If you put #define USE_TOOL_CHANGE in you header file, it will call a function void user_tool_change(uint8_t new_tool) when it sees the M6 gcode command.
The M30 gcode command signals the end of a file. Normally Grbl ignores the M30 command. If you put #define USE_M30 in your header file, it will call a function void user_m30() that you must provide when it sees the M30 command.
- Home
- Hardware
- ESP32 Dev Kit Versions
- Compiling with Arduino IDE
- Compiling with PlatformIO
- Using the Serial Port
- Grbl_ESP32 Settings
- Controlling Grbl_ESP32
- Setting Up the I/O pins
- Spindle Types
- Basic Kinematics
- Custom Machine Functions
- Home/Limit Switches
- Machine Work Space
- Stepper Motor Drivers
- Trinamic Drivers
- Axis Squaring and Ganging
- Settings
- SD Card
- Bluetooth
- Wifi
- WebUI
- Using Telnet
- Servo Axis
- Push notifications
- Switches
- Stepper Drivers
- Spindle options
- Other Ouputs
Testing public edit