diff --git a/README.md b/README.md index 8670a27..d0d5cc1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It has been written to complement grblHAL and has features such as proper keyboa --- -Latest build date is 20230302, see the [changelog](changelog.md) for details. +Latest build date is 20230311, see the [changelog](changelog.md) for details. __NOTE:__ A settings reset will be performed on an update of builds earlier than 20230125. Backup and restore of settings is recommended. __IMPORTANT!__ A new setting has been introduced for ganged axes motors in build 20211121. I have only bench tested this for a couple of drivers, correct function should be verified after updating by those who have more than three motors configured. diff --git a/changelog.md b/changelog.md index ced103b..12ad356 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,17 @@ ## grblHAL changelog -20230302 +20230311 + +Core: + +* Fix for isisue #264, stepper motors not disabled when entering sleep mode. +__NOTE:__ all stepper motors will now be disabled even if the $37 setting is set to keep some enabled. + +* Fix for recent regression that disabled G7/G8 handling in lathe mode. + +--- + +20230302 Core: @@ -16,7 +27,7 @@ Drivers: Plugins: -* Keypad: Type fix for homed status field. +* Keypad: I2C display protocol plugin, type fix for homed status field. --- diff --git a/config.h b/config.h index 3abdbbd..7730773 100644 --- a/config.h +++ b/config.h @@ -24,7 +24,7 @@ For the most part, users will not need to directly modify these, but they are here for specific needs, i.e. performance tuning or adjusting to non-typical machines.
__IMPORTANT:__ Symbol/macro names starting with `DEFAULT_` contains default values for run-time - configuarble settings that can be changed with `$=` commands. + configurable settings that can be changed with `$=` commands. Any changes to these requires a full re-compiling of the source code to propagate them. A reset of non-volatile storage with `$RST=*` after reflashing is also required. */ diff --git a/gcode.c b/gcode.c index 28afd30..c583fef 100644 --- a/gcode.c +++ b/gcode.c @@ -1695,7 +1695,7 @@ status_code_t gc_execute_block (char *block) gc_block.values.xyz[idx] *= MM_PER_INCH; } while(idx); - if (command_words.G1 && gc_state.modal.diameter_mode != gc_block.modal.diameter_mode) { + if (command_words.G15 && gc_state.modal.diameter_mode != gc_block.modal.diameter_mode) { gc_state.modal.diameter_mode = gc_block.modal.diameter_mode; system_add_rt_report(Report_LatheXMode); } diff --git a/grbl.h b/grbl.h index bb69ec3..599bee5 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20230302 +#define GRBL_BUILD 20230311 #define GRBL_URL "https://github.com/grblHAL" diff --git a/sleep.c b/sleep.c index 98f0d9c..aa7ddd7 100644 --- a/sleep.c +++ b/sleep.c @@ -52,7 +52,6 @@ static void sleep_execute() // If reached, sleep counter has expired. Execute sleep procedures. // Notify user that Grbl has timed out and will be parking. // To exit sleep, resume or reset. Either way, the job will not be recoverable. - grbl.report.feedback_message(Message_SleepMode); system_set_exec_state_flag(EXEC_SLEEP); } diff --git a/state_machine.c b/state_machine.c index cc7c1b1..b85ae00 100644 --- a/state_machine.c +++ b/state_machine.c @@ -111,7 +111,16 @@ static void state_restore_conditions (restore_condition_t *condition) } } -bool initiate_hold (uint_fast16_t new_state) +static void enter_sleep (void) +{ + st_go_idle(); + spindle_all_off(); + hal.coolant.set_state((coolant_state_t){0}); + grbl.report.feedback_message(Message_SleepMode); + stateHandler = state_noop; +} + +static bool initiate_hold (uint_fast16_t new_state) { spindle_ptrs_t *spindle; spindle_num_t spindle_num = N_SYS_SPINDLE; @@ -304,6 +313,8 @@ void state_set (sys_state_t new_state) } } else sys_state = new_state; + if(sys_state == STATE_SLEEP && stateHandler != state_await_waypoint_retract) + enter_sleep(); break; case STATE_ALARM: @@ -532,13 +543,13 @@ static void state_await_hold (uint_fast16_t rt_exec) // Parking motion not possible. Just disable the spindle and coolant. // NOTE: Laser mode does not start a parking motion to ensure the laser stops immediately. spindle_all_off(); // De-energize - if (!settings.safety_door.flags.keep_coolant_on) - hal.coolant.set_state((coolant_state_t){0}); // De-energize + if (!settings.safety_door.flags.keep_coolant_on || sys_state == STATE_SLEEP) + hal.coolant.set_state((coolant_state_t){0}); // De-energize sys.parking_state = hal.control.get_state().safety_door_ajar ? Parking_DoorAjar : Parking_DoorClosed; } } else { spindle_all_off(); // De-energize - if (!settings.safety_door.flags.keep_coolant_on) + if (!settings.safety_door.flags.keep_coolant_on || sys_state == STATE_SLEEP) hal.coolant.set_state((coolant_state_t){0}); // De-energize sys.parking_state = hal.control.get_state().safety_door_ajar ? Parking_DoorAjar : Parking_DoorClosed; } @@ -565,6 +576,10 @@ static void state_await_resume (uint_fast16_t rt_exec) st_parking_restore_buffer(); // Restore step segment buffer to normal run state. } sys.parking_state = hal.control.get_state().safety_door_ajar ? Parking_DoorAjar : Parking_DoorClosed; + if(sys_state == STATE_SLEEP) { + enter_sleep(); + return; + } } if (rt_exec & EXEC_SLEEP) diff --git a/stepper.c b/stepper.c index 953d6cb..a3eff5b 100644 --- a/stepper.c +++ b/stepper.c @@ -202,7 +202,6 @@ void st_deenergize (void) } } - // Stepper state initialization. Cycle should only start if the st.cycle_start flag is // enabled. Startup init and limits call this function but shouldn't start the cycle. void st_wake_up (void) @@ -230,10 +229,14 @@ ISR_CODE void ISR_FUNC(st_go_idle)(void) // Set stepper driver idle state, disabled or enabled, depending on settings and circumstances. if (((settings.steppers.idle_lock_time != 255) || sys.rt_exec_alarm || state == STATE_SLEEP) && state != STATE_HOMING) { - // Force stepper dwell to lock axes for a defined amount of time to ensure the axes come to a complete - // stop and not drift from residual inertial forces at the end of the last movement. - sys.steppers_deenergize = true; - hal.delay_ms(settings.steppers.idle_lock_time, st_deenergize); + if(state == STATE_SLEEP) + hal.stepper.enable((axes_signals_t){0}); + else { + // Force stepper dwell to lock axes for a defined amount of time to ensure the axes come to a complete + // stop and not drift from residual inertial forces at the end of the last movement. + sys.steppers_deenergize = true; + hal.delay_ms(settings.steppers.idle_lock_time, st_deenergize); + } } else hal.stepper.enable(settings.steppers.idle_lock_time == 255 ? (axes_signals_t){AXES_BITMASK} : settings.steppers.deenergize); }