From 8bca3fcf2c4be3ea707860ebb9a1bfa1c03e2d7e Mon Sep 17 00:00:00 2001 From: Luu Lac <45380455+shitcreek@users.noreply.github.com> Date: Sun, 8 Sep 2019 02:20:18 -0500 Subject: [PATCH] Display chamber with HAS_TEMP_CHAMBER (#15194) --- Marlin/src/inc/Conditionals_post.h | 3 +- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 12 ++---- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 18 ++++++--- Marlin/src/module/temperature.h | 44 +++++++++++----------- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 4e8f0ea4ff..3731b14512 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1044,7 +1044,8 @@ // Shorthand for common combinations #define HAS_HEATED_BED (HAS_TEMP_BED && HAS_HEATER_BED) -#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_TEMP_CHAMBER) +#define BED_OR_CHAMBER (HAS_HEATED_BED || HAS_TEMP_CHAMBER) +#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || BED_OR_CHAMBER) // PID heating #if !HAS_HEATED_BED diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index 821018bc0a..aff3a3ae1c 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -671,10 +671,8 @@ #define STATUS_BED_WIDTH 0 #endif -#if !STATUS_CHAMBER_WIDTH && HAS_HEATED_CHAMBER && ((HOTENDS <= 4 && !HAS_HEATED_BED) || (HOTENDS <= 3 && HAS_HEATED_BED)) - +#if !STATUS_CHAMBER_WIDTH && HAS_TEMP_CHAMBER && ((HOTENDS <= 4 && !HAS_HEATED_BED) || (HOTENDS <= 3 && HAS_HEATED_BED)) #define STATUS_CHAMBER_WIDTH 21 - #if STATUS_HEATERS_WIDTH #if ENABLED(STATUS_COMBINE_HEATERS) #define STATUS_CHAMBER_X (LCD_PIXEL_WIDTH - 2 - (STATUS_CHAMBER_BYTEWIDTH) * 8) @@ -703,7 +701,6 @@ B00011111,B11111111,B11111000, B00011111,B11111111,B11111000 }; - const unsigned char status_chamber_on_bmp[] PROGMEM = { B00011111,B11111111,B11111000, B00010000,B00000000,B00001000, @@ -741,13 +738,12 @@ #define STATUS_CHAMBER_WIDTH 0 #endif -#define BED_CHAM (HAS_HEATED_BED || HAS_HEATED_CHAMBER) -#define BED_CHAM_FAN (BED_CHAM || HAS_FAN0) +#define BED_OR_CHAMBER_OR_FAN (BED_OR_CHAMBER || HAS_FAN0) // Can also be overridden in Configuration_adv.h // If you can afford it, try the 3-frame fan animation! // Don't compile in the fan animation with no fan -#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_CHAM) || (ENABLED(STATUS_COMBINE_HEATERS) && HAS_HEATED_CHAMBER)) +#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_OR_CHAMBER) || (ENABLED(STATUS_COMBINE_HEATERS) && HAS_HEATED_CHAMBER)) #undef STATUS_FAN_FRAMES #elif !STATUS_FAN_FRAMES #define STATUS_FAN_FRAMES 2 @@ -1203,7 +1199,7 @@ #undef STATUS_LOGO_WIDTH #endif - #if (HOTENDS > 1 && STATUS_LOGO_WIDTH && BED_CHAM_FAN) || ( HOTENDS >= 3 && !BED_CHAM_FAN) + #if (HOTENDS > 1 && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN) #define _STATUS_HEATERS_X(H,S,N) (((LCD_PIXEL_WIDTH - (H * (S + N)) - STATUS_LOGO_WIDTH - STATUS_BED_WIDTH - STATUS_CHAMBER_WIDTH - STATUS_FAN_WIDTH) / 2) + STATUS_LOGO_WIDTH) #if STATUS_HOTEND1_WIDTH #if HOTENDS > 2 diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 94c700012b..59bc4eb0d1 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -65,7 +65,7 @@ #define DO_DRAW_LOGO (STATUS_LOGO_WIDTH && ENABLED(CUSTOM_STATUS_SCREEN_IMAGE)) #define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH && HOTENDS <= 4) -#define DO_DRAW_CHAMBER (HAS_HEATED_CHAMBER && STATUS_CHAMBER_WIDTH && HOTENDS <= 4) +#define DO_DRAW_CHAMBER (HAS_TEMP_CHAMBER && STATUS_CHAMBER_WIDTH && HOTENDS <= 4) #define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && HOTENDS <= 4 && defined(STATUS_FAN_FRAMES)) #define ANIM_HOTEND (HOTENDS && ENABLED(STATUS_HOTEND_ANIM)) @@ -252,12 +252,16 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin const float temp = 10 + (millis() >> 8) % CHAMBER_MAXTEMP, target = CHAMBER_MAXTEMP; #else - const float temp = thermalManager.degChamber(), - target = thermalManager.degTargetChamber(); + const float temp = thermalManager.degChamber(); + #if HAS_HEATED_CHAMBER + const float target = thermalManager.degTargetChamber(); + #endif #endif + #if !HEATER_IDLE_HANDLER UNUSED(blink); #endif + if (PAGE_UNDER(7)) { #if HEATER_IDLE_HANDLER const bool is_idle = false, // thermalManager.chamber_idle.timed_out, @@ -265,13 +269,15 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin #else constexpr bool dodraw = true; #endif - if (dodraw) _draw_centered_temp(target + 0.5, STATUS_CHAMBER_TEXT_X, 7); + #if HAS_HEATED_CHAMBER + if (dodraw) _draw_centered_temp(target + 0.5, STATUS_CHAMBER_TEXT_X, 7); + #endif } if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1)) _draw_centered_temp(temp + 0.5f, STATUS_CHAMBER_TEXT_X, 28); } -#endif +#endif // DO_DRAW_CHAMBER // // Before homing, blink '123' <-> '???'. @@ -324,7 +330,7 @@ void MarlinUI::draw_status_screen() { #if ANIM_BED if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(new_bits, 7); #endif - #if DO_DRAW_CHAMBER + #if DO_DRAW_CHAMBER && HAS_HEATED_CHAMBER if (thermalManager.isHeatingChamber() ^ SHOW_ON_STATE) SBI(new_bits, 6); #endif heat_bits = new_bits; diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 662d1866d4..df2fcf1062 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -623,25 +623,6 @@ class Temperature { start_watching_hotend(ee); } - #if WATCH_CHAMBER - static void start_watching_chamber(); - #else - static inline void start_watching_chamber() {} - #endif - - #if HAS_HEATED_CHAMBER - static void setTargetChamber(const int16_t celsius) { - temp_chamber.target = - #ifdef CHAMBER_MAXTEMP - _MIN(celsius, CHAMBER_MAXTEMP) - #else - celsius - #endif - ; - start_watching_chamber(); - } - #endif // HAS_HEATED_CHAMBER - FORCE_INLINE static bool isHeatingHotend(const uint8_t e) { E_UNUSED(); return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].current; @@ -660,6 +641,10 @@ class Temperature { ); #endif + FORCE_INLINE static bool still_heating(const uint8_t e) { + return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS; + } + #if HAS_HEATED_BED #if ENABLED(SHOW_TEMP_ADC_VALUES) @@ -712,9 +697,24 @@ class Temperature { #endif #endif // HAS_TEMP_CHAMBER - FORCE_INLINE static bool still_heating(const uint8_t e) { - return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS; - } + #if WATCH_CHAMBER + static void start_watching_chamber(); + #else + static inline void start_watching_chamber() {} + #endif + + #if HAS_HEATED_CHAMBER + static void setTargetChamber(const int16_t celsius) { + temp_chamber.target = + #ifdef CHAMBER_MAXTEMP + _MIN(celsius, CHAMBER_MAXTEMP) + #else + celsius + #endif + ; + start_watching_chamber(); + } + #endif // HAS_HEATED_CHAMBER /** * The software PWM power for a heater