瀏覽代碼

Move some MarlinCore and MarlinUI code (#20832)

Scott Lahteine 4 年之前
父節點
當前提交
c0870d417a
No account linked to committer's email address
共有 38 個文件被更改,包括 178 次插入206 次删除
  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 查看文件

43
 #include <math.h>
43
 #include <math.h>
44
 
44
 
45
 #include "core/utility.h"
45
 #include "core/utility.h"
46
+
46
 #include "module/motion.h"
47
 #include "module/motion.h"
47
 #include "module/planner.h"
48
 #include "module/planner.h"
48
 #include "module/endstops.h"
49
 #include "module/endstops.h"
57
 #include "gcode/parser.h"
58
 #include "gcode/parser.h"
58
 #include "gcode/queue.h"
59
 #include "gcode/queue.h"
59
 
60
 
61
+#include "feature/pause.h"
60
 #include "sd/cardreader.h"
62
 #include "sd/cardreader.h"
61
 
63
 
62
 #include "lcd/marlinui.h"
64
 #include "lcd/marlinui.h"
139
 
141
 
140
 #if ENABLED(EXPERIMENTAL_I2CBUS)
142
 #if ENABLED(EXPERIMENTAL_I2CBUS)
141
   #include "feature/twibus.h"
143
   #include "feature/twibus.h"
142
-  TWIBus i2c;
143
 #endif
144
 #endif
144
 
145
 
145
 #if ENABLED(I2C_POSITION_ENCODERS)
146
 #if ENABLED(I2C_POSITION_ENCODERS)
173
   #include "feature/bedlevel/bedlevel.h"
174
   #include "feature/bedlevel/bedlevel.h"
174
 #endif
175
 #endif
175
 
176
 
176
-#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT)
177
-  #include "feature/pause.h"
178
-#endif
179
-
180
 #if ENABLED(GCODE_REPEAT_MARKERS)
177
 #if ENABLED(GCODE_REPEAT_MARKERS)
181
   #include "feature/repeat.h"
178
   #include "feature/repeat.h"
182
 #endif
179
 #endif
267
 
264
 
268
 #endif
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
  * ******************************** FUNCTIONS ********************************
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
  * Stepper Reset (RigidBoard, et.al.)
274
  * Stepper Reset (RigidBoard, et.al.)
306
  */
275
  */
309
   void enableStepperDrivers()  { SET_INPUT(STEPPER_RESET_PIN); }      // Set to input, allowing pullups to pull the pin high
278
   void enableStepperDrivers()  { SET_INPUT(STEPPER_RESET_PIN); }      // Set to input, allowing pullups to pull the pin high
310
 #endif
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
  * Sensitive pin test for M42, M226
282
  * Sensitive pin test for M42, M226
326
  */
283
  */
342
 
299
 
343
 #pragma GCC diagnostic pop
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
 void enable_e_steppers() {
302
 void enable_e_steppers() {
357
   #define _ENA_E(N) ENABLE_AXIS_E##N();
303
   #define _ENA_E(N) ENABLE_AXIS_E##N();
358
   REPEAT(E_STEPPERS, _ENA_E)
304
   REPEAT(E_STEPPERS, _ENA_E)
389
   TERN_(EXTENSIBLE_UI, ExtUI::onSteppersDisabled());
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
  * A Print Job exists when the timer is running or SD printing
339
  * A Print Job exists when the timer is running or SD printing
429
  */
340
  */
511
 
422
 
512
   // Prevent steppers timing-out in the middle of M600
423
   // Prevent steppers timing-out in the middle of M600
513
   // unless PAUSE_PARK_NO_STEPPER_TIMEOUT is disabled
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
   // Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
428
   // Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
518
   if (parked_or_ignoring) gcode.reset_stepper_timeout(ms);
429
   if (parked_or_ignoring) gcode.reset_stepper_timeout(ms);
550
   }
461
   }
551
 
462
 
552
   #if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH)
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
     if (chdk_timeout && ELAPSED(ms, chdk_timeout)) {
465
     if (chdk_timeout && ELAPSED(ms, chdk_timeout)) {
554
       chdk_timeout = 0;
466
       chdk_timeout = 0;
555
       WRITE(CHDK_PIN, LOW);
467
       WRITE(CHDK_PIN, LOW);
1038
     SETUP_RUN(recovery.setup());
950
     SETUP_RUN(recovery.setup());
1039
   #endif
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
   #if HAS_TMC220x
962
   #if HAS_TMC220x
1044
     SETUP_RUN(tmc_serial_begin());
963
     SETUP_RUN(tmc_serial_begin());
1045
   #endif
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
   #if HAS_STEPPER_RESET
977
   #if HAS_STEPPER_RESET
1050
     SETUP_RUN(disableStepperDrivers());
978
     SETUP_RUN(disableStepperDrivers());

+ 0
- 13
Marlin/src/MarlinCore.h 查看文件

37
 void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep=false));
37
 void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep=false));
