Browse Source

Fix PLR cancel with ExtUI (#16556)

InsanityAutomation 5 years ago
parent
commit
ffd8b595d1

+ 1
- 1
Marlin/src/MarlinCore.cpp View File

406
     thermalManager.zero_fan_speeds();
406
     thermalManager.zero_fan_speeds();
407
     wait_for_heatup = false;
407
     wait_for_heatup = false;
408
     #if ENABLED(POWER_LOSS_RECOVERY)
408
     #if ENABLED(POWER_LOSS_RECOVERY)
409
-      card.removeJobRecoveryFile();
409
+      recovery.purge();
410
     #endif
410
     #endif
411
     #ifdef EVENT_GCODE_SD_STOP
411
     #ifdef EVENT_GCODE_SD_STOP
412
       queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));
412
       queue.inject_P(PSTR(EVENT_GCODE_SD_STOP));

+ 5
- 3
Marlin/src/feature/power_loss_recovery.h View File

148
     static void enable(const bool onoff);
148
     static void enable(const bool onoff);
149
     static void changed();
149
     static void changed();
150
 
150
 
151
-    static void check();
152
-    static void resume();
153
-
154
     static inline bool exists() { return card.jobRecoverFileExists(); }
151
     static inline bool exists() { return card.jobRecoverFileExists(); }
155
     static inline void open(const bool read) { card.openJobRecoveryFile(read); }
152
     static inline void open(const bool read) { card.openJobRecoveryFile(read); }
156
     static inline void close() { file.close(); }
153
     static inline void close() { file.close(); }
157
 
154
 
155
+    static void check();
156
+    static void resume();
158
     static void purge();
157
     static void purge();
158
+
159
+    static inline void cancel() { purge(); card.autostart_index = 0; }
160
+
159
     static void load();
161
     static void load();
160
     static void save(const bool force=
162
     static void save(const bool force=
161
       #if ENABLED(SAVE_EACH_CMD_MODE)
163
       #if ENABLED(SAVE_EACH_CMD_MODE)

+ 14
- 0
Marlin/src/gcode/feature/powerloss/M1000.cpp View File

47
   #endif
47
   #endif
48
 }
48
 }
49
 
49
 
50
+#if HAS_LCD_MENU
51
+  void lcd_power_loss_recovery_cancel();
52
+#endif
53
+
50
 /**
54
 /**
51
  * M1000: Resume from power-loss (undocumented)
55
  * M1000: Resume from power-loss (undocumented)
52
  *   - With 'S' go to the Resume/Cancel menu
56
  *   - With 'S' go to the Resume/Cancel menu
64
         SERIAL_ECHO_MSG("Resume requires LCD.");
68
         SERIAL_ECHO_MSG("Resume requires LCD.");
65
       #endif
69
       #endif
66
     }
70
     }
71
+    else if (parser.seen('C')) {
72
+      #if HAS_LCD_MENU
73
+        lcd_power_loss_recovery_cancel();
74
+      #else
75
+        recovery.cancel();
76
+      #endif
77
+      #if ENABLED(EXTENSIBLE_UI)
78
+        ExtUI::onPrintTimerStopped();
79
+      #endif
80
+    }
67
     else
81
     else
68
       recovery.resume();
82
       recovery.resume();
69
   }
83
   }

+ 4
- 0
Marlin/src/gcode/sdcard/M24_M25.cpp View File

86
  */
86
  */
87
 void GcodeSuite::M25() {
87
 void GcodeSuite::M25() {
88
 
88
 
89
+  #if ENABLED(POWER_LOSS_RECOVERY)
90
+    if (recovery.enabled) recovery.save(true, false);
91
+  #endif
92
+
89
   // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
93
   // Set initial pause flag to prevent more commands from landing in the queue while we try to pause
90
   #if ENABLED(SDSUPPORT)
94
   #if ENABLED(SDSUPPORT)
91
     if (IS_SD_PRINTING()) card.pauseSDPrint();
95
     if (IS_SD_PRINTING()) card.pauseSDPrint();

+ 3
- 2
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplay.cpp View File

702
 }
702
 }
