mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-09 05:40:46 +02:00
Added setup of ganged steper direction pins
This commit is contained in:
@@ -44,7 +44,7 @@ Some features should not be changed. See notes below.
|
|||||||
// The CPU map is the main definition of the machine/controller you want to use
|
// The CPU map is the main definition of the machine/controller you want to use
|
||||||
// These are typically found in the cpu_map.h file.
|
// These are typically found in the cpu_map.h file.
|
||||||
// See Github repo wiki for more details
|
// See Github repo wiki for more details
|
||||||
#define CPU_MAP_ESP32 // these are defined in cpu_map.h
|
#define CPU_MAP_TEST_DRIVE // these are defined in cpu_map.h
|
||||||
|
|
||||||
// Number of axes defined (steppers, servos, etc) (valid range: 3 to 6)
|
// Number of axes defined (steppers, servos, etc) (valid range: 3 to 6)
|
||||||
// Even if your machine only uses less than the minimum of 3, you should select 3
|
// Even if your machine only uses less than the minimum of 3, you should select 3
|
||||||
|
@@ -1012,20 +1012,27 @@
|
|||||||
#ifdef N_AXIS
|
#ifdef N_AXIS
|
||||||
#undef N_AXIS
|
#undef N_AXIS
|
||||||
#endif
|
#endif
|
||||||
#define N_AXIS 4 // can be 3 or 4. (if 3 install bypass jumper next to the A driver)
|
#define N_AXIS 3 // can be 3 or 4. (if 3 install bypass jumper next to the A driver)
|
||||||
|
|
||||||
#define USE_TRINAMIC
|
#define USE_TRINAMIC
|
||||||
#define TRINAMIC_DAISY_CHAIN
|
#define TRINAMIC_DAISY_CHAIN
|
||||||
|
|
||||||
// Use SPI enable instead of the enable pin
|
// Use SPI enable instead of the enable pin
|
||||||
// The hardware enable pin is tied to ground
|
// The hardware enable pin is tied to ground
|
||||||
#define USE_TRINAMIC_ENABLE
|
#define USE_TRINAMIC_ENABLE
|
||||||
|
|
||||||
|
// The ESP32 RMT feature will generate the step pulse timing
|
||||||
#define USE_RMT_STEPS
|
#define USE_RMT_STEPS
|
||||||
|
|
||||||
|
// allow two motors on an axis
|
||||||
|
#define USE_GANGED_AXES
|
||||||
|
|
||||||
#define X_DRIVER_TMC2130 // Which Driver Type?
|
#define X_DRIVER_TMC2130 // Which Driver Type?
|
||||||
#define X_RSENSE 0.11f // .11 Ohm...typical of 2130 type 0.075 typical for TMC5160
|
#define X_RSENSE 0.11f // .11 Ohm...typical of 2130 type 0.075 typical for TMC5160
|
||||||
#define X_STEP_PIN GPIO_NUM_12
|
#define X_STEP_PIN GPIO_NUM_12
|
||||||
#define X_DIRECTION_PIN GPIO_NUM_14
|
#define X_DIRECTION_PIN GPIO_NUM_14
|
||||||
|
#define X2_STEP_PIN GPIO_NUM_33
|
||||||
|
#define X2_DIRECTION_PIN GPIO_NUM_32
|
||||||
#define X_TRINAMIC // using SPI control
|
#define X_TRINAMIC // using SPI control
|
||||||
#define X_CS_PIN GPIO_NUM_17 // Daisy Chain, all share same CS pin
|
#define X_CS_PIN GPIO_NUM_17 // Daisy Chain, all share same CS pin
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
// Grbl versioning system
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "1.1f"
|
#define GRBL_VERSION "1.1f"
|
||||||
#define GRBL_VERSION_BUILD "20200221"
|
#define GRBL_VERSION_BUILD "20200222"
|
||||||
|
|
||||||
//#include <sdkconfig.h>
|
//#include <sdkconfig.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
@@ -271,8 +271,6 @@ void trinamic_stepper_enable(bool enable) {
|
|||||||
|
|
||||||
previous_state = enable;
|
previous_state = enable;
|
||||||
|
|
||||||
grbl_msg_sendf(CLIENT_SERIAL, MSG_LEVEL_INFO, "Trinamic Enable: %d", enable);
|
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
toff = TRINAMIC_DEFAULT_TOFF;
|
toff = TRINAMIC_DEFAULT_TOFF;
|
||||||
else
|
else
|
||||||
|
@@ -509,24 +509,44 @@ void stepper_init()
|
|||||||
#ifdef X_DIRECTION_PIN
|
#ifdef X_DIRECTION_PIN
|
||||||
pinMode(X_DIRECTION_PIN, OUTPUT);
|
pinMode(X_DIRECTION_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef X2_DIRECTION_PIN
|
||||||
|
pinMode(X2_DIRECTION_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Y_DIRECTION_PIN
|
#ifdef Y_DIRECTION_PIN
|
||||||
pinMode(Y_DIRECTION_PIN, OUTPUT);
|
pinMode(Y_DIRECTION_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Y2_DIRECTION_PIN
|
||||||
|
pinMode(Y2_DIRECTION_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Z_DIRECTION_PIN
|
#ifdef Z_DIRECTION_PIN
|
||||||
pinMode(Z_DIRECTION_PIN, OUTPUT);
|
pinMode(Z_DIRECTION_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef Z2_DIRECTION_PIN
|
||||||
|
pinMode(Z2_DIRECTION_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef A_DIRECTION_PIN
|
#ifdef A_DIRECTION_PIN
|
||||||
pinMode(A_DIRECTION_PIN, OUTPUT);
|
pinMode(A_DIRECTION_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef A2_DIRECTION_PIN
|
||||||
|
pinMode(A2_DIRECTION_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef B_DIRECTION_PIN
|
#ifdef B_DIRECTION_PIN
|
||||||
pinMode(B_DIRECTION_PIN, OUTPUT);
|
pinMode(B_DIRECTION_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef B2_DIRECTION_PIN
|
||||||
|
pinMode(B2_DIRECTION_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef C_DIRECTION_PIN
|
#ifdef C_DIRECTION_PIN
|
||||||
pinMode(C_DIRECTION_PIN, OUTPUT);
|
pinMode(C_DIRECTION_PIN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef C2_DIRECTION_PIN
|
||||||
|
pinMode(C2_DIRECTION_PIN, OUTPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
// setup stepper timer interrupt
|
// setup stepper timer interrupt
|
||||||
|
|
||||||
@@ -747,7 +767,7 @@ void set_direction_pins_on(uint8_t onMask)
|
|||||||
digitalWrite(X_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
digitalWrite(X_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
#ifdef X2_DIRECTION_PIN // optional ganged axis
|
#ifdef X2_DIRECTION_PIN // optional ganged axis
|
||||||
digitalWrite(X2_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
digitalWrite(X2_DIRECTION_PIN, (onMask & (1<<X_AXIS)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Y_DIRECTION_PIN
|
#ifdef Y_DIRECTION_PIN
|
||||||
|
Reference in New Issue
Block a user