Improve heating/cooling LCD messages (#10296)

This commit is contained in:
Scott Lahteine 2018-04-04 19:13:48 -05:00 committed by GitHub
parent a7e142460c
commit 7ff70d7adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 31 deletions

View File

@ -7729,7 +7729,11 @@ inline void gcode_M104() {
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
if (parser.value_celsius() > thermalManager.degHotend(target_extruder)) if (parser.value_celsius() > thermalManager.degHotend(target_extruder))
lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING); #if HOTENDS > 1
lcd_status_printf_P(0, PSTR("E%i " MSG_HEATING), target_extruder + 1);
#else
LCD_MESSAGEPGM("E " MSG_HEATING);
#endif
#endif #endif
} }
@ -7888,8 +7892,13 @@ inline void gcode_M109() {
#endif #endif
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
if (thermalManager.isHeatingHotend(target_extruder)) const bool heating = thermalManager.isHeatingHotend(target_extruder);
lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING); if (heating || !no_wait_for_cooling)
#if HOTENDS > 1
lcd_status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), target_extruder + 1);
#else
lcd_setstatusPGM(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
#endif
#endif #endif
} }
else return; else return;
@ -7995,7 +8004,7 @@ inline void gcode_M109() {
} while (wait_for_heatup && TEMP_CONDITIONS); } while (wait_for_heatup && TEMP_CONDITIONS);
if (wait_for_heatup) { if (wait_for_heatup) {
LCD_MESSAGEPGM(MSG_HEATING_COMPLETE); lcd_setstatusPGM(wants_to_cool ? PSTR(MSG_COOLING_COMPLETE) : PSTR(MSG_HEATING_COMPLETE));
#if ENABLED(PRINTER_EVENT_LEDS) #if ENABLED(PRINTER_EVENT_LEDS)
leds.set_white(); leds.set_white();
#endif #endif
@ -8022,7 +8031,6 @@ inline void gcode_M109() {
inline void gcode_M190() { inline void gcode_M190() {
if (DEBUGGING(DRYRUN)) return; if (DEBUGGING(DRYRUN)) return;
LCD_MESSAGEPGM(MSG_BED_HEATING);
const bool no_wait_for_cooling = parser.seenval('S'); const bool no_wait_for_cooling = parser.seenval('S');
if (no_wait_for_cooling || parser.seenval('R')) { if (no_wait_for_cooling || parser.seenval('R')) {
thermalManager.setTargetBed(parser.value_celsius()); thermalManager.setTargetBed(parser.value_celsius());
@ -8033,6 +8041,8 @@ inline void gcode_M109() {
} }
else return; else return;
lcd_setstatusPGM(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING));
#if TEMP_BED_RESIDENCY_TIME > 0 #if TEMP_BED_RESIDENCY_TIME > 0
millis_t residency_start_ms = 0; millis_t residency_start_ms = 0;
// Loop until the temperature has stabilized // Loop until the temperature has stabilized

View File

@ -783,6 +783,9 @@
#ifndef MSG_HEATING_FAILED_LCD #ifndef MSG_HEATING_FAILED_LCD
#define MSG_HEATING_FAILED_LCD _UxGT("Heating failed") #define MSG_HEATING_FAILED_LCD _UxGT("Heating failed")
#endif #endif
#ifndef MSG_HEATING_FAILED_LCD_BED
#define MSG_HEATING_FAILED_LCD_BED _UxGT("Bed heating failed")
#endif
#ifndef MSG_ERR_REDUNDANT_TEMP #ifndef MSG_ERR_REDUNDANT_TEMP
#define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: REDUNDANT TEMP") #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: REDUNDANT TEMP")
#endif #endif
@ -828,8 +831,17 @@
#ifndef MSG_HEATING_COMPLETE #ifndef MSG_HEATING_COMPLETE
#define MSG_HEATING_COMPLETE _UxGT("Heating done.") #define MSG_HEATING_COMPLETE _UxGT("Heating done.")
#endif #endif
#ifndef MSG_COOLING
#define MSG_COOLING _UxGT("Cooling...")
#endif
#ifndef MSG_COOLING_COMPLETE
#define MSG_COOLING_COMPLETE _UxGT("Cooling done.")
#endif
#ifndef MSG_BED_HEATING #ifndef MSG_BED_HEATING
#define MSG_BED_HEATING _UxGT("Bed Heating.") #define MSG_BED_HEATING _UxGT("Bed heating.")
#endif
#ifndef MSG_BED_COOLING
#define MSG_BED_COOLING _UxGT("Bed cooling.")
#endif #endif
#ifndef MSG_BED_DONE #ifndef MSG_BED_DONE
#define MSG_BED_DONE _UxGT("Bed done.") #define MSG_BED_DONE _UxGT("Bed done.")

View File

@ -58,6 +58,27 @@
Temperature thermalManager; Temperature thermalManager;
/**
* Macros to include the heater id in temp errors. The compiler's dead-code
* elimination should (hopefully) optimize out the unused strings.
*/
#if HAS_TEMP_BED
#define TEMP_ERR_PSTR(MSG, E) \
(E) == -1 ? PSTR(MSG ## _BED) : \
(HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
(HOTENDS > 2 && (E) == 2) ? PSTR(MSG_E3 " " MSG) : \
(HOTENDS > 3 && (E) == 3) ? PSTR(MSG_E4 " " MSG) : \
(HOTENDS > 4 && (E) == 4) ? PSTR(MSG_E5 " " MSG) : \
PSTR(MSG_E1 " " MSG)
#else
#define TEMP_ERR_PSTR(MSG, E) \
(HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \
(HOTENDS > 2 && (E) == 2) ? PSTR(MSG_E3 " " MSG) : \
(HOTENDS > 3 && (E) == 3) ? PSTR(MSG_E4 " " MSG) : \
(HOTENDS > 4 && (E) == 4) ? PSTR(MSG_E5 " " MSG) : \
PSTR(MSG_E1 " " MSG)
#endif
// public: // public:
float Temperature::current_temperature[HOTENDS] = { 0.0 }, float Temperature::current_temperature[HOTENDS] = { 0.0 },
@ -442,12 +463,10 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
if (current > watch_temp_target) heated = true; // - Flag if target temperature reached if (current > watch_temp_target) heated = true; // - Flag if target temperature reached
} }
else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired
_temp_error(hotend, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD)); _temp_error(hotend, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, hotend));
} }
else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far? else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
_temp_error(hotend, PSTR(MSG_T_THERMAL_RUNAWAY), _temp_error(hotend, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, hotend));
hotend >= 0 ? PSTR(MSG_THERMAL_RUNAWAY) : PSTR(MSG_THERMAL_RUNAWAY_BED)
);
} }
#endif #endif
} // every 2 seconds } // every 2 seconds
@ -582,24 +601,11 @@ void Temperature::_temp_error(const int8_t e, const char * const serial_msg, con
} }
void Temperature::max_temp_error(const int8_t e) { void Temperature::max_temp_error(const int8_t e) {
#if HAS_TEMP_BED _temp_error(e, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, e));
_temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
#else
_temp_error(HOTEND_INDEX, PSTR(MSG_T_MAXTEMP), PSTR(MSG_ERR_MAXTEMP));
#if HOTENDS == 1
UNUSED(e);
#endif
#endif
} }
void Temperature::min_temp_error(const int8_t e) { void Temperature::min_temp_error(const int8_t e) {
#if HAS_TEMP_BED _temp_error(e, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, e));
_temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
#else
_temp_error(HOTEND_INDEX, PSTR(MSG_T_MINTEMP), PSTR(MSG_ERR_MINTEMP));
#if HOTENDS == 1
UNUSED(e);
#endif
#endif
} }
float Temperature::get_pid_output(const int8_t e) { float Temperature::get_pid_output(const int8_t e) {
@ -795,7 +801,7 @@ void Temperature::manage_heater() {
// Make sure temperature is increasing // Make sure temperature is increasing
if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder? if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder?
if (degHotend(e) < watch_target_temp[e]) // Failed to increase enough? if (degHotend(e) < watch_target_temp[e]) // Failed to increase enough?
_temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD)); _temp_error(e, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e));
else // Start again if the target is still far off else // Start again if the target is still far off
start_watching_heater(e); start_watching_heater(e);
} }
@ -833,7 +839,7 @@ void Temperature::manage_heater() {
// Make sure temperature is increasing // Make sure temperature is increasing
if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed? if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed?
if (degBed() < watch_target_bed_temp) // Failed to increase enough? if (degBed() < watch_target_bed_temp) // Failed to increase enough?
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD)); _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
else // Start again if the target is still far off else // Start again if the target is still far off
start_watching_bed(); start_watching_bed();
} }
@ -1432,9 +1438,7 @@ void Temperature::init() {
else if (PENDING(millis(), *timer)) break; else if (PENDING(millis(), *timer)) break;
*state = TRRunaway; *state = TRRunaway;
case TRRunaway: case TRRunaway:
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater_id));
heater_id >= 0 ? PSTR(MSG_THERMAL_RUNAWAY) : PSTR(MSG_THERMAL_RUNAWAY_BED)
);
} }
} }