1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-12 09:34:45 +02:00

Fixed platformIO compile problems

This commit is contained in:
Mitch Bradley
2020-03-05 13:35:36 -10:00
parent 27a7b595b1
commit 1731e8d1c4
13 changed files with 102 additions and 67 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ Thumbs.db
embedded/node_modules
embedded/dist
*~
.pio/
.vscode/

View File

@@ -12,9 +12,9 @@
#define Z_DIRECTION_PIN GPIO_NUM_33
#define LIMIT_MASK B111
#define X_AXIS_LIMIT_PIN GPIO_NUM_2 // labeled X Limit
#define Y_AXIS_LIMIT_PIN GPIO_NUM_4 // labeled Y Limit
#define Y_AXIS_LIMIT_PIN GPIO_NUM_15 // labeled Z Limit
#define X_LIMIT_PIN GPIO_NUM_2 // labeled X Limit
#define Y_LIMIT_PIN GPIO_NUM_4 // labeled Y Limit
#define Z_LIMIT_PIN GPIO_NUM_15 // labeled Z Limit
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13

View File

@@ -12,9 +12,9 @@
#define Z_DIRECTION_PIN GPIO_NUM_33
#define LIMIT_MASK B111
#define X_AXIS_LIMIT_PIN GPIO_NUM_17
#define Y_AXIS_LIMIT_PIN GPIO_NUM_4
#define Z_AXIS_LIMIT_PIN GPIO_NUM_16
#define X_LIMIT_PIN GPIO_NUM_17
#define Y_LIMIT_PIN GPIO_NUM_4
#define Z_LIMIT_PIN GPIO_NUM_16
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13

View File

@@ -25,6 +25,10 @@
#define MACHINE_NAME "MACHINE_ATARI_1020"
// ================== CPU MAP ======================
#ifdef USE_RMT_STEPS
#undef USE_RMT_STEPS
#endif
#define USE_UNIPOLAR
#define X_UNIPOLAR
@@ -69,7 +73,7 @@
#endif
#ifdef INVERT_CONTROL_PIN_MASK
#undef IGNORE_CONTROL_PINS
#undef INVERT_CONTROL_PIN_MASK
#endif
#define INVERT_CONTROL_PIN_MASK B01110000

View File

@@ -42,16 +42,16 @@
// for all the things that can go here
// Assign CPU pins to machine functions, for example:
// #define X_STEP_PIN GPIO_NUM_12
// #define X_DIRECTION_PIN GPIO_NUM_26
// #define X_AXIS_LIMIT_PIN GPIO_NUM_2
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define X_LIMIT_PIN GPIO_NUM_2
// #define SPINDLE_PWM_PIN GPIO_NUM_17
// #define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35
// Set the number of bits to the number of limit switches
// #define LIMIT_MASK B111
#define LIMIT_MASK B111
// ============== Enable custom features =======================

View File

@@ -15,3 +15,7 @@
#define MACHINE_NAME "MACHINE_DEFAULT - Demo Only No I/O!"
#define LIMIT_MASK 0 // no limit pins
#ifdef USE_RMT_STEPS
#undef USE_RMT_STEPS // Suppress unused variable warning
#endif

View File

