From 5eb4fdacdde2778fe2542bc0ebbba363b840356f Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Mon, 9 Jan 2017 06:25:52 -0500 Subject: [PATCH] Fix interrupt enable restore bug --- grbl/system.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/grbl/system.c b/grbl/system.c index 491dfdf..413aa7b 100644 --- a/grbl/system.c +++ b/grbl/system.c @@ -350,58 +350,52 @@ uint8_t system_check_travel_limits(float *target) // Special handlers for setting and clearing Grbl's real-time execution flags. +// ARM: interrupts are always enabled, even within ISRs. We don't have +// to check on entry. void system_set_exec_state_flag(uint8_t mask) { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_state |= (mask); - if(en) __enable_irq(); + __enable_irq(); } void system_clear_exec_state_flag(uint8_t mask) { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_state &= ~(mask); - if(en) __enable_irq(); + __enable_irq(); } void system_set_exec_alarm(uint8_t code) { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_alarm = code; - if(en) __enable_irq(); + __enable_irq(); } void system_clear_exec_alarm() { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_alarm = 0; - if(en) __enable_irq(); + __enable_irq(); } void system_set_exec_motion_override_flag(uint8_t mask) { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_motion_override |= (mask); - if(en) __enable_irq(); + __enable_irq(); } void system_set_exec_accessory_override_flag(uint8_t mask) { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_accessory_override |= (mask); - if(en) __enable_irq(); + __enable_irq(); } void system_clear_exec_motion_overrides() { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_motion_override = 0; - if(en) __enable_irq(); + __enable_irq(); } void system_clear_exec_accessory_overrides() { - uint8_t en = __get_PRIMASK(); __disable_irq(); sys_rt_exec_accessory_override = 0; - if(en) __enable_irq(); + __enable_irq(); }