1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-01-17 22:28:29 +01:00

Introduced Machines directory for pin assignments

This commit is contained in:
Mitch Bradley 2020-03-05 10:55:00 -10:00
parent 389edf89e9
commit 27a7b595b1
34 changed files with 1533 additions and 1655 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ Thumbs.db
*.orig
embedded/node_modules
embedded/dist
*~

View File

@ -47,8 +47,8 @@ void setup() {
grbl_msg_sendf(CLIENT_SERIAL, MSG_LEVEL_INFO, "Compiled with ESP32 SDK:%s", ESP.getSdkVersion()); // print the SDK version
#ifdef CPU_MAP_NAME // show the map name at startup
grbl_msg_sendf(CLIENT_SERIAL, MSG_LEVEL_INFO, "Using cpu_map:%s", CPU_MAP_NAME);
#ifdef MACHINE_NAME // show the map name at startup
grbl_msg_sendf(CLIENT_SERIAL, MSG_LEVEL_INFO, "Using cpu_map:%s", MACHINE_NAME);
#endif
settings_init(); // Load Grbl settings from EEPROM

View File

@ -0,0 +1,33 @@
// This is an example of using a Brushless DC Hobby motor as
// a spindle motor. See this wiki page for more info
// https://github.com/bdring/Grbl_Esp32/wiki/BESC-Spindle-Feature
//
// To use this file you must first include another machine file
// that defines the pin assignments, such as Machines/3x_v4.h
#define SHOW_EXTENDED_SETTINGS
#define SPINDLE_PWM_BIT_PRECISION 16 // 16 bit recommended for ESC (don't change)
/*
Important ESC Settings
$33=50 // Hz this is the typical good frequency for an ESC
#define DEFAULT_SPINDLE_FREQ 5000.0 // $33 Hz (extended set)
Determine the typical min and max pulse length of your ESC
min_pulse is typically 1ms (0.001 sec) or less
max_pulse is typically 2ms (0.002 sec) or more
determine PWM_period. It is (1/freq) if freq = 50...period = 0.02
determine pulse length for min_pulse and max_pulse in percent.
(pulse / PWM_period)
min_pulse = (0.001 / 0.02) = 0.05 = 5% so ... $34 and $35 = 5.0
max_pulse = (0.002 / .02) = 0.1 = 10% so ... $36=10
*/
#define DEFAULT_SPINDLE_FREQ 50.0
#define DEFAULT_SPINDLE_OFF_VALUE 5.0
#define DEFAULT_SPINDLE_MIN_VALUE 5.0
#define DEFAULT_SPINDLE_MAX_VALUE 10.0

View File

@ -0,0 +1,31 @@
// Pin assignments for the ESP32 Development Controller, v3.5.
// https://github.com/bdring/Grbl_ESP32_Development_Controller
// https://www.tindie.com/products/33366583/grbl_esp32-cnc-development-board-v35/
#define MACHINE_NAME "MACHINE_ESP32_V3.5"
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define Y_STEP_PIN GPIO_NUM_14
#define Y_DIRECTION_PIN GPIO_NUM_25
#define Z_STEP_PIN GPIO_NUM_27
#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
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#define SPINDLE_PWM_PIN GPIO_NUM_17 // labeled SpinPWM
#define SPINDLE_ENABLE_PIN GPIO_NUM_22 // labeled SpinEnbl
#define MIST_PIN GPIO_NUM_21 // labeled Mist
#define FLOOD_PIN GPIO_NUM_16 // labeled Flood
#define PROBE_PIN GPIO_NUM_32 // labeled Probe
#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35 // labeled Door, needs external pullup
#define CONTROL_RESET_PIN GPIO_NUM_34 // labeled Reset, needs external pullup
#define CONTROL_FEED_HOLD_PIN GPIO_NUM_36 // labeled Hold, needs external pullup
#define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // labeled Start, needs external pullup

View File

@ -0,0 +1,31 @@
// Pin assignments for the ESP32 Development Controller, v4.1 and later.
// https://github.com/bdring/Grbl_ESP32_Development_Controller
// https://www.tindie.com/products/33366583/grbl_esp32-cnc-development-board-v35/
#define MACHINE_NAME "MACHINE_ESP32_V4"
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_14
#define Y_STEP_PIN GPIO_NUM_26
#define Y_DIRECTION_PIN GPIO_NUM_15
#define Z_STEP_PIN GPIO_NUM_27
#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
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#define SPINDLE_PWM_PIN GPIO_NUM_2 // labeled SpinPWM
#define SPINDLE_ENABLE_PIN GPIO_NUM_22 // labeled SpinEnbl
#define MIST_PIN GPIO_NUM_21 // labeled Mist
#define FLOOD_PIN GPIO_NUM_25 // labeled Flood
#define PROBE_PIN GPIO_NUM_32 // labeled Probe
#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35 // labeled Door, needs external pullup
#define CONTROL_RESET_PIN GPIO_NUM_34 // labeled Reset, needs external pullup
#define CONTROL_FEED_HOLD_PIN GPIO_NUM_36 // labeled Hold, needs external pullup
#define CONTROL_CYCLE_START_PIN GPIO_NUM_39 // labeled Start, needs external pullup

View File

@ -0,0 +1,35 @@
// This is the CPU Map for the ESP32 Development Controller
// used to drive a dual motor gantry where the drivers
// labeled X, Y and Z drive the machine axes X, Y and X.
// https://github.com/bdring/Grbl_ESP32_Development_Controller
// https://www.tindie.com/products/33366583/grbl_esp32-cnc-development-board-v35/
#define MACHINE_NAME "MACHINE_ESP32_V4_XYX"
#define X_STEP_PIN GPIO_NUM_26 /* labeled Y */
#define X_DIRECTION_PIN GPIO_NUM_15 /* labeled Y */
#define Y_STEP_PIN GPIO_NUM_12 /* labeled X */
#define Y_DIRECTION_PIN GPIO_NUM_14 /* labeled X */
#define Y2_STEP_PIN GPIO_NUM_27 /* labeled Z */
#define Y2_DIRECTION_PIN GPIO_NUM_33 /* labeled Z */
#define SPINDLE_PWM_PIN GPIO_NUM_2
#define LIMIT_MASK B11
#define X_LIMIT_PIN GPIO_NUM_17
#define Y_LIMIT_PIN GPIO_NUM_4
// #define Z_LIMIT_PIN GPIO_NUM_16
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#define COOLANT_MIST_PIN_1 GPIO_NUM_21
#define COOLANT_FLOOE_PIN_2 GPIO_NUM_25
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
// see versions for X and Z
#define PROBE_PIN GPIO_NUM_32
#define CONTROL_SAFETY_DOOR_PIN GPIO_NUM_35 // 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

View File

@ -0,0 +1,166 @@
/*
atari_1020.h
Part of Grbl_ESP32
copyright (c) 2018 - Bart Dring This file was modified for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
This contains all the special features required to control an
Atari 1010 Pen Plotter
*/
#define MACHINE_NAME "MACHINE_ATARI_1020"
// ================== CPU MAP ======================
#define USE_UNIPOLAR
#define X_UNIPOLAR
#define X_PIN_PHASE_0 GPIO_NUM_13
#define X_PIN_PHASE_1 GPIO_NUM_21
#define X_PIN_PHASE_2 GPIO_NUM_16
#define X_PIN_PHASE_3 GPIO_NUM_22
#define Y_UNIPOLAR
#define Y_PIN_PHASE_0 GPIO_NUM_25
#define Y_PIN_PHASE_1 GPIO_NUM_27
#define Y_PIN_PHASE_2 GPIO_NUM_26
#define Y_PIN_PHASE_3 GPIO_NUM_32
#define SOLENOID_DIRECTION_PIN GPIO_NUM_4
#define SOLENOID_PEN_PIN GPIO_NUM_2
#define SOLENOID_CHANNEL_NUM 6
#ifdef HOMING_CYCLE_0
#undef HOMING_CYCLE_0
#endif
#define HOMING_CYCLE_0 (1<<X_AXIS) // this 'bot only homes the X axis
#ifdef HOMING_CYCLE_1
#undef HOMING_CYCLE_1
#endif
#ifdef HOMING_CYCLE_2
#undef HOMING_CYCLE_2
#endif
#define REED_SW_PIN GPIO_NUM_17
#define LIMIT_MASK 0
#ifdef IGNORE_CONTROL_PINS // maybe set in config.h
#undef IGNORE_CONTROL_PINS
#endif
#ifndef ENABLE_CONTROL_SW_DEBOUNCE
#define ENABLE_CONTROL_SW_DEBOUNCE
#endif
#ifdef INVERT_CONTROL_PIN_MASK
#undef IGNORE_CONTROL_PINS
#endif
#define INVERT_CONTROL_PIN_MASK B01110000
#define MACRO_BUTTON_0_PIN GPIO_NUM_34 // Pen Switch
#define MACRO_BUTTON_1_PIN GPIO_NUM_35 // Color Switch
#define MACRO_BUTTON_2_PIN GPIO_NUM_36 // Paper Switch
#ifdef DEFAULTS_GENERIC
#undef DEFAULTS_GENERIC // undefine generic then define each default below
#endif
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 200 // 200ms
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 0 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 1
#define DEFAULT_HOMING_DIR_MASK 0
#define DEFAULT_HOMING_FEED_RATE 3000.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 3000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 10
#define DEFAULT_Y_STEPS_PER_MM 10
#define DEFAULT_Z_STEPS_PER_MM 100.0 // This is percent in servo mode
#define DEFAULT_X_MAX_RATE 5000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 5000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 200000.0 // mm/min
#define DEFAULT_X_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (500.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 120.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 20000.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 10.0 // This is percent in servo mode
// ================== CPU MAP ======================
#define ATARI_1020
#define SOLENOID_PWM_FREQ 5000
#define SOLENOID_PWM_RES_BITS 8
#define SOLENOID_PULSE_LEN_PULL 255
#define SOLENOID_PULL_DURATION 50 // in task counts...after this delay power will change to hold level see SOLENOID_TASK_FREQ
#define SOLENOID_PULSE_LEN_HOLD 40 // solenoid hold level ... typically a lower value to prevent overheating
#define SOLENOID_TASK_FREQ 50 // this is milliseconds
#define MAX_PEN_NUMBER 4
#define BUMPS_PER_PEN_CHANGE 3
#define ATARI_HOME_POS -10.0f // this amound to the left of the paper 0
#define ATARI_PAPER_WIDTH 100.0f //
#define ATARI_HOMING_ATTEMPTS 13
// tells grbl we have some special functions to call
#define USE_MACHINE_INIT
#define USE_CUSTOM_HOMING
#define USE_TOOL_CHANGE
#define ATARI_TOOL_CHANGE_Z 5.0
#define USE_M30 // use the user defined end of program
#ifndef atari_h
#define atari_h
void solenoid_disable();
void solenoidSyncTask(void *pvParameters);
void calc_solenoid(float penZ);
void atari_home_task(void *pvParameters);
void atari_next_pen();
#endif

View File

@ -0,0 +1,79 @@
/*
custom_machine_template.h
Part of Grbl_ESP32
copyright (c) 2020 - Bart Dring. This file was intended for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
====================================================================
See custom_machine_templete.cpp for getting started creating custom
machines
*/
// =============== MACHINE NAME ========================
// Change "MACHINE_CUSTOM", replacing "CUSTOM" with your chosen name
// #define MACHINE_NAME "MACHINE_CUSTOM"
// ================ config.h overrides ====================================
// If you want to make some changes to config.h, it is best to do it here
// if possible so all your changes are in your files. Many of the #defines
// in config.h are only applied if the symbol is not already defined in
// a machine definition file. Example:
// #define N_AXIS 4
// =============== MACHINE CONFIGURATION ========================
// Look at the other files in the Machines/ directory
// 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 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
// ============== Enable custom features =======================
// There are several customization functions that the code only
// calls if the symbols below are defined. To use such a function,
// you must define the symbol herein, and define the function in
// your my_machine.cpp file.
// #define USE_MACHINE_INIT // Enables use of custom machine_init()
// #define USE_CUSTOM_HOMING // Enables use of user_defined_homing()
// #define USE_KINEMATICS // Enables use of inverse_kinematics(), kinematics_pre_homing(), and kinematics_post_homing()
// #define USE_FWD_KINEMATIC // Enables use of forward_kinematics()
// #define USE_TOOL_CHANGE // Enables use off user_tool_change()
// #define USE_M30 // Enables use of user_m30()
// #define USE_TRIAMINIC // Enables use of functions shown in grbl_triaminic.h
// #define USE_MACHINE_TRINAMIC_INIT // Enables use of machine_triaminic_setup()
// ===================== $$ Defaults ==========================================
// defaults.h defines default values for the $$ settings that will be
// applied when you upload new firmware or if you reset them with $RST=$.
// You can override individual defaults by defining them here. Examples:
// #define DEFAULT_SPINDLE_FREQ 2000.0
// #define DEFAULT_X_MAX_TRAVEL 100.0

View File

@ -0,0 +1,38 @@
// Pin assignments for ESPDUINO-32 Boards and Protoneer V3 boards
// Note: Probe pin is mapped, but will require a 10k external pullup to 3.3V to work.
// Rebooting...See this issue https://github.com/bdring/Grbl_Esp32/issues/314
// !!!! Experimental Untested !!!!!
#define MACHINE_NAME "MACHINE_ESPDUINO_32"
#define X_STEP_PIN GPIO_NUM_26
#define X_DIRECTION_PIN GPIO_NUM_16
#define Y_STEP_PIN GPIO_NUM_25
#define Y_DIRECTION_PIN GPIO_NUM_27
#define Z_STEP_PIN GPIO_NUM_17
#define Z_DIRECTION_PIN GPIO_NUM_14
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_12
#define SPINDLE_PWM_PIN GPIO_NUM_19
#define SPINDLE_DIR_PIN GPIO_NUM_18
#define COOLANT_FLOOD_PIN GPIO_NUM_34
#define COOLANT_MIST_PIN GPIO_NUM_36
#define X_LIMIT_PIN GPIO_NUM_13
#define Y_LIMIT_PIN GPIO_NUM_5
#define Z_LIMIT_PIN GPIO_NUM_19
#define LIMIT_MASK B111
#define PROBE_PIN GPIO_NUM_39
// comment out #define IGNORE_CONTROL_PINS in config.h to use control pins
#define CONTROL_RESET_PIN GPIO_NUM_2
#define CONTROL_FEED_HOLD_PIN GPIO_NUM_4
#define CONTROL_CYCLE_START_PIN GPIO_NUM_35 // ESP32 needs external pullup

View File

@ -0,0 +1,40 @@
// Pin assignments for the buildlog.net 4-axis external driver board
#define MACHINE_NAME "External Driver Board V1.1"
#ifdef N_AXIS
#undef N_AXIS
#endif
#define N_AXIS 4
#define X_STEP_PIN GPIO_NUM_0
#define X_DIRECTION_PIN GPIO_NUM_2
#define Y_STEP_PIN GPIO_NUM_26
#define Y_DIRECTION_PIN GPIO_NUM_15
#define Z_STEP_PIN GPIO_NUM_27
#define Z_DIRECTION_PIN GPIO_NUM_33
#define A_STEP_PIN GPIO_NUM_14
#define A_DIRECTION_PIN GPIO_NUM_12
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#define SPINDLE_PWM_PIN GPIO_NUM_25
#define SPINDLE_ENABLE_PIN GPIO_NUM_22
#define MODBUS_TX GPIO_NUM_17
#define MODBUS_RX GPIO_NUM_4
#define MODBUS_CTRL GPIO_NUM_16
#define X_LIMIT_PIN GPIO_NUM_34
#define Y_LIMIT_PIN GPIO_NUM_35
#define Z_LIMIT_PIN GPIO_NUM_36
#if (N_AXIS == 3)
#define LIMIT_MASK B0111
#else
#define A_LIMIT_PIN GPIO_NUM_39
#define LIMIT_MASK B1111
#endif
#define PROBE_PIN GPIO_NUM_32
#define COOLANT_MIST_PIN GPIO_NUM_21

View File

@ -0,0 +1,139 @@
// Pin assignments for 6-axis system
#define MACHINE_NAME "MACHINE_FOO_6X"
// Be sure to change to N_AXIS 6 in nuts_bolts.h
#ifdef N_AXIS
#undef N_AXIS
#endif
#define N_AXIS 6
// stepper motors
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define Y_STEP_PIN GPIO_NUM_14
#define Y_DIRECTION_PIN GPIO_NUM_25
// Z is a servo
#define A_STEP_PIN GPIO_NUM_27
#define A_DIRECTION_PIN GPIO_NUM_33
#define B_STEP_PIN GPIO_NUM_15
#define B_DIRECTION_PIN GPIO_NUM_32
// C is a servo
// servos
#define USE_SERVO_AXES
#define SERVO_Z_PIN GPIO_NUM_22
#define SERVO_Z_CHANNEL_NUM 6
#define SERVO_Z_RANGE_MIN 0.0
#define SERVO_Z_RANGE_MAX 5.0
#define SERVO_Z_HOMING_TYPE SERVO_HOMING_TARGET // during homing it will instantly move to a target value
#define SERVO_Z_HOME_POS SERVO_Z_RANGE_MAX // move to max during homing
#define SERVO_Z_MPOS false // will not use mpos, uses work coordinates
#define SERVO_C_PIN GPIO_NUM_2
#define SERVO_C_CHANNEL_NUM 7
#define SERVO_C_RANGE_MIN 0.0
#define SERVO_C_RANGE_MAX 5.0
#define SERVO_C_HOMING_TYPE SERVO_HOMING_TARGET // during homing it will instantly move to a target value
#define SERVO_C_HOME_POS SERVO_C_RANGE_MAX // move to max during homing
#define SERVO_C_MPOS false // will not use mpos, uses work coordinates
// limit switches
#define X_LIMIT_PIN GPIO_NUM_21
#define Y_LIMIT_PIN GPIO_NUM_17
#define A_LIMIT_PIN GPIO_NUM_16
#define B_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B11011
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#ifdef HOMING_CYCLE_0 // undefine from config.h
#undef HOMING_CYCLE_0
#endif
//#define HOMING_CYCLE_0 (1<<X_AXIS)
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))
//#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS) |(1<<A_AXIS)|(1<<B_AXIS))
#ifdef HOMING_CYCLE_1 // undefine from config.h
#undef HOMING_CYCLE_1
#endif
//#define HOMING_CYCLE_1 (1<<A_AXIS)
#define HOMING_CYCLE_1 ((1<<A_AXIS)|(1<<B_AXIS))
#ifdef HOMING_CYCLE_2 // undefine from config.h
#undef HOMING_CYCLE_2
#endif
/*
#define HOMING_CYCLE_2 (1<<Y_AXIS)
#ifdef HOMING_CYCLE_3 // undefine from config.h
#undef HOMING_CYCLE_3
#endif
#define HOMING_CYCLE_3 (1<<B_AXIS)
*/
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 200 // 200ms
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 2 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 1
#define DEFAULT_HOMING_DIR_MASK 17
#define DEFAULT_HOMING_FEED_RATE 200.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 2000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 3.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 400.0
#define DEFAULT_Y_STEPS_PER_MM 400.0
#define DEFAULT_Z_STEPS_PER_MM 100.0 // This is percent in servo mode
#define DEFAULT_A_STEPS_PER_MM 400.0
#define DEFAULT_B_STEPS_PER_MM 400.0
#define DEFAULT_C_STEPS_PER_MM 100.0 // This is percent in servo mode
#define DEFAULT_X_MAX_RATE 30000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 30000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 8000.0 // mm/min
#define DEFAULT_A_MAX_RATE 30000.0 // mm/min
#define DEFAULT_B_MAX_RATE 30000.0 // mm/min
#define DEFAULT_C_MAX_RATE 8000.0 // mm/min
#define DEFAULT_X_ACCELERATION (1500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (1500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (100.0*60*60)
#define DEFAULT_A_ACCELERATION (1500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_B_ACCELERATION (1500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_C_ACCELERATION (100.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 250.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 250.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // This is percent in servo mode
#define DEFAULT_A_MAX_TRAVEL 250.0 // mm NOTE: Must be a positive value.
#define DEFAULT_B_MAX_TRAVEL 250.0 // mm NOTE: Must be a positive value.
#define DEFAULT_C_MAX_TRAVEL 100.0 // This is percent in servo mode

