Browse Source

Fix SD_FINISHED_RELEASECOMMAND bug

Fixes #17401 bug that was introduced in 8f26c3a
Scott Lahteine 5 years ago
parent
commit
7aed32df00

+ 2
- 2
Marlin/Configuration_adv.h View File

1035
   // Enable this option and set to HIGH if your SD cards are incorrectly detected.
1035
   // Enable this option and set to HIGH if your SD cards are incorrectly detected.
1036
   //#define SD_DETECT_STATE HIGH
1036
   //#define SD_DETECT_STATE HIGH
1037
 
1037
 
1038
-  #define SD_FINISHED_STEPPERRELEASE true          // Disable steppers when SD Print is finished
1039
-  #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place.
1038
+  #define SD_FINISHED_STEPPERRELEASE true   // Disable steppers when SD Print is finished
1039
+  #define SD_FINISHED_RELEASECOMMAND "M84"  // Use "M84XYE" to keep Z enabled so your bed stays in place
1040
 
1040
 
1041
   // Reverse SD sort to show "more recent" files first, according to the card's FAT.
1041
   // Reverse SD sort to show "more recent" files first, according to the card's FAT.
1042
   // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended.
1042
   // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended.

+ 7
- 7
Marlin/src/gcode/sd/M1001.cpp View File

27
 #include "../gcode.h"
27
 #include "../gcode.h"
28
 #include "../../module/printcounter.h"
28
 #include "../../module/printcounter.h"
29
 
29
 
30
+#ifdef SD_FINISHED_RELEASECOMMAND
31
+  #include "../queue.h"
32
+#endif
33
+
30
 #if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
34
 #if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
31
   #include "../../lcd/ultralcd.h"
35
   #include "../../lcd/ultralcd.h"
32
 #endif
36
 #endif
47
   #include "../../feature/host_actions.h"
51
   #include "../../feature/host_actions.h"
48
 #endif
52
 #endif
49
 
53
 
50
-#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
51
-  #include "../../module/planner.h"
52
-#endif
53
-
54
 #ifndef PE_LEDS_COMPLETED_TIME
54
 #ifndef PE_LEDS_COMPLETED_TIME
55
   #define PE_LEDS_COMPLETED_TIME (30*60)
55
   #define PE_LEDS_COMPLETED_TIME (30*60)
56
 #endif
56
 #endif
95
     }
95
     }
96
   #endif
96
   #endif
97
 
97
 
98
-  // Wait for the queue to empty (and "clean"), inject SD_FINISHED_RELEASECOMMAND
99
-  #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
100
-    planner.finish_and_disable();
98
+  // Inject SD_FINISHED_RELEASECOMMAND, if any
99
+  #ifdef SD_FINISHED_RELEASECOMMAND
100
+    queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND));
101
   #endif
101
   #endif
102
 
102
 
103
   // Re-select the last printed file in the UI
103
   // Re-select the last printed file in the UI

+ 9
- 0
Marlin/src/inc/Conditionals_adv.h View File

68
   #define HAS_FILAMENT_SENSOR 1
68
   #define HAS_FILAMENT_SENSOR 1
69
 #endif
69
 #endif
70
 
70
 
71
+// Let SD_FINISHED_RELEASECOMMAND stand in for SD_FINISHED_STEPPERRELEASE
72
+#if ENABLED(SD_FINISHED_STEPPERRELEASE)
73
+  #ifndef SD_FINISHED_RELEASECOMMAND
74
+    #define SD_FINISHED_RELEASECOMMAND "M84" // planner.finish_and_disable()
75
+  #endif
76
+#else
77
+  #undef SD_FINISHED_RELEASECOMMAND
78
+#endif
79
+
71
 #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
80
 #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
72
   #define HAS_PRINT_PROGRESS 1
81
   #define HAS_PRINT_PROGRESS 1
73
 #endif
82
 #endif

+ 2
- 2
Marlin/src/module/planner.cpp View File

1601
     clear_block_buffer_runtime();
1601
     clear_block_buffer_runtime();
1602
   #endif
1602
   #endif
1603
 
1603
 
1604
-  // Make sure to drop any attempt of queuing moves for at least 1 second
1605
-  cleaning_buffer_counter = 1000;
1604
+  // Make sure to drop any attempt of queuing moves for 1 second
1605
+  cleaning_buffer_counter = TEMP_TIMER_FREQUENCY;
1606
 
1606
 
1607
   // Reenable Stepper ISR
1607
   // Reenable Stepper ISR
1608
   if (was_enabled) stepper.wake_up();
1608
   if (was_enabled) stepper.wake_up();

+ 1
- 6
Marlin/src/module/planner.h View File

807
     // Periodic tick to handle cleaning timeouts
807
     // Periodic tick to handle cleaning timeouts
808
     // Called from the Temperature ISR at ~1kHz
808
     // Called from the Temperature ISR at ~1kHz
809
     static void tick() {
809
     static void tick() {
810
-      if (cleaning_buffer_counter) {
811
-        --cleaning_buffer_counter;
812
-        #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
813
-          if (!cleaning_buffer_counter) queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND));
814
-        #endif
815
-      }
810
+      if (cleaning_buffer_counter) --cleaning_buffer_counter;
816
     }
811
     }
817
 
812
 
818
     /**
813
     /**

+ 0
- 1
Marlin/src/module/probe.h View File

47
 
47
 
48
     static bool set_deployed(const bool deploy);
48
     static bool set_deployed(const bool deploy);
49
 
49
 
50
-
51
     #if IS_KINEMATIC
50
     #if IS_KINEMATIC
52
 
51
 
53
       #if HAS_PROBE_XY_OFFSET
52
       #if HAS_PROBE_XY_OFFSET

Loading…
Cancel
Save