diff --git a/doc/csv/alarm_codes_en_US.csv b/doc/csv/alarm_codes_en_US.csv index 1ab2b8ae..685b61e6 100644 --- a/doc/csv/alarm_codes_en_US.csv +++ b/doc/csv/alarm_codes_en_US.csv @@ -8,3 +8,4 @@ "7","Homing fail","Homing fail. Safety door was opened during homing cycle." "8","Homing fail","Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring." "9","Homing fail","Homing fail. Could not find limit switch within search distances. Try increasing max travel, decreasing pull-off distance, or check wiring." +"10","Homing fail","Homing fail. Second dual axis limit switch failed to trigger within configured search distance after first. Try increasing trigger fail distance or check wiring." diff --git a/doc/csv/build_option_codes_en_US.csv b/doc/csv/build_option_codes_en_US.csv index ab05ef29..54514bb6 100644 --- a/doc/csv/build_option_codes_en_US.csv +++ b/doc/csv/build_option_codes_en_US.csv @@ -19,4 +19,5 @@ $,Restore EEPROM `$` settings command,Disabled I,Build info write user string command,Disabled E,Force sync upon EEPROM write,Disabled W,Force sync upon work coordinate offset change,Disabled -L,Homing initialization auto-lock,Disabled \ No newline at end of file +L,Homing initialization auto-lock,Disabled +2,Dual axis motors,Enabled \ No newline at end of file diff --git a/doc/log/commit_log_v1.1.txt b/doc/log/commit_log_v1.1.txt index 2aa110de..e875ee3b 100644 --- a/doc/log/commit_log_v1.1.txt +++ b/doc/log/commit_log_v1.1.txt @@ -1,3 +1,40 @@ +---------------- +Date: 2018-11-12 +Author: Sonny Jeon +Subject: Update grbl.h + +---------------- +Date: 2018-11-12 +Author: Sonny Jeon +Subject: Update system.c + +Correct control pin state checking within pin change interrupt. Improper if-else statements could lead to missed signal. + +---------------- +Date: 2018-11-12 +Author: Sonny Jeon +Subject: Update gcode.c + +If statement bug fix related to jog motion modal group error checking. + +---------------- +Date: 2018-06-14 +Author: Sonny Jeon +Subject: Spindle/coolant rare bug fixes. Free more flash. + +[new] Altered the way default settings are stored and restored. Saved about 300 bytes(!) of flashed size. Should free up enough for certain configurations of CoreXY machines. + +[fix] When the optional M7 mist coolant IO was enabled, coolant overrides was not disabling correctly. + +[fix] Coolant override states was not restored correctly after a parking motion in certain situations. It would restore programmed state, rather than current overridden state. + +[fix] Now allow coolant overrides to operate during jogging motion. + +[fix] Invert control pin mask typo. + +[new] Added a new build info feedback mechanism for enabling the safety door input pin. + + ---------------- Date: 2018-06-09 Author: Jon diff --git a/grbl/config.h b/grbl/config.h index 4d36b54e..f48d9586 100644 --- a/grbl/config.h +++ b/grbl/config.h @@ -586,9 +586,11 @@ // to ensure the laser doesn't inadvertently remain powered while at a stop and cause a fire. #define DISABLE_LASER_DURING_HOLD // Default enabled. Comment to disable. -// Enables a piecewise linear model of the spindle PWM/speed output. Requires a solution by the -// 'fit_nonlinear_spindle.py' script in the /doc/script folder of the repo. See file comments -// on how to gather spindle data and run the script to generate a solution. +// This feature alters the spindle PWM/speed to a nonlinear output with a simple piecewise linear +// curve. Useful for spindles that don't produce the right RPM from Grbl's standard spindle PWM +// linear model. Requires a solution by the 'fit_nonlinear_spindle.py' script in the /doc/script +// folder of the repo. See file comments on how to gather spindle data and run the script to +// generate a solution. // #define ENABLE_PIECEWISE_LINEAR_SPINDLE // Default disabled. Uncomment to enable. // N_PIECES, RPM_MAX, RPM_MIN, RPM_POINTxx, and RPM_LINE_XX constants are all set and given by @@ -610,6 +612,68 @@ #define RPM_LINE_A4 1.203413e-01 // Used N_PIECES = 4. A and B constants of line 4. #define RPM_LINE_B4 1.151360e+03 +/* --------------------------------------------------------------------------------------- + This optional dual axis feature is primarily for the homing cycle to locate two sides of + a dual-motor gantry independently, i.e. self-squaring. This requires an additional limit + switch for the cloned motor. To self square, both limit switches on the cloned axis must + be physically positioned to trigger when the gantry is square. Highly recommend keeping + the motors always enabled to ensure the gantry stays square with the $1=255 setting. + + For Grbl on the Arduino Uno, the cloned axis limit switch must to be shared with and + wired with z-axis limit pin due to the lack of available pins. The homing cycle must home + the z-axis and cloned axis in different cycles, which is already the default config. + + The dual axis feature works by cloning an axis step output onto another pair of step + and direction pins. The step pulse and direction of the cloned motor can be set + independently of the main axis motor. However to save precious flash and memory, this + dual axis feature must share the same settings (step/mm, max speed, acceleration) as the + parent motor. This is NOT a feature for an independent fourth axis. Only a motor clone. + + WARNING: Make sure to test the directions of your dual axis motors! They must be setup + to move the same direction BEFORE running your first homing cycle or any long motion! + Motors moving in opposite directions can cause serious damage to your machine! Use this + dual axis feature at your own risk. +*/ +// NOTE: This feature requires approximately 400 bytes of flash. Certain configurations can +// run out of flash to fit on an Arduino 328p/Uno. Only X and Y axes are supported. Variable +// spindle/laser mode IS supported, but only for one config option. Core XY, spindle direction +// pin, and M7 mist coolant are disabled/not supported. +// #define ENABLE_DUAL_AXIS // Default disabled. Uncomment to enable. + +// Select the one axis to mirror another motor. Only X and Y axis is supported at this time. +#define DUAL_AXIS_SELECT X_AXIS // Must be either X_AXIS or Y_AXIS + +// To prevent the homing cycle from racking the dual axis, when one limit triggers before the +// other due to switch failure or noise, the homing cycle will automatically abort if the second +// motor's limit switch does not trigger within the three distance parameters defined below. +// Axis length percent will automatically compute a fail distance as a percentage of the max +// travel of the other non-dual axis, i.e. if dual axis select is X_AXIS at 5.0%, then the fail +// distance will be computed as 5.0% of y-axis max travel. Fail distance max and min are the +// limits of how far or little a valid fail distance is. +#define DUAL_AXIS_HOMING_FAIL_AXIS_LENGTH_PERCENT 5.0 // Float (percent) +#define DUAL_AXIS_HOMING_FAIL_DISTANCE_MAX 25.0 // Float (mm) +#define DUAL_AXIS_HOMING_FAIL_DISTANCE_MIN 2.5 // Float (mm) + +// Dual axis pin configuration currently supports two shields. Uncomment the shield you want, +// and comment out the other one(s). +// NOTE: Protoneer CNC Shield v3.51 has A.STP and A.DIR wired to pins A4 and A3 respectively. +// The variable spindle (i.e. laser mode) build option works and may be enabled or disabled. +// Coolant pin A3 is moved to D13, replacing spindle direction. +#define DUAL_AXIS_CONFIG_PROTONEER_V3_51 // Uncomment to select. Comment other configs. + +// NOTE: Arduino CNC Shield Clone (Originally Protoneer v3.0) has A.STP and A.DIR wired to +// D12 and D13, respectively. With the limit pins and stepper enable pin on this same port, +// the spindle enable pin had to be moved and spindle direction pin deleted. The spindle +// enable pin now resides on A3, replacing coolant enable. Coolant enable is bumped over to +// pin A4. Spindle enable is used far more and this pin setup helps facilitate users to +// integrate this feature without arguably too much work. +// Variable spindle (i.e. laser mode) does NOT work with this shield as configured. While +// variable spindle technically can work with this shield, it requires too many changes for +// most user setups to accomodate. It would best be implemented by sharing all limit switches +// on pins D9/D10 (as [X1,Z]/[X2,Y] or [X,Y2]/[Y1,Z]), home each axis independently, and +// updating lots of code to ensure everything is running correctly. +// #define DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE // Uncomment to select. Comment other configs. + /* --------------------------------------------------------------------------------------- OEM Single File Configuration Option diff --git a/grbl/cpu_map.h b/grbl/cpu_map.h index 0e2b25e5..9f43a3fc 100644 --- a/grbl/cpu_map.h +++ b/grbl/cpu_map.h @@ -67,39 +67,13 @@ #else #define Z_LIMIT_BIT 3 // Uno Digital Pin 11 #endif - #define LIMIT_MASK ((1< 62.5kHz + // #define SPINDLE_TCCRB_INIT_MASK (1< 7.8kHz (Used in v0.9) + // #define SPINDLE_TCCRB_INIT_MASK ((1< 1.96kHz + #define SPINDLE_TCCRB_INIT_MASK (1< 0.98kHz (J-tech laser) + + // NOTE: On the 328p, these must be the same as the SPINDLE_ENABLE settings. + #define SPINDLE_PWM_DDR DDRB + #define SPINDLE_PWM_PORT PORTB + #define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11 + + #else + + // Dual axis feature requires an independent step pulse pin to operate. The independent direction pin is not + // absolutely necessary but facilitates easy direction inverting with a Grbl $$ setting. These pins replace + // the spindle direction and optional coolant mist pins. + + #ifdef DUAL_AXIS_CONFIG_PROTONEER_V3_51 + // NOTE: Step pulse and direction pins may be on any port and output pin. + #define STEP_DDR_DUAL DDRC + #define STEP_PORT_DUAL PORTC + #define DUAL_STEP_BIT 4 // Uno Analog Pin 4 + #define STEP_MASK_DUAL ((1< 62.5kHz + // #define SPINDLE_TCCRB_INIT_MASK (1< 7.8kHz (Used in v0.9) + // #define SPINDLE_TCCRB_INIT_MASK ((1< 1.96kHz + #define SPINDLE_TCCRB_INIT_MASK (1< 0.98kHz (J-tech laser) + + // NOTE: On the 328p, these must be the same as the SPINDLE_ENABLE settings. + #define SPINDLE_PWM_DDR DDRB + #define SPINDLE_PWM_PORT PORTB + #define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11 + #endif + + // NOTE: Variable spindle not supported with this shield. + #ifdef DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE + // NOTE: Step pulse and direction pins may be on any port and output pin. + #define STEP_DDR_DUAL DDRB + #define STEP_PORT_DUAL PORTB + #define DUAL_STEP_BIT 4 // Uno Digital Pin 12 + #define STEP_MASK_DUAL ((1< 62.5kHz - // #define SPINDLE_TCCRB_INIT_MASK (1< 7.8kHz (Used in v0.9) - // #define SPINDLE_TCCRB_INIT_MASK ((1< 1.96kHz - #define SPINDLE_TCCRB_INIT_MASK (1< 0.98kHz (J-tech laser) - - // NOTE: On the 328p, these must be the same as the SPINDLE_ENABLE settings. - #define SPINDLE_PWM_DDR DDRB - #define SPINDLE_PWM_PORT PORTB - #define SPINDLE_PWM_BIT 3 // Uno Digital Pin 11 #endif diff --git a/grbl/defaults.h b/grbl/defaults.h index dbbbb934..2e461300 100644 --- a/grbl/defaults.h +++ b/grbl/defaults.h @@ -369,6 +369,84 @@ #define DEFAULT_HOMING_PULLOFF 1.0 // mm #endif +#ifdef DEFAULTS_BOBSCNC_E3 + // Grbl settings for Bob's CNC E3 Machine + // https://www.bobscnc.com/products/e3-cnc-engraving-kit + #define DEFAULT_X_STEPS_PER_MM 80.0 + #define DEFAULT_Y_STEPS_PER_MM 80.0 + #define DEFAULT_Z_STEPS_PER_MM 2267.717 + #define DEFAULT_X_MAX_RATE 10000.0 // mm/min + #define DEFAULT_Y_MAX_RATE 10000.0 // mm/min + #define DEFAULT_Z_MAX_RATE 500.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 (300.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 + #define DEFAULT_X_MAX_TRAVEL 450.0 // mm NOTE: Must be a positive value. + #define DEFAULT_Y_MAX_TRAVEL 390.0 // mm NOTE: Must be a positive value. + #define DEFAULT_Z_MAX_TRAVEL 85.0 // mm NOTE: Must be a positive value. + #define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm + #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm + #define DEFAULT_STEP_PULSE_MICROSECONDS 5 + #define DEFAULT_STEPPING_INVERT_MASK 0 + #define DEFAULT_DIRECTION_INVERT_MASK 0 + #define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled) + #define DEFAULT_STATUS_REPORT_MASK 1 // MPos enabled + #define DEFAULT_JUNCTION_DEVIATION 0.01 // mm + #define DEFAULT_ARC_TOLERANCE 0.002 // mm + #define DEFAULT_REPORT_INCHES 1 // true + #define DEFAULT_INVERT_ST_ENABLE 0 // false + #define DEFAULT_INVERT_LIMIT_PINS 1 // true + #define DEFAULT_SOFT_LIMIT_ENABLE 1 // true + #define DEFAULT_HARD_LIMIT_ENABLE 0 // false + #define DEFAULT_INVERT_PROBE_PIN 0 // false + #define DEFAULT_LASER_MODE 0 // false + #define DEFAULT_HOMING_ENABLE 1 // true + #define DEFAULT_HOMING_DIR_MASK 3 // move xy -dir, z dir + #define DEFAULT_HOMING_FEED_RATE 500.0 // mm/min + #define DEFAULT_HOMING_SEEK_RATE 4000.0 // mm/min + #define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k) + #define DEFAULT_HOMING_PULLOFF 5.0 // mm +#endif + +#ifdef DEFAULTS_BOBSCNC_E4 + // Grbl settings for Bob's CNC E4 Machine + // https://www.bobscnc.com/products/e4-cnc-router + #define DEFAULT_X_STEPS_PER_MM 80.0 + #define DEFAULT_Y_STEPS_PER_MM 80.0 + #define DEFAULT_Z_STEPS_PER_MM 2267.717 + #define DEFAULT_X_MAX_RATE 10000.0 // mm/min + #define DEFAULT_Y_MAX_RATE 10000.0 // mm/min + #define DEFAULT_Z_MAX_RATE 500.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 (300.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2 + #define DEFAULT_X_MAX_TRAVEL 610.0 // mm NOTE: Must be a positive value. + #define DEFAULT_Y_MAX_TRAVEL 610.0 // mm NOTE: Must be a positive value. + #define DEFAULT_Z_MAX_TRAVEL 85.0 // mm NOTE: Must be a positive value. + #define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm + #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm + #define DEFAULT_STEP_PULSE_MICROSECONDS 5 + #define DEFAULT_STEPPING_INVERT_MASK 0 + #define DEFAULT_DIRECTION_INVERT_MASK 0 + #define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled) + #define DEFAULT_STATUS_REPORT_MASK 1 // MPos enabled + #define DEFAULT_JUNCTION_DEVIATION 0.01 // mm + #define DEFAULT_ARC_TOLERANCE 0.002 // mm + #define DEFAULT_REPORT_INCHES 1 // true + #define DEFAULT_INVERT_ST_ENABLE 0 // false + #define DEFAULT_INVERT_LIMIT_PINS 1 // true + #define DEFAULT_SOFT_LIMIT_ENABLE 1 // true + #define DEFAULT_HARD_LIMIT_ENABLE 0 // false + #define DEFAULT_INVERT_PROBE_PIN 0 // false + #define DEFAULT_LASER_MODE 0 // false + #define DEFAULT_HOMING_ENABLE 1 // true + #define DEFAULT_HOMING_DIR_MASK 3 // move xy -dir, z dir + #define DEFAULT_HOMING_FEED_RATE 500.0 // mm/min + #define DEFAULT_HOMING_SEEK_RATE 4000.0 // mm/min + #define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k) + #define DEFAULT_HOMING_PULLOFF 5.0 // mm +#endif + #ifdef DEFAULTS_ZEN_TOOLWORKS_7x7 // Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors. // Leadscrew is different from some ZTW kits, where most are 1.25mm/rev rather than 8.0mm/rev here. diff --git a/grbl/grbl.h b/grbl/grbl.h index 6a842100..89884a2d 100644 --- a/grbl/grbl.h +++ b/grbl/grbl.h @@ -22,8 +22,8 @@ #define grbl_h // Grbl versioning system -#define GRBL_VERSION "1.1g" -#define GRBL_VERSION_BUILD "20181112" +#define GRBL_VERSION "1.1h" +#define GRBL_VERSION_BUILD "20190724" // Define standard libraries used by Grbl. #include @@ -111,6 +111,30 @@ #error "Override refresh must be greater than zero." #endif +#if defined(ENABLE_DUAL_AXIS) + #if !((DUAL_AXIS_SELECT == X_AXIS) || (DUAL_AXIS_SELECT == Y_AXIS)) + #error "Dual axis currently supports X or Y axes only." + #endif + #if defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && defined(VARIABLE_SPINDLE) + #error "VARIABLE_SPINDLE not supported with DUAL_AXIS_CNC_SHIELD_CLONE." + #endif + #if defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && defined(DUAL_AXIS_CONFIG_PROTONEER_V3_51) + #error "More than one dual axis configuration found. Select one." + #endif + #if !defined(DUAL_AXIS_CONFIG_CNC_SHIELD_CLONE) && !defined(DUAL_AXIS_CONFIG_PROTONEER_V3_51) + #error "No supported dual axis configuration found. Select one." + #endif + #if defined(COREXY) + #error "CORE XY not supported with dual axis feature." + #endif + #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) + #error "USE_SPINDLE_DIR_AS_ENABLE_PIN not supported with dual axis feature." + #endif + #if defined(ENABLE_M7) + #error "ENABLE_M7 not supported with dual axis feature." + #endif +#endif + // --------------------------------------------------------------------------------------- #endif diff --git a/grbl/limits.c b/grbl/limits.c index 3cc2556b..1348c147 100644 --- a/grbl/limits.c +++ b/grbl/limits.c @@ -30,6 +30,14 @@ #define HOMING_AXIS_LOCATE_SCALAR 5.0 // Must be > 1 to ensure limit switch is cleared. #endif +#ifdef ENABLE_DUAL_AXIS + // Flags for dual axis async limit trigger check. + #define DUAL_AXIS_CHECK_DISABLE 0 // Must be zero + #define DUAL_AXIS_CHECK_ENABLE bit(0) + #define DUAL_AXIS_CHECK_TRIGGER_1 bit(1) + #define DUAL_AXIS_CHECK_TRIGGER_2 bit(2) +#endif + void limits_init() { LIMIT_DDR &= ~(LIMIT_MASK); // Set as input pins @@ -79,6 +87,9 @@ uint8_t limits_get_state() for (idx=0; idx dual_fail_distance) { + system_set_exec_alarm(EXEC_ALARM_HOMING_FAIL_DUAL_APPROACH); + mc_reset(); + protocol_execute_realtime(); + return; + } + } + } else { + dual_axis_async_check |= DUAL_AXIS_CHECK_ENABLE; + dual_trigger_position = sys_position[DUAL_AXIS_SELECT]; + } + } + #endif } st_prep_buffer(); // Check and prep segment buffer. NOTE: Should take no longer than 200us. @@ -273,7 +339,11 @@ void limits_go_home(uint8_t cycle_mask) } } - } while (STEP_MASK & axislock); + #ifdef ENABLE_DUAL_AXIS + } while ((STEP_MASK & axislock) || (sys.homing_axis_lock_dual)); + #else + } while (STEP_MASK & axislock); + #endif st_reset(); // Immediately force kill steppers and reset step segment buffer. delay_ms(settings.homing_debounce_delay); // Delay to allow transient dynamics to dissipate. diff --git a/grbl/planner.c b/grbl/planner.c index 4839bbf4..49ff7229 100644 --- a/grbl/planner.c +++ b/grbl/planner.c @@ -456,7 +456,7 @@ uint8_t plan_buffer_line(float *target, plan_line_data_t *pl_data) float nominal_speed = plan_compute_profile_nominal_speed(block); plan_compute_profile_parameters(block, nominal_speed, pl.previous_nominal_speed); pl.previous_nominal_speed = nominal_speed; - + // Update previous path unit_vector and planner position. memcpy(pl.previous_unit_vec, unit_vec, sizeof(unit_vec)); // pl.previous_unit_vec[] = unit_vec[] memcpy(pl.position, target_steps, sizeof(target_steps)); // pl.position[] = target_steps[] diff --git a/grbl/report.c b/grbl/report.c index 3e78b471..666608a3 100644 --- a/grbl/report.c +++ b/grbl/report.c @@ -436,6 +436,9 @@ void report_build_info(char *line) #ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled. serial_write('W'); #endif + #ifdef ENABLE_DUAL_AXIS + serial_write('2'); + #endif // NOTE: Compiled values, like override increments/max/min values, may be added at some point later. serial_write(','); print_uint8_base10(BLOCK_BUFFER_SIZE-1); @@ -569,9 +572,21 @@ void report_realtime_status() printPgmString(PSTR("|Pn:")); if (prb_pin_state) { serial_write('P'); } if (lim_pin_state) { - if (bit_istrue(lim_pin_state,bit(X_AXIS))) { serial_write('X'); } - if (bit_istrue(lim_pin_state,bit(Y_AXIS))) { serial_write('Y'); } - if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); } + #ifdef ENABLE_DUAL_AXIS + #if (DUAL_AXIS_SELECT == X_AXIS) + if (bit_istrue(lim_pin_state,(bit(X_AXIS)|bit(N_AXIS)))) { serial_write('X'); } + if (bit_istrue(lim_pin_state,bit(Y_AXIS))) { serial_write('Y'); } + #endif + #if (DUAL_AXIS_SELECT == Y_AXIS) + if (bit_istrue(lim_pin_state,bit(X_AXIS))) { serial_write('X'); + if (bit_istrue(lim_pin_state,(bit(Y_AXIS)|bit(N_AXIS)))) { serial_write('Y'); } + #endif + if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); } + #else + if (bit_istrue(lim_pin_state,bit(X_AXIS))) { serial_write('X'); } + if (bit_istrue(lim_pin_state,bit(Y_AXIS))) { serial_write('Y'); } + if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); } + #endif } if (ctrl_pin_state) { #ifdef ENABLE_SAFETY_DOOR_INPUT_PIN diff --git a/grbl/spindle_control.c b/grbl/spindle_control.c index 61cb90b8..550b7520 100644 --- a/grbl/spindle_control.c +++ b/grbl/spindle_control.c @@ -30,7 +30,6 @@ void spindle_init() { #ifdef VARIABLE_SPINDLE - // Configure variable spindle PWM and enable pin, if requried. On the Uno, PWM and enable are // combined unless configured otherwise. SPINDLE_PWM_DDR |= (1<step_event_count >> 1); } st.dir_outbits = st.exec_block->direction_bits ^ dir_port_invert_mask; + #ifdef ENABLE_DUAL_AXIS + st.dir_outbits_dual = st.exec_block->direction_bits_dual ^ dir_port_invert_mask_dual; + #endif #ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING // With AMASS enabled, adjust Bresenham axis increment counters according to AMASS level. @@ -384,6 +407,9 @@ ISR(TIMER1_COMPA_vect) // Reset step out bits. st.step_outbits = 0; + #ifdef ENABLE_DUAL_AXIS + st.step_outbits_dual = 0; + #endif // Execute step displacement profile by Bresenham line algorithm #ifdef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING @@ -393,6 +419,9 @@ ISR(TIMER1_COMPA_vect) #endif if (st.counter_x > st.exec_block->step_event_count) { st.step_outbits |= (1<step_event_count; if (st.exec_block->direction_bits & (1< st.exec_block->step_event_count) { st.step_outbits |= (1<step_event_count; if (st.exec_block->direction_bits & (1<direction_bits = pl_block->direction_bits; + #ifdef ENABLE_DUAL_AXIS + #if (DUAL_AXIS_SELECT == X_AXIS) + if (st_prep_block->direction_bits & (1<direction_bits & (1<direction_bits_dual = (1<direction_bits_dual = 0; } + #endif uint8_t idx; #ifndef ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING for (idx=0; idxsteps[idx] = (pl_block->steps[idx] << 1); } diff --git a/grbl/system.h b/grbl/system.h index 4d4f6128..cfc92738 100644 --- a/grbl/system.h +++ b/grbl/system.h @@ -38,15 +38,16 @@ #define EXEC_SLEEP bit(7) // bitmask 10000000 // Alarm executor codes. Valid values (1-255). Zero is reserved. -#define EXEC_ALARM_HARD_LIMIT 1 -#define EXEC_ALARM_SOFT_LIMIT 2 -#define EXEC_ALARM_ABORT_CYCLE 3 -#define EXEC_ALARM_PROBE_FAIL_INITIAL 4 -#define EXEC_ALARM_PROBE_FAIL_CONTACT 5 -#define EXEC_ALARM_HOMING_FAIL_RESET 6 -#define EXEC_ALARM_HOMING_FAIL_DOOR 7 -#define EXEC_ALARM_HOMING_FAIL_PULLOFF 8 -#define EXEC_ALARM_HOMING_FAIL_APPROACH 9 +#define EXEC_ALARM_HARD_LIMIT 1 +#define EXEC_ALARM_SOFT_LIMIT 2 +#define EXEC_ALARM_ABORT_CYCLE 3 +#define EXEC_ALARM_PROBE_FAIL_INITIAL 4 +#define EXEC_ALARM_PROBE_FAIL_CONTACT 5 +#define EXEC_ALARM_HOMING_FAIL_RESET 6 +#define EXEC_ALARM_HOMING_FAIL_DOOR 7 +#define EXEC_ALARM_HOMING_FAIL_PULLOFF 8 +#define EXEC_ALARM_HOMING_FAIL_APPROACH 9 +#define EXEC_ALARM_HOMING_FAIL_DUAL_APPROACH 10 // Override bit maps. Realtime bitflags to control feed, rapid, spindle, and coolant overrides. // Spindle/coolant and feed/rapids are separated into two controlling flag variables. @@ -131,6 +132,9 @@ typedef struct { uint8_t step_control; // Governs the step segment generator depending on system state. uint8_t probe_succeeded; // Tracks if last probing cycle was successful. uint8_t homing_axis_lock; // Locks axes when limits engage. Used as an axis motion mask in the stepper ISR. + #ifdef ENABLE_DUAL_AXIS + uint8_t homing_axis_lock_dual; + #endif uint8_t f_override; // Feed rate override value in percent uint8_t r_override; // Rapids override value in percent uint8_t spindle_speed_ovr; // Spindle speed value in percent