Move stack checking to the temperature ISR
Now that the stack_error function is truly minimal, we can check for stack errors much more frequently. Also move away stack_error from ultralcd to Marlin_main.
This commit is contained in:
parent
01934b89e9
commit
050cf72e98
5 changed files with 19 additions and 21 deletions
|
@ -497,6 +497,7 @@ void marlin_wait_for_click();
|
|||
void raise_z_above(float target, bool plan=true);
|
||||
|
||||
extern "C" void softReset();
|
||||
void stack_error();
|
||||
|
||||
extern uint32_t IP_address;
|
||||
|
||||
|
|
|
@ -1727,6 +1727,20 @@ ISR(WDT_vect)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
void stack_error() {
|
||||
WRITE(BEEPER, HIGH);
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FW_CRASH_FLAG, (uint8_t)dump_crash_reason::stack_error);
|
||||
#ifdef EMERGENCY_DUMP
|
||||
xfdump_full_dump_and_reset(dump_crash_reason::stack_error);
|
||||
#elif defined(EMERGENCY_SERIAL_DUMP)
|
||||
if (emergency_serial_dump)
|
||||
serial_dump_and_reset(dump_crash_reason::stack_error);
|
||||
#endif
|
||||
softReset();
|
||||
}
|
||||
|
||||
|
||||
void trace();
|
||||
|
||||
#define CHUNK_SIZE 64 // bytes
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "temperature.h"
|
||||
#include "cardreader.h"
|
||||
|
||||
#include "Sd2PinMap.h"
|
||||
#include "SdFatUtil.h"
|
||||
|
||||
#include <avr/wdt.h>
|
||||
#include "adc.h"
|
||||
|
@ -2065,6 +2065,9 @@ FORCE_INLINE static void temperature_isr()
|
|||
}
|
||||
#endif //BABYSTEPPING
|
||||
|
||||
// Check if a stack overflow happened
|
||||
if (!SdFatUtil::test_stack_integrity()) stack_error();
|
||||
|
||||
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1))
|
||||
check_fans();
|
||||
#endif //(defined(TACH_0))
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
//#include "Configuration.h"
|
||||
#include "cmdqueue.h"
|
||||
|
||||
#include "SdFatUtil.h"
|
||||
#include "xflash_dump.h"
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
|
@ -6721,23 +6720,6 @@ static void lcd_main_menu()
|
|||
}
|
||||
|
||||
|
||||
#ifdef EMERGENCY_SERIAL_DUMP
|
||||
#include "Dcodes.h"
|
||||
#endif
|
||||
|
||||
void stack_error() {
|
||||
WRITE(BEEPER, HIGH);
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FW_CRASH_FLAG, (uint8_t)dump_crash_reason::stack_error);
|
||||
#ifdef EMERGENCY_DUMP
|
||||
xfdump_full_dump_and_reset(dump_crash_reason::stack_error);
|
||||
#elif defined(EMERGENCY_SERIAL_DUMP)
|
||||
if (emergency_serial_dump)
|
||||
serial_dump_and_reset(dump_crash_reason::stack_error);
|
||||
#endif
|
||||
softReset();
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_STEPPER_TIMER_MISSED
|
||||
bool stepper_timer_overflow_state = false;
|
||||
uint16_t stepper_timer_overflow_max = 0;
|
||||
|
@ -8961,7 +8943,6 @@ void menu_lcd_lcdupdate_func(void)
|
|||
if (lcd_draw_update) lcd_draw_update--;
|
||||
lcd_next_update_millis = _millis() + LCD_UPDATE_INTERVAL;
|
||||
}
|
||||
if (!SdFatUtil::test_stack_integrity()) stack_error();
|
||||
lcd_ping(); //check that we have received ping command if we are in farm mode
|
||||
lcd_send_status();
|
||||
if (lcd_commands_type == LcdCommands::Layer1Cal) lcd_commands();
|
||||
|
|
|
@ -194,7 +194,6 @@ void mFilamentItemForce();
|
|||
void lcd_generic_preheat_menu();
|
||||
void unload_filament(bool automatic = false);
|
||||
|
||||
void stack_error();
|
||||
void lcd_printer_connected();
|
||||
void lcd_ping();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue