Browse Source

Improve heating/cooling LCD messages (#10293)

Marcio Teixeira 7 years ago
parent
commit
8bc93c6f2b

+ 13
- 4
Marlin/src/gcode/temperature/M104_M109.cpp View File

72
 
72
 
73
     #if ENABLED(ULTRA_LCD)
73
     #if ENABLED(ULTRA_LCD)
74
       if (parser.value_celsius() > thermalManager.degHotend(e))
74
       if (parser.value_celsius() > thermalManager.degHotend(e))
75
-        lcd_status_printf_P(0, PSTR("E%i %s"), e + 1, MSG_HEATING);
75
+        #if HOTENDS > 1
76
+          lcd_status_printf_P(0, PSTR("E%i " MSG_HEATING), e + 1);
77
+        #else
78
+          LCD_MESSAGEPGM("E " MSG_HEATING);
79
+        #endif
76
     #endif
80
     #endif
77
   }
81
   }
78
 
82
 
127
     #endif
131
     #endif
128
 
132
 
129
     #if ENABLED(ULTRA_LCD)
133
     #if ENABLED(ULTRA_LCD)
130
-      if (thermalManager.isHeatingHotend(target_extruder))
131
-        lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
134
+      const bool heating = thermalManager.isHeatingHotend(target_extruder);
135
+      if (heating || !no_wait_for_cooling)
136
+        #if HOTENDS > 1
137
+          lcd_status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), target_extruder + 1);
138
+        #else
139
+          lcd_setstatusPGM(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
140
+        #endif
132
     #endif
141
     #endif
133
   }
142
   }
134
   else return;
143
   else return;
234
   } while (wait_for_heatup && TEMP_CONDITIONS);
243
   } while (wait_for_heatup && TEMP_CONDITIONS);
235
 
244
 
236
   if (wait_for_heatup) {
245
   if (wait_for_heatup) {
237
-    LCD_MESSAGEPGM(MSG_HEATING_COMPLETE);
246
+    lcd_setstatusPGM(wants_to_cool ? PSTR(MSG_COOLING_COMPLETE) : PSTR(MSG_HEATING_COMPLETE));
238
     #if ENABLED(PRINTER_EVENT_LEDS)
247
     #if ENABLED(PRINTER_EVENT_LEDS)
239
       leds.set_white();
248
       leds.set_white();
240
     #endif
249
     #endif

+ 2
- 1
Marlin/src/gcode/temperature/M140_M190.cpp View File

61
 void GcodeSuite::M190() {
61
 void GcodeSuite::M190() {
62
   if (DEBUGGING(DRYRUN)) return;
62
   if (DEBUGGING(DRYRUN)) return;
63
 
63
 
64
-  LCD_MESSAGEPGM(MSG_BED_HEATING);
65
   const bool no_wait_for_cooling = parser.seenval('S');
64
   const bool no_wait_for_cooling = parser.seenval('S');
66
   if (no_wait_for_cooling || parser.seenval('R')) {
65
   if (no_wait_for_cooling || parser.seenval('R')) {
67
     thermalManager.setTargetBed(parser.value_celsius());
66
     thermalManager.setTargetBed(parser.value_celsius());
72
   }
71
   }
73
   else return;
72
   else return;
74
 
73
 
74
+  lcd_setstatusPGM(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING));
75
+
75
   #if TEMP_BED_RESIDENCY_TIME > 0
76
   #if TEMP_BED_RESIDENCY_TIME > 0
76
     millis_t residency_start_ms = 0;
77
     millis_t residency_start_ms = 0;
77
     // Loop until the temperature has stabilized
78
     // Loop until the temperature has stabilized

+ 13
- 1
Marlin/src/lcd/language/language_en.h View File

783
 #ifndef MSG_HEATING_FAILED_LCD
783
 #ifndef MSG_HEATING_FAILED_LCD
784
   #define MSG_HEATING_FAILED_LCD              _UxGT("Heating failed")
784
   #define MSG_HEATING_FAILED_LCD              _UxGT("Heating failed")
785
 #endif
785
 #endif
786
+#ifndef MSG_HEATING_FAILED_LCD_BED
787
+  #define MSG_HEATING_FAILED_LCD_BED          _UxGT("Bed heating failed")
788
+#endif
786
 #ifndef MSG_ERR_REDUNDANT_TEMP
789
 #ifndef MSG_ERR_REDUNDANT_TEMP
787
   #define MSG_ERR_REDUNDANT_TEMP              _UxGT("Err: REDUNDANT TEMP")
790
   #define MSG_ERR_REDUNDANT_TEMP              _UxGT("Err: REDUNDANT TEMP")
788
 #endif
791
 #endif
828
 #ifndef MSG_HEATING_COMPLETE
831
 #ifndef MSG_HEATING_COMPLETE
829
   #define MSG_HEATING_COMPLETE                _UxGT("Heating done.")
832
   #define MSG_HEATING_COMPLETE                _UxGT("Heating done.")
830
 #endif
833
 #endif
834
+#ifndef MSG_COOLING
835
+  #define MSG_COOLING                         _UxGT("Cooling...")
836
+#endif
837
+#ifndef MSG_COOLING_COMPLETE
838
+  #define MSG_COOLING_COMPLETE                _UxGT("Cooling done.")
839
+#endif
831
 #ifndef MSG_BED_HEATING
840
 #ifndef MSG_BED_HEATING
832
-  #define MSG_BED_HEATING                     _UxGT("Bed Heating.")
841
+  #define MSG_BED_HEATING                     _UxGT("Bed heating.")
842
+#endif
843
+#ifndef MSG_BED_COOLING
844
+  #define MSG_BED_COOLING                     _UxGT("Bed cooling.")
833
 #endif
845
 #endif
834
 #ifndef MSG_BED_DONE
846
 #ifndef MSG_BED_DONE
835
   #define MSG_BED_DONE                        _UxGT("Bed done.")
847
   #define MSG_BED_DONE                        _UxGT("Bed done.")

+ 25
- 25
Marlin/src/module/temperature.cpp View File

59
 
59
 
60
 Temperature thermalManager;
60
 Temperature thermalManager;
61
 
61
 
62
+/**
63
+ * Macros to include the heater id in temp errors. The compiler's dead-code
64
+ * elimination should (hopefully) optimize out the unused strings.
65
+ */
66
+#if HAS_TEMP_BED
67
+  #define _BED_ERR_PSTR(MSG, E) (E) == -1 ? PSTR(MSG ## _BED) :
68
+#else
69
+  #define _BED_ERR_PSTR(MSG, E)
70
+#endif
71
+
72
+#define TEMP_ERR_PSTR(MSG, E) \
73
+  _BED_ERR_PSTR(MSG, E) \
74
+  (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
75
+  (HOTENDS > 2 && (E) == 2) ? PSTR(MSG_E3 " " MSG) : \
76
+  (HOTENDS > 3 && (E) == 3) ? PSTR(MSG_E4 " " MSG) : \
77
+  (HOTENDS > 4 && (E) == 4) ? PSTR(MSG_E5 " " MSG) : \
78
+  PSTR(MSG_E1 " " MSG)
79
+
62
 // public:
80
 // public:
63
 
81
 
64
 float Temperature::current_temperature[HOTENDS] = { 0.0 },
82
 float Temperature::current_temperature[HOTENDS] = { 0.0 },
447
                 if (current > watch_temp_target) heated = true;     // - Flag if target temperature reached
465
                 if (current > watch_temp_target) heated = true;     // - Flag if target temperature reached
448
               }
466
               }
449
               else if (ELAPSED(ms, temp_change_ms))                 // Watch timer expired
467
               else if (ELAPSED(ms, temp_change_ms))                 // Watch timer expired
450
-                _temp_error(hotend, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
468
+                _temp_error(hotend, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, hotend));
451
             }
469
             }
452
             else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
470
             else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
453
-              _temp_error(hotend, PSTR(MSG_T_THERMAL_RUNAWAY),
454
-                hotend >= 0 ? PSTR(MSG_THERMAL_RUNAWAY) : PSTR(MSG_THERMAL_RUNAWAY_BED)
455
-              );
471
+              _temp_error(hotend, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, hotend));
456
           }
472
           }
457
         #endif
473
         #endif
458
       } // every 2 seconds
474
       } // every 2 seconds
591
 }
607
 }
592
 
608
 
593
 void Temperature::max_temp_error(const int8_t e) {
609
 void Temperature::max_temp_error(const int8_t e) {
594
-  #if HAS_TEMP_BED
595
-    _temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
596
-  #else
597
-    _temp_error(HOTEND_INDEX, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
598
-    #if HOTENDS == 1
599
-      UNUSED(e);
600
-    #endif
601
-  #endif
610
+  _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e));
602
 }
611
 }
603
 void Temperature::min_temp_error(const int8_t e) {
612
 void Temperature::min_temp_error(const int8_t e) {
604
-  #if HAS_TEMP_BED
605
-    _temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
606
-  #else
607
-    _temp_error(HOTEND_INDEX, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
608
-    #if HOTENDS == 1
609
-      UNUSED(e);
610
-    #endif
611
-  #endif
613
+  _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e));
612
 }
614
 }
613
 
615
 
614
 float Temperature::get_pid_output(const int8_t e) {
616
 float Temperature::get_pid_output(const int8_t e) {
812
       // Make sure temperature is increasing
814
       // Make sure temperature is increasing
813
       if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder?
815
       if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder?
814
         if (degHotend(e) < watch_target_temp[e])                             // Failed to increase enough?
816
         if (degHotend(e) < watch_target_temp[e])                             // Failed to increase enough?
815
-          _temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
817
+          _temp_error(e, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e));
816
         else                                                                 // Start again if the target is still far off
818
         else                                                                 // Start again if the target is still far off
817
           start_watching_heater(e);
819
           start_watching_heater(e);
818
       }
820
       }
850
     // Make sure temperature is increasing
852
     // Make sure temperature is increasing
851
     if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {        // Time to check the bed?
853
     if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {        // Time to check the bed?
852
       if (degBed() < watch_target_bed_temp)                           // Failed to increase enough?
854
       if (degBed() < watch_target_bed_temp)                           // Failed to increase enough?
853
-        _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
855
+        _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
854
       else                                                            // Start again if the target is still far off
856
       else                                                            // Start again if the target is still far off
855
         start_watching_bed();
857
         start_watching_bed();
856
     }
858
     }
1453
         else if (PENDING(millis(), *timer)) break;
1455
         else if (PENDING(millis(), *timer)) break;
1454
         *state = TRRunaway;
1456
         *state = TRRunaway;
1455
       case TRRunaway:
1457
       case TRRunaway:
1456
-        _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY),
1457
-          heater_id >= 0 ? PSTR(MSG_THERMAL_RUNAWAY) : PSTR(MSG_THERMAL_RUNAWAY_BED)
1458
-        );
1458
+        _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater_id));
1459
     }
1459
     }
1460
   }
1460
   }
1461
 
1461
 

Loading…
Cancel
Save