Browse Source

Move some MarlinCore and MarlinUI code (#20832)

Scott Lahteine 3 years ago
parent
commit
c0870d417a
No account linked to committer's email address
38 changed files with 178 additions and 206 deletions
  1. 23
    95
      Marlin/src/MarlinCore.cpp
  2. 0
    13
      Marlin/src/MarlinCore.h
  3. 0
    1
      Marlin/src/feature/e_parser.h
  4. 2
    0
      Marlin/src/feature/encoder_i2c.cpp
  5. 13
    34
      Marlin/src/feature/pause.cpp
  6. 5
    1
      Marlin/src/feature/pause.h
  7. 2
    1
      Marlin/src/feature/runout.cpp
  8. 2
    6
      Marlin/src/feature/runout.h
  9. 10
    0
      Marlin/src/feature/twibus.cpp
  10. 13
    0
      Marlin/src/feature/twibus.h
  11. 2
    1
      Marlin/src/gcode/control/M108_M112_M410.cpp
  12. 2
    0
      Marlin/src/gcode/control/M226.cpp
  13. 4
    0
      Marlin/src/gcode/control/M42.cpp
  14. 1
    1
      Marlin/src/gcode/feature/i2c/M260_M261.cpp
  15. 3
    6
      Marlin/src/gcode/feature/pause/M125.cpp
  16. 3
    6
      Marlin/src/gcode/feature/pause/M600.cpp
  17. 5
    8
      Marlin/src/gcode/feature/pause/M701_M702.cpp
  18. 30
    2
      Marlin/src/gcode/gcode.cpp
  19. 2
    0
      Marlin/src/gcode/gcode.h
  20. 1
    0
      Marlin/src/gcode/queue.cpp
  21. 1
    1
      Marlin/src/gcode/sd/M1001.cpp
  22. 2
    0
      Marlin/src/lcd/dogm/marlinui_DOGM.cpp
  23. 0
    1
      Marlin/src/lcd/dwin/e3v2/rotary_encoder.h
  24. 2
    2
      Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp
  25. 3
    2
      Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.h
  26. 0
    2
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp
  27. 4
    0
      Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp
  28. 1
    1
      Marlin/src/lcd/marlinui.cpp
  29. 12
    13
      Marlin/src/lcd/marlinui.h
  30. 2
    0
      Marlin/src/lcd/menu/menu_configuration.cpp
  31. 2
    0
      Marlin/src/lcd/menu/menu_delta_calibrate.cpp
  32. 3
    1
      Marlin/src/lcd/menu/menu_filament.cpp
  33. 2
    0
      Marlin/src/lcd/menu/menu_motion.cpp
  34. 0
    1
      Marlin/src/module/endstops.cpp
  35. 11
    2
      Marlin/src/module/motion.cpp
  36. 2
    0
      Marlin/src/module/motion.h
  37. 1
    1
      Marlin/src/module/probe.cpp
  38. 7
    4
      Marlin/src/module/temperature.cpp

+ 23
- 95
Marlin/src/MarlinCore.cpp View File

@@ -43,6 +43,7 @@
43 43
 #include <math.h>
44 44
 
45 45
 #include "core/utility.h"
46
+
46 47
 #include "module/motion.h"
47 48
 #include "module/planner.h"
48 49
 #include "module/endstops.h"
@@ -57,6 +58,7 @@
57 58
 #include "gcode/parser.h"
58 59
 #include "gcode/queue.h"
59 60
 
61
+#include "feature/pause.h"
60 62
 #include "sd/cardreader.h"
61 63
 
62 64
 #include "lcd/marlinui.h"
@@ -139,7 +141,6 @@
139 141
 
140 142
 #if ENABLED(EXPERIMENTAL_I2CBUS)
141 143
   #include "feature/twibus.h"
142
-  TWIBus i2c;
143 144
 #endif
144 145
 
145 146
 #if ENABLED(I2C_POSITION_ENCODERS)
@@ -173,10 +174,6 @@
173 174
   #include "feature/bedlevel/bedlevel.h"
174 175
 #endif
175 176
 
176
-#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT)
177
-  #include "feature/pause.h"
178
-#endif
179
-
180 177
 #if ENABLED(GCODE_REPEAT_MARKERS)
181 178
   #include "feature/repeat.h"
182 179
 #endif
@@ -267,40 +264,12 @@ bool wait_for_heatup = true;
267 264
 
268 265
 #endif
269 266
 
270
-#if PIN_EXISTS(CHDK)
271
-  extern millis_t chdk_timeout;
272
-#endif
273
-
274
-#if ENABLED(I2C_POSITION_ENCODERS)
275
-  I2CPositionEncodersMgr I2CPEM;
276
-#endif
277
-
278 267
 /**
279 268
  * ***************************************************************************
280 269
  * ******************************** FUNCTIONS ********************************
281 270
  * ***************************************************************************
282 271
  */
283 272
 
284
-void setup_killpin() {
285
-  #if HAS_KILL
286
-    #if KILL_PIN_STATE
287
-      SET_INPUT_PULLDOWN(KILL_PIN);
288
-    #else
289
-      SET_INPUT_PULLUP(KILL_PIN);
290
-    #endif
291
-  #endif
292
-}
293
-
294
-void setup_powerhold() {
295
-  #if HAS_SUICIDE
296
-    OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
297
-  #endif
298
-  #if ENABLED(PSU_CONTROL)
299
-    powersupply_on = ENABLED(PSU_DEFAULT_OFF);
300
-    if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
301
-  #endif
302
-}
303
-
304 273
 /**
305 274
  * Stepper Reset (RigidBoard, et.al.)
306 275
  */
@@ -309,18 +278,6 @@ void setup_powerhold() {
309 278
   void enableStepperDrivers()  { SET_INPUT(STEPPER_RESET_PIN); }      // Set to input, allowing pullups to pull the pin high
310 279
 #endif
311 280
 
312
-#if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
313
-
314
-  void i2c_on_receive(int bytes) { // just echo all bytes received to serial
315
-    i2c.receive(bytes);
316
-  }
317
-
318
-  void i2c_on_request() {          // just send dummy data for now
319
-    i2c.reply("Hello World!\n");
320
-  }
321
-
322
-#endif
323
-
324 281
 /**
325 282
  * Sensitive pin test for M42, M226
326 283
  */
@@ -342,17 +299,6 @@ bool pin_is_protected(const pin_t pin) {
342 299
 
343 300
 #pragma GCC diagnostic pop
344 301
 
345
-void protected_pin_err() {
346
-  SERIAL_ERROR_MSG(STR_ERR_PROTECTED_PIN);
347
-}
348
-
349
-void quickstop_stepper() {
350
-  planner.quick_stop();
351
-  planner.synchronize();
352
-  set_current_from_steppers_for_axis(ALL_AXES);
353
-  sync_plan_position();
354
-}
355
-
356 302
 void enable_e_steppers() {
357 303
   #define _ENA_E(N) ENABLE_AXIS_E##N();
358 304
   REPEAT(E_STEPPERS, _ENA_E)
@@ -389,41 +335,6 @@ void disable_all_steppers() {
389 335
   TERN_(EXTENSIBLE_UI, ExtUI::onSteppersDisabled());
390 336
 }
391 337
 
392
-#if ENABLED(G29_RETRY_AND_RECOVER)
393
-
394
-  void event_probe_failure() {
395
-    #ifdef ACTION_ON_G29_FAILURE
396
-      host_action(PSTR(ACTION_ON_G29_FAILURE));
397
-    #endif
398
-    #ifdef G29_FAILURE_COMMANDS
399
-      gcode.process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS));
400
-    #endif
401
-    #if ENABLED(G29_HALT_ON_FAILURE)
402
-      #ifdef ACTION_ON_CANCEL
403
-        host_action_cancel();
404
-      #endif
405
-      kill(GET_TEXT(MSG_LCD_PROBING_FAILED));
406
-    #endif
407
-  }
408
-
409
-  void event_probe_recover() {
410
-    TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR));
411
-    #ifdef ACTION_ON_G29_RECOVER
412
-      host_action(PSTR(ACTION_ON_G29_RECOVER));
413
-    #endif
414
-    #ifdef G29_RECOVER_COMMANDS
415
-      gcode.process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS));
416
-    #endif
417
-  }
418
-
419
-#endif
420
-
421
-#if ENABLED(ADVANCED_PAUSE_FEATURE)
422
-  #include "feature/pause.h"
423
-#else
424
-  constexpr bool did_pause_print = false;
425
-#endif
426
-
427 338
 /**
428 339
  * A Print Job exists when the timer is running or SD printing
429 340
  */
