mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 19:02:35 +02:00
new Z probe button
This commit is contained in:
@@ -38,8 +38,8 @@ void user_defined_macro(uint8_t index) {
|
||||
|
||||
if (msPassedBy >= DEBOUNCE_TIME_MACRO_1) {
|
||||
switch (index) {
|
||||
case 0: // Macro button 1 (Hold/Cycle switch)
|
||||
|
||||
case 0: // Macro button 1 (Hold/Cycle switch)
|
||||
switch (sys.state) {
|
||||
case State::Hold:
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. New state \"Cyle start\"\r\n", index + 1);
|
||||
@@ -74,6 +74,30 @@ void user_defined_macro(uint8_t index) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // Macro button 3 (Z Probe)
|
||||
if (sys.state == State::Idle) {
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. Z probe\r\n", index + 1);
|
||||
|
||||
// use datum plane XY, mm unit of measure, relative addresing mode
|
||||
grbl_sendf(CLIENT_ALL, "G17 G21 G91\r\n");
|
||||
WebUI::inputBuffer.push("G21 G91\r\n");
|
||||
|
||||
// Go 25mm deeper to hopefully hit alu plate
|
||||
grbl_sendf(CLIENT_ALL, "G38.2 Z-25.0 F50\r\n");
|
||||
WebUI::inputBuffer.push("G38.2 Z-25.0 F50\r\n");
|
||||
|
||||
// Plate thickness 20mm, so adjust Z hG54 height
|
||||
grbl_sendf(CLIENT_ALL, "G10 L20 P0 Z+20\r\n");
|
||||
WebUI::inputBuffer.push("G10 L20 P0 Z+20\r\n"); // Set G54, only Z axis, on workpiece level, 20mm below alu plate
|
||||
|
||||
Move up
|
||||
grbl_sendf(CLIENT_ALL, "G53 G0 Z-5 F200\r\n");
|
||||
WebUI::inputBuffer.push("G53 G0 Z-5 F200\r\n"); // Z up
|
||||
} else {
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. Works only in state \"Idle\"\r\n", index + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -70,12 +70,13 @@
|
||||
*/
|
||||
#define PROBE_PIN GPIO_NUM_35 //ok
|
||||
//#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_36 // needs external pullup
|
||||
#define CONTROL_RESET_PIN GPIO_NUM_34 // needs external pullup
|
||||
//#define CONTROL_RESET_PIN GPIO_NUM_34 // needs external pullup
|
||||
//#define CONTROL_FEED_HOLD_PIN GPIO_NUM_36 // needs external pullup
|
||||
//#define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // needs external pullup
|
||||
|
||||
#define MACRO_BUTTON_0_PIN GPIO_NUM_36
|
||||
#define MACRO_BUTTON_1_PIN GPIO_NUM_39
|
||||
#define MACRO_BUTTON_2_PIN GPIO_NUM_34
|
||||
|
||||
/* Normally Grbl_ESP32 ignores tool changes.
|
||||
* It just tracks the current tool number.
|
||||
|
@@ -54,7 +54,7 @@ Some features should not be changed. See notes below.
|
||||
// The mask order is ...
|
||||
// Macro3 | Macro2 | Macro 1| Macr0 |Cycle Start | Feed Hold | Reset | Safety Door
|
||||
// For example B1101 will invert the function of the Reset pin.
|
||||
#define INVERT_CONTROL_PIN_MASK B00111111
|
||||
#define INVERT_CONTROL_PIN_MASK B01111111
|
||||
|
||||
// #define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
|
||||
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
|
||||
|
Reference in New Issue
Block a user