Browse Source

📺 ExtUI pause state response (#22164)

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

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

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

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

3266
  * Advanced Pause - Filament Change
3266
  * Advanced Pause - Filament Change
3267
  */
3267
  */
3268
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
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
     #define M600_PURGE_MORE_RESUMABLE 1
3270
     #define M600_PURGE_MORE_RESUMABLE 1
3271
   #endif
3271
   #endif
3272
   #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH
3272
   #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH

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

102
   #include "../../feature/host_actions.h"
102
   #include "../../feature/host_actions.h"
103
 #endif
103
 #endif
104
 
104
 
105
+#if M600_PURGE_MORE_RESUMABLE
106
+  #include "../../feature/pause.h"
107
+#endif
108
+
105
 namespace ExtUI {
109
 namespace ExtUI {
106
   static struct {
110
   static struct {
107
     uint8_t printer_killed : 1;
111
     uint8_t printer_killed : 1;
381
     return !thermalManager.tooColdToExtrude(extruder - E0);
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
   #if HAS_SOFTWARE_ENDSTOPS
391
   #if HAS_SOFTWARE_ENDSTOPS
387
     bool getSoftEndstopState() { return soft_endstop._enabled; }
392
     bool getSoftEndstopState() { return soft_endstop._enabled; }
1025
     TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
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
   void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
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
   void printFile(const char *filename) {
1042
   void printFile(const char *filename) {
1032
     TERN(SDSUPPORT, card.openAndPrintFile(filename), UNUSED(filename));
1043
     TERN(SDSUPPORT, card.openAndPrintFile(filename), UNUSED(filename));
1033
   }
1044
   }

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

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

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

1661
   }
1661
   }
1662
 #endif
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
 #if ENABLED(EEPROM_SETTINGS)
1698
 #if ENABLED(EEPROM_SETTINGS)
1665
 
1699
 
1666
   #if HAS_LCD_MENU
1700
   #if HAS_LCD_MENU

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

55
   #include "../module/printcounter.h"
55
   #include "../module/printcounter.h"
56
 #endif
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
   #include "../feature/pause.h"
59
   #include "../feature/pause.h"
60
   #include "../module/motion.h" // for active_extruder
60
   #include "../module/motion.h" // for active_extruder
61
 #endif
61
 #endif
551
     static inline bool use_click() { return false; }
551
     static inline bool use_click() { return false; }
552
   #endif
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
     static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
555
     static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
556
   #else
556
   #else
557
     static inline void _pause_show_message() {}
557
     static inline void _pause_show_message() {}

Loading…
Cancel
Save