@@ -511,8 +422,8 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
511 422
 
512 423
   // Prevent steppers timing-out in the middle of M600
513 424
   // unless PAUSE_PARK_NO_STEPPER_TIMEOUT is disabled
514
-  const bool parked_or_ignoring = ignore_stepper_queue ||
515
-     (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print);
425
+  const bool parked_or_ignoring = ignore_stepper_queue
426
+                               || TERN0(PAUSE_PARK_NO_STEPPER_TIMEOUT, did_pause_print);
516 427
 
517 428
   // Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
518 429
   if (parked_or_ignoring) gcode.reset_stepper_timeout(ms);
@@ -550,6 +461,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
550 461
   }
551 462
 
552 463
   #if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH)
464
+    extern millis_t chdk_timeout;
553 465
     if (chdk_timeout && ELAPSED(ms, chdk_timeout)) {
554 466
       chdk_timeout = 0;
555 467
       WRITE(CHDK_PIN, LOW);
@@ -1038,13 +950,29 @@ void setup() {
1038 950
     SETUP_RUN(recovery.setup());
1039 951
   #endif
1040 952
 
1041
-  SETUP_RUN(setup_killpin());
953
+  #if HAS_KILL
954
+    SETUP_LOG("KILL_PIN");
955
+    #if KILL_PIN_STATE
956
+      SET_INPUT_PULLDOWN(KILL_PIN);
957
+    #else
958
+      SET_INPUT_PULLUP(KILL_PIN);
959
+    #endif
960
+  #endif
1042 961
 
1043 962
   #if HAS_TMC220x
1044 963
     SETUP_RUN(tmc_serial_begin());
1045 964
   #endif
1046 965
 
1047
-  SETUP_RUN(setup_powerhold());
966
+  #if HAS_SUICIDE
967
+    SETUP_LOG("SUICIDE_PIN")
968
+    OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
969
+  #endif
970
+
971
+  #if ENABLED(PSU_CONTROL)
972
+    SETUP_LOG("PSU_CONTROL");
973
+    powersupply_on = ENABLED(PSU_DEFAULT_OFF);
974
+    if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
975
+  #endif
1048 976
 
1049 977
   #if HAS_STEPPER_RESET
1050 978
     SETUP_RUN(disableStepperDrivers());

+ 0
- 13
Marlin/src/MarlinCore.h View File

@@ -37,11 +37,6 @@ void stop();
37 37
 void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep=false));
