Skip to content

Commit

Permalink
Watch idle() depth over 5
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and RFBomb committed Dec 23, 2020
1 parent 88f1fbd commit db50bce
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
* - Handle Joystick jogging
*/
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
#if ENABLED(MARLIN_DEV_MODE)
static uint8_t idle_depth = 0;
if (++idle_depth > 5) SERIAL_ECHOLNPAIR("idle() call depth: ", int(idle_depth));
#endif

// Core Marlin activities
manage_inactivity(TERN_(ADVANCED_PAUSE_FEATURE, no_stepper_sleep));
Expand All @@ -720,7 +724,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
TERN_(MAX7219_DEBUG, max7219.idle_tasks());

// Return if setup() isn't completed
if (marlin_state == MF_INITIALIZING) return;
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;

// Handle filament runout sensors
TERN_(HAS_FILAMENT_SENSOR, runout.run());
Expand Down Expand Up @@ -764,6 +768,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {

// Run i2c Position Encoders
#if ENABLED(I2C_POSITION_ENCODERS)
{
static millis_t i2cpem_next_update_ms;
if (planner.has_blocks_queued()) {
const millis_t ms = millis();
Expand All @@ -772,6 +777,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
i2cpem_next_update_ms = ms + I2CPE_MIN_UPD_TIME_MS;
}
}
}
#endif

// Auto-report Temperatures / SD Status
Expand All @@ -793,6 +799,10 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {

// Update the LVGL interface
TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());

IDLE_DONE:
TERN_(MARLIN_DEV_MODE, idle_depth--);
return;
}

/**
Expand Down

0 comments on commit db50bce

Please sign in to comment.