View File

@ -0,0 +1,78 @@
// Pin assignments for the Buildlog.net MPCNC controller
// used in lowrider mode. Low rider has (2) Y and Z and one X motor
// These will not match the silkscreen or schematic descriptions
// !!!!!!!!!!!!!!!!! Warning: Untested !!!!!!!!!!!!!!!!! //
//#define V1P1
#define V1P2 // works for V1.2.1 as well
#ifdef V1P1
#define MACHINE_NAME "MACHINE_LOWRIDER_V1P1"
#else // V1P2
#define MACHINE_NAME "MACHINE_LOWRIDER_V1P2"
#endif
#define USE_GANGED_AXES // allow two motors on an axis
#define X_STEP_PIN GPIO_NUM_27 // use Z labeled connector
#define X_DIRECTION_PIN GPIO_NUM_33 // use Z labeled connector
#define Y_STEP_PIN GPIO_NUM_14
#define Y2_STEP_PIN GPIO_NUM_21 // ganged motor
#define Y_DIRECTION_PIN GPIO_NUM_25
#define Y_AXIS_SQUARING
#define Z_STEP_PIN GPIO_NUM_12 // use X labeled connector
#define Z2_STEP_PIN GPIO_NUM_22 // use X labeled connector
#define Z_DIRECTION_PIN GPIO_NUM_26 // use X labeled connector
#define Z_AXIS_SQUARING
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
// Note: if you use PWM rather than relay, you could map GPIO_NUM_2 to mist or flood
//#define USE_SPINDLE_RELAY
#ifdef USE_SPINDLE_RELAY
#ifdef V1P1
#define SPINDLE_PWM_PIN GPIO_NUM_17
#else // V1p2
#define SPINDLE_PWM_PIN GPIO_NUM_2
#endif
#else
#define SPINDLE_PWM_PIN GPIO_NUM_16
#define SPINDLE_ENABLE_PIN GPIO_NUM_32
#endif
// Note: Only uncomment this if USE_SPINDLE_RELAY is commented out.
// Relay can be used for Spindle or Coolant
//#define COOLANT_FLOOD_PIN GPIO_NUM_17
#define X_LIMIT_PIN GPIO_NUM_15
#define Y_LIMIT_PIN GPIO_NUM_4
#ifdef V1P1 //v1p1
#define Z_LIMIT_PIN GPIO_NUM_2
#else
#define Z_LIMIT_PIN GPIO_NUM_17
#endif
#define LIMIT_MASK B111
#ifdef V1P2
#ifndef ENABLE_SOFTWARE_DEBOUNCE // V1P2 does not have R/C filters
#define ENABLE_SOFTWARE_DEBOUNCE
#endif
#endif
// The default value in config.h is wrong for this controller
#ifdef INVERT_CONTROL_PIN_MASK
#undef INVERT_CONTROL_PIN_MASK
#endif
#define INVERT_CONTROL_PIN_MASK B1110
// Note: check the #define IGNORE_CONTROL_PINS is the way you want in config.h
#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

