From 2535d072c414fdcfda5bcc87308a8e793a89cc21 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 14 May 2022 18:03:43 +0200 Subject: [PATCH] Do not recursively enter temperature_isr Disable the interrupt source instead, which avoids the added latency of reentering the isr in the first place. --- Firmware/temperature.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index c5012a852..7fe7166c9 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1777,15 +1777,11 @@ ISR(TIMER2_COMPB_vect) ISR(TIMER0_COMPB_vect) #endif //SYSTEM_TIMER_2 { - static bool _lock = false; - if (!_lock) - { - _lock = true; - sei(); - temperature_isr(); - cli(); - _lock = false; - } + DISABLE_TEMPERATURE_INTERRUPT(); + sei(); + temperature_isr(); + cli(); + ENABLE_TEMPERATURE_INTERRUPT(); } void check_max_temp()