ソースを参照

serial_dump_and_reset: do not call manage_heater with interrupts disabled

Do not call manage_heater() in print_mem() if interrupts are already
disabled. This means we're running inside the crash handler.
Yuri D'Elia 3 年 前
コミット
a614268c94
1 ファイル変更4 行追加2 行削除
  1. 4 2
      Firmware/Dcodes.cpp

+ 4 - 2
Firmware/Dcodes.cpp

@@ -101,8 +101,10 @@ void print_mem(daddr_t address, daddr_t count, dcode_mem_t type, uint8_t countpe
 			count_line--;
 			count--;
 
-            // sporadically call manage heaters to avoid wdt
-            if(!((uint16_t)count % 8192))
+            // sporadically call manage_heater, but only when interrupts are enabled (meaning
+            // print_mem is called by D2). Don't do anything otherwise: we are inside a crash
+            // handler where memory & stack needs to be preserved!
+            if((SREG & (1 << SREG_I)) && !((uint16_t)count % 8192))
                 manage_heater();
 		}
 		putchar('\n');