View File

@ -0,0 +1,101 @@
// Pin assignments for the Buildlog.net midtbot
#define MACHINE_NAME "MACHINE_MIDTBOT"
#define X_STEP_PIN GPIO_NUM_12
#define Y_STEP_PIN GPIO_NUM_14
#define X_DIRECTION_PIN GPIO_NUM_26
#define Y_DIRECTION_PIN GPIO_NUM_25
#ifndef COREXY // maybe set in config.h
#define COREXY
#endif
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#define X_LIMIT_PIN GPIO_NUM_2
#define Y_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B11
#ifndef USE_SERVO_AXES // maybe set in config.h
#define USE_SERVO_AXES
#endif
#define SERVO_Z_PIN GPIO_NUM_27
#define SERVO_Z_CHANNEL_NUM 5
#define SERVO_Z_RANGE_MIN 0.0
#define SERVO_Z_RANGE_MAX 5.0
#define SERVO_Z_HOMING_TYPE SERVO_HOMING_TARGET // during homing it will instantly move to a target value
#define SERVO_Z_HOME_POS SERVO_Z_RANGE_MAX // move to max during homing
#define SERVO_Z_MPOS false // will not use mpos, uses work coordinates
#ifndef IGNORE_CONTROL_PINS // maybe set in config.h
#define IGNORE_CONTROL_PINS
#endif
// redefine some stuff from config.h
#ifdef HOMING_CYCLE_0
#undef HOMING_CYCLE_0
#endif
#define HOMING_CYCLE_0 (1<<Y_AXIS)
#ifdef HOMING_CYCLE_1
#undef HOMING_CYCLE_1
#endif
#define HOMING_CYCLE_1 (1<<X_AXIS)
#ifdef HOMING_CYCLE_2
#undef HOMING_CYCLE_2
#endif
#define SERVO_PEN_PIN GPIO_NUM_27
// defaults
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // stay on
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 2 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 1
#define DEFAULT_HOMING_DIR_MASK 1
#define DEFAULT_HOMING_FEED_RATE 200.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 3.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 200.0
#define DEFAULT_Y_STEPS_PER_MM 100.0
#define DEFAULT_Z_STEPS_PER_MM 100.0 // This is percent in servo mode
#define DEFAULT_X_MAX_RATE 8000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 8000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 5000.0 // mm/min
#define DEFAULT_X_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (100.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 100.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // This is percent in servo mode

138
Grbl_Esp32/Machines/mpcnc.h Normal file
View File

