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,7 +72,11 @@ void GcodeSuite::M104() {
72 72
 
73 73
     #if ENABLED(ULTRA_LCD)
74 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 80
     #endif
77 81
   }
78 82
 
@@ -127,8 +131,13 @@ void GcodeSuite::M109() {
127 131
     #endif
128 132
 
129 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 141
     #endif
133 142
   }
134 143
   else return;
@@ -234,7 +243,7 @@ void GcodeSuite::M109() {
234 243
   } while (wait_for_heatup && TEMP_CONDITIONS);
235 244
 
236 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 247
     #if ENABLED(PRINTER_EVENT_LEDS)
239 248
       leds.set_white();
240 249
     #endif

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

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

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

@@ -783,6 +783,9 @@
783 783
 #ifndef MSG_HEATING_FAILED_LCD
784 784
   #define MSG_HEATING_FAILED_LCD              _UxGT("Heating failed")
785 785
 #endif
786
+#ifndef MSG_HEATING_FAILED_LCD_BED
787
+  #define MSG_HEATING_FAILED_LCD_BED          _UxGT("Bed heating failed")
788
+#endif
786 789
 #ifndef MSG_ERR_REDUNDANT_TEMP
787 790
   #define MSG_ERR_REDUNDANT_TEMP              _UxGT("Err: REDUNDANT TEMP")
788 791
 #endif
@@ -828,8 +831,17 @@
828 831
 #ifndef MSG_HEATING_COMPLETE
829 832
   #define MSG_HEATING_COMPLETE                _UxGT("Heating done.")
830 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 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 845
 #endif
834 846
 #ifndef MSG_BED_DONE
835 847
   #define MSG_BED_DONE                        _UxGT("Bed done.")

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

@@ -59,6 +59,24 @@
59 59
 
60 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 80
 // public:
63 81
 
64 82
 float Temperature::current_temperature[HOTENDS] = { 0.0 },
@@ -447,12 +465,10 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
447 465
                 if (current > watch_temp_target) heated = true;     // - Flag if target temperature reached
448 466
               }
449 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 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 473
         #endif
458 474
       } // every 2 seconds
@@ -591,24 +607,10 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con
591 607
 }
592 608
 
593 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 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 616
 float Temperature::get_pid_output(const int8_t e) {
@@ -812,7 +814,7 @@ void Temperature::manage_heater() {
812 814
       // Make sure temperature is increasing
813 815
       if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder?
814 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 818
         else                                                                 // Start again if the target is still far off
817 819
           start_watching_heater(e);
818 820
       }
@@ -850,7 +852,7 @@ void Temperature::manage_heater() {
850 852
     // Make sure temperature is increasing
851 853
     if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) {        // Time to check the bed?
852 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 856
       else                                                            // Start again if the target is still far off
855 857
         start_watching_bed();
856 858
     }
@@ -1453,9 +1455,7 @@ void Temperature::init() {
1453 1455
         else if (PENDING(millis(), *timer)) break;
1454 1456
         *state = TRRunaway;
1455 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