@@ -41,6 +41,53 @@ Some features should not be changed. See notes below.
// It is no longer necessary to edit this file to choose
// a machine configuration; edit machine.h instead
// machine.h is #included below, after some definitions
// that the machine file might choose to undefine.
// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If
// an axis is omitted from the defines, it will not home, nor will the system update its position.
// Meaning that this allows for users with non-standard Cartesian machines, such as a lathe (x then z,
// with no y), to configure the homing cycle behavior to their needs.
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
// cycle, but this requires some pin settings changes in the machine definition file. For example, the default homing
// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
// may be reduced to one pin, if all axes are homed with separate cycles, or vice versa, all three axes
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
// will not be affected by pin sharing.
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
// These homing cycle definitions precede the machine.h file so that the machine
// definition can undefine them if necessary.
#define HOMING_CYCLE_0 (1<<Z_AXIS) // TYPICALLY REQUIRED: First move Z to clear workspace.
#define HOMING_CYCLE_1 (1<<X_AXIS)
#define HOMING_CYCLE_2 (1<<Y_AXIS)
// NOTE: The following is for for homing X and Y at the same time
// #define HOMING_CYCLE_0 (1<<Z_AXIS) // first home z by itself
// #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // Homes both X-Y in one cycle. NOT COMPATIBLE WITH COREXY!!!
// Inverts pin logic of the control command pins based on a mask. This essentially means you can use
// normally-closed switches on the specified pins, rather than the default normally-open switches.
// The mask order is Cycle Start | Feed Hold | Reset | Safety Door
// For example B1101 will invert the function of the Reset pin.
#define INVERT_CONTROL_PIN_MASK B1111
// This allows control pins to be ignored.
// Since these are typically used on the pins that don't have pullups, they will float and cause
// problems if not externally pulled up. Ignoring will always return not activated when read.
#define IGNORE_CONTROL_PINS
#define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
#define USE_RMT_STEPS
// Include the file that loads the machine-specific config file.
// machine.h must be edited to choose the desired file.
#include "machine.h"
// machine_common.h contains settings that do not change
@@ -167,30 +214,6 @@ Some features should not be changed. See notes below.
// mainly a safety feature to remind the user to home, since position is unknown to Grbl.
#define HOMING_INIT_LOCK // Comment to disable
// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If
// an axis is omitted from the defines, it will not home, nor will the system update its position.
// Meaning that this allows for users with non-standard Cartesian machines, such as a lathe (x then z,
// with no y), to configure the homing cycle behavior to their needs.
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
// cycle, but this requires some pin settings changes in the machine definition file. For example, the default homing
// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
// may be reduced to one pin, if all axes are homed with separate cycles, or vice versa, all three axes
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
// will not be affected by pin sharing.
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
#define HOMING_CYCLE_0 (1<<Z_AXIS) // TYPICALLY REQUIRED: First move Z to clear workspace.
#define HOMING_CYCLE_1 (1<<X_AXIS)
#define HOMING_CYCLE_2 (1<<Y_AXIS)
// NOTE: The following is for for homingg X and Y at the same time
// #define HOMING_CYCLE_0 (1<<Z_AXIS) // first home z by itself
// #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // Homes both X-Y in one cycle. NOT COMPATIBLE WITH COREXY!!!
// Number of homing cycles performed after when the machine initially jogs to limit switches.
// This help in preventing overshoot and should improve repeatability. This value should be one or
// greater.
@@ -286,21 +309,6 @@ Some features should not be changed. See notes below.
// Enable using a solenoid for the Z axis on a pen type machine
// #define USE_PEN_SOLENOID
// Inverts pin logic of the control command pins based on a mask. This essentially means you can use
// normally-closed switches on the specified pins, rather than the default normally-open switches.
// The mask order is Cycle Start | Feed Hold | Reset | Safety Door
// For example B1101 will invert the function of the Reset pin.
#define INVERT_CONTROL_PIN_MASK B1111
// This allows control pins to be ignored.
// Since these are typically used on the pins that don't have pullups, they will float and cause
// problems if not externally pulled up. Ignoring will always return not activated when read.
#define IGNORE_CONTROL_PINS
#define ENABLE_CONTROL_SW_DEBOUNCE // Default disabled. Uncomment to enable.
#define CONTROL_SW_DEBOUNCE_PERIOD 32 // in milliseconds default 32 microseconds
// Inverts select limit pin states based on the following mask. This effects all limit pin functions,
// such as hard limits and homing. However, this is different from overall invert limits setting.
// This build option will invert only the limit pins defined here, and then the invert limits setting

View File