@ -0,0 +1,138 @@
// // Pin assignments for the Buildlog.net MPCNC controller
// uncomment ONE of the following versions
//#define V1P1
#define V1P2 // works for V1.2.1 as well
#ifdef V1P1
#define MACHINE_NAME "MACHINE_MPCNC_V1P1"
#else // V1P2
#define MACHINE_NAME "MACHINE_MPCNC_V1P2"
#endif
#define USE_GANGED_AXES // allow two motors on an axis
#define X_STEP_PIN GPIO_NUM_12
#define X2_STEP_PIN GPIO_NUM_22 // ganged motor
#define X_AXIS_SQUARING
#define Y_STEP_PIN GPIO_NUM_14
#define Y2_STEP_PIN GPIO_NUM_21 // ganged motor
#define Y_AXIS_SQUARING
#define Z_STEP_PIN GPIO_NUM_27
#define X_DIRECTION_PIN GPIO_NUM_26
#define Y_DIRECTION_PIN GPIO_NUM_25
#define Z_DIRECTION_PIN GPIO_NUM_33
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
// Note: if you use PWM rather than relay, you could map GPIO_NUM_2 to mist or flood
//#define USE_SPINDLE_RELAY
#ifdef USE_SPINDLE_RELAY
#ifdef V1P1
#define SPINDLE_PWM_PIN GPIO_NUM_17
#else // V1p2
#define SPINDLE_PWM_PIN GPIO_NUM_2
#endif
#else
#define SPINDLE_PWM_PIN GPIO_NUM_16
#define SPINDLE_ENABLE_PIN GPIO_NUM_32
#endif
// Note: Only uncomment this if USE_SPINDLE_RELAY is commented out.
// Relay can be used for spindle or either coolant
//#define COOLANT_FLOOD_PIN GPIO_NUM_2
//#define COOLANT_MIST_PIN GPIO_NUM_2
#ifdef V1P1 //v1p1
#define X_LIMIT_PIN GPIO_NUM_2
#else
#define X_LIMIT_PIN GPIO_NUM_17
#endif
#define Y_LIMIT_PIN GPIO_NUM_4
#define Z_LIMIT_PIN GPIO_NUM_15
#define LIMIT_MASK B111
#ifdef V1P2
#ifndef ENABLE_SOFTWARE_DEBOUNCE // V1P2 does not have R/C filters
#define ENABLE_SOFTWARE_DEBOUNCE
#endif
#endif
#define PROBE_PIN GPIO_NUM_35
// The default value in config.h is wrong for this controller
#ifdef INVERT_CONTROL_PIN_MASK
#undef INVERT_CONTROL_PIN_MASK
#endif
#define INVERT_CONTROL_PIN_MASK B1110
// Note: default is #define IGNORE_CONTROL_PINS in config.h
// uncomment to these lines to use them
/*
#ifdef IGNORE_CONTROL_PINS
#undef IGNORE_CONTROL_PINS
#endif
*/
#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 DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // 255 = Keep steppers on
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 0 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 1 // false
#define DEFAULT_HOMING_DIR_MASK 3 // move positive dir Z,negative X,Y
#define DEFAULT_HOMING_FEED_RATE 100.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 200.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
#ifdef USE_SPINDLE_RELAY
#define DEFAULT_SPINDLE_RPM_MAX 1.0 // must be 1 so PWM duty is alway 100% to prevent relay damage
#else
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // can be change to your spindle max
#endif
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 200.0
#define DEFAULT_Y_STEPS_PER_MM 200.0
#define DEFAULT_Z_STEPS_PER_MM 800.0
#define DEFAULT_X_MAX_RATE 8000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 8000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 3000.0 // mm/min
#define DEFAULT_X_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (100.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_X_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 500.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 80.0 // mm NOTE: Must be a positive value.

View File

@ -0,0 +1,97 @@
// Pen assignments for the Buildlog.net pen laser controller V1 & V2
// For pen mode be sure to uncomment #define USE_PEN_SERVO in config.h
// For solenoid mode be sure to uncomment #define USE_PEN_SERVO in config.h
// For laser mode, you do not need to change anything
// Note: You can use all 3 modes at the same time if you want
#define MACHINE_NAME "MACHINE_PEN_LASER"
// Pick a board version
//#define PEN_LASER_V1
#define PEN_LASER_V2
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define Y_STEP_PIN GPIO_NUM_14
#define Y_DIRECTION_PIN GPIO_NUM_25
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#ifdef PEN_LASER_V1
#define X_LIMIT_PIN GPIO_NUM_2
#endif
#ifdef PEN_LASER_V2
#define X_LIMIT_PIN GPIO_NUM_15
#endif
#define Y_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B11
// If SPINDLE_PWM_PIN is commented out, this frees up the pin, but Grbl will still
// use a virtual spindle. Do not comment out the other parameters for the spindle.
#define SPINDLE_PWM_PIN GPIO_NUM_17 // Laser PWM
#define USING_SERVO // uncomment to use this feature
//#define USING_SOLENOID // uncomment to use this feature
#ifdef USING_SERVO
#define USE_SERVO_AXES
#define SERVO_Z_PIN GPIO_NUM_27
#define SERVO_Z_CHANNEL_NUM 3
#define SERVO_Z_RANGE_MIN 0
#define SERVO_Z_RANGE_MAX 10
#endif
#ifdef USING_SOLENOID
#define USE_PEN_SOLENOID
#define SOLENOID_PEN_PIN GPIO_NUM_16
#define SOLENOID_CHANNEL_NUM 6
#endif
// defaults
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 250 // stay on
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 0 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 0
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir Z, negative X,Y
#define DEFAULT_HOMING_FEED_RATE 200.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 3.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 80
#define DEFAULT_Y_STEPS_PER_MM 80
#define DEFAULT_Z_STEPS_PER_MM 100.0 // This is percent in servo mode...used for calibration
#define DEFAULT_X_MAX_RATE 5000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 5000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 5000.0 // mm/min
#define DEFAULT_X_ACCELERATION (50.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (50.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // This is percent in servo mode...used for calibration

View File