703
 
703
 
704
 #if ENABLED(POWER_LOSS_RECOVERY)
704
 #if ENABLED(POWER_LOSS_RECOVERY)
705
+
705
   void DGUSScreenVariableHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
706
   void DGUSScreenVariableHandler::HandlePowerLossRecovery(DGUS_VP_Variable &var, void *val_ptr) {
706
     uint16_t value = swap16(*(uint16_t*)val_ptr);
707
     uint16_t value = swap16(*(uint16_t*)val_ptr);
707
     if (value) {
708
     if (value) {
709
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
710
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_SDPRINTMANIPULATION);
710
     }
711
     }
711
     else {
712
     else {
712
-      card.removeJobRecoveryFile();
713
-      card.autostart_index = 0;
713
+      recovery.cancel();
714
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_STATUS);
714
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_STATUS);
715
     }
715
     }
716
   }
716
   }
717
+
717
 #endif
718
 #endif
718
 
719
 
719
 void DGUSScreenVariableHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
720
 void DGUSScreenVariableHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {

+ 1
- 2
Marlin/src/lcd/menu/menu_job_recovery.cpp View File

39
 }
39
 }
40
 
40
 
41
 void lcd_power_loss_recovery_cancel() {
41
 void lcd_power_loss_recovery_cancel() {
42
-  card.removeJobRecoveryFile();
43
-  card.autostart_index = 0;
42
+  recovery.cancel();
44
   ui.return_to_status();
43
   ui.return_to_status();
45
 }
44
 }
46
 
45
 

+ 0
- 8
Marlin/src/lcd/ultralcd.cpp View File

95
 #include "../module/planner.h"
95
 #include "../module/planner.h"
96
 #include "../module/motion.h"
96
 #include "../module/motion.h"
97
 
97
 
98
-#if ENABLED(POWER_LOSS_RECOVERY)
99
-  #include "../feature/power_loss_recovery.h"
100
-#endif
101
-
102
 #if ENABLED(AUTO_BED_LEVELING_UBL)
98
 #if ENABLED(AUTO_BED_LEVELING_UBL)
103
   #include "../feature/bedlevel/bedlevel.h"
99
   #include "../feature/bedlevel/bedlevel.h"
104
 #endif
100
 #endif
1519
       synchronize(GET_TEXT(MSG_PAUSE_PRINT));
1515
       synchronize(GET_TEXT(MSG_PAUSE_PRINT));
1520
     #endif
1516
     #endif
1521
 
1517
 
1522
-    #if ENABLED(POWER_LOSS_RECOVERY)
1523
-      if (recovery.enabled) recovery.save(true, false);
1524
-    #endif
1525
-
1526
     #if ENABLED(HOST_PROMPT_SUPPORT)
1518
     #if ENABLED(HOST_PROMPT_SUPPORT)
1527
       host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume"));
1519
       host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume"));
1528
     #endif
1520
     #endif

+ 1
- 1
Marlin/src/sd/cardreader.cpp View File

1071
     stopSDPrint();
1071
     stopSDPrint();
1072
 
1072
 
1073
     #if ENABLED(POWER_LOSS_RECOVERY)
1073
     #if ENABLED(POWER_LOSS_RECOVERY)
1074
-      removeJobRecoveryFile();
1074
+      recovery.purge();
1075
     #endif
1075
     #endif
1076
 
1076
 
1077
     #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
1077
     #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)

+ 1
- 1
platformio.ini View File

437
 
437
 
438
 #
438
 #
439
 # Geeetech GTM32 (STM32F103VET6)
439
 # Geeetech GTM32 (STM32F103VET6)
440
-#  
440
+#
441
 [env:STM32F103VE_GTM32]
441
 [env:STM32F103VE_GTM32]
442
 platform        = ststm32
442
 platform        = ststm32
443
 board           = genericSTM32F103VE
443
 board           = genericSTM32F103VE

Loading…
Cancel
Save