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.
This commit is contained in:
Yuri D'Elia 2021-06-15 18:44:44 +02:00
parent d193d0f7ac
commit a614268c94
1 changed files with 4 additions and 2 deletions

View File

@ -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');