mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-03 03:13:25 +02:00
- rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters. So programming fits to parameters - added 2 buttons (#1 hold/resume), #2 homing and tool change position
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,3 +19,4 @@ __vm/
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
*.suo
|
||||
Grbl_Esp32/Grbl_Esp32.ino.cpp
|
||||
|
@@ -17,13 +17,77 @@
|
||||
//vTaskDelay (0.5 / portTICK_RATE_MS); // 0.5 Sec.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#define DEBOUNCE_TIME_MACRO_1 300 //ms
|
||||
|
||||
//#define DEBUG; // do I want debug messages? yes/no
|
||||
#include <stdint.h>
|
||||
#include "src/Grbl.h"
|
||||
#include "Machines/4axis_xyza.h"
|
||||
|
||||
uint32_t earlier = 0;
|
||||
|
||||
/*
|
||||
options. user_defined_macro() is called with the button number to
|
||||
perform whatever actions you choose.
|
||||
*/
|
||||
#if defined(MACRO_BUTTON_0_PIN) || defined(MACRO_BUTTON_1_PIN) || defined(MACRO_BUTTON_2_PIN)
|
||||
void user_defined_macro(uint8_t index) {
|
||||
uint32_t later, msPassedBy = 0;
|
||||
|
||||
later = millis();
|
||||
msPassedBy = later - earlier;
|
||||
|
||||
if (msPassedBy >= DEBOUNCE_TIME_MACRO_1) {
|
||||
switch (index) {
|
||||
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);
|
||||
sys_rt_exec_state.bit.cycleStart = true;
|
||||
break;
|
||||
|
||||
case State::Cycle:
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. New state \"Hold\"\r\n", index + 1);
|
||||
sys_rt_exec_state.bit.feedHold = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. Works only in states \"Cycle\" or \"Hold\"\r\n", index + 1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // Macro button 2 (Homing)
|
||||
if (sys.state == State::Idle) {
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. Homing, Y tool change position\r\n", index + 1);
|
||||
|
||||
grbl_sendf(CLIENT_ALL, "$H\r\n");
|
||||
WebUI::inputBuffer.push("$H\r\n"); // Homing all axis
|
||||
|
||||
grbl_sendf(CLIENT_ALL, "G53 G0 Z-5\r\n");
|
||||
WebUI::inputBuffer.push("G53 G0 Z-5\r\n"); // Move Z axis up (should already be there, just to be sure)
|
||||
|
||||
grbl_sendf(CLIENT_ALL, "G53 G0 X-5 Y-210 F1000\r\n");
|
||||
WebUI::inputBuffer.push("G53 G0 X-5 Y-210 F1000\r\n"); // Move Y axis to the middle for tool change
|
||||
} else {
|
||||
grbl_sendf(CLIENT_ALL, "Macro button #%d pressed. Works only in state \"Idle\"\r\n", index + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
earlier = later;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
VARIABLES
|
||||
*/
|
||||
|
||||
/*
|
||||
uint8_t AmountOfToolChanges; // Each new tool increases this by 1. Before first tool, it<69>s 0.
|
||||
uint8_t currenttoolNo, newtoolNo;
|
||||
float firstZPos, newZPos, Zdiff;
|
||||
@@ -44,12 +108,12 @@ uint8_t tc_state; // tool change (tc) state machine
|
||||
float getLastZProbePos();
|
||||
|
||||
#ifdef USE_MACHINE_INIT
|
||||
/*
|
||||
|
||||
machine_init() is called when Grbl_ESP32 first starts. You can use it to do any
|
||||
special things your machine needs at startup.
|
||||
|
||||
Prerequisite: add "#define USE_MACHINE_INIT" to your machine.h file
|
||||
*/
|
||||
|
||||
void machine_init()
|
||||
{
|
||||
// We start with 0 tool changes
|
||||
@@ -74,7 +138,7 @@ void machine_init()
|
||||
#endif
|
||||
|
||||
// state machine
|
||||
/*
|
||||
|
||||
void zProbeSyncTask(void* pvParameters)
|
||||
{
|
||||
TickType_t xLastWakeTime;
|
177
Grbl_Esp32/Custom/4axis_xyza.txt
Normal file
177
Grbl_Esp32/Custom/4axis_xyza.txt
Normal file
@@ -0,0 +1,177 @@
|
||||
Working GRBL_Esp32 parameters
|
||||
|
||||
(1) $S parameters
|
||||
$Sta/SSID=Home
|
||||
$Sta/Password=******
|
||||
$Sta/IPMode=Static
|
||||
$Sta/IP=192.168.2.30
|
||||
$Sta/Gateway=192.168.2.2
|
||||
$Sta/Netmask=255.255.255.0
|
||||
$AP/SSID=GRBL_ESP
|
||||
$AP/Password=******
|
||||
$AP/IP=192.168.0.1
|
||||
$AP/Channel=1
|
||||
$System/Hostname=grblesp
|
||||
$Http/Enable=ON
|
||||
$Http/Port=80
|
||||
$Telnet/Enable=ON
|
||||
$Telnet/Port=23
|
||||
$Radio/Mode=STA
|
||||
$Notification/Type=NONE
|
||||
$Notification/T1=
|
||||
$Notification/T2=
|
||||
$Notification/TS=
|
||||
$Message/Level=Info
|
||||
$User/Macro0=
|
||||
$User/Macro1=
|
||||
$User/Macro2=
|
||||
$User/Macro3=
|
||||
$Homing/Cycle0=Z
|
||||
$Homing/Cycle1=XY
|
||||
$Homing/Cycle2=
|
||||
$Homing/Cycle3=
|
||||
$Homing/Cycle4=
|
||||
$Homing/Cycle5=
|
||||
$Report/StallGuard=
|
||||
$Stepper/Pulse=10
|
||||
$Stepper/IdleTime=250
|
||||
$Stepper/StepInvert=
|
||||
$Stepper/DirInvert=Y
|
||||
$Stepper/EnableInvert=On
|
||||
$Limits/Invert=Off
|
||||
$Probe/Invert=On
|
||||
$Report/Status=1
|
||||
$GCode/JunctionDeviation=0.010
|
||||
$GCode/ArcTolerance=0.002
|
||||
$Report/Inches=Off
|
||||
$Firmware/Build=
|
||||
$Limits/Soft=On
|
||||
$Limits/Hard=On
|
||||
$Homing/Enable=On
|
||||
$Homing/DirInvert=Y
|
||||
$Homing/Squared=
|
||||
$Homing/Feed=200.000
|
||||
$Homing/Seek=3000.000
|
||||
$Homing/Debounce=250.000
|
||||
$Homing/Pulloff=5.000
|
||||
$GCode/MaxS=1000.000
|
||||
$GCode/MinS=0.000
|
||||
$Laser/FullPower=1000
|
||||
$GCode/LaserMode=Off
|
||||
$GCode/Line1=
|
||||
$GCode/Line0=
|
||||
$Spindle/Enable/Invert=Off
|
||||
$Spindle/Enable/OffWithSpeed=Off
|
||||
$Spindle/Delay/SpinDown=0.000
|
||||
$Spindle/Delay/SpinUp=0.000
|
||||
$Spindle/PWM/Invert=Off
|
||||
$Spindle/PWM/Frequency=5000.000
|
||||
$Spindle/PWM/Off=0.000
|
||||
$Spindle/PWM/Min=0.000
|
||||
$Spindle/PWM/Max=100.000
|
||||
$Spindle/Type=RELAY
|
||||
$X/StepsPerMm=160.000
|
||||
$Y/StepsPerMm=160.000
|
||||
$Z/StepsPerMm=160.000
|
||||
$A/StepsPerMm=160.000
|
||||
$B/StepsPerMm=100.000
|
||||
$C/StepsPerMm=100.000
|
||||
$X/MaxRate=4000.000
|
||||
$Y/MaxRate=4000.000
|
||||
$Z/MaxRate=1500.000
|
||||
$A/MaxRate=1000.000
|
||||
$B/MaxRate=1000.000
|
||||
$C/MaxRate=1000.000
|
||||
$X/Acceleration=100.000
|
||||
$Y/Acceleration=100.000
|
||||
$Z/Acceleration=100.000
|
||||
$A/Acceleration=200.000
|
||||
$B/Acceleration=200.000
|
||||
$C/Acceleration=200.000
|
||||
$X/Home/Mpos=0.000
|
||||
$Y/Home/Mpos=-420.000
|
||||
$Z/Home/Mpos=0.000
|
||||
$A/Home/Mpos=0.000
|
||||
$B/Home/Mpos=0.000
|
||||
$C/Home/Mpos=0.000
|
||||
$X/MaxTravel=1000.000
|
||||
$Y/MaxTravel=425.000
|
||||
$Z/MaxTravel=120.000
|
||||
$A/MaxTravel=300.000
|
||||
$B/MaxTravel=300.000
|
||||
$C/MaxTravel=300.000
|
||||
$X/Current/Run=0.250
|
||||
$Y/Current/Run=0.250
|
||||
$Z/Current/Run=0.250
|
||||
$A/Current/Run=0.250
|
||||
$B/Current/Run=0.250
|
||||
$C/Current/Run=0.250
|
||||
$X/Current/Hold=0.125
|
||||
$Y/Current/Hold=0.125
|
||||
$Z/Current/Hold=0.125
|
||||
$A/Current/Hold=0.125
|
||||
$B/Current/Hold=0.125
|
||||
$C/Current/Hold=0.125
|
||||
$X/Microsteps=16
|
||||
$Y/Microsteps=16
|
||||
$Z/Microsteps=16
|
||||
$A/Microsteps=16
|
||||
$B/Microsteps=16
|
||||
$C/Microsteps=16
|
||||
$X/StallGuard=16
|
||||
$Y/StallGuard=16
|
||||
$Z/StallGuard=16
|
||||
$A/StallGuard=16
|
||||
$B/StallGuard=16
|
||||
$C/StallGuard=16
|
||||
$Errors/Verbose=Off
|
||||
|
||||
(2) $$ parameters
|
||||
$0=10
|
||||
$1=250
|
||||
$2=0
|
||||
$3=2
|
||||
$4=1
|
||||
$5=0
|
||||
$6=1
|
||||
$10=1
|
||||
$11=0.010
|
||||
$12=0.002
|
||||
$13=0
|
||||
$20=1
|
||||
$21=1
|
||||
$22=1
|
||||
$23=2
|
||||
$24=200.000
|
||||
$25=3000.000
|
||||
$26=250.000
|
||||
$27=5.000
|
||||
$30=1000.000
|
||||
$31=0.000
|
||||
$32=0
|
||||
$N1=
|
||||
$N0=
|
||||
$100=160.000
|
||||
$101=160.000
|
||||
$102=160.000
|
||||
$103=160.000
|
||||
$104=100.000
|
||||
$105=100.000
|
||||
$110=4000.000
|
||||
$111=4000.000
|
||||
$112=1500.000
|
||||
$113=1000.000
|
||||
$114=1000.000
|
||||
$115=1000.000
|
||||
$120=100.000
|
||||
$121=100.000
|
||||
$122=100.000
|
||||
$123=200.000
|
||||
$124=200.000
|
||||
$125=200.000
|
||||
$130=1000.000
|
||||
$131=425.000
|
||||
$132=120.000
|
||||
$133=300.000
|
||||
$134=300.000
|
||||
$135=300.000
|
@@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
/*
|
||||
* 4 Achsen CNC Fraese von Jens
|
||||
* Infos zur Benutzung einer Spindel mit Relais https://github.com/bdring/Grbl_Esp32/wiki/Spindle-Types
|
||||
@@ -5,8 +6,10 @@
|
||||
|
||||
#define MACHINE_NAME "MACHINE_ESP32 Jens XYZA"
|
||||
|
||||
#define CUSTOM_CODE_FILENAME "Custom/4axis_xyza.cpp"
|
||||
|
||||
#ifdef N_AXIS
|
||||
#undef N_AXIS
|
||||
#undef N_AXIS
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -17,8 +20,6 @@
|
||||
#define N_AXIS 3
|
||||
// #######################################
|
||||
|
||||
//#define CUSTOM_CODE_FILENAME "Custom/4axis_xyxz.cpp"
|
||||
|
||||
/*
|
||||
* Spindeltyp definieren
|
||||
* Das 1. Relais
|
||||
@@ -70,8 +71,11 @@
|
||||
#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_FEED_HOLD_PIN GPIO_NUM_36 // needs external pullup
|
||||
#define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // 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
|
||||
|
||||
/* Normally Grbl_ESP32 ignores tool changes.
|
||||
* It just tracks the current tool number.
|
||||
@@ -80,4 +84,12 @@
|
||||
*/
|
||||
|
||||
//#define USE_MACHINE_INIT
|
||||
//#define USE_TOOL_CHANGE
|
||||
//#define USE_TOOL_CHANGE
|
||||
|
||||
|
||||
// wrap prototypes
|
||||
#ifndef FourAxis_xyxz_h
|
||||
#define FourAxis_xyxz_h
|
||||
|
||||
void user_defined_macro(uint8_t index);
|
||||
#endif
|
@@ -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 B00001111
|
||||
#define INVERT_CONTROL_PIN_MASK B00111111
|
||||
|
||||
// #define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
|
||||
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// all I/O pins
|
||||
// #include "Machines/atari_1020.h"
|
||||
//#include "Machines/test_drive.h"
|
||||
#include "Machines/4axis_xyxz.h"
|
||||
#include "Machines/4axis_xyza.h"
|
||||
|
||||
// !!! For actual use, change the line above to select a board
|
||||
// from Machines/, for example:
|
||||
|
Reference in New Issue
Block a user