@ -1,58 +1,40 @@
/*
kinematics_polar_coaster.h - Implements simple kinematics for Grbl_ESP32
Part of Grbl_ESP32
// Pin assignments and other configuration for the buildlog.net
// Polar Coaster.
Copyright (c) 2019 Barton Dring @buildlog
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
#define MACHINE_NAME "MACHINE_POLAR_COASTER"
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/
// This must be defined so that polar_coaster.cpp is not skipped
#define MACHINE_POLAR_COASTER
#define RADIUS_AXIS 0
#define POLAR_AXIS 1
#define SEGMENT_LENGTH 0.5 // segment length in mm
#define USE_KINEMATICS
#define USE_FWD_KINEMATIC // report in cartesian
#define USE_FWD_KINEMATIC // report in cartesian
#define USE_M30
// ============= Begin CPU MAP ================
#define CPU_MAP_NAME "CPU_MAP_POLAR_COASTER"
#define X_STEP_PIN GPIO_NUM_15
#define Y_STEP_PIN GPIO_NUM_2
#define X_DIRECTION_PIN GPIO_NUM_25
#define Y_DIRECTION_PIN GPIO_NUM_26
#define USE_RMT_STEPS
#define X_STEP_PIN GPIO_NUM_15
#define Y_STEP_PIN GPIO_NUM_2
#define X_DIRECTION_PIN GPIO_NUM_25
#define Y_DIRECTION_PIN GPIO_NUM_26
#define STEPPERS_DISABLE_PIN GPIO_NUM_17
#define STEPPERS_DISABLE_PIN GPIO_NUM_17
#ifndef USE_SERVO_AXES // maybe set in config.h
#define USE_SERVO_AXES
#endif
#define SERVO_Z_PIN GPIO_NUM_16
#define SERVO_Z_CHANNEL_NUM 5
#define SERVO_Z_RANGE_MIN 0.0
#define SERVO_Z_RANGE_MAX 5.0
#define SERVO_Z_HOMING_TYPE SERVO_HOMING_TARGET // during homing it will instantly move to a target value
#define SERVO_Z_HOME_POS SERVO_Z_RANGE_MAX // move to max during homing
#define SERVO_Z_MPOS false // will not use mpos, uses work coordinates
#define X_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B1
#define SERVO_Z_PIN GPIO_NUM_16
#define SERVO_Z_CHANNEL_NUM 5
#define SERVO_Z_RANGE_MIN 0.0
#define SERVO_Z_RANGE_MAX 5.0
#define SERVO_Z_HOMING_TYPE SERVO_HOMING_TARGET // during homing it will instantly move to a target value
#define SERVO_Z_HOME_POS SERVO_Z_RANGE_MAX // move to max during homing
#define SERVO_Z_MPOS false // will not use mpos, uses work coordinates
#define X_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B1
#ifdef IGNORE_CONTROL_PINS // maybe set in config.h
#undef IGNORE_CONTROL_PINS
@ -70,12 +52,12 @@
#ifdef INVERT_CONTROL_PIN_MASK
#undef INVERT_CONTROL_PIN_MASK
#endif
#define INVERT_CONTROL_PIN_MASK B11111111
#define INVERT_CONTROL_PIN_MASK B11111111
#define MACRO_BUTTON_0_PIN GPIO_NUM_13
#define MACRO_BUTTON_1_PIN GPIO_NUM_12
#define MACRO_BUTTON_2_PIN GPIO_NUM_14
#define MACRO_BUTTON_0_PIN GPIO_NUM_13
#define MACRO_BUTTON_1_PIN GPIO_NUM_12
#define MACRO_BUTTON_2_PIN GPIO_NUM_14
// redefine some stuff from config.h
#ifdef HOMING_CYCLE_0
#undef HOMING_CYCLE_0
@ -86,19 +68,19 @@
#endif
#ifdef HOMING_CYCLE_2
#undef HOMING_CYCLE_2
#endif
#endif
// ============= End CPU MAP ==================
// ============= Begin Default Settings ================
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 255 // stay on
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 2 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 2 // MPos enabled
@ -109,7 +91,7 @@
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 1
#define DEFAULT_HOMING_ENABLE 1
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir Z, negative X,Y
#define DEFAULT_HOMING_FEED_RATE 200.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
@ -131,26 +113,8 @@
#define DEFAULT_X_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (200.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60)
#define DEFAULT_Z_ACCELERATION (50.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 50.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 100.0 // This is percent in servo mode
// ============= End Default Settings ==================
#ifndef kinematics_h
#define kinematics_h
#include "grbl.h"
bool kinematics_pre_homing(uint8_t cycle_mask);
void kinematics_post_homing();
void inverse_kinematics(float *target, plan_line_data_t *pl_data, float *position);
void calc_polar(float *target_xyz, float *polar, float last_angle);
float abs_angle(float ang);
void user_defined_macro(uint8_t index);
void forward_kinematics(float *position);
void user_m30();
#endif

View File

@ -0,0 +1,101 @@
// Pin assignments for the Buildlog.net pen laser controller V1
// using servos.
// For pen mode be sure to uncomment #define USE_PEN_SERVO in config.h
// For solenoid mode be sure to uncomment #define USE_PEN_SERVO in config.h
// For laser mode, you do not need to change anything
// Note: You can use all 3 modes at the same time if you want
#define MACHINE_NAME "MACHINE_SERVO_AXIS"
// Pick a board version
//#define PEN_LASER_V1
#define PEN_LASER_V2
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#ifdef PEN_LASER_V1
#define X_LIMIT_PIN GPIO_NUM_2
#endif
#ifdef PEN_LASER_V2
#define X_LIMIT_PIN GPIO_NUM_15
#endif
#define Y_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B11
// If SPINDLE_PWM_PIN is commented out, this frees up the pin, but Grbl will still
// use a virtual spindle. Do not comment out the other parameters for the spindle.
#define SPINDLE_PWM_PIN GPIO_NUM_17 // Laser PWM
// PWM Generator is based on 80,000,000 Hz counter
// Therefor the freq determines the resolution
// 80,000,000 / freq = max resolution
// For 5000 that is 80,000,000 / 5000 = 16000
// round down to nearest bit count for SPINDLE_PWM_MAX_VALUE
//#define SPINDLE_PWM_BASE_FREQ 5000 // Hz
#define SPINDLE_PWM_OFF_VALUE 0
#ifndef SPINDLE_PWM_MIN_VALUE
#define SPINDLE_PWM_MIN_VALUE 1 // Must be greater than zero.
#endif
#define SERVO_Y_PIN GPIO_NUM_14
#define SERVO_Y_CHANNEL_NUM 6
#define SERVO_Y_RANGE_MIN 0.0
#define SERVO_Y_RANGE_MAX 30.0
#define SERVO_Z_PIN GPIO_NUM_27
#define SERVO_Z_CHANNEL_NUM 5
#define SERVO_Z_RANGE_MIN 0.0
#define SERVO_Z_RANGE_MAX 20.0
// defaults
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 250 // stay on
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 0 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 0
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir Z, negative X,Y
#define DEFAULT_HOMING_FEED_RATE 200.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 3.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 40 // half turn on a stepper
#define DEFAULT_Y_STEPS_PER_MM 100.0 // default calibration value
#define DEFAULT_Z_STEPS_PER_MM 100.0 // default calibration value
#define DEFAULT_X_MAX_RATE 2000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 2000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 2000.0 // mm/min
#define DEFAULT_X_ACCELERATION (50.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (50.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (50.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 100.0 // default calibration value
#define DEFAULT_Z_MAX_TRAVEL 100.0 // default calibration value

View File

@ -0,0 +1,78 @@
// Pin assignments for a 4-axis machine using Triaminic drivers
// in daisy-chained SPI mode.
#define MACHINE_NAME "SPI_DAISY_4X"
#ifdef N_AXIS
#undef N_AXIS
#endif
#define N_AXIS 3 // can be 3 or 4. (if 3 install bypass jumper next to the A driver)
#define USE_TRINAMIC
#define TRINAMIC_DAISY_CHAIN
// Use SPI enable instead of the enable pin
// The hardware enable pin is tied to ground
#define USE_TRINAMIC_ENABLE
// allow two motors on an axis
#define USE_GANGED_AXES
#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_STEP_PIN GPIO_NUM_12
#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_CS_PIN GPIO_NUM_17 // Daisy Chain, all share same CS pin
#define Y_DRIVER_TMC2130 // Which Driver Type?
#define Y_RSENSE 0.11f // .11 Ohm...typical of 2130 type 0.075 typical for TMC5160
#define Y_STEP_PIN GPIO_NUM_27
#define Y_DIRECTION_PIN GPIO_NUM_26
#define Y_TRINAMIC // using SPI control
#define Y_CS_PIN X_CS_PIN // Daisy Chain, all share same CS pin
#define Z_DRIVER_TMC2130 // Which Driver Type?
#define Z_RSENSE 0.11f // .11 Ohm...typical of 2130 type 0.075 typical for TMC5160
#define Z_STEP_PIN GPIO_NUM_15
#define Z_DIRECTION_PIN GPIO_NUM_2
#define Z_TRINAMIC // using SPI control
#define Z_CS_PIN X_CS_PIN // Daisy Chain, all share same CS pin
#if (N_AXIS == 4)
#define A_DRIVER_TMC2130 // Which Driver Type?
#define A_RSENSE 0.11f // .11 Ohm...typical of 2130 type 0.075 typical for TMC5160
#define A_STEP_PIN GPIO_NUM_33
#define A_DIRECTION_PIN GPIO_NUM_32
#define A_TRINAMIC // using SPI control
#define A_CS_PIN X_CS_PIN // Daisy Chain, all share same CS pin
#endif
// Mist is a 3.3V output
// Turn on with M7 and off with M9
#define COOLANT_MIST_PIN GPIO_NUM_21
#define SPINDLE_PWM_PIN GPIO_NUM_25
#define SPINDLE_ENABLE_PIN GPIO_NUM_4
// Relay operation
// Install Jumper near relay
// For spindle Use max RPM of 1
// For PWM remove jumper and set MAX RPM to something higher ($30 setting)
// Interlock jumper along top edge needs to be installed for both versions
#define DEFAULT_SPINDLE_RPM_MAX 1 // Should be 1 for relay operation
#define PROBE_PIN GPIO_NUM_22
#define X_LIMIT_PIN GPIO_NUM_36
#define Y_LIMIT_PIN GPIO_NUM_39
#define Z_LIMIT_PIN GPIO_NUM_34
#if (N_AXIS == 4)
#define A_LIMIT_PIN GPIO_NUM_35
#define LIMIT_MASK B1111
#else
#define LIMIT_MASK B0111
#endif

View File

@ -0,0 +1,17 @@
// Pin assignments (or lack thereof) for testing Grbl_ESP32.
// It creates a basic 3 axis machine without actually driving
// I/O pins. Grbl will report that axes are moving, but no physical
// motor motion will occur.
// This can be uploaded to an unattached ESP32 or attached to
// unknown hardware with no risk of pins trying to output signals
// into a short, etc that could dmamge the ESP32
// It can also be used to get the basic program running so OTA
// (over the air) firmware loading can be done.
#define MACHINE_NAME "MACHINE_DEFAULT - Demo Only No I/O!"
#define LIMIT_MASK 0 // no limit pins

View File

@ -0,0 +1,55 @@
// Pin assignments (or lack thereof) for a pen plotter
// using Triaminic TMC2130 drivers.
// Select a version to match your PCB
//#define MACHINE_V1 // version 1 PCB
#define MACHINE_V2 // version 2 PCB
#ifdef MACHINE_V1
#define MACHINE_NAME "ESP32_TMC2130_PEN V1"
#define X_LIMIT_PIN GPIO_NUM_2
#else
#define MACHINE_NAME "ESP32_TMC2130_PEN V2"
#define X_LIMIT_PIN GPIO_NUM_32
#endif
#define USE_TRINAMIC // Using at least 1 trinamic driver
#define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26
#define X_TRINAMIC // using SPI control
#define X_DRIVER_TMC2130 // Which Driver Type?
#define X_CS_PIN GPIO_NUM_17 //chip select
#define X_RSENSE 0.11f // .11 Ohm
#define Y_STEP_PIN GPIO_NUM_14
#define Y_DIRECTION_PIN GPIO_NUM_25
#define Y_TRINAMIC // using SPI control
#define Y_DRIVER_TMC2130 // Which Driver Type?
#define Y_CS_PIN GPIO_NUM_16 //chip select
#define Y_RSENSE 0.11f // .11 Ohm
// OK to comment out to use pin for other features
#define STEPPERS_DISABLE_PIN GPIO_NUM_13
#ifndef USE_SERVO_AXES // may be set in config.h
#define USE_SERVO_AXES
#endif
#define SERVO_Z_PIN GPIO_NUM_27
#define SERVO_Z_CHANNEL_NUM 5
#define SERVO_Z_RANGE_MIN 0.0
#define SERVO_Z_RANGE_MAX 5.0
#define SERVO_Z_HOMING_TYPE SERVO_HOMING_TARGET // during homing it will instantly move to a target value
#define SERVO_Z_HOME_POS SERVO_Z_RANGE_MAX // move to max during homing
#define SERVO_Z_MPOS false // will not use mpos, uses work coordinates
// Comment out servo pin and uncomment spindle pwm pin to use the servo PWM to control a spindle
/*
#define SPINDLE_PWM_PIN GPIO_NUM_27
*/
// #define X_LIMIT_PIN See version section
#define Y_LIMIT_PIN GPIO_NUM_4
#define LIMIT_MASK B11

