Switch to ATOMIC sections instead of cli/sei/CRITICAL_SECTION
This commit is contained in:
parent
8cbe69e285
commit
30dccb3252
@ -1157,18 +1157,18 @@ FORCE_INLINE static void applyBabysteps() {
|
|||||||
|
|
||||||
if(curTodo>0)
|
if(curTodo>0)
|
||||||
{
|
{
|
||||||
CRITICAL_SECTION_START;
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
babystep(axis,/*fwd*/true);
|
babystep(axis,/*fwd*/true);
|
||||||
babystepsTodo[axis]--; //less to do next time
|
babystepsTodo[axis]--; //less to do next time
|
||||||
CRITICAL_SECTION_END;
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(curTodo<0)
|
if(curTodo<0)
|
||||||
{
|
{
|
||||||
CRITICAL_SECTION_START;
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
babystep(axis,/*fwd*/false);
|
babystep(axis,/*fwd*/false);
|
||||||
babystepsTodo[axis]++; //less to do next time
|
babystepsTodo[axis]++; //less to do next time
|
||||||
CRITICAL_SECTION_END;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1537,9 +1537,9 @@ ISR(TIMER0_COMPB_vect)
|
|||||||
#endif //SYSTEM_TIMER_2
|
#endif //SYSTEM_TIMER_2
|
||||||
{
|
{
|
||||||
DISABLE_SOFT_PWM_INTERRUPT();
|
DISABLE_SOFT_PWM_INTERRUPT();
|
||||||
sei();
|
NONATOMIC_BLOCK(NONATOMIC_FORCEOFF) {
|
||||||
soft_pwm_isr();
|
soft_pwm_isr();
|
||||||
cli();
|
}
|
||||||
ENABLE_SOFT_PWM_INTERRUPT();
|
ENABLE_SOFT_PWM_INTERRUPT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1825,7 +1825,7 @@ void temp_mgr_init()
|
|||||||
adc_start_cycle();
|
adc_start_cycle();
|
||||||
|
|
||||||
// initialize timer5
|
// initialize timer5
|
||||||
CRITICAL_SECTION_START;
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
|
||||||
// CTC
|
// CTC
|
||||||
TCCR5B &= ~(1<<WGM53);
|
TCCR5B &= ~(1<<WGM53);
|
||||||
@ -1850,7 +1850,7 @@ void temp_mgr_init()
|
|||||||
TEMP_MGR_INT_FLAG_CLEAR();
|
TEMP_MGR_INT_FLAG_CLEAR();
|
||||||
ENABLE_TEMP_MGR_INTERRUPT();
|
ENABLE_TEMP_MGR_INTERRUPT();
|
||||||
|
|
||||||
CRITICAL_SECTION_END;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pid_heater(uint8_t e, const float current, const int target)
|
static void pid_heater(uint8_t e, const float current, const int target)
|
||||||
@ -2174,9 +2174,9 @@ ISR(TIMER5_COMPA_vect)
|
|||||||
|
|
||||||
// run temperature management with interrupts enabled to reduce latency
|
// run temperature management with interrupts enabled to reduce latency
|
||||||
DISABLE_TEMP_MGR_INTERRUPT();
|
DISABLE_TEMP_MGR_INTERRUPT();
|
||||||
sei();
|
NONATOMIC_BLOCK(NONATOMIC_FORCEOFF) {
|
||||||
temp_mgr_isr();
|
temp_mgr_isr();
|
||||||
cli();
|
}
|
||||||
ENABLE_TEMP_MGR_INTERRUPT();
|
ENABLE_TEMP_MGR_INTERRUPT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2185,8 +2185,7 @@ void disable_heater()
|
|||||||
setAllTargetHotends(0);
|
setAllTargetHotends(0);
|
||||||
setTargetBed(0);
|
setTargetBed(0);
|
||||||
|
|
||||||
CRITICAL_SECTION_START;
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
|
|
||||||
// propagate all values down the chain
|
// propagate all values down the chain
|
||||||
setIsrTargetTemperatures();
|
setIsrTargetTemperatures();
|
||||||
temp_mgr_pid();
|
temp_mgr_pid();
|
||||||
@ -2207,8 +2206,7 @@ void disable_heater()
|
|||||||
timer02_set_pwm0(0);
|
timer02_set_pwm0(0);
|
||||||
bedPWMDisabled = 0;
|
bedPWMDisabled = 0;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
CRITICAL_SECTION_END;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_min_temp_raw()
|
static void check_min_temp_raw()
|
||||||
|
Loading…
Reference in New Issue
Block a user