-
-
Notifications
You must be signed in to change notification settings - Fork 532
Macro Button Feature
Macro buttons allow you to associate a switch closure with a macro. A basic macro can be simple commands or run a file from an SD card or the ESP32 flash file system. Advanced macros are written into the firmware and can do complex calculations and branch on conditions.
Button are connected to GPIO. They can be normally open or normally closed. They are part of control button group and can be inverted with #define INVERT_CONTROL_PIN_MASK Bnnnnnnnn
in the config.h file. You can see them in the response to the ? command when they are in the active state.
Macro buttons are similar to the control switches (reset, hold, etc). You can define up to (4) of them. You add them to your machine definition file like...
#define MACRO_BUTTON_0_PIN GPIO_NUM_13
Basic macros are implemented using settings. $User/Macro0= assigns a macro to button 0.
- Single Command: This can be any command or gcode. Example:$User/Macro0=$H
- Multiple commands: Place and ampersand "&" between commands (limit 250 chars). Example: $User/Macro0=G90&G53G0Z-1&G0X0Y0
- File from SD Card: Example: Use the $SD/Run command and a filename Example: $User/Macro0=$SD/Run=foo.nc
- File from ESP32 Flash File System: Use the $LocalFS/Run command and a filename. Example: $User/Macro0=$LocalFS/Run=bar.nc
A file can be gcode, most Grbl_ESP32 commands and settings or a mixture of both.
You must be in the idle state to execute button macros.
When a macro button is pushed Grbl_ESP32 calls the user_defined_macro(uint8_t index) function with the button number (0-3) as the parameter. This is a weakly defined function. This means, if you provide your own version, the compiler will use that instead. Put this in a file in the Custom folder. Provide a reference to it in your machine definition file with....
#define CUSTOM_CODE_FILENAME "Custom/my_file.cpp"
This feature is initiated by an interrupt on the input pin. The current implementation is not very robust. Be sure to do a lot of testing to be sure your setup is stable. We hope to implement a more robust version soon.
- 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