View File

@ -1,173 +0,0 @@
/*
atari_1020.h
Part of Grbl_ESP32
copyright (c) 2018 - Bart Dring This file was modified for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
This contains all the special features required to control an
Atari 1010 Pen Plotter
*/
#define CPU_MAP_NAME "CPU_MAP_ATARI_1020"
// ================== CPU MAP ======================
#define USE_UNIPOLAR
#define X_UNIPOLAR
#define X_PIN_PHASE_0 GPIO_NUM_13
#define X_PIN_PHASE_1 GPIO_NUM_21
#define X_PIN_PHASE_2 GPIO_NUM_16
#define X_PIN_PHASE_3 GPIO_NUM_22
#define Y_UNIPOLAR
#define Y_PIN_PHASE_0 GPIO_NUM_25
#define Y_PIN_PHASE_1 GPIO_NUM_27
#define Y_PIN_PHASE_2 GPIO_NUM_26
#define Y_PIN_PHASE_3 GPIO_NUM_32
#define SOLENOID_DIRECTION_PIN GPIO_NUM_4
#define SOLENOID_PEN_PIN GPIO_NUM_2
#define SOLENOID_CHANNEL_NUM 6
#ifdef HOMING_CYCLE_0
#undef HOMING_CYCLE_0
#endif
#define HOMING_CYCLE_0 (1<<X_AXIS) // this 'bot only homes the X axis
#ifdef HOMING_CYCLE_1
#undef HOMING_CYCLE_1
#endif
#ifdef HOMING_CYCLE_2
#undef HOMING_CYCLE_2
#endif
#define REED_SW_PIN GPIO_NUM_17
#define LIMIT_MASK 0
#ifdef IGNORE_CONTROL_PINS // maybe set in config.h
#undef IGNORE_CONTROL_PINS
#endif
#ifndef ENABLE_CONTROL_SW_DEBOUNCE
#define ENABLE_CONTROL_SW_DEBOUNCE
#endif
#ifdef INVERT_CONTROL_PIN_MASK
#undef IGNORE_CONTROL_PINS
#endif
#define INVERT_CONTROL_PIN_MASK B01110000
#define MACRO_BUTTON_0_PIN GPIO_NUM_34 // Pen Switch
#define MACRO_BUTTON_1_PIN GPIO_NUM_35 // Color Switch
#define MACRO_BUTTON_2_PIN GPIO_NUM_36 // Paper Switch
#ifdef DEFAULTS_GENERIC
#undef DEFAULTS_GENERIC // undefine generic then define each default below
#endif
#define DEFAULT_STEP_PULSE_MICROSECONDS 3
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 200 // 200ms
#define DEFAULT_STEPPING_INVERT_MASK 0 // uint8_t
#define DEFAULT_DIRECTION_INVERT_MASK 0 // uint8_t
#define DEFAULT_INVERT_ST_ENABLE 0 // boolean
#define DEFAULT_INVERT_LIMIT_PINS 1 // boolean
#define DEFAULT_INVERT_PROBE_PIN 0 // boolean
#define DEFAULT_STATUS_REPORT_MASK 1
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
#define DEFAULT_REPORT_INCHES 0 // false
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
#define DEFAULT_HOMING_ENABLE 1
#define DEFAULT_HOMING_DIR_MASK 0
#define DEFAULT_HOMING_FEED_RATE 3000.0 // mm/min
#define DEFAULT_HOMING_SEEK_RATE 3000.0 // mm/min
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
#define DEFAULT_LASER_MODE 0 // false
#define DEFAULT_X_STEPS_PER_MM 10
#define DEFAULT_Y_STEPS_PER_MM 10
#define DEFAULT_Z_STEPS_PER_MM 100.0 // This is percent in servo mode
#define DEFAULT_X_MAX_RATE 5000.0 // mm/min
#define DEFAULT_Y_MAX_RATE 5000.0 // mm/min
#define DEFAULT_Z_MAX_RATE 200000.0 // mm/min
#define DEFAULT_X_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Y_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
#define DEFAULT_Z_ACCELERATION (500.0*60*60)
#define DEFAULT_X_MAX_TRAVEL 120.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Y_MAX_TRAVEL 20000.0 // mm NOTE: Must be a positive value.
#define DEFAULT_Z_MAX_TRAVEL 10.0 // This is percent in servo mode
// ================== CPU MAP ======================
#define ATARI_1020
#define SOLENOID_PWM_FREQ 5000
#define SOLENOID_PWM_RES_BITS 8
#define SOLENOID_PULSE_LEN_PULL 255
#define SOLENOID_PULL_DURATION 50 // in task counts...after this delay power will change to hold level see SOLENOID_TASK_FREQ
#define SOLENOID_PULSE_LEN_HOLD 40 // solenoid hold level ... typically a lower value to prevent overheating
#define SOLENOID_TASK_FREQ 50 // this is milliseconds
#define MAX_PEN_NUMBER 4
#define BUMPS_PER_PEN_CHANGE 3
#define ATARI_HOME_POS -10.0f // this amound to the left of the paper 0
#define ATARI_PAPER_WIDTH 100.0f //
#define ATARI_HOMING_ATTEMPTS 13
// tells grbl we have some special functions to call
#define USE_MACHINE_INIT
#define USE_CUSTOM_HOMING
#define USE_TOOL_CHANGE
#define ATARI_TOOL_CHANGE_Z 5.0
#define USE_M30 // use the user defined end of program
#ifndef atari_h
#define atari_h
void machine_init();
void solenoid_disable();
void solenoidSyncTask(void *pvParameters);
void calc_solenoid(float penZ);
bool user_defined_homing();
void atari_home_task(void *pvParameters);
void user_tool_change(uint8_t new_tool);
void user_defined_macro(uint8_t index);
void user_m30();
void atari_next_pen();
#endif

View File

@ -6,7 +6,7 @@
Copyright (c) 2009-2011 Simen Svale Skogsrud
2018 - Bart Dring This file was modifed for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
CPU. Do not use this with Grbl for atMega328P
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -39,16 +39,18 @@ Some features should not be changed. See notes below.
#define config_h
#include <Arduino.h>
// !!!! Most Important Configuration Item !!!!
// #define the CPU map 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.
// See Github repo wiki for more details
#define CPU_MAP_TEST_DRIVE // these are defined in cpu_map.h
// It is no longer necessary to edit this file to choose
// a machine configuration; edit machine.h instead
#include "machine.h"
// machine_common.h contains settings that do not change
#include "machine_common.h"
// 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
#ifndef N_AXIS
#define N_AXIS 3
#endif
#define VERBOSE_HELP // Currently this doesn't do anything
#define GRBL_MSG_LEVEL MSG_LEVEL_INFO // what level of [MSG:....] do you want to see 0=all off
@ -62,7 +64,7 @@ Some features should not be changed. See notes below.
//#define CONNECT_TO_SSID "your SSID"
//#define SSID_PASSWORD "your SSID password"
#define ENABLE_BLUETOOTH // enable bluetooth
#define ENABLE_BLUETOOTH // enable bluetooth
#define ENABLE_SD_CARD // enable use of SD Card to run jobs
@ -173,7 +175,7 @@ Some features should not be changed. See notes below.
// 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 cpu_map.h file. For example, the default homing
// 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
@ -251,7 +253,7 @@ Some features should not be changed. See notes below.
// analog pin 4. Only use this option if you require a second coolant control pin.
// NOTE: The M8 flood coolant control pin on analog pin 3 will still be functional regardless.
// ESP32 NOTE! This is here for reference only. You enable both M7 and M8 by assigning them a GPIO Pin
// in cpu_map.h
// in the machine definition file.
//#define ENABLE_M7 // Don't uncomment...see above!
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,
@ -275,10 +277,10 @@ Some features should not be changed. See notes below.
// #define COREXY // Default disabled. Uncomment to enable.
// Enable using a servo for the Z axis on a pen type machine.
// You typically should not define a pin for the Z axis in cpu_map.h
// You typically should not define a pin for the Z axis in the machine definition file
// You should configure your settings in servo_pen.h
// #define USE_SERVO_AXES // the new method
// define your servo pin here or in cpu_map.h
// define your servo pin here or in the machine definition file
//#define SERVO_PEN_PIN GPIO_NUM_27
// Enable using a solenoid for the Z axis on a pen type machine
@ -600,7 +602,7 @@ Some features should not be changed. See notes below.
// Additional settings have been added to the original set that you see with the $$ command
// Some senders may not be able to parse anything different from the original set
// You can still set these like $33=5000, but you cannot read them back.
// Default is off to limit support issues...you can enable here or in your cpu_map
// Default is off to limit support issues...you can enable here or in your machine definition file
// #define SHOW_EXTENDED_SETTINGS
// Enable the '$I=(string)' build info write command. If disabled, any existing build info data must
@ -716,19 +718,4 @@ Some features should not be changed. See notes below.
#define RPM_LINE_A3 9.528342e-03
#define RPM_LINE_B3 3.306286e+01
/* ---------------------------------------------------------------------------------------
OEM Single File Configuration Option
Instructions: Paste the cpu_map and default setting definitions below without an enclosing
#ifdef. Comment out the CPU_MAP_xxx and DEFAULT_xxx defines at the top of this file, and
the compiler will ignore the contents of defaults.h and cpu_map.h and use the definitions
below.
*/
// Paste CPU_MAP definitions here.
// Paste default settings definitions here.
#endif