38 38
 inline void idle_no_sleep() { idle(TERN_(ADVANCED_PAUSE_FEATURE, true)); }
39 39
 
40
-#if ENABLED(EXPERIMENTAL_I2CBUS)
41
-  #include "feature/twibus.h"
42
-  extern TWIBus i2c;
43
-#endif
44
-
45 40
 #if ENABLED(G38_PROBE_TARGET)
46 41
   extern uint8_t G38_move;          // Flag to tell the ISR that G38 is in progress, and the type
47 42
   extern bool G38_did_trigger;      // Flag from the ISR to indicate the endstop changed
@@ -59,8 +54,6 @@ void disable_all_steppers();
59 54
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
60 55
 void minkill(const bool steppers_off=false);
61 56
 
62
-void quickstop_stepper();
63
-
64 57
 // Global State of the firmware
65 58
 enum MarlinState : uint8_t {
66 59
   MF_INITIALIZING =  0,
@@ -103,7 +96,6 @@ extern bool wait_for_heatup;
103 96
 #endif
104 97
 
105 98
 bool pin_is_protected(const pin_t pin);
106
-void protected_pin_err();
107 99
 
108 100
 #if HAS_SUICIDE
109 101
   inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
@@ -116,11 +108,6 @@ void protected_pin_err();
116 108
   inline bool kill_state() { return READ(KILL_PIN) == KILL_PIN_STATE; }
117 109
 #endif
118 110
 
119
-#if ENABLED(G29_RETRY_AND_RECOVER)
120
-  void event_probe_recover();
121
-  void event_probe_failure();
122
-#endif
123
-
124 111
 extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
125 112
                   SP_A_STR[], SP_B_STR[], SP_C_STR[],
126 113
                   SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[],

+ 0
- 1
Marlin/src/feature/e_parser.h View File

@@ -33,7 +33,6 @@
33 33
 
34 34
 // External references
35 35
 extern bool wait_for_user, wait_for_heatup;
36
-void quickstop_stepper();
37 36
 
38 37
 class EmergencyParser {
39 38
 

+ 2
- 0
Marlin/src/feature/encoder_i2c.cpp View File

@@ -41,6 +41,8 @@
41 41
 
42 42
 #include <Wire.h>
43 43
 
44
+I2CPositionEncodersMgr I2CPEM;
45
+
44 46
 void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
45 47
   encoderAxis = axis;
46 48
   i2cAddress = address;

+ 13
- 34
Marlin/src/feature/pause.cpp View File

@@ -137,10 +137,7 @@ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=P
137 137
       thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
138 138
   #endif
139 139
 
140
-  #if HAS_LCD_MENU
141
-    lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode);
142
-  #endif
143
-  UNUSED(mode);
140
+  ui.pause_show_message(PAUSE_MESSAGE_HEATING, mode); UNUSED(mode);
144 141
 
145 142
   if (wait) return thermalManager.wait_for_hotend(active_extruder);
146 143
 
@@ -181,19 +178,13 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
181 178
   DEBUG_SECTION(lf, "load_filament", true);
182 179
   DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " showlcd:", int(show_lcd), " pauseforuser:", int(pause_for_user), " pausemode:", int(mode) DXC_SAY);
183 180
 
184
-  UNUSED(show_lcd);
185
-
186 181
   if (!ensure_safe_temperature(false, mode)) {
187
-    #if HAS_LCD_MENU
188
-      if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS, mode);
189
-    #endif
182
+    if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_STATUS, mode);
190 183
     return false;
191 184
   }
192 185
 
193 186
   if (pause_for_user) {
194
-    #if HAS_LCD_MENU
195
-      if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_INSERT, mode);
196
-    #endif
187
+    if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_INSERT, mode);
197 188
     SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
198 189
 
199 190
     first_impatient_beep(max_beep_count);
@@ -217,9 +208,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
217 208
     }
218 209
   }
219 210
 
220
-  #if HAS_LCD_MENU
221
-    if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_LOAD, mode);
222
-  #endif
211
+  if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_LOAD, mode);
223 212
 
224 213
   #if ENABLED(DUAL_X_CARRIAGE)
225 214
     const int8_t saved_ext        = active_extruder;
@@ -250,9 +239,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
250 239
 
251 240
   #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
252 241
 
253
-    #if HAS_LCD_MENU
254
-      if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
255
-    #endif
242
+    if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
256 243
 
257 244
     TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
258 245
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
@@ -266,9 +253,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
266 253
     do {
267 254
       if (purge_length > 0) {
268 255
         // "Wait for filament purge"
269
-        #if HAS_LCD_MENU
270
-          if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE);
271
-        #endif
256
+        if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
272 257
 
273 258
         // Extrude filament to get into hotend
274 259
         unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
@@ -281,7 +266,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
281 266
           // Show "Purge More" / "Resume" menu and wait for reply
282 267
           KEEPALIVE_STATE(PAUSED_FOR_USER);
283 268
           wait_for_user = false;
284
-          lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
269
+          ui.pause_show_message(PAUSE_MESSAGE_OPTION);
285 270
           while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
286 271
         }
287 272
       #endif
@@ -330,22 +315,16 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
330 315
     #endif
331 316
   );
332 317
 
333
-  UNUSED(show_lcd);
334
-
335 318
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
336 319
     constexpr float mix_multiplier = 1.0;
337 320
   #endif
338 321
 