38
 inline void idle_no_sleep() { idle(TERN_(ADVANCED_PAUSE_FEATURE, true)); }
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
 #if ENABLED(G38_PROBE_TARGET)
40
 #if ENABLED(G38_PROBE_TARGET)
46
   extern uint8_t G38_move;          // Flag to tell the ISR that G38 is in progress, and the type
41
   extern uint8_t G38_move;          // Flag to tell the ISR that G38 is in progress, and the type
47
   extern bool G38_did_trigger;      // Flag from the ISR to indicate the endstop changed
42
   extern bool G38_did_trigger;      // Flag from the ISR to indicate the endstop changed
59
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
54
 void kill(PGM_P const lcd_error=nullptr, PGM_P const lcd_component=nullptr, const bool steppers_off=false);
60
 void minkill(const bool steppers_off=false);
55
 void minkill(const bool steppers_off=false);
61
 
56
 
62
-void quickstop_stepper();
63
-
64
 // Global State of the firmware
57
 // Global State of the firmware
65
 enum MarlinState : uint8_t {
58
 enum MarlinState : uint8_t {
66
   MF_INITIALIZING =  0,
59
   MF_INITIALIZING =  0,
103
 #endif
96
 #endif
104
 
97
 
105
 bool pin_is_protected(const pin_t pin);
98
 bool pin_is_protected(const pin_t pin);
106
-void protected_pin_err();
107
 
99
 
108
 #if HAS_SUICIDE
100
 #if HAS_SUICIDE
109
   inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
101
   inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
116
   inline bool kill_state() { return READ(KILL_PIN) == KILL_PIN_STATE; }
108
   inline bool kill_state() { return READ(KILL_PIN) == KILL_PIN_STATE; }
117
 #endif
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
 extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
111
 extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
125
                   SP_A_STR[], SP_B_STR[], SP_C_STR[],
112
                   SP_A_STR[], SP_B_STR[], SP_C_STR[],
126
                   SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[],
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 查看文件

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

+ 2
- 0
Marlin/src/feature/encoder_i2c.cpp 查看文件

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

+ 13
- 34
Marlin/src/feature/pause.cpp 查看文件

137
       thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
137
       thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder);
138
   #endif
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
   if (wait) return thermalManager.wait_for_hotend(active_extruder);
142
   if (wait) return thermalManager.wait_for_hotend(active_extruder);
146
 
143
 
181
   DEBUG_SECTION(lf, "load_filament", true);
178
   DEBUG_SECTION(lf, "load_filament", true);
182
   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);
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
   if (!ensure_safe_temperature(false, mode)) {
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
     return false;
183
     return false;
191
   }
184
   }
192
 
185
 
193
   if (pause_for_user) {
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
     SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
188
     SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_INSERT));
198
 
189
 
199
     first_impatient_beep(max_beep_count);
190
     first_impatient_beep(max_beep_count);
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
   #if ENABLED(DUAL_X_CARRIAGE)
213
   #if ENABLED(DUAL_X_CARRIAGE)
225
     const int8_t saved_ext        = active_extruder;
214
     const int8_t saved_ext        = active_extruder;
250
 
239
 
251
   #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
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
     TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
244
     TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