File diff suppressed because it is too large Load Diff

View File

@ -20,152 +20,152 @@
=======================================================================
This is a template of a custom machine file. All of these functions are called by
main Grbl_ESP when enabled via #define statements. The machine designer must fill
in the contents of the functions. Almost all of them are optional. Remove any
unused functions. See each function for more information
This is a template for a custom machine file. The various optional functions are
called by main Grbl_ESP when enabled via #define statements in Machines/my_machine.h.
The machine designer must fill in the contents of the functions that are enabled.
See each function for more information
Make copies of custom_machine_template.cpp and custom_machine_template.h
and replace the file prefix with your machine's name
Copy custom_machine_template.cpp and Machines/custom_machine_template.h,
changing the filenames to your machine's name.
Example:
my_machine.h
Machines/my_machine.h
my_machine.cpp
In cpu_map.h you need to create #include links to your new machine files. This is
done using a CPU_MAP name so that you can switch to it in config.h like any of
the other defined machine. See the template example at the bottom of cpu_map.h
Edit machine.h to include your Machines/my_machine.h file
Example
#ifdef CPU_MAP_MY_MACHINE
#include my_machine.h
#endif
in config.h make sure CPU_MAP_MY_MACHINE is the only define cpu map.
To keep your machine organized and cpu_map.h clean, put all of the stuff normally put in
cpu_map.h in your my_machine.h file. There are sections in that template expaining it.
Edit Machines/my_machine.h according to the instructions therein.
===============================================================================
*/
#ifdef CPU_MAP_CUSTOM_MACHINE // !!! Change this name to your machine map name
// It is necessary to include grbl.h so that the machine definitions
// will be loaded before the remainder of this file is processed.
#include "grbl.h"
// !!! Change this to the name you chose in Machines/my_machine.h
// The compiler will skip the rest of this file unless that name is defined
#ifdef MACHINE_CUSTOM
#ifdef USE_MACHINE_INIT
/*
This function is called if you have #define USE_MACHINE_INIT in your my_machine.h file
This function will be called when Grbl_ESP32 first starts. You can use it to do any
special things your machine needs at startup.
*/
void machine_init() {
}
}
#endif
#ifdef USE_CUSTOM_HOMING
/*
This function is called if you have #define USE_CUSTOM_HOMING in your my_machine.h file
This function gets called at the begining of the normal Grbl_ESP32 homing sequence. You
Can skip the rest of normal Grbl_ESP32 homing by returning false. You return true if you
want normal homing to continue. You might do this if you just need to prep the machine
for homing.
user_defined_homing() is called at the begining of the normal Grbl_ESP32 homing
sequence. If user_defined_homing() returns false, the rest of normal Grbl_ESP32
homing is skipped if it returns false, other normal homing continues. For
example, if you need to manually prep the machine for homing, you could implement
user_defined_homing() to wait for some button to be pressed, then return true.
*/
bool user_defined_homing() {
return true; // True = done with homing, false = continue with normal Grbl_ESP32 homing
// True = done with homing, false = continue with normal Grbl_ESP32 homing
return true;
}
#endif
#ifdef USE_KINEMATICS
/*
Inverse Kinematics converts X,Y,Z cartesian coordinate to the steps
on your "joint" motors. It requires the following three functions:
*/
/*
Inverse Kinematics converts X,Y,Z cartesian coordinate to the steps on your "joint"
motors.
inverse_kinematics() looks at incoming move commands and modifies
them before Grbl_ESP32 puts them in the motion planner.
This function allows you to look at incoming move commands and modify them before
Grbl_ESP32 puts them in the motion planner.
Grbl_ESP32 processes arcs by converting them into tiny little line segments.
Kinematics in Grbl_ESP32 works the same way. Search for this function across
Grbl_ESP32 for examples. You are basically converting cartesian X,Y,Z... targets to
Grbl_ESP32 processes arc by converting them into tiny little line segments.
Kinematics in Grbl_ESP32 works the same way. Search for this function across Grbl_ESP32
for examples. You are basically converting cartesian X,Y,Z... targets to
target = an N_AXIS array of target positions (where the move is supposed to go)
pl_data = planner data (see the definition of this type to see what it is)
position = an N_AXIS array of where the machine is starting from for this move
target = an N_AXIS array of target positions (where the move is supposed to go)
pl_data = planner data (see the definition of this type to see what it is)
position = an N_AXIS array of where the machine is starting from for this move
*/
void inverse_kinematics(target, pl_data, position) {
mc_line(target, pl_data); // this simply moves to the target Replace with your kinematics.
void inverse_kinematics(float *target, plan_line_data_t *pl_data, float *position) {
// this simply moves to the target. Replace with your kinematics.
mc_line(target, pl_data);
}
/*
Forward Kinematics converts your motor postions to X,Y,Z... cartesian information.
This is used by the status command.
Convert the N_AXIS array of motor positions to cartesian in your code.
kinematics_pre_homing() is called before normal homing
You can use it to do special homing or just to set stuff up
cycle_mask is a bit mask of the axes being homed this time.
*/
void forward_kinematics(float *position) {
// position[X_AXIS] =
// position[Y_AXIS] =
}
/*
This function is required if you have #define USE_KINEMATIC
This function is called before normal homing
You can use it to do special homing or just to set stuff up
cycle_mask = is a bit mask of the axes being homed this time.
*/
bool kinematics_pre_homing(cycle_mask)) {
bool kinematics_pre_homing(uint8_t cycle_mask)) {
return false; // finish normal homing cycle
}
/*
This function is required if you have #define USE_KINEMATIC
It is called at the end of normal homing
/*
kinematics_post_homing() is called at the end of normal homing
*/
void kinematics_post_homing() {
}
#endif
#ifdef USE_FWD_KINEMATICS
/*
This function is called if #USE_TOOL_CHANGE is define and
a gcode for a tool change is received
The status command uses forward_kinematics() to convert
your motor positions to cartesian X,Y,Z... coordinates.
Convert the N_AXIS array of motor positions to cartesian in your code.
*/
void forward_kinematics(float *position) {
// position[X_AXIS] =
// position[Y_AXIS] =
}
#endif
#ifdef USE_TOOL_CHANGE
/*
user_tool_change() is called when tool change gcode is received,
to perform appropriate actions for your machine.
*/
void user_tool_change(uint8_t new_tool) {
}
#endif
/*
This will be called if any of the #define MACRO_BUTTON_0_PIN options
are defined
#ifdef MACRO_BUTTON_0_PIN
/*
options. user_defined_macro() is called with the button number to
perform whatever actions you choose.
*/
void user_defined_macro(uint8_t index)
{
}
#endif
#ifdef USE_M30
/*
This function is called if #define USE_M30 is defined and
an M30 gcode is received. M30 signals the end of a gcode file.
user_m30() is called when an M30 gcode signals the end of a gcode file.
*/
void user_m30() {
}
#endif
#ifdef USE_MACHINE_TRINAMIC_INIT
/*
Enable this function with #define USE_MACHINE_TRINAMIC_INIT
This will replace the normal setup of trinamic drivers with your own
This is where you could setup StallGaurd
machine_triaminic_setup() replaces the normal setup of trinamic
drivers with your own code. For example, you could setup StallGuard
*/
void machine_trinamic_setup() {
}
#endif
// If you add any additional functions specific to your machine that
// require calls from common code, guard their calls in the common code with
// #ifdef USE_WHATEVER and add function prototypes (also guarded) to grbl.h
// feel free to add any additional functions specific to your machine
#endif
#endif

View File

