Scott Lahteine 7 роки тому
джерело
коміт
51f195e698

+ 3
- 14
Marlin/src/Marlin.cpp Переглянути файл

@@ -163,7 +163,6 @@ volatile bool wait_for_heatup = true;
163 163
 #endif
164 164
 
165 165
 // Inactivity shutdown
166
-millis_t previous_cmd_ms = 0;
167 166
 static millis_t max_inactive_time = 0;
168 167
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
169 168
 
@@ -366,16 +365,6 @@ void suicide() {
366 365
  ***************** GCode Handlers *****************
367 366
  **************************************************/
368 367
 
369
-#if ENABLED(ARC_SUPPORT)
370
-  #include "gcode/motion/G2_G3.h"
371
-#endif
372
-
373
-void dwell(millis_t time) {
374
-  gcode.refresh_cmd_timeout();
375
-  time += previous_cmd_ms;
376
-  while (PENDING(millis(), time)) idle();
377
-}
378
-
379 368
 #include "gcode/motion/G4.h"
380 369
 
381 370
 #if ENABLED(BEZIER_CURVE_SUPPORT)
@@ -882,7 +871,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
882 871
 
883 872
   const millis_t ms = millis();
884 873
 
885
-  if (max_inactive_time && ELAPSED(ms, previous_cmd_ms + max_inactive_time)) {
874
+  if (max_inactive_time && ELAPSED(ms, gcode.previous_cmd_ms + max_inactive_time)) {
886 875
     SERIAL_ERROR_START();
887 876
     SERIAL_ECHOLNPAIR(MSG_KILL_INACTIVE_TIME, parser.command_ptr);
888 877
     kill(PSTR(MSG_KILLED));
@@ -895,7 +884,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
895 884
     #define MOVE_AWAY_TEST true
896 885
   #endif
897 886
 
898
-  if (MOVE_AWAY_TEST && stepper_inactive_time && ELAPSED(ms, previous_cmd_ms + stepper_inactive_time)
887
+  if (MOVE_AWAY_TEST && stepper_inactive_time && ELAPSED(ms, gcode.previous_cmd_ms + stepper_inactive_time)
899 888
       && !ignore_stepper_queue && !planner.blocks_queued()) {
900 889
     #if ENABLED(DISABLE_INACTIVE_X)
901 890
       disable_X();
@@ -965,7 +954,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
965 954
   #endif
966 955
 
967 956
   #if ENABLED(EXTRUDER_RUNOUT_PREVENT)
968
-    if (ELAPSED(ms, previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL)
957
+    if (ELAPSED(ms, gcode.previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL)
969 958
       && thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) {
970 959
       #if ENABLED(SWITCHING_EXTRUDER)
971 960
         const bool oldstatus = E0_ENABLE_READ;

+ 2
- 2
Marlin/src/gcode/control/M3-M5.h Переглянути файл

@@ -52,10 +52,10 @@
52 52
  */
53 53
 
54 54
 // Wait for spindle to come up to speed
55
-inline void delay_for_power_up() { dwell(SPINDLE_LASER_POWERUP_DELAY); }
55
+inline void delay_for_power_up() { gcode.dwell(SPINDLE_LASER_POWERUP_DELAY); }
56 56
 
57 57
 // Wait for spindle to stop turning
58
-inline void delay_for_power_down() { dwell(SPINDLE_LASER_POWERDOWN_DELAY); }
58
+inline void delay_for_power_down() { gcode.dwell(SPINDLE_LASER_POWERDOWN_DELAY); }
59 59
 
60 60
 /**
61 61
  * ocr_val_mode() is used for debugging and to get the points needed to compute the RPM vs ocr_val line

+ 11
- 1
Marlin/src/gcode/gcode.cpp Переглянути файл

@@ -31,12 +31,13 @@ GcodeSuite gcode;
31 31
 #include "parser.h"
32 32
 #include "queue.h"
33 33
 #include "../module/motion.h"
34
-#include "../module/printcounter.h"
35 34
 
36 35
 #if ENABLED(PRINTCOUNTER)
37 36
   #include "../module/printcounter.h"
38 37
 #endif
39 38
 
39
+#include "../Marlin.h" // for idle()
40
+
40 41
 uint8_t GcodeSuite::target_extruder;
41 42
 millis_t GcodeSuite::previous_cmd_ms;
42 43
 
@@ -99,6 +100,15 @@ void GcodeSuite::get_destination_from_command() {
99 100
   #endif
100 101
 }
101 102
 
103
+/**
104
+ * Dwell waits immediately. It does not synchronize. Use M400 instead of G4
105
+ */
106
+void GcodeSuite::dwell(millis_t time) {
107
+  refresh_cmd_timeout();
108
+  time += previous_cmd_ms;
109
+  while (PENDING(millis(), time)) idle();
110
+}
111
+
102 112
 //
103 113
 // Placeholders for non-migrated codes
104 114
 //

+ 2
- 0
Marlin/src/gcode/gcode.h Переглянути файл

@@ -299,6 +299,8 @@ public:
299 299
     #define KEEPALIVE_STATE(n) NOOP
300 300
   #endif
301 301
 
302
+  void dwell(millis_t time);
303
+
302 304
 private:
303 305
 
304 306
   static void G0_G1(

+ 1
- 1
Marlin/src/gcode/lcd/M0_M1.h Переглянути файл

@@ -67,7 +67,7 @@ void gcode_M0_M1() {
67 67
   gcode.refresh_cmd_timeout();
68 68
 
69 69
   if (ms > 0) {
70
-    ms += previous_cmd_ms;  // wait until this time for a click
70
+    ms += gcode.previous_cmd_ms;  // wait until this time for a click
71 71
     while (PENDING(millis(), ms) && wait_for_user) idle();
72 72
   }
73 73
   else {

+ 1
- 1
Marlin/src/gcode/motion/G4.h Переглянути файл

@@ -33,5 +33,5 @@ void gcode_G4() {
33 33
 
34 34
   if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
35 35
 
36
-  dwell(dwell_ms);
36
+  gcode.dwell(dwell_ms);
37 37
 }

+ 5
- 1
Marlin/src/module/tool_change.cpp Переглянути файл

@@ -30,6 +30,10 @@
30 30
 
31 31
 #include "../inc/MarlinConfig.h"
32 32
 
33
+#if ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
34
+  #include "../gcode/gcode.h" // for dwell()
35
+#endif
36
+
33 37
 #if ENABLED(SWITCHING_EXTRUDER)
34 38
 
35 39
   #if EXTRUDERS > 3
@@ -74,7 +78,7 @@
74 78
       default: OUT_WRITE(SOL0_PIN, state); break;
75 79
     }
76 80
     #if PARKING_EXTRUDER_SOLENOIDS_DELAY > 0
77
-      dwell(PARKING_EXTRUDER_SOLENOIDS_DELAY);
81
+      gcode.dwell(PARKING_EXTRUDER_SOLENOIDS_DELAY);
78 82
     #endif
79 83
   }
80 84
 

Завантаження…
Відмінити
Зберегти