Fix interrupt enable restore bug

This commit is contained in:
Todd Fleming 2017-01-09 06:25:52 -05:00
parent 5bd05fbe14
commit 5eb4fdacdd

View File

@ -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();
}