Browse Source

📺 ExtUI pause state response (#22164)

InsanityAutomation 2 years ago
parent
commit
3ba5eda0b2
No account linked to committer's email address

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

@@ -424,6 +424,7 @@ public:
424 424
     static uint8_t host_keepalive_interval;
425 425
 
426 426
     static void host_keepalive();
427
+    static inline bool host_keepalive_is_paused() { return busy_state >= PAUSED_FOR_USER; }
427 428
 
428 429
     #define KEEPALIVE_STATE(N) REMEMBER(_KA_, gcode.busy_state, gcode.N)
429 430
   #else

+ 1
- 1
Marlin/src/inc/Conditionals_post.h View File

@@ -3266,7 +3266,7 @@
3266 3266
  * Advanced Pause - Filament Change
3267 3267
  */
3268 3268
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
3269
-  #if HAS_LCD_MENU || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
3269
+  #if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
3270 3270
     #define M600_PURGE_MORE_RESUMABLE 1
3271 3271
   #endif
3272 3272
   #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH

+ 13
- 2
Marlin/src/lcd/extui/ui_api.cpp View File

@@ -102,6 +102,10 @@
102 102
   #include "../../feature/host_actions.h"
103 103
 #endif
104 104
 
105
+#if M600_PURGE_MORE_RESUMABLE
106
+  #include "../../feature/pause.h"
107
+#endif
108
+
105 109
 namespace ExtUI {
106 110
   static struct {
107 111
     uint8_t printer_killed : 1;
@@ -381,7 +385,8 @@ namespace ExtUI {
381 385
     return !thermalManager.tooColdToExtrude(extruder - E0);
382 386
   }
383 387
 
384
-  GcodeSuite::MarlinBusyState getMachineBusyState() { return TERN0(HOST_KEEPALIVE_FEATURE, GcodeSuite::busy_state); }
388
+  GcodeSuite::MarlinBusyState getHostKeepaliveState() { return TERN0(HOST_KEEPALIVE_FEATURE, gcode.busy_state); }
389
+  bool getHostKeepaliveIsPaused() { return TERN0(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive_is_paused()); }
385 390
 
386 391
   #if HAS_SOFTWARE_ENDSTOPS
387 392
     bool getSoftEndstopState() { return soft_endstop._enabled; }
@@ -1025,9 +1030,15 @@ namespace ExtUI {
1025 1030
     TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
1026 1031
   }
1027 1032
 
1028
-  bool awaitingUserConfirm() { return TERN0(HAS_RESUME_CONTINUE, wait_for_user); }
1033
+  bool awaitingUserConfirm() {
1034
+    return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused();
1035
+  }
1029 1036
   void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
1030 1037
 
1038
+  #if M600_PURGE_MORE_RESUMABLE
1039
+    void setPauseMenuResponse(PauseMenuResponse response) { pause_menu_response = response; }
1040
+  #endif
1041
+
1031 1042
   void printFile(const char *filename) {
1032 1043
     TERN(SDSUPPORT, card.openAndPrintFile(filename), UNUSED(filename));
1033 1044
   }

+ 22
- 14
Marlin/src/lcd/extui/ui_api.h View File

@@ -45,6 +45,9 @@
45 45
 #include "../../inc/MarlinConfig.h"
46 46
 #include "../marlinui.h"
47 47
 #include "../../gcode/gcode.h"
48
+#if M600_PURGE_MORE_RESUMABLE
49
+  #include "../../feature/pause.h"
50
+#endif
48 51
 
49 52
 namespace ExtUI {
50 53
 
@@ -79,7 +82,8 @@ namespace ExtUI {
79 82
   void injectCommands(char * const);
80 83
   bool commandsInQueue();
81 84
 
82
-  GcodeSuite::MarlinBusyState getMachineBusyState();
85
+  GcodeSuite::MarlinBusyState getHostKeepaliveState();
86
+  bool getHostKeepaliveIsPaused();
83 87
 
84 88
   bool isHeaterIdle(const heater_t);
85 89
   bool isHeaterIdle(const extruder_t);
@@ -220,14 +224,18 @@ namespace ExtUI {
220 224
   void setFeedrate_mm_s(const feedRate_t);
221 225
   void setMinFeedrate_mm_s(const feedRate_t);
222 226
   void setMinTravelFeedrate_mm_s(const feedRate_t);
223
-  void setPrintingAcceleration_mm_s2(const_float_t );
224
-  void setRetractAcceleration_mm_s2(const_float_t );
225
-  void setTravelAcceleration_mm_s2(const_float_t );
226
-  void setFeedrate_percent(const_float_t );
227
+  void setPrintingAcceleration_mm_s2(const_float_t);
228
+  void setRetractAcceleration_mm_s2(const_float_t);
229
+  void setTravelAcceleration_mm_s2(const_float_t);
230
+  void setFeedrate_percent(const_float_t);
227 231
   void setFlow_percent(const int16_t, const extruder_t);
228 232
   bool awaitingUserConfirm();
229 233
   void setUserConfirmed();
230 234
 
235
+  #if M600_PURGE_MORE_RESUMABLE
236
+    void setPauseMenuResponse(PauseMenuResponse);
237
+  #endif
238
+
231 239
   #if ENABLED(LIN_ADVANCE)
232 240
     float getLinearAdvance_mm_mm_s(const extruder_t);
233 241
     void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
@@ -235,7 +243,7 @@ namespace ExtUI {
235 243
 
236 244
   #if HAS_JUNCTION_DEVIATION
237 245
     float getJunctionDeviation_mm();
238
-    void setJunctionDeviation_mm(const_float_t );
246
+    void setJunctionDeviation_mm(const_float_t);
239 247
   #else
240 248
     float getAxisMaxJerk_mm_s(const axis_t);
241 249
     float getAxisMaxJerk_mm_s(const extruder_t);
@@ -262,7 +270,7 @@ namespace ExtUI {
262 270
   #endif
263 271
 
264 272
   float getZOffset_mm();
265
-  void setZOffset_mm(const_float_t );
273
+  void setZOffset_mm(const_float_t);
266 274
 
267 275
   #if HAS_BED_PROBE
268 276
     float getProbeOffset_mm(const axis_t);
@@ -274,11 +282,11 @@ namespace ExtUI {
274 282
     void setAxisBacklash_mm(const_float_t, const axis_t);
275 283
 
276 284
     float getBacklashCorrection_percent();
277
-    void setBacklashCorrection_percent(const_float_t );
285
+    void setBacklashCorrection_percent(const_float_t);
278 286
 
279 287
     #ifdef BACKLASH_SMOOTHING_MM
280 288
       float getBacklashSmoothing_mm();
281
-      void setBacklashSmoothing_mm(const_float_t );
289
+      void setBacklashSmoothing_mm(const_float_t);
282 290
     #endif
283 291
   #endif
284 292
 
@@ -290,7 +298,7 @@ namespace ExtUI {
290 298
 
291 299
     #if HAS_FILAMENT_RUNOUT_DISTANCE
292 300
       float getFilamentRunoutDistance_mm();
293
-      void setFilamentRunoutDistance_mm(const_float_t );
301
+      void setFilamentRunoutDistance_mm(const_float_t);
294 302
     #endif
295 303
   #endif
296 304
 
@@ -300,7 +308,7 @@ namespace ExtUI {
300 308
 
301 309
     #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
302 310
       float getCaseLightBrightness_percent();
303
-      void setCaseLightBrightness_percent(const_float_t );
311
+      void setCaseLightBrightness_percent(const_float_t);
304 312
     #endif
305 313
   #endif
306 314
 
@@ -309,15 +317,15 @@ namespace ExtUI {
309 317
     float getPIDValues_Ki(const extruder_t);
310 318
     float getPIDValues_Kd(const extruder_t);
311 319
     void setPIDValues(const_float_t, const_float_t , const_float_t , extruder_t);
312
-    void startPIDTune(const_float_t, extruder_t);
320
+    void startPIDTune(const celsius_t, extruder_t);
313 321
   #endif
314 322
 
315 323
   #if ENABLED(PIDTEMPBED)
316 324
     float getBedPIDValues_Kp();
317 325
     float getBedPIDValues_Ki();
318 326
     float getBedPIDValues_Kd();
319
-    void setBedPIDValues(const_float_t, const_float_t , const_float_t );
320
-    void startBedPIDTune(const_float_t );
327
+    void setBedPIDValues(const_float_t, const_float_t , const_float_t);
328
+    void startBedPIDTune(const celsius_t);
321 329
   #endif
322 330
 
323 331
   /**

+ 34
- 0
Marlin/src/lcd/marlinui.cpp View File

@@ -1661,6 +1661,40 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
1661 1661
   }
1662 1662
 #endif
1663 1663
 
1664
+#if BOTH(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE)
1665
+
1666
+  void MarlinUI::pause_show_message(
1667
+    const PauseMessage message,
1668
+    const PauseMode mode/*=PAUSE_MODE_SAME*/,
1669
+    const uint8_t extruder/*=active_extruder*/
1670
+  ) {
1671
+    if (mode == PAUSE_MODE_SAME)
1672
+      return;
1673
+    pause_mode = mode;
1674
+    switch (message) {
1675
+      case PAUSE_MESSAGE_PARKING:  ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PAUSE_PRINT_PARKING));
1676
+      case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INIT));
1677
+      case PAUSE_MESSAGE_UNLOAD:   ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_UNLOAD));
1678
+      case PAUSE_MESSAGE_WAITING:  ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_ADVANCED_PAUSE_WAITING));
1679
+      case PAUSE_MESSAGE_INSERT:   ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INSERT));
1680
+      case PAUSE_MESSAGE_LOAD:     ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD));
1681
+      case PAUSE_MESSAGE_PURGE:
1682
+        #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
1683
+          ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_CONT_PURGE));
1684
+        #else
1685
+          ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE));
1686
+        #endif
1687
+      case PAUSE_MESSAGE_RESUME:   ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME));
1688
+      case PAUSE_MESSAGE_HEAT:     ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT));
1689
+      case PAUSE_MESSAGE_HEATING:  ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING));
1690
+      case PAUSE_MESSAGE_OPTION:   ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_OPTION_HEADER));
1691
+      case PAUSE_MESSAGE_STATUS:
1692
+      default: break;
1693
+    }
1694
+  }
1695
+
1696
+#endif
1697
+
1664 1698
 #if ENABLED(EEPROM_SETTINGS)
1665 1699
 
1666 1700
   #if HAS_LCD_MENU

+ 2
- 2
Marlin/src/lcd/marlinui.h View File

@@ -55,7 +55,7 @@
55 55
   #include "../module/printcounter.h"
56 56
 #endif
57 57
 
58
-#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
58
+#if ENABLED(ADVANCED_PAUSE_FEATURE) && EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
59 59
   #include "../feature/pause.h"
60 60
   #include "../module/motion.h" // for active_extruder
61 61
 #endif
@@ -551,7 +551,7 @@ public:
551 551
     static inline bool use_click() { return false; }
552 552
   #endif
553 553
 
554
-  #if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
554
+  #if ENABLED(ADVANCED_PAUSE_FEATURE) && EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
555 555
     static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
556 556
   #else
557 557
     static inline void _pause_show_message() {}

Loading…
Cancel
Save