@@ -261,7 +261,7 @@
#ifndef DEFAULT_Z_MAX_TRAVEL
#define DEFAULT_Z_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#endif
#ifndef DEFAULT_A_TRAVEL
#ifndef DEFAULT_A_MAX_TRAVEL
#define DEFAULT_A_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#endif
#ifndef DEFAULT_B_MAX_TRAVEL
@@ -358,4 +358,4 @@
#endif
#endif

View File

@@ -23,13 +23,14 @@
#ifdef USE_TRINAMIC
/*
The drivers can use SPI daisy chaining to allow the use of only (1) CS_PIN.
The PCB must be designed for this, with SDO pins being coonect to the
next driver's SDI pin. The final SDO goes back to the controller.
The drivers can use SPI daisy chaining to allow the use of a single CS_PIN.
The PCB must be designed for this, with SDO pins connected to the
next driver's SDI pin and the final SDO going back to the CPU.
This is setup in the machine definition file (Machines/*.h).
add #define TRINAMIC_DAISY_CHAIN to your map
Make every axis CS_PIN definition be for the same pin like this...
To set this up, #define TRINAMIC_DAISY_CHAIN in your machine definition
file (Machines/something.h).
Set the CS_PIN definition for every axis to the same pin, like this...
#define X_CS_PIN GPIO_NUM_17
#define Y_CS_PIN GPIO_NUM_17
...etc.

View File

@@ -11,8 +11,7 @@
// For actual use, select the appropriate board from Machines/,
// or create your own, for example:
// #include "Machines/3x_v4.h"
#include "Machines/spi_daisy_4x.h"
#include "Machines/3x_v4.h"
// Some configurations use two files, the first assigning pins
// and the second providing additional customization, for example:
@@ -31,4 +30,4 @@
// Paste default settings override definitions here.
#endif _machine_h
#endif // _machine_h

View File

@@ -1,8 +1,6 @@
#ifndef _machine_common_h
#define _machine_common_h
#define USE_RMT_STEPS
#ifndef SPINDLE_PWM_BIT_PRECISION
#define SPINDLE_PWM_BIT_PRECISION 8
#endif

View File

@@ -32,15 +32,33 @@
*/
#ifndef SOLENOID_PWM_FREQ
#define SOLENOID_PWM_FREQ 5000
#endif
#ifndef SOLENOID_PWM_RES_BITS
#define SOLENOID_PWM_RES_BITS 8
#endif
#ifndef SOLENOID_TURNON_DELAY
#define SOLENOID_TURNON_DELAY (SOLENOID_TIMER_INT_FREQ/2)
#define SOLENOID_PULSE_LEN_UP 255
#define SOLENOID_HOLD_DELAY (SOLENOID_TIMER_INT_FREQ/2) // in task counts...after this delay power will change to hold level
#define SOLENOID_PULSE_LEN_HOLD 80 // solenoid hold level ... typically a lower value to prevent overheating
#endif
#ifndef SOLENOID_PULSE_LEN_UP
#define SOLENOID_PULSE_LEN_UP 255
#endif
#ifndef SOLENOID_HOLD_DELAY
#define SOLENOID_HOLD_DELAY (SOLENOID_TIMER_INT_FREQ/2) // in task counts...after this delay power will change to hold level
#endif
#ifndef SOLENOID_PULSE_LEN_HOLD
#define SOLENOID_PULSE_LEN_HOLD 80 // solenoid hold level ... typically a lower value to prevent overheating
#endif
#ifndef SOLENOID_TIMER_INT_FREQ
#define SOLENOID_TIMER_INT_FREQ 50
#endif
#ifndef solenoid_h
#define solenoid_h
@@ -50,4 +68,4 @@ void solenoid_disable();
void solenoidSyncTask(void *pvParameters);
void calc_solenoid(float penZ);
#endif
#endif

View File

@@ -21,6 +21,7 @@ lib_deps_builtin =
WiFiClientSecure
[env:nodemcu-32s]
lib_deps = TMCStepper
platform = espressif32
board = nodemcu-32s
framework = arduino