Browse Source

Watch idle() depth over 5

Scott Lahteine 4 years ago
parent
commit
2ecb4fad72
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      Marlin/src/MarlinCore.cpp

+ 11
- 1
Marlin/src/MarlinCore.cpp View File

709
  *  - Handle Joystick jogging
709
  *  - Handle Joystick jogging
710
  */
710
  */
711
 void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
711
 void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
712
+  #if ENABLED(MARLIN_DEV_MODE)
713
+    static uint8_t idle_depth = 0;
714
+    if (++idle_depth > 5) SERIAL_ECHOLNPAIR("idle() call depth: ", int(idle_depth));
715
+  #endif
712
 
716
 
713
   // Core Marlin activities
717
   // Core Marlin activities
714
   manage_inactivity(TERN_(ADVANCED_PAUSE_FEATURE, no_stepper_sleep));
718
   manage_inactivity(TERN_(ADVANCED_PAUSE_FEATURE, no_stepper_sleep));
720
   TERN_(MAX7219_DEBUG, max7219.idle_tasks());
724
   TERN_(MAX7219_DEBUG, max7219.idle_tasks());
721
 
725
 
722
   // Return if setup() isn't completed
726
   // Return if setup() isn't completed
723
-  if (marlin_state == MF_INITIALIZING) return;
727
+  if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;
724
 
728
 
725
   // Handle filament runout sensors
729
   // Handle filament runout sensors
726
   TERN_(HAS_FILAMENT_SENSOR, runout.run());
730
   TERN_(HAS_FILAMENT_SENSOR, runout.run());
764
 
768
 
765
   // Run i2c Position Encoders
769
   // Run i2c Position Encoders
766
   #if ENABLED(I2C_POSITION_ENCODERS)
770
   #if ENABLED(I2C_POSITION_ENCODERS)
771
+  {
767
     static millis_t i2cpem_next_update_ms;
772
     static millis_t i2cpem_next_update_ms;
768
     if (planner.has_blocks_queued()) {
773
     if (planner.has_blocks_queued()) {
769
       const millis_t ms = millis();
774
       const millis_t ms = millis();
772
         i2cpem_next_update_ms = ms + I2CPE_MIN_UPD_TIME_MS;
777
         i2cpem_next_update_ms = ms + I2CPE_MIN_UPD_TIME_MS;
773
       }
778
       }
774
     }
779
     }
780
+  }
775
   #endif
781
   #endif
776
 
782
 
777
   // Auto-report Temperatures / SD Status
783
   // Auto-report Temperatures / SD Status
793
 
799
 
794
   // Update the LVGL interface
800
   // Update the LVGL interface
795
   TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());
801
   TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());
802
+
803
+  IDLE_DONE:
804
+  TERN_(MARLIN_DEV_MODE, idle_depth--);
805
+  return;
796
 }
806
 }
797
 
807
 
798
 /**
808
 /**

Loading…
Cancel
Save