@ -1,96 +0,0 @@
/*
custom_machine_template.h
Part of Grbl_ESP32
copyright (c) 2020 - Bart Dring. This file was intended for use on the ESP32
CPU. Do not use this with Grbl for atMega328P
Grbl_ESP32 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl_ESP32 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
====================================================================
See custom_machine_templete.cpp for getting started creating custom
machines
*/
// ================ config.h overrides ========================================
/*
If you want to make some changes to config.h, it might be easier to do it here
so all your changes are in your files.
example to change baud rate
#ifdef BAUD_RATE
#undef BAUDRATE
#endif
#define BAUD_RATE 9600
example to change the number of axes
#idef N_AXIS
#undef N_AXIS
#endif
#define N_AXIS 4
*/
// =============== CPU MAP ========================
// Look at cpu_map.h for all the things that can go here
#define CPU_MAP_NAME "CPU_MAP_MY_MACHINE"
#define LIMIT_MASK B111 // you need this with as many switches you are using
// ============== Enable custom features =======================
// #define #USE_MACHINE_INIT
// #define USE_CUSTOM_HOMING
// #define USE_KINEMATICS
// #define USE_FWD_KINEMATIC
// #define USE_TOOL_CHANGE
// #define USE_M30
// #define USE_MACHINE_TRINAMIC_INIT
// ===================== $$ Defaults ==========================================
/* These are default values for any of the $$ settings.
This will automatically set them when you upload new firmware or if you
reset them with $RST=$.
All default values are set in the defaults.h file. You would only need to
put values here that are different from those values
Below are a few examples
*/
#define DEFAULT_SPINDLE_FREQ 2000.0
#define DEFAULT_X_MAX_TRAVEL 100.0
#ifndef custom_machine_template_h // !!!!!!!!!!!!!!! Change this to your file !!!!!!!!!!!!!
#define custom_machine_template_h // !!! here too !!!!
#include "grbl.h"
// ================ Function Prototypes ================
void machine_init();
bool user_defined_homing();
void inverse_kinematics(float *target, plan_line_data_t *pl_data, float *position);
void forward_kinematics(float *position);
void kinematics_post_homing();
void user_tool_change(uint8_t new_tool);
void user_defined_macro(uint8_t index);
void user_m30();
void machine_trinamic_setup();
#endif

View File

@ -344,11 +344,11 @@ uint8_t gc_execute_line(char *line, uint8_t client)
break;
}
break;
case 6: // too change
case 6: // tool change
word_bit = MODAL_GROUP_M6;
gc_block.modal.tool_change = TOOL_CHANGE;
#ifdef USE_TOOL_CHANGE
//tool_change(gc_state.tool);
//user_tool_change(gc_state.tool);
#endif
break;
case 7:

View File

@ -34,7 +34,6 @@
// Define the Grbl system include files. NOTE: Do not alter organization.
#include "config.h"
#include "nuts_bolts.h"
#include "cpu_map.h"
#include "tdef.h"
#include "defaults.h"
@ -92,3 +91,25 @@
#include "grbl_unipolar.h"
#endif
// Called if USE_MACHINE_INIT is defined
void machine_init();
// Called if USE_CUSTOM_HOMING is defined
bool user_defined_homing();
// Called if USE_KINEMATICS is defined
void inverse_kinematics(float *target, plan_line_data_t *pl_data, float *position);
bool kinematics_pre_homing(uint8_t cycle_mask);
void kinematics_post_homing();
// Called if USE_FWD_KINEMATIC is defined
void forward_kinematics(float *position);
// Called if MACRO_BUTTON_0_PIN or MACRO_BUTTON_1_PIN or MACRO_BUTTON_2_PIN is defined
void user_defined_macro(uint8_t index);
// Called if USE_M30 is defined
void user_m30();
// Called if USE_TOOL_CHANGE is defined
void user_tool_change(uint8_t new_tool);

View File

@ -27,7 +27,7 @@
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.
This is setup in cpu_map.
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...
#define X_CS_PIN GPIO_NUM_17
@ -302,4 +302,4 @@ void trinamic_stepper_enable(bool enable) {
}
#endif
#endif

View File

@ -31,6 +31,9 @@
void trinamic_change_settings();
void trinamic_test_response(uint8_t result, const char *axis);
void trinamic_stepper_enable(bool enable);
#ifdef USE_MACHINE_TRINAMIC_INIT
void machine_trinamic_setup();
#endif
#endif
#endif
#endif // GRBL_TRIAMINIC_h

34
Grbl_Esp32/machine.h Normal file
View File

@ -0,0 +1,34 @@
// Configure for a specific machine by including one or more
// machine definition files as described below. Machine
// definition files assign CPU pins to machine functions
// according to the wiring of interface boards.
#ifndef _machine_h
#define _machine_h
// For initial testing, start with this one which disables all I/O pins
// #include "Machines/test_drive.h"
// 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"
// Some configurations use two files, the first assigning pins
// and the second providing additional customization, for example:
// #include "Machines/3x_v4.h"
// #include "Machines/3x_esc_spindle.h"
/* ---------------------------------------------------------------------------------------
OEM Single File Configuration Option
Instructions: Comment out all #include's above and paste the machine definition and
any default settings that you wish to override below.
*/
// Paste machine definitions here.
// Paste default settings override definitions here.
#endif _machine_h

View File

@ -0,0 +1,65 @@
#ifndef _machine_common_h
#define _machine_common_h
#define USE_RMT_STEPS
#ifndef SPINDLE_PWM_BIT_PRECISION
#define SPINDLE_PWM_BIT_PRECISION 8
#endif
#define SPINDLE_PWM_MAX_VALUE ((1<<SPINDLE_PWM_BIT_PRECISION) - 1)
#define SPINDLE_PWM_CHANNEL 0
// Grbl setting that are common to all machines
// It should not be necessary to change anything herein
#ifndef GRBL_SPI_FREQ
// You can override these by defining them in a board file.
// To override, you must set all of them
//-1 means use the default board pin
#define GRBL_SPI_SS -1
#define GRBL_SPI_MOSI -1
#define GRBL_SPI_MISO -1
#define GRBL_SPI_SCK -1
#define GRBL_SPI_FREQ 4000000
#endif
// ESP32 CPU Settings
#define F_TIMERS 80000000 // a reference to the speed of ESP32 timers
#define F_STEPPER_TIMER 20000000 // frequency of step pulse timer
#define STEPPER_OFF_TIMER_PRESCALE 8 // gives a frequency of 10MHz
#define STEPPER_OFF_PERIOD_uSEC 3 // each tick is
#define STEP_PULSE_MIN 2 // uSeconds
#define STEP_PULSE_MAX 10 // uSeconds
// =============== Don't change or comment these out ======================
// They are for legacy purposes and will not affect your I/O
#define X_STEP_BIT 0
#define Y_STEP_BIT 1
#define Z_STEP_BIT 2
#define A_STEP_BIT 3
#define B_STEP_BIT 4
#define C_STEP_BIT 5
#define STEP_MASK B111111
#define X_DIRECTION_BIT 0
#define Y_DIRECTION_BIT 1
#define Z_DIRECTION_BIT 2
#define A_DIRECTION_BIT 3
#define B_DIRECTION_BIT 4
#define C_DIRECTION_BIT 5
#define X_LIMIT_BIT 0
#define Y_LIMIT_BIT 1
#define Z_LIMIT_BIT 2
#define A_LIMIT_BIT 3
#define B_LIMIT_BIT 4
#define C_LIMIT_BIT 5
#define PROBE_MASK 1
#define CONTROL_MASK B1111
#endif // _machine_common_h

View File

@ -30,7 +30,7 @@
// Axis array index values. Must start with 0 and be continuous.
// Note: You set the number of axes used by changing N_AXIS.
// Be sure to define pins or servos in cpu_map.h
// Be sure to define pins or servos in the machine definition file.
#define X_AXIS 0 // Axis indexing value.
#define Y_AXIS 1
#define Z_AXIS 2

View File

@ -1,5 +1,5 @@
/*
kinematics_polar_coaster.cpp - Implements simple inverse kinematics for Grbl_ESP32
polar_coaster.cpp - Implements simple inverse kinematics for Grbl_ESP32
Part of Grbl_ESP32
Copyright (c) 2019 Barton Dring @buildlog
@ -49,10 +49,15 @@
*/
#include "grbl.h"
#ifdef CPU_MAP_POLAR_COASTER
#ifdef MACHINE_POLAR_COASTER
#ifdef USE_KINEMATICS
void calc_polar(float *target_xyz, float *polar, float last_angle);
float abs_angle(float ang);
static float last_angle = 0;
static float last_radius = 0;

View File

@ -34,7 +34,7 @@
1. In config.h un-comment #define USE_SERVO_AXES
2. In a cpu_map.h section, define servo pins and PWM channels like this ....
2. In the machine definition file in Machines/, define servo pins and PWM channels like this ....
#define SERVO_Y_PIN GPIO_NUM_14
#define SERVO_Y_CHANNEL_NUM 6