258
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
245
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
266
     do {
253
     do {
267
       if (purge_length > 0) {
254
       if (purge_length > 0) {
268
         // "Wait for filament purge"
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
         // Extrude filament to get into hotend
258
         // Extrude filament to get into hotend
274
         unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
259
         unscaled_e_move(purge_length, ADVANCED_PAUSE_PURGE_FEEDRATE);
281
           // Show "Purge More" / "Resume" menu and wait for reply
266
           // Show "Purge More" / "Resume" menu and wait for reply
282
           KEEPALIVE_STATE(PAUSED_FOR_USER);
267
           KEEPALIVE_STATE(PAUSED_FOR_USER);
283
           wait_for_user = false;
268
           wait_for_user = false;
284
-          lcd_pause_show_message(PAUSE_MESSAGE_OPTION);
269
+          ui.pause_show_message(PAUSE_MESSAGE_OPTION);
285
           while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
270
           while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle_no_sleep();
286
         }
271
         }
287
       #endif
272
       #endif
330
     #endif
315
     #endif
331
   );
316
   );
332
 
317
 
333
-  UNUSED(show_lcd);
334
-
335
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
318
   #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER)
336
     constexpr float mix_multiplier = 1.0;
319
     constexpr float mix_multiplier = 1.0;
337
   #endif
320
   #endif
338
 
321
 
339
   if (!ensure_safe_temperature(false, mode)) {
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
     return false;
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
   // Retract filament
329
   // Retract filament
351
   unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
330
   unscaled_e_move(-(FILAMENT_UNLOAD_PURGE_RETRACT) * mix_multiplier, (PAUSE_PARK_RETRACT_FEEDRATE) * mix_multiplier);
479
   DEBUG_SECTION(scp, "pause_print", true);
458
   DEBUG_SECTION(scp, "pause_print", true);
480
   DEBUG_ECHOLNPAIR("... is_reload:", int(is_reload));
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
   SERIAL_ECHO_START();
462
   SERIAL_ECHO_START();
484
   serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
463
   serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n"));
485
 }
464
 }
520
     // Wait for the user to press the button to re-heat the nozzle, then
499
     // Wait for the user to press the button to re-heat the nozzle, then
521
     // re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
500
     // re-heat the nozzle, re-show the continue prompt, restart idle timers, start over
522
     if (nozzle_timed_out) {
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
       SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
503
       SERIAL_ECHO_MSG(_PMSG(STR_FILAMENT_CHANGE_HEAT));
525
 
504
 
526
       TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT)));
505
       TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_HEATER_TIMEOUT), GET_TEXT(MSG_REHEAT)));
614
     thermalManager.wait_for_hotend(active_extruder, false);
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
   // Check Temperature before moving hotend
598
   // Check Temperature before moving hotend
620
   ensure_safe_temperature();
599
   ensure_safe_temperature();
653
   // Write PLR now to update the z axis value
632
   // Write PLR now to update the z axis value
654
   TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
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
   #ifdef ACTION_ON_RESUMED
637
   #ifdef ACTION_ON_RESUMED
659
     host_action_resumed();
638
     host_action_resumed();

+ 5
- 1
Marlin/src/feature/pause.h 查看文件

101
   #endif
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 查看文件

59
 // Filament Runout event handler
59
 // Filament Runout event handler
60
 //
60
 //
61
 #include "../MarlinCore.h"
61
 #include "../MarlinCore.h"
62
+#include "../feature/pause.h"
62
 #include "../gcode/queue.h"
63
 #include "../gcode/queue.h"
63
 
64
 
64
 #if ENABLED(HOST_ACTION_COMMANDS)
65
 #if ENABLED(HOST_ACTION_COMMANDS)
71
 
72
 
