Cooler (for Laser) - M143, M193 (#21255)

This commit is contained in:
Mike La Spina
2021-03-06 14:13:28 -06:00
committed by GitHub
parent 87bef13a4c
commit b95e548ddb
41 changed files with 1041 additions and 125 deletions

View File

@ -78,6 +78,16 @@
#define STATUS_CUTTER_WIDTH 0
#endif
//
// Laser Cooler
//
#if !STATUS_COOLER_WIDTH && HAS_COOLER
#include "status/cooler.h"
#endif
#ifndef STATUS_COOLER_WIDTH
#define STATUS_COOLER_WIDTH 0
#endif
//
// Bed
//
@ -498,6 +508,47 @@
#endif
//
// Cooler Bitmap Properties
//
#ifndef STATUS_COOLER_BYTEWIDTH
#define STATUS_COOLER_BYTEWIDTH BW(STATUS_COOLER_WIDTH)
#endif
#if STATUS_COOLER_WIDTH
#ifndef STATUS_COOLER_X
#define STATUS_COOLER_X (LCD_PIXEL_WIDTH - (STATUS_COOLER_BYTEWIDTH + STATUS_FAN_BYTEWIDTH + STATUS_CUTTER_BYTEWIDTH) * 8)
#endif
#ifndef STATUS_COOLER_HEIGHT
#ifdef STATUS_COOLER_ANIM
#define STATUS_COOLER_HEIGHT(S) ((S) ? sizeof(status_cooler_on_bmp) / (STATUS_COOLER_BYTEWIDTH) : sizeof(status_cooler_bmp) / (STATUS_COOLER_BYTEWIDTH))
#else
#define STATUS_COOLER_HEIGHT(S) (sizeof(status_cooler_bmp) / (STATUS_COOLER_BYTEWIDTH))
#endif
#endif
#ifndef STATUS_COOLER_Y
#define STATUS_COOLER_Y(S) (18 - STATUS_COOLER_HEIGHT(S))
#endif
#ifndef STATUS_COOLER_TEXT_X
#define STATUS_COOLER_TEXT_X (STATUS_COOLER_X + 8)
#endif
static_assert(
sizeof(status_cooler_bmp) == (STATUS_COOLER_BYTEWIDTH) * (STATUS_COOLER_HEIGHT(0)),
"Status cooler bitmap (status_cooler_bmp) dimensions don't match data."
);
#ifdef STATUS_COOLER_ANIM
static_assert(
sizeof(status_cooler_on_bmp) == (STATUS_COOLER_BYTEWIDTH) * (STATUS_COOLER_HEIGHT(1)),
"Status cooler bitmap (status_cooler_on_bmp) dimensions don't match data."
);
#endif
#endif
//
// Bed Bitmap Properties
//
@ -585,6 +636,10 @@
#if HAS_CUTTER && !DO_DRAW_BED
#define DO_DRAW_CUTTER 1
#endif
#if HAS_COOLER
#define DO_DRAW_COOLER 1
#endif
#if HAS_TEMP_CHAMBER && STATUS_CHAMBER_WIDTH && HOTENDS <= 4
#define DO_DRAW_CHAMBER 1
#endif
@ -603,6 +658,9 @@
#if BOTH(DO_DRAW_CUTTER, STATUS_CUTTER_ANIM)
#define ANIM_CUTTER 1
#endif
#if BOTH(DO_DRAW_COOLER, STATUS_COOLER_ANIM)
#define ANIM_COOLER 1
#endif
#if ANIM_HOTEND || ANIM_BED || ANIM_CHAMBER || ANIM_CUTTER
#define ANIM_HBCC 1
#endif

View File

@ -0,0 +1,70 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
//
// lcd/dogm/status/cooler.h - Status Screen Laser Cooler bitmaps
//
#define STATUS_COOLER_WIDTH 16
#ifdef STATUS_COOLER_ANIM
const unsigned char status_cooler_on_bmp[] PROGMEM = {
B00010000,B00001000,
B00010010,B01001001,
B01010100,B00101010,
B00111000,B00011100,
B11111110,B11111111,
B00111000,B00011100,
B01010100,B00101010,
B10010000,B10001001,
B00010000,B10000000,
B00000100,B10010000,
B00000010,B10100000,
B00000001,B11000000,
B00011111,B11111100,
B00000001,B11000000,
B00000010,B10100000,
B00000100,B10010000
};
#endif
const unsigned char status_cooler_bmp[] PROGMEM = {
B00010000,B00001000,
B00010010,B01001001,
B01010100,B00101010,
B00101000,B00010100,
B11000111,B01100011,
B00101000,B00010100,
B01010100,B00101010,
B10010000,B10001001,
B00010000,B10000000,
B00000100,B10010000,
B00000010,B10100000,
B00000001,B01000000,
B00011110,B00111100,
B00000001,B01000000,
B00000010,B10100000,
B00000100,B10010000
};

View File

@ -86,6 +86,7 @@
HEATBIT_HOTEND,
HEATBIT_BED = HOTENDS,
HEATBIT_CHAMBER,
HEATBIT_COOLER,
HEATBIT_CUTTER
};
IF<(HEATBIT_CUTTER > 7), uint16_t, uint8_t>::type heat_bits;
@ -111,6 +112,11 @@
#else
#define CUTTER_ALT() false
#endif
#if ANIM_COOLER
#define COOLER_ALT(N) TEST(heat_bits, HEATBIT_COOLER)
#else
#define COOLER_ALT() false
#endif
#if DO_DRAW_HOTENDS
#define MAX_HOTEND_DRAW _MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE)))
@ -361,18 +367,22 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
#endif // DO_DRAW_BED
#if DO_DRAW_CHAMBER
FORCE_INLINE void _draw_chamber_status() {
#if HAS_HEATED_CHAMBER
if (PAGE_UNDER(7))
_draw_centered_temp(thermalManager.degTargetChamber() + 0.5f, STATUS_CHAMBER_TEXT_X, 7);
#endif
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
_draw_centered_temp(thermalManager.degChamber() + 0.5f, STATUS_CHAMBER_TEXT_X, 28);
}
#endif
#endif // DO_DRAW_CHAMBER
#if DO_DRAW_COOLER
FORCE_INLINE void _draw_cooler_status() {
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
_draw_centered_temp(thermalManager.degCooler(), STATUS_COOLER_TEXT_X, 28);
}
#endif
//
// Before homing, blink '123' <-> '???'.
@ -447,6 +457,9 @@ void MarlinUI::draw_status_screen() {
#if DO_DRAW_CHAMBER && HAS_HEATED_CHAMBER
if (thermalManager.isHeatingChamber()) SBI(new_bits, HEATBIT_CHAMBER);
#endif
#if DO_DRAW_COOLER && HAS_COOLER
if (thermalManager.isLaserCooling()) SBI(new_bits, HEATBIT_COOLER);
#endif
if (TERN0(ANIM_CUTTER, cutter.enabled())) SBI(new_bits, HEATBIT_CUTTER);
heat_bits = new_bits;
#endif
@ -631,12 +644,28 @@ void MarlinUI::draw_status_screen() {
}
#endif
// Laser Cooler
#if DO_DRAW_COOLER
#if ANIM_COOLER
#define COOLER_BITMAP(S) ((S) ? status_cooler_bmp : status_cooler_on_bmp)
#else
#define COOLER_BITMAP(S) status_cooler_bmp
#endif
const uint8_t coolery = STATUS_COOLER_Y(COOLER_ALT()),
coolerh = STATUS_COOLER_HEIGHT(COOLER_ALT());
if (PAGE_CONTAINS(coolery, coolery + coolerh - 1))
u8g.drawBitmapP(STATUS_COOLER_X, coolery, STATUS_COOLER_BYTEWIDTH, coolerh, COOLER_BITMAP(COOLER_ALT()));
#endif
// Heated Bed
TERN_(DO_DRAW_BED, _draw_bed_status(blink));
// Heated Chamber
TERN_(DO_DRAW_CHAMBER, _draw_chamber_status());
// Cooler
TERN_(DO_DRAW_COOLER, _draw_cooler_status());
// 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)) {