From 45b0e105892d08e76d5140871cfb032d445d2f20 Mon Sep 17 00:00:00 2001 From: Terje Io Date: Thu, 16 Jun 2022 08:45:10 +0200 Subject: [PATCH] Delayed calling hal.driver_reset until alarm and abort state has been established. --- changelog.md | 18 ++++++++++++++++++ grbl.h | 2 +- protocol.c | 11 +++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index dbdc9c9..3e88729 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,21 @@ ## grblHAL changelog +20220616: + +Core: + +* Delayed calling `hal.driver_reset` until alarm and abort states has been established. + +Drivers: + +* STM32F4xx : Fix for [issue #77](https://github.com/grblHAL/STM32F4xx/issues/77) - serial port clock selection. + +Plugins: + +* Spindle plugin: Fix for [issue #9](https://github.com/grblHAL/plugins/issues/9) - VFD spindle not stopped on STOP command. + +--- + 20220612: Core: @@ -20,6 +36,8 @@ Drivers: * ESP32 : Added missing file \(corexy.c\) to filelist, fixed incorrect URL in readme. +--- + 20220416: Drivers: diff --git a/grbl.h b/grbl.h index eb020fb..958ea29 100644 --- a/grbl.h +++ b/grbl.h @@ -34,7 +34,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20220612 +#define GRBL_BUILD 20220616 // The following symbols are set here if not already set by the compiler or in config.h // Do NOT change here! diff --git a/protocol.c b/protocol.c index e454a7d..21dfff4 100644 --- a/protocol.c +++ b/protocol.c @@ -412,8 +412,6 @@ bool protocol_exec_rt_system (void) killed = true; hal.spindle.set_state((spindle_state_t){0}, 0.0f); hal.coolant.set_state((coolant_state_t){0}); - // Tell driver/plugins about reset. - hal.driver_reset(); } // System alarm. Everything has shutdown by something that has gone severely wrong. Report @@ -421,6 +419,9 @@ bool protocol_exec_rt_system (void) // loop until system reset/abort. system_raise_alarm((alarm_code_t)rt_exec); + if(killed) // Tell driver/plugins about reset. + hal.driver_reset(); + // Halt everything upon a critical event flag. Currently hard and soft limits flag this. if ((alarm_code_t)rt_exec == Alarm_HardLimit || (alarm_code_t)rt_exec == Alarm_SoftLimit || @@ -463,12 +464,11 @@ bool protocol_exec_rt_system (void) // Execute system abort. if (rt_exec & EXEC_RESET) { + if(!killed) { // Kill spindle and coolant. hal.spindle.set_state((spindle_state_t){0}, 0.0f); hal.coolant.set_state((coolant_state_t){0}); - // Tell driver/plugins about reset. - hal.driver_reset(); } // Only place sys.abort is set true, when E-stop is not asserted. @@ -483,6 +483,9 @@ bool protocol_exec_rt_system (void) grbl.report.feedback_message(Message_MotorFault); } + if(!killed) // Tell driver/plugins about reset. + hal.driver_reset(); + return !sys.abort; // Nothing else to do but exit. }