72
 void event_filament_runout() {
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
   #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
77
   #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
77
     if (migration.in_progress) {
78
     if (migration.in_progress) {

+ 2
- 6
Marlin/src/feature/runout.h 查看文件

118
 
118
 
119
     // Give the response a chance to update its counter.
119
     // Give the response a chance to update its counter.
120
     static inline void run() {
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
         TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
122
         TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
125
         response.run();
123
         response.run();
126
         sensor.run();
124
         sensor.run();
343
       }
341
       }
344
 
342
 
345
       static inline void block_completed(const block_t* const b) {
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
           // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
345
           // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover.
350
           const uint8_t e = b->extruder;
346
           const uint8_t e = b->extruder;
351
           const int32_t steps = b->steps.e;
347
           const int32_t steps = b->steps.e;

+ 10
- 0
Marlin/src/feature/twibus.cpp 查看文件

28
 
28
 
29
 #include <Wire.h>
29
 #include <Wire.h>
30
 
30
 
31
+TWIBus i2c;
32
+
31
 TWIBus::TWIBus() {
33
 TWIBus::TWIBus() {
32
   #if I2C_SLAVE_ADDRESS == 0
34
   #if I2C_SLAVE_ADDRESS == 0
33
     Wire.begin();                  // No address joins the BUS as the master
35
     Wire.begin();                  // No address joins the BUS as the master
155
     reset();
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
 #endif
168
 #endif
159
 
169
 
160
 #if ENABLED(DEBUG_TWIBUS)
170
 #if ENABLED(DEBUG_TWIBUS)

+ 13
- 0
Marlin/src/feature/twibus.h 查看文件

31
 typedef void (*twiReceiveFunc_t)(int bytes);
31
 typedef void (*twiReceiveFunc_t)(int bytes);
32
 typedef void (*twiRequestFunc_t)();
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
 #define TWIBUS_BUFFER_SIZE 32
45
 #define TWIBUS_BUFFER_SIZE 32
35
 
46
 
36
 /**
47
 /**
238
       static inline void debug(const char[], uint8_t) {}
249
       static inline void debug(const char[], uint8_t) {}
239
     #endif
250
     #endif
240
 };
251
 };
252
+
253
+extern TWIBus i2c;

+ 2
- 1
Marlin/src/gcode/control/M108_M112_M410.cpp 查看文件

25
 #if DISABLED(EMERGENCY_PARSER)
25
 #if DISABLED(EMERGENCY_PARSER)
26
 
26
 
27
 #include "../gcode.h"
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
  * M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
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 查看文件

28
 #include "../../MarlinCore.h" // for pin_is_protected and idle()
28
 #include "../../MarlinCore.h" // for pin_is_protected and idle()
29
 #include "../../module/stepper.h"
29
 #include "../../module/stepper.h"
30
 
30
 
31
+void protected_pin_err();
32
+
31
 /**
33
 /**
32
  * M226: Wait until the specified pin reaches the state required (M226 P<pin> S<state>)
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 查看文件

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

+ 1
- 1
Marlin/src/gcode/feature/i2c/M260_M261.cpp 查看文件

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

+ 3
- 6
Marlin/src/gcode/feature/pause/M125.cpp 查看文件

27
 #include "../../gcode.h"
27
 #include "../../gcode.h"
28
 #include "../../parser.h"
28
 #include "../../parser.h"
29
 #include "../../../feature/pause.h"
29
 #include "../../../feature/pause.h"
30
+#include "../../../lcd/marlinui.h"
30
 #include "../../../module/motion.h"
31
 #include "../../../module/motion.h"
31
-#include "../../../sd/cardreader.h"
32
 #include "../../../module/printcounter.h"
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
 #if ENABLED(POWER_LOSS_RECOVERY)
35
 #if ENABLED(POWER_LOSS_RECOVERY)
39
   #include "../../../feature/powerloss.h"
36
   #include "../../../feature/powerloss.h"
76
 
73
 
77
   const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
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
   // If possible, show an LCD prompt with the 'P' flag
78
   // If possible, show an LCD prompt with the 'P' flag
82
   const bool show_lcd = TERN0(HAS_LCD_MENU, parser.boolval('P'));
79
   const bool show_lcd = TERN0(HAS_LCD_MENU, parser.boolval('P'));

+ 3
- 6
Marlin/src/gcode/feature/pause/M600.cpp 查看文件

28
 #include "../../../feature/pause.h"
28
 #include "../../../feature/pause.h"
29
 #include "../../../module/motion.h"
29
 #include "../../../module/motion.h"
30
 #include "../../../module/printcounter.h"
30
 #include "../../../module/printcounter.h"
31
+#include "../../../lcd/marlinui.h"
31
 
32
 
32
 #if HAS_MULTI_EXTRUDER
33
 #if HAS_MULTI_EXTRUDER
33
   #include "../../../module/tool_change.h"
34
   #include "../../../module/tool_change.h"
34
 #endif
35
 #endif
35
 
36
 
36
-#if HAS_LCD_MENU
37
-  #include "../../../lcd/marlinui.h"
38
-#endif
39
-
40
 #if ENABLED(MMU2_MENUS)
37
 #if ENABLED(MMU2_MENUS)
41
   #include "../../../lcd/menu/menu_mmu2.h"
38
   #include "../../../lcd/menu/menu_mmu2.h"
42
 #endif
39
 #endif
96
   #endif
93
   #endif
97
 
94
 
98
   // Show initial "wait for start" message
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
   #endif
98
   #endif
102
 
99
 
103
   #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)
100
   #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)

+ 5
- 8
Marlin/src/gcode/feature/pause/M701_M702.cpp 查看文件

29
 #include "../../../module/motion.h"
29
 #include "../../../module/motion.h"
30
 #include "../../../module/temperature.h"
30
 #include "../../../module/temperature.h"
31
 #include "../../../feature/pause.h"
31
 #include "../../../feature/pause.h"
32
+#include "../../../lcd/marlinui.h"
32
 
33
 
33
 #if HAS_MULTI_EXTRUDER
34
 #if HAS_MULTI_EXTRUDER
34
   #include "../../../module/tool_change.h"
35
   #include "../../../module/tool_change.h"
35
 #endif
36
 #endif
36
 
37
 
37
-#if HAS_LCD_MENU
38
-  #include "../../../lcd/marlinui.h"
39
-#endif
40
-
41
 #if HAS_PRUSA_MMU2
38
 #if HAS_PRUSA_MMU2
42
   #include "../../../feature/mmu/mmu2.h"
39
   #include "../../../feature/mmu/mmu2.h"
43
 #endif
40
 #endif
82
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
79
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
83
 
80
 
84
   // Show initial "wait for load" message
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
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
84
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
88
     // Change toolhead if specified
85
     // Change toolhead if specified
128
   TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
125
   TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
129
 
126
 
130
   // Show status screen
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
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
177
   if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
181
 
178
 
182
   // Show initial "wait for unload" message
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
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
182
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
186
     // Change toolhead if specified
183
     // Change toolhead if specified
232
   TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
229
   TERN_(MIXING_EXTRUDER, mixer.T(old_mixing_tool)); // Restore original mixing tool
233
 
230
 
234
   // Show status screen
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
 #endif // ADVANCED_PAUSE_FEATURE
235
 #endif // ADVANCED_PAUSE_FEATURE

+ 30
- 2
Marlin/src/gcode/gcode.cpp 查看文件

61
   #include "../feature/password/password.h"
61
   #include "../feature/password/password.h"
62
 #endif
62
 #endif
63
 
63
 
64
-#include "../MarlinCore.h" // for idle()
64
+#include "../MarlinCore.h" // for idle, kill
65
 
65
 
66
 // Inactivity shutdown
66
 // Inactivity shutdown
67
 millis_t GcodeSuite::previous_move_ms = 0,
67
 millis_t GcodeSuite::previous_move_ms = 0,
209
  */
209
  */
210
 #if BOTH(HAS_LEVELING, G29_RETRY_AND_RECOVER)
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
   #ifndef G29_MAX_RETRIES
237
   #ifndef G29_MAX_RETRIES
213
     #define G29_MAX_RETRIES 0
238
     #define G29_MAX_RETRIES 0
214
   #endif
239
   #endif
216
   void GcodeSuite::G29_with_retry() {
241
   void GcodeSuite::G29_with_retry() {
217
     uint8_t retries = G29_MAX_RETRIES;
242
     uint8_t retries = G29_MAX_RETRIES;
218
     while (G29()) { // G29 should return true for failed probes ONLY
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
       else {
248
       else {
221
         event_probe_failure();
249
         event_probe_failure();
222
         return;
250
         return;

+ 2
- 0
Marlin/src/gcode/gcode.h 查看文件

452
 
452
 
453
   #if HAS_LEVELING
453
   #if HAS_LEVELING
454
     #if ENABLED(G29_RETRY_AND_RECOVER)
454
     #if ENABLED(G29_RETRY_AND_RECOVER)
455
+      static void event_probe_failure();
456
+      static void event_probe_recover();
455
       static void G29_with_retry();
457
       static void G29_with_retry();
456
       #define G29_TYPE bool
458
       #define G29_TYPE bool
457
     #else
459
     #else

+ 1
- 0
Marlin/src/gcode/queue.cpp 查看文件

31
 
31
 
32
 #include "../lcd/marlinui.h"
32
 #include "../lcd/marlinui.h"
33
 #include "../sd/cardreader.h"
33
 #include "../sd/cardreader.h"
34
+#include "../module/motion.h"
34
 #include "../module/planner.h"
35
 #include "../module/planner.h"
35
 #include "../module/temperature.h"
36
 #include "../module/temperature.h"
36
 #include "../MarlinCore.h"
37
 #include "../MarlinCore.h"

+ 1
- 1
Marlin/src/gcode/sd/M1001.cpp 查看文件

44
 #endif
44
 #endif
45
 
45
 
46
 #if HAS_LEDS_OFF_FLAG
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
   #include "../../feature/leds/printer_event_leds.h"
48
   #include "../../feature/leds/printer_event_leds.h"
49
 #endif
49
 #endif
50
 
50
 

+ 2
- 0
Marlin/src/lcd/dogm/marlinui_DOGM.cpp 查看文件

544
 
544
 
545
       // Put Relevant Text on Display
545
       // Put Relevant Text on Display
546
 
546
 
547
+      extern const char X_LBL[], Y_LBL[], Z_LBL[];
548
+
547
       // Show X and Y positions at top of screen
549
       // Show X and Y positions at top of screen
548
       u8g.setColorIndex(1);
550
       u8g.setColorIndex(1);
549
       if (PAGE_UNDER(7)) {
551
       if (PAGE_UNDER(7)) {

+ 0
- 1
Marlin/src/lcd/dwin/e3v2/rotary_encoder.h 查看文件

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

+ 2
- 2
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp 查看文件

27
 #include "../../ui_api.h"
27
 #include "../../ui_api.h"
28
 
28
 
29
 #include "../../../../libs/numtostr.h"
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
 #include "../../../../inc/MarlinConfig.h"
32
 #include "../../../../inc/MarlinConfig.h"
33
 
33
 
34
 // command sending macro's with debugging capability
34
 // command sending macro's with debugging capability

+ 3
- 2
Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.h 查看文件

25
 
25
 
26
 #include "../../../../inc/MarlinConfigPre.h"
26
 #include "../../../../inc/MarlinConfigPre.h"
27
 
27
 
28
-#include "../../../../MarlinCore.h"
28
+#include <stdlib.h>    // size_t
29
+
29
 #if HAS_BED_PROBE
30
 #if HAS_BED_PROBE
30
   #include "../../../../module/probe.h"
31
   #include "../../../../module/probe.h"
31
 #endif
32
 #endif
96
   static void WritePGM(const char str[], uint8_t len);
97
   static void WritePGM(const char str[], uint8_t len);
97
   static void ProcessRx();
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
   static rx_datagram_state_t rx_datagram_state;
101
   static rx_datagram_state_t rx_datagram_state;
101
   static uint8_t rx_datagram_len;
102
   static uint8_t rx_datagram_len;
102
   static bool Initialized, no_reentrance;
103
   static bool Initialized, no_reentrance;

+ 0
- 2
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp 查看文件

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

+ 4
- 0
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp 查看文件

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

+ 1
- 1
Marlin/src/lcd/marlinui.cpp 查看文件

1516
     LCD_MESSAGEPGM(MSG_PRINT_PAUSED);
1516
     LCD_MESSAGEPGM(MSG_PRINT_PAUSED);
1517
 
1517
 
1518
     #if ENABLED(PARK_HEAD_ON_PAUSE)
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
       queue.inject_P(PSTR("M25 P\nM24"));
1520
       queue.inject_P(PSTR("M25 P\nM24"));
1521
     #elif ENABLED(SDSUPPORT)
1521
     #elif ENABLED(SDSUPPORT)
1522
       queue.inject_P(PSTR("M25"));
1522
       queue.inject_P(PSTR("M25"));

+ 12
- 13
Marlin/src/lcd/marlinui.h 查看文件

51
   #include "../module/printcounter.h"
51
   #include "../module/printcounter.h"
52
 #endif
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
   enum LCDViewAction : uint8_t {
61
   enum LCDViewAction : uint8_t {
64
     LCDVIEW_NONE,
62
     LCDVIEW_NONE,
87
     typedef void (*screenFunc_t)();
85
     typedef void (*screenFunc_t)();
88
     typedef void (*menuAction_t)();
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
     #if ENABLED(AUTO_BED_LEVELING_UBL)
88
     #if ENABLED(AUTO_BED_LEVELING_UBL)
97
       void lcd_mesh_edit_setup(const float &initial);
89
       void lcd_mesh_edit_setup(const float &initial);
98
       float lcd_mesh_edit();
90
       float lcd_mesh_edit();
506
 
498
 
507
   #endif
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
   // EEPROM: Reset / Init / Load / Store
509
   // EEPROM: Reset / Init / Load / Store
511
   //
510
   //

+ 2
- 0
Marlin/src/lcd/menu/menu_configuration.cpp 查看文件

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

+ 2
- 0
Marlin/src/lcd/menu/menu_delta_calibrate.cpp 查看文件

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

+ 3
- 1
Marlin/src/lcd/menu/menu_filament.cpp 查看文件

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

+ 2
- 0
Marlin/src/lcd/menu/menu_motion.cpp 查看文件

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

+ 0
- 1
Marlin/src/module/endstops.cpp 查看文件

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

+ 11
- 2
Marlin/src/module/motion.cpp 查看文件

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
  * Set the planner/stepper positions directly from current_position with
250
  * Set the planner/stepper positions directly from current_position with
242
  * no kinematic translation. Used for homing axes and cartesian/core syncing.
251
  * no kinematic translation. Used for homing axes and cartesian/core syncing.
243
  */
252
  */

+ 2
- 0
Marlin/src/module/motion.h 查看文件

212
 void get_cartesian_from_steppers();
212
 void get_cartesian_from_steppers();
213
 void set_current_from_steppers_for_axis(const AxisEnum axis);
213
 void set_current_from_steppers_for_axis(const AxisEnum axis);
214
 
214
 
215
+void quickstop_stepper();
216
+
215
 /**
217
 /**
216
  * sync_plan_position
218
  * sync_plan_position
217
  *
219
  *

+ 1
- 1
Marlin/src/module/probe.cpp 查看文件

38
 #include "../gcode/gcode.h"
38
 #include "../gcode/gcode.h"
39
 #include "../lcd/marlinui.h"
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
 #if HAS_LEVELING
43
 #if HAS_LEVELING
44
   #include "../feature/bedlevel/bedlevel.h"
44
   #include "../feature/bedlevel/bedlevel.h"

+ 7
- 4
Marlin/src/module/temperature.cpp 查看文件

27
 // Useful when debugging thermocouples
27
 // Useful when debugging thermocouples
28
 //#define IGNORE_THERMOCOUPLE_ERRORS
28
 //#define IGNORE_THERMOCOUPLE_ERRORS
29
 
29
 
30
+#include "../MarlinCore.h"
31
+#include "../HAL/shared/Delay.h"
32
+#include "../lcd/marlinui.h"
33
+
30
 #include "temperature.h"
34
 #include "temperature.h"
31
 #include "endstops.h"
35
 #include "endstops.h"
32
-
33
-#include "../MarlinCore.h"
34
 #include "planner.h"
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
 #if ENABLED(DWIN_CREALITY_LCD)
42
 #if ENABLED(DWIN_CREALITY_LCD)
40
   #include "../lcd/dwin/e3v2/dwin.h"
43
   #include "../lcd/dwin/e3v2/dwin.h"

Loading…
取消
儲存