Heated Chamber for Graphical LCD (#14190)

This commit is contained in:
InsanityAutomation
2019-05-30 19:31:50 -04:00
committed by Scott Lahteine
parent 93ab16c6e4
commit 123e58d9c3
79 changed files with 228 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && STATUS_FAN_FRAMES)
#define ANIM_HOTEND (HOTENDS && ENABLED(STATUS_HOTEND_ANIM))
#define ANIM_BED (DO_DRAW_BED && ENABLED(STATUS_BED_ANIM))
#define ANIM_CHAMBER (HAS_HEATED_CHAMBER && ENABLED(STATUS_CHAMBER_ANIM))
#if ANIM_HOTEND || ANIM_BED
uint8_t heat_bits;
@@ -88,6 +89,11 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#else
#define BED_ALT() false
#endif
#if ANIM_CHAMBER
#define CHAMBER_ALT() TEST(heat_bits, 6)
#else
#define CHAMBER_ALT() false
#endif
#define MAX_HOTEND_DRAW MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE)))
#define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1)
@@ -126,6 +132,27 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) {
target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater));
#endif
#if HAS_HEATED_CHAMBER
FORCE_INLINE void _draw_chamber_status(const bool blink) {
const float temp = thermalManager.degChamber(),
target = thermalManager.degTargetChamber();
#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,
dodraw = (blink || !is_idle);
#else
constexpr bool dodraw = true;
#endif
if (dodraw) _draw_centered_temp(target + 0.5, STATUS_CHAMBER_TEXT_X, 7);
}
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
_draw_centered_temp(temp + 0.5f, STATUS_CHAMBER_TEXT_X, 28);
}
#endif
#if DISABLED(STATUS_HOTEND_ANIM)
#define STATIC_HOTEND true
#define HOTEND_DOT isHeat
@@ -271,7 +298,7 @@ void MarlinUI::draw_status_screen() {
// At the first page, generate new display values
if (first_page) {
#if ANIM_HOTEND || ANIM_BED
#if ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER
uint8_t new_bits = 0;
#if ANIM_HOTEND
HOTEND_LOOP() if (thermalManager.isHeatingHotend(e) ^ SHOW_ON_STATE) SBI(new_bits, e);
@@ -279,6 +306,9 @@ void MarlinUI::draw_status_screen() {
#if ANIM_BED
if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(new_bits, 7);
#endif
#if ANIM_CHAMBER
if (thermalManager.isHeatingChamber() ^ SHOW_ON_STATE) SBI(new_bits, 6);
#endif
heat_bits = new_bits;
#endif
strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
@@ -326,6 +356,20 @@ void MarlinUI::draw_status_screen() {
u8g.drawBitmapP(STATUS_BED_X, bedy, STATUS_BED_BYTEWIDTH, bedh, BED_BITMAP(BED_ALT()));
#endif
#if DO_DRAW_CHAMBER
#if ANIM_HAMBER
#define CHAMBER_BITMAP(S) ((S) ? status_chamber_on_bmp : status_chamber_bmp)
#else
#define CHAMBER_BITMAP(S) status_chamber_bmp
#endif
if (PAGE_CONTAINS(STATUS_CHAMBER_Y, STATUS_CHAMBER_Y + STATUS_CHAMBER_HEIGHT - 1))
u8g.drawBitmapP(
STATUS_CHAMBER_X, STATUS_CHAMBER_Y,
STATUS_CHAMBER_BYTEWIDTH, STATUS_CHAMBER_HEIGHT,
CHAMBER_BITMAP(CHAMBER_ALT())
);
#endif
#if DO_DRAW_FAN
#if STATUS_FAN_FRAMES > 2
static bool old_blink;
@@ -366,6 +410,10 @@ void MarlinUI::draw_status_screen() {
_draw_heater_status(-1, blink);
#endif
#if HAS_HEATED_CHAMBER
_draw_chamber_status(blink);
#endif
// Fan, if a bitmap was provided
#if DO_DRAW_FAN
if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y - 1)) {