Quellcode durchsuchen

Add heater timeouts to ExtUI (#13970)

- Add local UI methods to get heater timeout state.
- Add methods to resume timed-out heaters.
- Re-enable heaters on UI temperature request.
- Make `ExtUI` show a dialog box if pause needs a button press after reheat.
Marcio Teixeira vor 6 Jahren
Ursprung
Commit
227f29090d

+ 10
- 0
Marlin/src/feature/pause.cpp Datei anzeigen

@@ -49,6 +49,10 @@
49 49
   #include "host_actions.h"
50 50
 #endif
51 51
 
52
+#if ENABLED(EXTENSIBLE_UI)
53
+  #include "../lcd/extensible_ui/ui_api.h"
54
+#endif
55
+
52 56
 #include "../lcd/ultralcd.h"
53 57
 #include "../libs/buzzer.h"
54 58
 #include "../libs/nozzle.h"
@@ -538,6 +542,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
538 542
       #if ENABLED(HOST_PROMPT_SUPPORT)
539 543
         host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheating"));
540 544
       #endif
545
+      #if ENABLED(EXTENSIBLE_UI)
546
+        ExtUI::onStatusChanged(PSTR("Reheating..."));
547
+      #endif
541 548
 
542 549
       // Re-enable the heaters if they timed out
543 550
       HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
@@ -555,6 +562,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
555 562
       #if ENABLED(HOST_PROMPT_SUPPORT)
556 563
         host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), PSTR("Continue"));
557 564
       #endif
565
+      #if ENABLED(EXTENSIBLE_UI)
566
+        ExtUI::onUserConfirmRequired("Reheat finished.");
567
+      #endif
558 568
       wait_for_user = true;
559 569
       nozzle_timed_out = false;
560 570
 

+ 53
- 33
Marlin/src/lcd/extensible_ui/ui_api.cpp Datei anzeigen

@@ -148,9 +148,7 @@ namespace ExtUI {
148 148
     }
149 149
   #endif // __SAM3X8E__
150 150
 
151
-  void delay_us(unsigned long us) {
152
-    DELAY_US(us);
153
-  }
151
+  void delay_us(unsigned long us) { DELAY_US(us); }
154 152
 
