diff --git a/README.md b/README.md index 8720167..1dbf327 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It has been written to complement grblHAL and has features such as proper keyboa --- -Latest build date is 20211015, see the [changelog](changelog.md) for details. +Latest build date is 20211019, see the [changelog](changelog.md) for details. __NOTE:__ Drivers built with more than three axes configured \(`N_AXIS` > `3`\) will force a settings reset when upgraded. Backup and restore of settings is recommended for these. --- @@ -80,4 +80,4 @@ List of Supported G-Codes: Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes. --- -2021-10-15 +2021-10-19 diff --git a/changelog.md b/changelog.md index 976123f..51bdd19 100644 --- a/changelog.md +++ b/changelog.md @@ -1,19 +1,34 @@ ## grblHAL changelog +Build 2021019: + +Core: +* Some minor changes to better support Trinamic drivers, probing and drivers/boards with limited number of control inputs \(cycle start, feed hold, ...\). + +Plugins: +* Trinamic driver enhancements: Allow different StallGuard threshold settings for seek and locate phases, option to reduce acceleration during homing, bug fixes++ + __NOTE__: _All_ plugin settings will be reset when updating if the Trinamic plugin is in use. Backup and restore. + +Drivers: +* Improved TMC2209 UART support for the STM32F407 based BTT SKR 2.0 board. By @fitch22 +* Added PicoBOB board support to RP2040 driver. By @andrewmarles + +Templates: +* Corrections for Arduino builds, a few minor bug fixes. + +--- + Build 2021015: Core: - * Improved `grbl.on_probe_fixture` event signature by adding pointer to the pending tool when fired when M6 is executing \(NULL if not\) and a flag indicating that the current XY-position is within 5mm of G59.3. * A few minor fixes. Plugins: - * I2C keypad: Switch to metric mode when jogging. * WebUI: added option to store read-only webui files in flash. Templates: - * Updated the [probe select](https://github.com/grblHAL/Templates/blob/master/my_plugin/probe%20select/my_plugin.c) example for the `grbl.on_probe_fixture` signature change and added an optional mode select parameter to M401. --- @@ -26,7 +41,7 @@ Core: Drivers: * Improved stream support in many drivers by adding support for _write_n_ characters. This is mainly used for outputting human readable settings descriptions. -* Added TMC2209 UART support to the STM32F407 based BTT SKR 2.0 board. By @fitch22. +* Added TMC2209 UART support to the STM32F407 based BTT SKR 2.0 board. By @fitch22 Plugins: * Added support for reading files from flash based storage to http daemon support code. diff --git a/core_handlers.h b/core_handlers.h index b68ffe0..4974c5b 100644 --- a/core_handlers.h +++ b/core_handlers.h @@ -79,7 +79,7 @@ typedef void (*on_realtime_report_ptr)(stream_write_ptr stream_write, report_tra typedef void (*on_unknown_feedback_message_ptr)(stream_write_ptr stream_write); typedef void (*on_stream_changed_ptr)(stream_type_t type); typedef bool (*on_laser_ppi_enable_ptr)(uint_fast16_t ppi, uint_fast16_t pulse_length); -typedef void (*on_homing_rate_set_ptr)(axes_signals_t axes, float rate); +typedef void (*on_homing_rate_set_ptr)(axes_signals_t axes, float rate, bool pulloff); typedef bool (*on_probe_fixture_ptr)(tool_data_t *tool, bool at_g59_3, bool on); typedef status_code_t (*on_unknown_sys_command_ptr)(sys_state_t state, char *line); // return Status_Unhandled. typedef status_code_t (*on_user_command_ptr)(char *line); diff --git a/gcode.c b/gcode.c index 1018391..49cf3bd 100644 --- a/gcode.c +++ b/gcode.c @@ -1397,7 +1397,7 @@ status_code_t gc_execute_block(char *block) if (!gc_block.words.s) gc_block.values.s = gc_state.modal.spindle_rpm_mode == SpindleSpeedMode_RPM ? gc_state.spindle.rpm : gc_state.spindle.css.surface_speed; - else if(gc_state.modal.spindle_rpm_mode == SpindleSpeedMode_CSS) + else if(!user_words.s && gc_state.modal.spindle_rpm_mode == SpindleSpeedMode_CSS) // Unsure what to do about S values when in SpindleSpeedMode_CSS - ignore? For now use it to (re)calculate surface speed. // Reinsert commented out code above if this is removed!! gc_block.values.s *= (gc_block.modal.units_imperial ? MM_PER_INCH * 12.0f : 1000.0f); // convert surface speed to mm/min @@ -2497,7 +2497,8 @@ status_code_t gc_execute_block(char *block) // [4. Set spindle speed ]: if(gc_state.modal.spindle_rpm_mode == SpindleSpeedMode_CSS) { - gc_state.spindle.css.surface_speed = gc_block.values.s; + if(!user_words.s) + gc_state.spindle.css.surface_speed = gc_block.values.s; if((plan_data.condition.is_rpm_pos_adjusted = gc_block.modal.motion != MotionMode_None && gc_block.modal.motion != MotionMode_Seek)) { gc_state.spindle.css.active = true; gc_state.spindle.css.axis = plane.axis_1; @@ -2514,7 +2515,7 @@ status_code_t gc_execute_block(char *block) } } - if ((gc_state.spindle.rpm != gc_block.values.s) || gc_parser_flags.spindle_force_sync) { + if (!user_words.s && ((gc_state.spindle.rpm != gc_block.values.s) || gc_parser_flags.spindle_force_sync)) { if (gc_state.modal.spindle.on && !gc_parser_flags.laser_is_motion) spindle_sync(gc_state.modal.spindle, gc_parser_flags.laser_disable ? 0.0f : gc_block.values.s); gc_state.spindle.rpm = gc_block.values.s; // Update spindle speed state. @@ -2656,7 +2657,7 @@ status_code_t gc_execute_block(char *block) protocol_buffer_synchronize(); // Ensure user defined mcode is executed when specified in program. gc_block.words.mask = user_words.mask; hal.user_mcode.execute(state_get(), &gc_block); -// gc_block.words.mask ^= user_words.mask; + gc_block.words.mask = 0; } // [10. Dwell ]: diff --git a/grbl.h b/grbl.h index faa2997..26a511d 100644 --- a/grbl.h +++ b/grbl.h @@ -34,7 +34,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_VERSION_BUILD "20211015" +#define GRBL_VERSION_BUILD "20211019" // The following symbols are set here if not already set by the compiler or in config.h // Do NOT change here! diff --git a/limits.c b/limits.c index 1074b60..c30a05a 100644 --- a/limits.c +++ b/limits.c @@ -312,11 +312,12 @@ static bool limits_homing_cycle (axes_signals_t cycle, axes_signals_t auto_squar } } while(idx); - homing_rate *= sqrtf(n_active_axis); // [sqrt(N_AXIS)] Adjust so individual axes all move at homing rate. sys.homing_axis_lock.mask = axislock.mask; if(grbl.on_homing_rate_set) - grbl.on_homing_rate_set(cycle, homing_rate); + grbl.on_homing_rate_set(cycle, homing_rate, !approach); + + homing_rate *= sqrtf(n_active_axis); // [sqrt(N_AXIS)] Adjust so individual axes all move at homing rate. // Perform homing cycle. Planner buffer should be empty, as required to initiate the homing cycle. plan_data.feed_rate = homing_rate; // Set current homing rate. @@ -430,7 +431,7 @@ static bool limits_homing_cycle (axes_signals_t cycle, axes_signals_t auto_squar hal.stepper.disable_motors((axes_signals_t){0}, SquaringMode_Both); } - } while (cycle.mask && n_cycle-- > 0); + } while (homing_rate > 0.0f && cycle.mask && n_cycle-- > 0); // Pull off B motor to compensate for switch inaccuracy when configured. if(auto_square.mask && settings.axis[dual_motor_axis].dual_axis_offset != 0.0f) { diff --git a/motion_control.c b/motion_control.c index a131df8..25d9302 100644 --- a/motion_control.c +++ b/motion_control.c @@ -743,7 +743,6 @@ void mc_dwell (float seconds) } } - // Perform homing cycle to locate and set machine zero. Only '$H' executes this command. // NOTE: There should be no motions in the buffer and Grbl must be in an idle state before // executing the homing cycle. This prevents incorrect buffered plans after homing. @@ -768,6 +767,9 @@ status_code_t mc_homing_cycle (axes_signals_t cycle) #endif } else { + if(settings.homing.seek_rate <= 0.0f) + return Status_HomingDisabled; + // Check and abort homing cycle, if hard limits are already enabled. Helps prevent problems // with machines with limits wired on both ends of travel to one limit pin. // TODO: Move the pin-specific LIMIT_BIT call to limits.c as a function. diff --git a/pin_bits_masks.h b/pin_bits_masks.h index a8cc6a2..b5ecbba 100644 --- a/pin_bits_masks.h +++ b/pin_bits_masks.h @@ -37,17 +37,37 @@ #endif #ifndef RESET_BIT +#ifdef RESET_PIN #define RESET_BIT (1< 0 && !sys.report.wco) + if(wco_counter > 0 && !sys.report.wco) { + if(wco_counter > (REPORT_WCO_REFRESH_IDLE_COUNT - 1) && state_get() == STATE_IDLE) + wco_counter = REPORT_WCO_REFRESH_IDLE_COUNT - 1; wco_counter--; - else + } else wco_counter = state_get() & (STATE_HOMING|STATE_CYCLE|STATE_HOLD|STATE_JOG|STATE_SAFETY_DOOR) ? (REPORT_WCO_REFRESH_BUSY_COUNT - 1) // Reset counter for slow refresh : (REPORT_WCO_REFRESH_IDLE_COUNT - 1); diff --git a/settings.c b/settings.c index 4cbfffc..fedd7af 100644 --- a/settings.c +++ b/settings.c @@ -603,14 +603,14 @@ PROGMEM static const setting_descr_t setting_descr[] = { { Setting_PositionIGain, "" }, { Setting_PositionDGain, "" }, { Setting_PositionIMaxError, "Spindle sync PID max integrator error." }, - { Setting_AxisStepsPerMM, "Axis travel resolution in steps per millimeter." }, - { Setting_AxisMaxRate, "Axis maximum rate. Used as G0 rapid rate." }, - { Setting_AxisAcceleration, "Axis acceleration. Used for motion planning to not exceed motor torque and lose steps." }, + { Setting_AxisStepsPerMM, "Travel resolution in steps per millimeter." }, + { Setting_AxisMaxRate, "Maximum rate. Used as G0 rapid rate." }, + { Setting_AxisAcceleration, "Acceleration. Used for motion planning to not exceed motor torque and lose steps." }, { Setting_AxisMaxTravel, "Maximum axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances." }, #ifdef ENABLE_BACKLASH_COMPENSATION - { Setting_AxisBacklash, "Axis backlash distance to compensate for." }, + { Setting_AxisBacklash, "Backlash distance to compensate for." }, #endif - { Setting_AxisAutoSquareOffset, "Axis offset between sides to compensate for homing switches inaccuracies." }, + { Setting_AxisAutoSquareOffset, "Offset between sides to compensate for homing switches inaccuracies." }, { Setting_SpindleAtSpeedTolerance, "Spindle at speed" }, { Setting_ToolChangeMode, "Normal: allows jogging for manual touch off. Set new position manually.\\n\\n" "Manual touch off: retracts tool axis to home position for tool change, use jogging or $TPW for touch off.\\n\\n" @@ -677,7 +677,9 @@ static void restore_override_backup (void) // Note: only allowed when current state is idle. bool settings_override_acceleration (uint8_t axis, float acceleration) { - if(state_get() != STATE_IDLE) + sys_state_t state = state_get(); + + if(!(state == STATE_IDLE || (state & (STATE_HOMING|STATE_ALARM)))) return false; if(acceleration <= 0.0f) {