|
@@ -1483,8 +1483,15 @@ void Temperature::set_current_temp_raw() {
|
1483
|
1483
|
*/
|
1484
|
1484
|
ISR(TIMER0_COMPB_vect) { Temperature::isr(); }
|
1485
|
1485
|
|
|
1486
|
+volatile bool Temperature::in_temp_isr = false;
|
|
1487
|
+
|
1486
|
1488
|
void Temperature::isr() {
|
1487
|
|
- //Allow UART and stepper ISRs
|
|
1489
|
+ // The stepper ISR can interrupt this ISR. When it does it re-enables this ISR
|
|
1490
|
+ // at the end of its run, potentially causing re-entry. This flag prevents it.
|
|
1491
|
+ if (in_temp_isr) return;
|
|
1492
|
+ in_temp_isr = true;
|
|
1493
|
+
|
|
1494
|
+ // Allow UART and stepper ISRs
|
1488
|
1495
|
CBI(TIMSK0, OCIE0B); //Disable Temperature ISR
|
1489
|
1496
|
sei();
|
1490
|
1497
|
|
|
@@ -1949,5 +1956,7 @@ void Temperature::isr() {
|
1949
|
1956
|
}
|
1950
|
1957
|
#endif
|
1951
|
1958
|
|
|
1959
|
+ cli();
|
|
1960
|
+ in_temp_isr = false;
|
1952
|
1961
|
SBI(TIMSK0, OCIE0B); //re-enable Temperature ISR
|
1953
|
1962
|
}
|