339 322
   if (!ensure_safe_temperature(false, mode)) {
340
-    #if HAS_LCD_MENU
341
-      if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS);
342
-    #endif
323
+    if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_STATUS);
343 324
     return false;
344 325
   }
345 326
 
346
-  #if HAS_LCD_MENU
347
-    if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);
348
-  #endif
327
+  if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_UNLOAD, mode);
349 328
 
350 329
   // Retract filament
351 330
   unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
@@ -479,7 +458,7 @@ void show_continue_prompt(const bool is_reload) {
479 458
   DEBUG_SECTION(scp, "pause_print", true);
480 459
   DEBUG_ECHOLNPAIR("... is_reload:", int(is_reload));
481 460
 
482
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING));
461
+  ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING);
483 462
   SERIAL_ECHO_START();
484 463
   serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
485 464
 }
@@ -520,7 +499,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
520 499
     // Wait for the user to press the button to re-heat the nozzle, then
521 500
     // re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
522 501
     if (nozzle_timed_out) {
523
-      TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_HEAT));
502
+      ui.pause_show_message(PAUSE_MESSAGE_HEAT);
524 503
       SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
525 504
 
526 505
       TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT)));
@@ -614,7 +593,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
614 593
     thermalManager.wait_for_hotend(active_extruder, false);
615 594
   }
616 595
 
617
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_RESUME));
596
+  ui.pause_show_message(PAUSE_MESSAGE_RESUME);
618 597
 
619 598
   // Check Temperature before moving hotend
620 599
   ensure_safe_temperature();
@@ -653,7 +632,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
653 632
   // Write PLR now to update the z axis value
654 633
   TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
655 634
 
656
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
635
+  ui.pause_show_message(PAUSE_MESSAGE_STATUS);
657 636
 
658 637
   #ifdef ACTION_ON_RESUMED
659 638
     host_action_resumed();

+ 5
- 1
Marlin/src/feature/pause.h View File

@@ -101,4 +101,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd=false, cons
101 101
   #endif
102 102
 );
103 103
 
104
-#endif // ADVANCED_PAUSE_FEATURE
104
+#else // !ADVANCED_PAUSE_FEATURE
105
+
106
+  constexpr uint8_t did_pause_print = 0;
107
+
108
+#endif // !ADVANCED_PAUSE_FEATURE

+ 2
- 1
Marlin/src/feature/runout.cpp View File

@@ -59,6 +59,7 @@ bool FilamentMonitorBase::enabled = true,
59 59
 // Filament Runout event handler
60 60
 //
61 61
 #include "../MarlinCore.h"
62
+#include "../feature/pause.h"
62 63
 #include "../gcode/queue.h"
63 64
 
64 65
 #if ENABLED(HOST_ACTION_COMMANDS)
@@ -71,7 +72,7 @@ bool FilamentMonitorBase::enabled = true,
71 72
 
72 73
 void event_filament_runout() {
73 74
 
74
-  if (TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print)) return;  // Action already in progress. Purge triggered repeated runout.
75
+  if (did_pause_print) return;  // Action already in progress. Purge triggered repeated runout.
75 76
 
76 77
   #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
