Merge pull request #302 from XPila/MK3

Stack monitor in stepper ISR
This commit is contained in:
XPila 2017-12-10 20:41:44 +01:00 committed by GitHub
commit 49bbb950ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View File

@ -96,6 +96,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
//#define _NO_ASM
#define DEBUG_DCODES //D codes
#if 1
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable

View File

@ -41,6 +41,10 @@
int fsensor_counter = 0; //counter for e-steps
#endif //PAT9125
#ifdef DEBUG_STACK_MONITOR
uint16_t SP_min = 0x21FF;
#endif //DEBUG_STACK_MONITOR
//===========================================================================
//=============================public variables ============================
//===========================================================================
@ -371,6 +375,10 @@ FORCE_INLINE void trapezoid_generator_reset() {
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
ISR(TIMER1_COMPA_vect) {
#ifdef DEBUG_STACK_MONITOR
uint16_t sp = SPL + 256 * SPH;
if (sp < SP_min) SP_min = sp;
#endif //DEBUG_STACK_MONITOR
#ifdef LIN_ADVANCE
advance_isr_scheduler();
#else

View File

@ -1534,10 +1534,8 @@ static void lcd_menu_fails_stats()
lcd.print(" Filament fails: ");
lcd.setCursor(17, 3);
lcd.print(itostr3((int)ferror_count));
if (lcd_clicked())
if (lcd_clicked())
{
lcd_quick_feedback();
lcd_return_to_status();
@ -1545,6 +1543,18 @@ static void lcd_menu_fails_stats()
}
extern uint16_t SP_min;
static void lcd_menu_debug()
{
fprintf_P(lcdout, PSTR(ESC_H(1,1)"SP_min: 0x%04x"), SP_min);
if (lcd_clicked())
{
lcd_quick_feedback();
lcd_return_to_status();
}
}
static void lcd_menu_temperatures()
{
fprintf_P(lcdout, PSTR(ESC_H(1,1) "Ambient: %d%c" ESC_H(1,2) "PINDA: %d%c"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01');
@ -4931,7 +4941,9 @@ static void lcd_main_menu()
MENU_ITEM(submenu, MSG_SUPPORT, lcd_support_menu);
MENU_ITEM(submenu, PSTR("Fail stats"), lcd_menu_fails_stats);
MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug);
END_MENU();
}