155 153
   void delay_ms(unsigned long ms) {
156 154
     if (flags.printer_killed)
@@ -164,14 +162,49 @@ namespace ExtUI {
164 162
       thermalManager.manage_heater();
165 163
   }
166 164
 
165
+  void enableHeater(const extruder_t extruder) {
166
+    #if HEATER_IDLE_HANDLER
167
+      thermalManager.reset_heater_idle_timer(extruder - E0);
168
+    #endif
169
+  }
170
+
171
+  void enableHeater(const heater_t heater) {
172
+    #if HEATER_IDLE_HANDLER
173
+      #if HAS_HEATED_BED
174
+        if (heater == BED)
175
+          thermalManager.reset_bed_idle_timer();
176
+        else
177
+      #endif
178
+          thermalManager.reset_heater_idle_timer(heater - H0);
179
+    #endif
180
+  }
181
+
182
+  bool isHeaterIdle(const extruder_t extruder) {
183
+    return false
184
+      #if HEATER_IDLE_HANDLER
185
+        || thermalManager.hotend_idle[extruder - E0].timed_out
186
+      #endif
187
+    ;
188
+  }
189
+
190
+  bool isHeaterIdle(const heater_t heater) {
191
+    return (false
192
+      #if HEATER_IDLE_HANDLER
193
+        || (heater == BED ? (false
194
+          #if HAS_HEATED_BED
195
+            || thermalManager.bed_idle.timed_out
196
+          #endif
197
+        ) : thermalManager.hotend_idle[heater - H0].timed_out)
198
+      #endif
199
+    );
200
+  }
201
+
167 202
   float getActualTemp_celsius(const heater_t heater) {
168
-    return heater == BED ?
203
+    return heater == BED ? (0
169 204
       #if HAS_HEATED_BED
170
-        thermalManager.degBed()
171
-      #else
172
-        0
205
+        + thermalManager.degBed()
173 206
       #endif
174
-      : thermalManager.degHotend(heater - H0);
207
+    ) : thermalManager.degHotend(heater - H0);
175 208
   }
176 209
 
177 210
   float getActualTemp_celsius(const extruder_t extruder) {
@@ -179,13 +212,11 @@ namespace ExtUI {
179 212
   }
180 213
 
181 214
   float getTargetTemp_celsius(const heater_t heater) {
182
-    return heater == BED ?
215
+    return heater == BED ? (0
183 216
       #if HAS_HEATED_BED
184
-        thermalManager.degTargetBed()
185
-      #else
186
-        0
217
+        + thermalManager.degTargetBed()
187 218
       #endif
188
-      : thermalManager.degTargetHotend(heater - H0);
219
+    ) : thermalManager.degTargetHotend(heater - H0);
189 220
   }
190 221
 
191 222
   float getTargetTemp_celsius(const extruder_t extruder) {
@@ -252,8 +283,7 @@ namespace ExtUI {
252 283
       }
253 284
     #endif
254 285
 
255
-    if (!flags.manual_motion)
256
-      set_destination_from_current();
286
+    if (!flags.manual_motion) set_destination_from_current();
257 287
     destination[axis] = clamp(position, min, max);
258 288
     flags.manual_motion = true;
259 289
   }
@@ -261,8 +291,7 @@ namespace ExtUI {
261 291
   void setAxisPosition_mm(const float position, const extruder_t extruder) {
262 292
     setActiveTool(extruder, true);
263 293
 
264
-    if (!flags.manual_motion)
265
-      set_destination_from_current();
294
+    if (!flags.manual_motion) set_destination_from_current();
266 295
     destination[E_AXIS] = position;
267 296
     flags.manual_motion = true;
268 297
   }
@@ -303,8 +332,7 @@ namespace ExtUI {
303 332
     #if EXTRUDERS > 1
304 333
       const uint8_t e = extruder - E0;
305 334
       #if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER)
306
-        if (e != active_extruder)
307
-          tool_change(e, 0, no_move);
335
+        if (e != active_extruder) tool_change(e, 0, no_move);
308 336
       #endif
309 337
       active_extruder = e;
310 338
     #endif
@@ -341,13 +369,8 @@ namespace ExtUI {
341 369
   }
342 370
 
343 371
   #if HAS_SOFTWARE_ENDSTOPS
344
-    bool getSoftEndstopState() {
345
-      return soft_endstops_enabled;
346
-    }
347
-
348
-    void setSoftEndstopState(const bool value) {
349
-      soft_endstops_enabled = value;
350
-    }
372
+    bool getSoftEndstopState() { return soft_endstops_enabled; }
373
+    void setSoftEndstopState(const bool value) { soft_endstops_enabled = value; }
351 374
   #endif
352 375
 
353 376
   #if HAS_TRINAMIC
@@ -513,13 +536,8 @@ namespace ExtUI {
513 536
     void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; }
514 537
 
515 538
     #ifdef FILAMENT_RUNOUT_DISTANCE_MM
516
-      float getFilamentRunoutDistance_mm() {
517
-        return runout.runout_distance();
518
-      }
519
-
520
-      void setFilamentRunoutDistance_mm(const float value) {
521
-        runout.set_runout_distance(clamp(value, 0, 999));
522
-      }
539
+      float getFilamentRunoutDistance_mm()                 { return runout.runout_distance(); }
540
+      void setFilamentRunoutDistance_mm(const float value) { runout.set_runout_distance(clamp(value, 0, 999)); }
523 541
     #endif
524 542
   #endif
525 543
 
@@ -761,6 +779,7 @@ namespace ExtUI {
761 779
   void setTargetTemp_celsius(float value, const heater_t heater) {
762 780
     constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
763 781
     const int16_t e = heater - H0;
782
+    enableHeater(heater);
764 783
     #if HAS_HEATED_BED
765 784
       if (heater == BED)
766 785
         thermalManager.setTargetBed(clamp(value, 0, BED_MAXTEMP - 10));
@@ -772,6 +791,7 @@ namespace ExtUI {
772 791
   void setTargetTemp_celsius(float value, const extruder_t extruder) {
773 792
     constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
774 793
     const int16_t e = extruder - E0;
794
+    enableHeater(extruder);
775 795
     thermalManager.setTargetHotend(clamp(value, 0, heater_maxtemp[e] - 15), e);
776 796
   }
777 797
 

+ 5
- 0
Marlin/src/lcd/extensible_ui/ui_api.h Datei anzeigen

@@ -70,6 +70,11 @@ namespace ExtUI {
70 70
   void enqueueCommands_P(PGM_P const);
71 71
   bool commandsInQueue();
72 72
 
73
+  bool isHeaterIdle(const heater_t);
74
+  bool isHeaterIdle(const extruder_t);
75
+  void enableHeater(const heater_t);
76
+  void enableHeater(const extruder_t);
77
+
73 78
   /**
74 79
    * Getters and setters
75 80
    * Should be used by the EXTENSIBLE_UI to query or change Marlin's state.

Laden…
Abbrechen
Speichern