77 78
     if (migration.in_progress) {

+ 2
- 6
Marlin/src/feature/runout.h View File

@@ -118,9 +118,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
118 118
 
119 119
     // Give the response a chance to update its counter.
120 120
     static inline void run() {
121
-      if ( enabled && !filament_ran_out
122
-        && (printingIsActive() || TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print))
123
-      ) {
121
+      if (enabled && !filament_ran_out && (printingIsActive() || did_pause_print)) {
124 122
         TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
125 123
         response.run();
126 124
         sensor.run();
@@ -343,9 +341,7 @@ class FilamentSensorBase {
343 341
       }
344 342
 
345 343
       static inline void block_completed(const block_t* const b) {
346
-        if (b->steps.x || b->steps.y || b->steps.z
347
-          || TERN0(ADVANCED_PAUSE_FEATURE, did_pause_print) // Allow pause purge move to re-trigger runout state
348
-        ) {
344
+        if (b->steps.x || b->steps.y || b->steps.z || did_pause_print) { // Allow pause purge move to re-trigger runout state
349 345
           // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
350 346
           const uint8_t e = b->extruder;
351 347
           const int32_t steps = b->steps.e;

+ 10
- 0
Marlin/src/feature/twibus.cpp View File

@@ -28,6 +28,8 @@
28 28
 
29 29
 #include <Wire.h>
30 30
 
31
+TWIBus i2c;
32
+
31 33
 TWIBus::TWIBus() {
32 34
   #if I2C_SLAVE_ADDRESS == 0
33 35
     Wire.begin();                  // No address joins the BUS as the master
@@ -155,6 +157,14 @@ void TWIBus::flush() {
155 157
     reset();
156 158
   }
157 159
 
160
+  void i2c_on_receive(int bytes) { // just echo all bytes received to serial
161
+    i2c.receive(bytes);
162
+  }
163
+
164
+  void i2c_on_request() {          // just send dummy data for now
165
+    i2c.reply("Hello World!\n");
166
+  }
167
+
158 168
 #endif
159 169
 
160 170
 #if ENABLED(DEBUG_TWIBUS)

+ 13
- 0
Marlin/src/feature/twibus.h View File

@@ -31,6 +31,17 @@
31 31
 typedef void (*twiReceiveFunc_t)(int bytes);
32 32
 typedef void (*twiRequestFunc_t)();
33 33
 
34
+/**
35
+ * For a light i2c protocol that runs on two boards running Marlin see:
36
+ * See https://github.com/MarlinFirmware/Marlin/issues/4776#issuecomment-246262879
37
+ */
38
+#if I2C_SLAVE_ADDRESS > 0
39
+
40
+  void i2c_on_receive(int bytes); // Demo i2c onReceive handler
41
+  void i2c_on_request();          // Demo i2c onRequest handler
42
+
43
+#endif
44
+
34 45
 #define TWIBUS_BUFFER_SIZE 32
35 46
 
36 47
 /**
@@ -238,3 +249,5 @@ class TWIBus {
238 249
       static inline void debug(const char[], uint8_t) {}
239 250
     #endif
240 251
 };
252
+
253
+extern TWIBus i2c;

+ 2
- 1
Marlin/src/gcode/control/M108_M112_M410.cpp View File

@@ -25,7 +25,8 @@
25 25
 #if DISABLED(EMERGENCY_PARSER)
26 26
 
27 27
 #include "../gcode.h"
28
-#include "../../MarlinCore.h" // for wait_for_heatup, kill, quickstop_stepper
28
+#include "../../MarlinCore.h" // for wait_for_heatup, kill
29
+#include "../../module/motion.h" // for quickstop_stepper
29 30
 
30 31
 /**
31 32
  * M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.

+ 2
- 0
Marlin/src/gcode/control/M226.cpp View File

@@ -28,6 +28,8 @@
28 28
 #include "../../MarlinCore.h" // for pin_is_protected and idle()
29 29
 #include "../../module/stepper.h"
30 30
 
31
+void protected_pin_err();
32
+
31 33
 /**
32 34
  * M226: Wait until the specified pin reaches the state required (M226 P<pin> S<state>)
33 35
  */

+ 4
- 0
Marlin/src/gcode/control/M42.cpp View File

@@ -31,6 +31,10 @@
31 31
   #include "../../module/temperature.h"
32 32
 #endif
33 33
 
34
+void protected_pin_err() {
35
+  SERIAL_ERROR_MSG(STR_ERR_PROTECTED_PIN);
36
+}
37
+
34 38
 /**
35 39
  * M42: Change pin status via GCode
36 40
  *

+ 1
- 1
Marlin/src/gcode/feature/i2c/M260_M261.cpp View File

@@ -26,7 +26,7 @@
26 26
 
27 27
 #include "../../gcode.h"
28 28
 
29
-#include "../../../MarlinCore.h" // for i2c
29
+#include "../../../feature/twibus.h"
30 30
 
31 31
 /**
32 32
  * M260: Send data to a I2C slave device

+ 3
- 6
Marlin/src/gcode/feature/pause/M125.cpp View File

@@ -27,13 +27,10 @@
27 27
 #include "../../gcode.h"
28 28
 #include "../../parser.h"
29 29
 #include "../../../feature/pause.h"
30
+#include "../../../lcd/marlinui.h"
30 31
 #include "../../../module/motion.h"
31
-#include "../../../sd/cardreader.h"
32 32
 #include "../../../module/printcounter.h"
33
-
34
-#if HAS_LCD_MENU
35
-  #include "../../../lcd/marlinui.h"
36
-#endif
33
+#include "../../../sd/cardreader.h"
37 34
 
38 35
 #if ENABLED(POWER_LOSS_RECOVERY)
39 36
   #include "../../../feature/powerloss.h"
@@ -76,7 +73,7 @@ void GcodeSuite::M125() {
76 73
 
77 74
   const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
78 75
 
79
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT));
76
+  ui.pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT);
80 77
 
81 78
   // If possible, show an LCD prompt with the 'P' flag
82 79
   const bool show_lcd = TERN0(HAS_LCD_MENU, parser.boolval('P'));

+ 3
- 6
Marlin/src/gcode/feature/pause/M600.cpp View File

@@ -28,15 +28,12 @@
28 28
 #include "../../../feature/pause.h"
29 29
 #include "../../../module/motion.h"
30 30
 #include "../../../module/printcounter.h"
31
+#include "../../../lcd/marlinui.h"
31 32
 
32 33
 #if HAS_MULTI_EXTRUDER
33 34
   #include "../../../module/tool_change.h"
34 35
 #endif
35 36
 
36
-#if HAS_LCD_MENU
37
-  #include "../../../lcd/marlinui.h"
38
-#endif
39
-
40 37
 #if ENABLED(MMU2_MENUS)
41 38
   #include "../../../lcd/menu/menu_mmu2.h"
42 39
 #endif
@@ -96,8 +93,8 @@ void GcodeSuite::M600() {
96 93
   #endif
97 94
 
98 95
   // Show initial "wait for start" message
99
-  #if HAS_LCD_MENU && DISABLED(MMU2_MENUS)
100
-    lcd_pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);
96
+  #if DISABLED(MMU2_MENUS)
97
+    ui.pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);
101 98
   #endif
102 99
 
103 100
   #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)

+ 5
- 8
Marlin/src/gcode/feature/pause/M701_M702.cpp View File

@@ -29,15 +29,12 @@
29 29
 #include "../../../module/motion.h"
30 30
 #include "../../../module/temperature.h"
31 31
 #include "../../../feature/pause.h"
32
+#include "../../../lcd/marlinui.h"
32 33
 
33 34
 #if HAS_MULTI_EXTRUDER
34 35
   #include "../../../module/tool_change.h"
35 36
 #endif
36 37
 
37
-#if HAS_LCD_MENU
38
-  #include "../../../lcd/marlinui.h"
39
-#endif
40
-
41 38
 #if HAS_PRUSA_MMU2
42 39
   #include "../../../feature/mmu/mmu2.h"
43 40
 #endif
@@ -82,7 +79,7 @@ void GcodeSuite::M701() {
82 79
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
83 80
 
84 81
   // Show initial "wait for load" message
85
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder));
82
+  ui.pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder);
86 83
 
87 84
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
88 85
     // Change toolhead if specified
@@ -128,7 +125,7 @@ void GcodeSuite::M701() {
128 125
   TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
129 126
 
130 127
   // Show status screen
131
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
128
+  ui.pause_show_message(PAUSE_MESSAGE_STATUS);
132 129
 }
133 130
 
134 131
 /**
@@ -180,7 +177,7 @@ void GcodeSuite::M702() {
180 177
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
181 178
 
182 179
   // Show initial "wait for unload" message
183
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder));
180
+  ui.pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder);
184 181
 
185 182
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
186 183
     // Change toolhead if specified
@@ -232,7 +229,7 @@ void GcodeSuite::M702() {
232 229
   TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
233 230
 
234 231
   // Show status screen
235
-  TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_STATUS));
232
+  ui.pause_show_message(PAUSE_MESSAGE_STATUS);
236 233
 }
237 234
 
238 235
 #endif // ADVANCED_PAUSE_FEATURE

+ 30
- 2
Marlin/src/gcode/gcode.cpp View File

@@ -61,7 +61,7 @@ GcodeSuite gcode;
61 61
   #include "../feature/password/password.h"
62 62
 #endif
63 63
 
64
-#include "../MarlinCore.h" // for idle()
64
+#include "../MarlinCore.h" // for idle, kill
65 65
 
66 66
 // Inactivity shutdown
67 67
 millis_t GcodeSuite::previous_move_ms = 0,
@@ -209,6 +209,31 @@ void GcodeSuite::dwell(millis_t time) {
209 209
  */
210 210
 #if BOTH(HAS_LEVELING, G29_RETRY_AND_RECOVER)
211 211
 
212
+  void GcodeSuite::event_probe_recover() {
213
+    TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying"), DISMISS_STR));
214
+    #ifdef ACTION_ON_G29_RECOVER
215
+      host_action(PSTR(ACTION_ON_G29_RECOVER));
216
+    #endif
217
+    #ifdef G29_RECOVER_COMMANDS
218
+      process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS));
219
+    #endif
220
+  }
221
+
222
+  void GcodeSuite::event_probe_failure() {
223
+    #ifdef ACTION_ON_G29_FAILURE
224
+      host_action(PSTR(ACTION_ON_G29_FAILURE));
225
+    #endif
226
+    #ifdef G29_FAILURE_COMMANDS
227
+      process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS));
228
+    #endif
229
+    #if ENABLED(G29_HALT_ON_FAILURE)
230
+      #ifdef ACTION_ON_CANCEL
231
+        host_action_cancel();
232
+      #endif
233
+      kill(GET_TEXT(MSG_LCD_PROBING_FAILED));
234
+    #endif
235
+  }
236
+
212 237
   #ifndef G29_MAX_RETRIES
213 238
     #define G29_MAX_RETRIES 0
214 239
   #endif
@@ -216,7 +241,10 @@ void GcodeSuite::dwell(millis_t time) {
216 241
   void GcodeSuite::G29_with_retry() {
217 242
     uint8_t retries = G29_MAX_RETRIES;
218 243
     while (G29()) { // G29 should return true for failed probes ONLY
219
-      if (retries--) event_probe_recover();
244
+      if (retries) {
245
+        event_probe_recover();
246
+        --retries;
247
+      }
220 248
       else {
221 249
         event_probe_failure();
222 250
         return;

+ 2
- 0
Marlin/src/gcode/gcode.h View File

@@ -452,6 +452,8 @@ private:
452 452
 
453 453
   #if HAS_LEVELING
454 454
     #if ENABLED(G29_RETRY_AND_RECOVER)
455
+      static void event_probe_failure();
456
+      static void event_probe_recover();
455 457
       static void G29_with_retry();
456 458
       #define G29_TYPE bool
457 459
     #else

+ 1
- 0
Marlin/src/gcode/queue.cpp View File

@@ -31,6 +31,7 @@ GCodeQueue queue;
31 31
 
32 32
 #include "../lcd/marlinui.h"
33 33
 #include "../sd/cardreader.h"
34
+#include "../module/motion.h"
34 35
 #include "../module/planner.h"
35 36
 #include "../module/temperature.h"
36 37
 #include "../MarlinCore.h"

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

@@ -44,7 +44,7 @@
44 44
 #endif
45 45
 
46 46
 #if HAS_LEDS_OFF_FLAG
47
-  #include "../../MarlinCore.h" // for wait_for_user_response
47
+  #include "../../MarlinCore.h" // for wait_for_user_response()
48 48
   #include "../../feature/leds/printer_event_leds.h"
49 49
 #endif
50 50
 

+ 2
- 0
Marlin/src/lcd/dogm/marlinui_DOGM.cpp View File

@@ -544,6 +544,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
544 544
 
545 545
       // Put Relevant Text on Display
546 546
 
547
+      extern const char X_LBL[], Y_LBL[], Z_LBL[];
548
+
547 549
       // Show X and Y positions at top of screen
548 550
       u8g.setColorIndex(1);
549 551
       if (PAGE_UNDER(7)) {

+ 0
- 1
Marlin/src/lcd/dwin/e3v2/rotary_encoder.h View File

@@ -30,7 +30,6 @@
30 30
   ****************************************************************************/
31 31
 
32 32
 #include "../../../inc/MarlinConfig.h"
33
-#include "../../../MarlinCore.h"
34 33
 
35 34
 /*********************** Encoder Set ***********************/
36 35
 

+ 2
- 2
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp View File

@@ -27,8 +27,8 @@
27 27
 #include "../../ui_api.h"
28 28
 
29 29
 #include "../../../../libs/numtostr.h"
30
-#include "../../../../module/motion.h"  // for A20 read printing speed feedrate_percentage
31
-#include "../../../../MarlinCore.h"     // for quickstop_stepper, disable_steppers, G28_STR
30
+#include "../../../../module/motion.h"  // for quickstop_stepper, A20 read printing speed, feedrate_percentage
31
+#include "../../../../MarlinCore.h"     // for disable_steppers, G28_STR
32 32
 #include "../../../../inc/MarlinConfig.h"
33 33
 
34 34
 // command sending macro's with debugging capability

+ 3
- 2
Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.h View File

@@ -25,7 +25,8 @@
25 25
 
26 26
 #include "../../../../inc/MarlinConfigPre.h"
27 27
 
28
-#include "../../../../MarlinCore.h"
28
+#include <stdlib.h>    // size_t
29
+
29 30
 #if HAS_BED_PROBE
30 31
   #include "../../../../module/probe.h"
31 32
 #endif
@@ -96,7 +97,7 @@ private:
96 97
   static void WritePGM(const char str[], uint8_t len);
97 98
   static void ProcessRx();
98 99
 
99
-  static inline uint16_t swap16(const uint16_t value) { return (value & 0xffU) << 8U | (value >> 8U); }
100
+  static inline uint16_t swap16(const uint16_t value) { return (value & 0xFFU) << 8U | (value >> 8U); }
100 101
   static rx_datagram_state_t rx_datagram_state;
101 102
   static uint8_t rx_datagram_len;
102 103
   static bool Initialized, no_reentrance;

+ 0
- 2
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp View File

@@ -23,8 +23,6 @@
23 23
 
24 24
 #if HAS_TFT_LVGL_UI
25 25
 
26
-#include "../../../../MarlinCore.h"
27
-
28 26
 #include "draw_ui.h"
29 27
 #include "tft_multi_language.h"
30 28
 

+ 4
- 0
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp View File

@@ -39,6 +39,10 @@
39 39
 #include "../../../../module/planner.h"
40 40
 #include "../../../../module/servo.h"
41 41
 #include "../../../../module/probe.h"
42
+
43
+#if DISABLED(EMERGENCY_PARSER)
44
+  #include "../../../../module/motion.h"
45
+#endif
42 46
 #if ENABLED(POWER_LOSS_RECOVERY)
43 47
   #include "../../../../feature/powerloss.h"
44 48
 #endif

+ 1
- 1
Marlin/src/lcd/marlinui.cpp View File

@@ -1516,7 +1516,7 @@ void MarlinUI::update() {
1516 1516
     LCD_MESSAGEPGM(MSG_PRINT_PAUSED);
1517 1517
 
1518 1518
     #if ENABLED(PARK_HEAD_ON_PAUSE)
1519
-      TERN_(HAS_WIRED_LCD, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT)); // Show message immediately to let user know about pause in progress
1519
+      pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT); // Show message immediately to let user know about pause in progress
1520 1520
       queue.inject_P(PSTR("M25 P\nM24"));
1521 1521
     #elif ENABLED(SDSUPPORT)
1522 1522
       queue.inject_P(PSTR("M25"));

+ 12
- 13
Marlin/src/lcd/marlinui.h View File

@@ -51,14 +51,12 @@
51 51
   #include "../module/printcounter.h"
52 52
 #endif
53 53
 
54
-#if HAS_WIRED_LCD
55
-
56
-  #include "../MarlinCore.h"
54
+#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
55
+  #include "../feature/pause.h"
56
+  #include "../module/motion.h" // for active_extruder
57
+#endif
57 58
 
58
-  #if ENABLED(ADVANCED_PAUSE_FEATURE)
59
-    #include "../feature/pause.h"
60
-    #include "../module/motion.h" // for active_extruder
61
-  #endif
59
+#if HAS_WIRED_LCD
62 60
 
63 61
   enum LCDViewAction : uint8_t {
64 62
     LCDVIEW_NONE,
@@ -87,12 +85,6 @@
87 85
     typedef void (*screenFunc_t)();
88 86
     typedef void (*menuAction_t)();
89 87
 
90
-    #if ENABLED(ADVANCED_PAUSE_FEATURE)
91
-      void lcd_pause_show_message(const PauseMessage message,
92
-                                  const PauseMode mode=PAUSE_MODE_SAME,
93
-                                  const uint8_t extruder=active_extruder);
94
-    #endif
95
-
96 88
     #if ENABLED(AUTO_BED_LEVELING_UBL)
97 89
       void lcd_mesh_edit_setup(const float &initial);
98 90
       float lcd_mesh_edit();
@@ -506,6 +498,13 @@ public:
506 498
 
507 499
   #endif
508 500
 
501
+  #if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
502
+    static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
503
+  #else
504
+    static inline void _pause_show_message() {}
505
+    #define pause_show_message(...) _pause_show_message()
506
+  #endif
507
+
509 508
   //
510 509
   // EEPROM: Reset / Init / Load / Store
511 510
   //

+ 2
- 0
Marlin/src/lcd/menu/menu_configuration.cpp View File

@@ -161,6 +161,8 @@ void menu_advanced_settings();
161 161
   #include "../../module/motion.h"
162 162
   #include "../../gcode/queue.h"
163 163
 
164
+  extern const char G28_STR[];
165
+
164 166
   void menu_tool_offsets() {
165 167
 
166 168
     auto _recalc_offsets = []{

+ 2
- 0
Marlin/src/lcd/menu/menu_delta_calibrate.cpp View File

@@ -53,6 +53,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
53 53
 
54 54
 #if ENABLED(DELTA_AUTO_CALIBRATION)
55 55
 
56
+  #include "../../MarlinCore.h" // for wait_for_user_response()
56 57
   #include "../../gcode/gcode.h"
57 58
 
58 59
   #if ENABLED(HOST_PROMPT_SUPPORT)
@@ -81,6 +82,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
81 82
   }
82 83
 
83 84
   void _lcd_delta_calibrate_home() {
85
+    extern const char G28_STR[];
84 86
     queue.inject_P(G28_STR);
85 87
     ui.goto_screen(_lcd_calibrate_homing);
86 88
   }

+ 3
- 1
Marlin/src/lcd/menu/menu_filament.cpp View File

@@ -107,6 +107,8 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) {
107 107
  */
108 108
 #if E_STEPPERS > 1 || ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
109 109
 
110
+  bool printingIsPaused();
111
+
110 112
   void menu_change_filament() {
111 113
     // Say "filament change" when no print is active
112 114
     editable.int8 = printingIsPaused() ? PAUSE_MODE_PAUSE_PRINT : PAUSE_MODE_CHANGE_FILAMENT;
@@ -315,7 +317,7 @@ FORCE_INLINE screenFunc_t ap_message_screen(const PauseMessage message) {
315 317
   return nullptr;
316 318
 }
317 319
 
318
-void lcd_pause_show_message(
320
+void MarlinUI::pause_show_message(
319 321
   const PauseMessage message,
320 322
   const PauseMode mode/*=PAUSE_MODE_SAME*/,
321 323
   const uint8_t extruder/*=active_extruder*/

+ 2
- 0
Marlin/src/lcd/menu/menu_motion.cpp View File

@@ -51,6 +51,8 @@
51 51
   float manual_move_e_origin = 0;
52 52
 #endif
53 53
 
54
+extern const char G28_STR[];
55
+
54 56
 //
55 57
 // "Motion" > "Move Axis" submenu
56 58
 //

+ 0
- 1
Marlin/src/module/endstops.cpp View File

@@ -27,7 +27,6 @@
27 27
 #include "endstops.h"
28 28
 #include "stepper.h"
29 29
 
30
-#include "../MarlinCore.h"
31 30
 #include "../sd/cardreader.h"
32 31
 #include "temperature.h"
33 32
 #include "../lcd/marlinui.h"

+ 11
- 2
Marlin/src/module/motion.cpp View File

@@ -236,8 +236,17 @@ void report_current_position_projected() {
236 236
 }
237 237
 
238 238
 /**
239
- * sync_plan_position
240
- *
239
+ * Run out the planner buffer and re-sync the current
240
+ * position from the last-updated stepper positions.
241
+ */
242
+void quickstop_stepper() {
243
+  planner.quick_stop();
244
+  planner.synchronize();
245
+  set_current_from_steppers_for_axis(ALL_AXES);
246
+  sync_plan_position();
247
+}
248
+
249
+/**
241 250
  * Set the planner/stepper positions directly from current_position with
242 251
  * no kinematic translation. Used for homing axes and cartesian/core syncing.
243 252
  */

+ 2
- 0
Marlin/src/module/motion.h View File

@@ -212,6 +212,8 @@ void report_current_position_projected();
212 212
 void get_cartesian_from_steppers();
213 213
 void set_current_from_steppers_for_axis(const AxisEnum axis);
214 214
 
215
+void quickstop_stepper();
216
+
215 217
 /**
216 218
  * sync_plan_position
217 219
  *

+ 1
- 1
Marlin/src/module/probe.cpp View File

@@ -38,7 +38,7 @@
38 38
 #include "../gcode/gcode.h"
39 39
 #include "../lcd/marlinui.h"
40 40
 
41
-#include "../MarlinCore.h" // for stop(), disable_e_steppers
41
+#include "../MarlinCore.h" // for stop(), disable_e_steppers(), wait_for_user_response()
42 42
 
43 43
 #if HAS_LEVELING
44 44
   #include "../feature/bedlevel/bedlevel.h"

+ 7
- 4
Marlin/src/module/temperature.cpp View File

@@ -27,14 +27,17 @@
27 27
 // Useful when debugging thermocouples
28 28
 //#define IGNORE_THERMOCOUPLE_ERRORS
29 29
 
30
+#include "../MarlinCore.h"
31
+#include "../HAL/shared/Delay.h"
32
+#include "../lcd/marlinui.h"
33
+
30 34
 #include "temperature.h"
31 35
 #include "endstops.h"
32
-
33
-#include "../MarlinCore.h"
34 36
 #include "planner.h"
35
-#include "../HAL/shared/Delay.h"
36 37
 
37
-#include "../lcd/marlinui.h"
38
+#if ENABLED(EMERGENCY_PARSER)
39
+  #include "motion.h"
40
+#endif
38 41
 
39 42
 #if ENABLED(DWIN_CREALITY_LCD)
40 43
   #include "../lcd/dwin/e3v2/dwin.h"

Loading…
Cancel
Save