|
|
@ -51,87 +51,151 @@
|
|
|
|
#include "../../module/printcounter.h"
|
|
|
|
#include "../../module/printcounter.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) {
|
|
|
|
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, const uint8_t ty) {
|
|
|
|
const char *str = itostr3(temp);
|
|
|
|
const char *str = itostr3(temp);
|
|
|
|
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
|
|
|
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
|
|
|
lcd_moveto(x - len * (INFO_FONT_WIDTH) / 2 + 1, y);
|
|
|
|
lcd_moveto(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty);
|
|
|
|
lcd_put_u8str(&str[3-len]);
|
|
|
|
lcd_put_u8str(&str[3-len]);
|
|
|
|
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
|
|
|
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(MARLIN_DEV_MODE)
|
|
|
|
#define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH && HOTENDS <= 3 && DISABLED(STATUS_COMBINE_HEATERS))
|
|
|
|
#define SHOW_ON_STATE READ(X_MIN_PIN)
|
|
|
|
#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))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ANIM_HOTEND || ANIM_BED
|
|
|
|
|
|
|
|
uint8_t heat_bits;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ANIM_HOTEND
|
|
|
|
|
|
|
|
#define HOTEND_ALT(N) TEST(heat_bits, N)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define HOTEND_ALT(N) false
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ANIM_BED
|
|
|
|
|
|
|
|
#define BED_ALT() TEST(heat_bits, 7)
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define SHOW_ON_STATE false
|
|
|
|
#define BED_ALT() false
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) {
|
|
|
|
#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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) {
|
|
|
|
#if !HEATER_IDLE_HANDLER
|
|
|
|
#if !HEATER_IDLE_HANDLER
|
|
|
|
UNUSED(blink);
|
|
|
|
UNUSED(blink);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
const bool isBed = heater < 0;
|
|
|
|
const bool isBed = heater < 0;
|
|
|
|
|
|
|
|
#define IFBED(A,B) (isBed ? (A) : (B))
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
constexpr bool isBed = false;
|
|
|
|
#define IFBED(A,B) (B)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (PAGE_UNDER(7)) {
|
|
|
|
const bool isHeat = IFBED(BED_ALT(), HOTEND_ALT(heater));
|
|
|
|
#if HEATER_IDLE_HANDLER
|
|
|
|
const uint8_t ix = IFBED(STATUS_BED_X, STATUS_HOTEND_X(heater)),
|
|
|
|
const bool is_idle = (
|
|
|
|
tx = IFBED(STATUS_BED_TEXT_X, STATUS_HOTEND_TEXT_X(heater));
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
const float temp = IFBED(thermalManager.degBed(), thermalManager.degHotend(heater)),
|
|
|
|
isBed ? thermalManager.is_bed_idle() :
|
|
|
|
target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
thermalManager.is_heater_idle(heater)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (blink || !is_idle)
|
|
|
|
#if DISABLED(STATUS_HOTEND_ANIM)
|
|
|
|
#endif
|
|
|
|
#define STATIC_HOTEND true
|
|
|
|
_draw_centered_temp(0.5 + (
|
|
|
|
#define HOTEND_DOT isHeat
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
#else
|
|
|
|
isBed ? thermalManager.degTargetBed() :
|
|
|
|
#define STATIC_HOTEND false
|
|
|
|
#endif
|
|
|
|
#define HOTEND_DOT false
|
|
|
|
thermalManager.degTargetHotend(heater)
|
|
|
|
#endif
|
|
|
|
), x, 7
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(21, 28))
|
|
|
|
#if HAS_HEATED_BED && DISABLED(STATUS_BED_ANIM)
|
|
|
|
_draw_centered_temp(0.5f + (
|
|
|
|
#define STATIC_BED true
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
#define BED_DOT isHeat
|
|
|
|
isBed ? thermalManager.degBed() :
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
#define STATIC_BED false
|
|
|
|
thermalManager.degHotend(heater)
|
|
|
|
#define BED_DOT false
|
|
|
|
), x, 28
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef STATUS_HOTEND_ANIM
|
|
|
|
#if ANIM_HOTEND && ENABLED(STATUS_HOTEND_INVERTED)
|
|
|
|
#define INDICATE_HOTEND true
|
|
|
|
#define OFF_BMP(N) status_hotend##N##_b_bmp
|
|
|
|
#define INDICATE_HOTEND_ON (thermalManager.isHeatingHotend(heater) ^ SHOW_ON_STATE)
|
|
|
|
#define ON_BMP(N) status_hotend##N##_a_bmp
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define INDICATE_HOTEND false
|
|
|
|
#define OFF_BMP(N) status_hotend##N##_a_bmp
|
|
|
|
#define INDICATE_HOTEND_ON false
|
|
|
|
#define ON_BMP(N) status_hotend##N##_b_bmp
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_HEATED_BED && !defined(STATUS_BED_ANIM)
|
|
|
|
#if STATUS_HOTEND_BITMAPS > 1
|
|
|
|
#define INDICATE_BED true
|
|
|
|
static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, OFF_BMP(1), OFF_BMP(2), OFF_BMP(3), OFF_BMP(4), OFF_BMP(5), OFF_BMP(6));
|
|
|
|
#define INDICATE_BED_ON (thermalManager.isHeatingBed() ^ SHOW_ON_STATE)
|
|
|
|
#if ANIM_HOTEND
|
|
|
|
|
|
|
|
static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, ON_BMP(1), ON_BMP(2), ON_BMP(3), ON_BMP(4), ON_BMP(5), ON_BMP(6));
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr((S) ? &status_hotend_on_gfx[(N) % (STATUS_HOTEND_BITMAPS)] : &status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr(&status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif ANIM_HOTEND
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) ((S) ? ON_BMP() : OFF_BMP())
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define INDICATE_BED false
|
|
|
|
#define HOTEND_BITMAP(N,S) status_hotend_a_bmp
|
|
|
|
#define INDICATE_BED_ON false
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (isBed ? INDICATE_BED : INDICATE_HOTEND) {
|
|
|
|
if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) {
|
|
|
|
if (PAGE_CONTAINS(17, 20)) {
|
|
|
|
|
|
|
|
const uint8_t y = 20 - (isBed ? 2 : 3);
|
|
|
|
#define BAR_TALL (STATUS_HEATERS_HEIGHT - 2)
|
|
|
|
if (isBed ? INDICATE_BED_ON : INDICATE_HOTEND_ON) {
|
|
|
|
|
|
|
|
u8g.setColorIndex(0); // set to white on black
|
|
|
|
const float prop = target - 20,
|
|
|
|
u8g.drawBox(x, y, 2, 2);
|
|
|
|
perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0;
|
|
|
|
u8g.setColorIndex(1); // restore black on white
|
|
|
|
uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f);
|
|
|
|
|
|
|
|
NOMORE(tall, BAR_TALL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef STATUS_HOTEND_ANIM
|
|
|
|
|
|
|
|
// Draw hotend bitmap, either whole or split by the heating percent
|
|
|
|
|
|
|
|
if (IFBED(0, 1)) {
|
|
|
|
|
|
|
|
const uint8_t hx = STATUS_HOTEND_X(heater), bw = STATUS_HOTEND_BYTEWIDTH(heater);
|
|
|
|
|
|
|
|
#if ENABLED(STATUS_HEAT_PERCENT)
|
|
|
|
|
|
|
|
if (isHeat && tall <= BAR_TALL) {
|
|
|
|
|
|
|
|
const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
|
|
|
|
|
|
|
|
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(heater, false));
|
|
|
|
|
|
|
|
u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(heater, true) + ph * bw);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(heater, isHeat));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
u8g.drawBox(x, y, 2, 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
// Draw a heating progress bar, if specified
|
|
|
|
|
|
|
|
#if ENABLED(STATUS_HEAT_PERCENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IFBED(true, STATIC_HOTEND) && isHeat) {
|
|
|
|
|
|
|
|
const uint8_t bx = ix + IFBED(STATUS_BED_WIDTH, STATUS_HOTEND_WIDTH(heater)) + 1;
|
|
|
|
|
|
|
|
u8g.drawFrame(bx, STATUS_HEATERS_Y, 3, STATUS_HEATERS_HEIGHT);
|
|
|
|
|
|
|
|
if (tall) {
|
|
|
|
|
|
|
|
const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
|
|
|
|
|
|
|
|
if (PAGE_OVER(STATUS_HEATERS_Y + ph))
|
|
|
|
|
|
|
|
u8g.drawVLine(bx + 1, STATUS_HEATERS_Y + ph, tall);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // PAGE_CONTAINS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (PAGE_UNDER(7)) {
|
|
|
|
|
|
|
|
#if HEATER_IDLE_HANDLER
|
|
|
|
|
|
|
|
const bool is_idle = IFBED(thermalManager.is_bed_idle(), thermalManager.is_heater_idle(heater)),
|
|
|
|
|
|
|
|
dodraw = (blink || !is_idle);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
constexpr bool dodraw = true;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (dodraw) _draw_centered_temp(target + 0.5, tx, 7);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
|
|
|
|
|
|
|
_draw_centered_temp(temp + 0.5f, tx, 28);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IFBED(STATIC_BED && BED_DOT, STATIC_HOTEND && HOTEND_DOT) && PAGE_CONTAINS(17, 19)) {
|
|
|
|
|
|
|
|
u8g.setColorIndex(0); // set to white on black
|
|
|
|
|
|
|
|
u8g.drawBox(tx, IFBED(20-2, 20-3), 2, 2);
|
|
|
|
|
|
|
|
u8g.setColorIndex(1); // restore black on white
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -158,94 +222,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MarlinUI::draw_status_message(const bool blink) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the UTF8 character count of the string
|
|
|
|
|
|
|
|
uint8_t slen = utf8_strlen(status_message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool last_blink = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slen <= LCD_WIDTH) {
|
|
|
|
|
|
|
|
// The string fits within the line. Print with no scrolling
|
|
|
|
|
|
|
|
lcd_put_u8str(status_message);
|
|
|
|
|
|
|
|
for (; slen < LCD_WIDTH; ++slen) lcd_put_wchar(' ');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// String is longer than the available space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get a pointer to the next valid UTF8 character
|
|
|
|
|
|
|
|
const char *stat = status_message + status_scroll_offset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the string remaining length
|
|
|
|
|
|
|
|
const uint8_t rlen = utf8_strlen(stat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rlen >= LCD_WIDTH) {
|
|
|
|
|
|
|
|
// The remaining string fills the screen - Print it
|
|
|
|
|
|
|
|
lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// The remaining string does not completely fill the screen
|
|
|
|
|
|
|
|
lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); // The string leaves space
|
|
|
|
|
|
|
|
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
|
|
|
|
|
|
|
|
if (--chars) { // Draw a second dot if there's space
|
|
|
|
|
|
|
|
lcd_put_wchar('.');
|
|
|
|
|
|
|
|
if (--chars) {
|
|
|
|
|
|
|
|
// Print a second copy of the message
|
|
|
|
|
|
|
|
lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH - (rlen + 2) * (MENU_FONT_WIDTH));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (last_blink != blink) {
|
|
|
|
|
|
|
|
last_blink = blink;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Adjust by complete UTF8 characters
|
|
|
|
|
|
|
|
if (status_scroll_offset < slen) {
|
|
|
|
|
|
|
|
status_scroll_offset++;
|
|
|
|
|
|
|
|
while (!START_OF_UTF8_CHAR(status_message[status_scroll_offset]))
|
|
|
|
|
|
|
|
status_scroll_offset++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
status_scroll_offset = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else // !STATUS_MESSAGE_SCROLLING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNUSED(blink);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Just print the string to the LCD
|
|
|
|
|
|
|
|
lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fill the rest with spaces
|
|
|
|
|
|
|
|
for (; slen < LCD_WIDTH; ++slen) lcd_put_wchar(' ');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !STATUS_MESSAGE_SCROLLING
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MarlinUI::draw_status_screen() {
|
|
|
|
void MarlinUI::draw_status_screen() {
|
|
|
|
|
|
|
|
|
|
|
|
#define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH)
|
|
|
|
|
|
|
|
#define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && STATUS_FAN_FRAMES)
|
|
|
|
|
|
|
|
#define ANIM_END (HOTENDS && defined(STATUS_HOTEND_ANIM))
|
|
|
|
|
|
|
|
#define ANIM_BED (DO_DRAW_BED && defined(STATUS_BED_ANIM))
|
|
|
|
|
|
|
|
#if ANIM_END || ANIM_BED
|
|
|
|
|
|
|
|
static uint8_t heat_bits;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ANIM_END
|
|
|
|
|
|
|
|
#define HOTEND_ALT(N) TEST(heat_bits, N)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define HOTEND_ALT(N) false
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ANIM_BED
|
|
|
|
|
|
|
|
#define BED_ALT TEST(heat_bits, 7)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define BED_ALT false
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char xstring[5], ystring[5], zstring[8];
|
|
|
|
static char xstring[5], ystring[5], zstring[8];
|
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
|
|
|
static char wstring[5], mstring[4];
|
|
|
|
static char wstring[5], mstring[4];
|
|
|
@ -253,14 +231,15 @@ void MarlinUI::draw_status_screen() {
|
|
|
|
|
|
|
|
|
|
|
|
// At the first page, generate new display values
|
|
|
|
// At the first page, generate new display values
|
|
|
|
if (first_page) {
|
|
|
|
if (first_page) {
|
|
|
|
#if ANIM_END || ANIM_BED
|
|
|
|
#if ANIM_HOTEND || ANIM_BED
|
|
|
|
heat_bits = 0;
|
|
|
|
uint8_t new_bits = 0;
|
|
|
|
#if ANIM_END
|
|
|
|
#if ANIM_HOTEND
|
|
|
|
HOTEND_LOOP() if (thermalManager.isHeatingHotend(e) ^ SHOW_ON_STATE) SBI(heat_bits, e);
|
|
|
|
HOTEND_LOOP() if (thermalManager.isHeatingHotend(e)) SBI(new_bits, e);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if ANIM_BED
|
|
|
|
#if ANIM_BED
|
|
|
|
if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(heat_bits, 7);
|
|
|
|
if (thermalManager.isHeatingBed()) SBI(new_bits, 7);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
heat_bits = new_bits;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
|
|
|
|
strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
|
|
|
|
strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
|
|
|
|
strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
|
|
|
@ -283,65 +262,13 @@ void MarlinUI::draw_status_screen() {
|
|
|
|
|
|
|
|
|
|
|
|
#if STATUS_LOGO_WIDTH
|
|
|
|
#if STATUS_LOGO_WIDTH
|
|
|
|
if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1))
|
|
|
|
if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1))
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp);
|
|
|
|
STATUS_LOGO_X, STATUS_LOGO_Y,
|
|
|
|
|
|
|
|
STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT,
|
|
|
|
|
|
|
|
status_logo_bmp
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if STATUS_HEATERS_WIDTH || STATUS_HOTEND1_WIDTH
|
|
|
|
#if STATUS_HEATERS_WIDTH
|
|
|
|
|
|
|
|
// Draw all heaters (and maybe the bed) in one go
|
|
|
|
if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1)) {
|
|
|
|
if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1))
|
|
|
|
|
|
|
|
u8g.drawBitmapP(STATUS_HEATERS_X, STATUS_HEATERS_Y, STATUS_HEATERS_BYTEWIDTH, STATUS_HEATERS_HEIGHT, status_heaters_bmp);
|
|
|
|
#if STATUS_HEATERS_WIDTH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Draw all heaters (and maybe the bed) in one go
|
|
|
|
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
|
|
|
|
STATUS_HEATERS_X, STATUS_HEATERS_Y,
|
|
|
|
|
|
|
|
STATUS_HEATERS_BYTEWIDTH, STATUS_HEATERS_HEIGHT,
|
|
|
|
|
|
|
|
status_heaters_bmp
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ANIM_END && defined(STATUS_HOTEND_INVERTED)
|
|
|
|
|
|
|
|
#define OFF_BMP(N) status_hotend##N##_b_bmp
|
|
|
|
|
|
|
|
#define ON_BMP(N) status_hotend##N##_a_bmp
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define OFF_BMP(N) status_hotend##N##_a_bmp
|
|
|
|
|
|
|
|
#define ON_BMP(N) status_hotend##N##_b_bmp
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if STATUS_HOTEND_BITMAPS > 1
|
|
|
|
|
|
|
|
static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, OFF_BMP(1), OFF_BMP(2), OFF_BMP(3), OFF_BMP(4), OFF_BMP(5), OFF_BMP(6));
|
|
|
|
|
|
|
|
#if ANIM_END
|
|
|
|
|
|
|
|
static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = ARRAY_N(STATUS_HOTEND_BITMAPS, ON_BMP(1), ON_BMP(2), ON_BMP(3), ON_BMP(4), ON_BMP(5), ON_BMP(6));
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr((S) ? &status_hotend_on_gfx[(N) % (STATUS_HOTEND_BITMAPS)] : &status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr(&status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif ANIM_END
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) ((S) ? ON_BMP() : OFF_BMP())
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define HOTEND_BITMAP(N,S) status_hotend_a_bmp
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_HOTEND_DRAW MIN(HOTENDS, ((128 - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Draw hotends from one or more individual hotend bitmaps
|
|
|
|
|
|
|
|
for (uint8_t h = 0; h < MAX_HOTEND_DRAW; ++h) {
|
|
|
|
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
|
|
|
|
STATUS_HOTEND_X(h), STATUS_HEATERS_Y,
|
|
|
|
|
|
|
|
STATUS_HOTEND_BYTEWIDTH(h), STATUS_HEATERS_HEIGHT,
|
|
|
|
|
|
|
|
HOTEND_BITMAP(h, HOTEND_ALT(h))
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // PAGE_CONTAINS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if DO_DRAW_BED
|
|
|
|
#if DO_DRAW_BED
|
|
|
@ -350,14 +277,9 @@ void MarlinUI::draw_status_screen() {
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define BED_BITMAP(S) status_bed_bmp
|
|
|
|
#define BED_BITMAP(S) status_bed_bmp
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
const uint8_t bedy = STATUS_BED_Y(BED_ALT), bedh = STATUS_BED_HEIGHT(BED_ALT);
|
|
|
|
const uint8_t bedy = STATUS_BED_Y(BED_ALT()), bedh = STATUS_BED_HEIGHT(BED_ALT());
|
|
|
|
if (PAGE_CONTAINS(bedy, bedy + bedh - 1)) {
|
|
|
|
if (PAGE_CONTAINS(bedy, bedy + bedh - 1))
|
|
|
|
u8g.drawBitmapP(
|
|
|
|
u8g.drawBitmapP(STATUS_BED_X, bedy, STATUS_BED_BYTEWIDTH, bedh, BED_BITMAP(BED_ALT()));
|
|
|
|
STATUS_BED_X, bedy,
|
|
|
|
|
|
|
|
STATUS_BED_BYTEWIDTH, bedh,
|
|
|
|
|
|
|
|
BED_BITMAP(BED_ALT)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if DO_DRAW_FAN
|
|
|
|
#if DO_DRAW_FAN
|
|
|
@ -390,13 +312,14 @@ void MarlinUI::draw_status_screen() {
|
|
|
|
// Temperature Graphics and Info
|
|
|
|
// Temperature Graphics and Info
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
if (PAGE_UNDER(28)) {
|
|
|
|
if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) {
|
|
|
|
// Extruders
|
|
|
|
// Extruders
|
|
|
|
HOTEND_LOOP() _draw_heater_status(STATUS_HOTEND_TEXT_X(e), e, blink);
|
|
|
|
for (uint8_t e = 0; e < MAX_HOTEND_DRAW; ++e)
|
|
|
|
|
|
|
|
_draw_heater_status(e, blink);
|
|
|
|
|
|
|
|
|
|
|
|
// Heated bed
|
|
|
|
// Heated bed
|
|
|
|
#if HOTENDS < 4 && HAS_HEATED_BED
|
|
|
|
#if HAS_HEATED_BED && HOTENDS < 4
|
|
|
|
_draw_heater_status(STATUS_BED_TEXT_X, -1, blink);
|
|
|
|
_draw_heater_status(-1, blink);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Fan, if a bitmap was provided
|
|
|
|
// Fan, if a bitmap was provided
|
|
|
@ -435,11 +358,8 @@ void MarlinUI::draw_status_screen() {
|
|
|
|
#define PROGRESS_BAR_X 54
|
|
|
|
#define PROGRESS_BAR_X 54
|
|
|
|
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
|
|
|
|
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
|
|
|
|
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(49, 52)) // 49-52 (or 49-51)
|
|
|
|
if (PAGE_CONTAINS(49, 52))
|
|
|
|
u8g.drawFrame(
|
|
|
|
u8g.drawFrame(PROGRESS_BAR_X, 49, PROGRESS_BAR_WIDTH, 4);
|
|
|
|
PROGRESS_BAR_X, 49,
|
|
|
|
|
|
|
|
PROGRESS_BAR_WIDTH, 4
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint8_t progress = get_progress();
|
|
|
|
const uint8_t progress = get_progress();
|
|
|
|
|
|
|
|
|
|
|
@ -601,4 +521,72 @@ void MarlinUI::draw_status_screen() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MarlinUI::draw_status_message(const bool blink) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the UTF8 character count of the string
|
|
|
|
|
|
|
|
uint8_t slen = utf8_strlen(status_message);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool last_blink = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (slen <= LCD_WIDTH) {
|
|
|
|
|
|
|
|
// The string fits within the line. Print with no scrolling
|
|
|
|
|
|
|
|
lcd_put_u8str(status_message);
|
|
|
|
|
|
|
|
for (; slen < LCD_WIDTH; ++slen) lcd_put_wchar(' ');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// String is longer than the available space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get a pointer to the next valid UTF8 character
|
|
|
|
|
|
|
|
const char *stat = status_message + status_scroll_offset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the string remaining length
|
|
|
|
|
|
|
|
const uint8_t rlen = utf8_strlen(stat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rlen >= LCD_WIDTH) {
|
|
|
|
|
|
|
|
// The remaining string fills the screen - Print it
|
|
|
|
|
|
|
|
lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// The remaining string does not completely fill the screen
|
|
|
|
|
|
|
|
lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); // The string leaves space
|
|
|
|
|
|
|
|
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
|
|
|
|
|
|
|
|
if (--chars) { // Draw a second dot if there's space
|
|
|
|
|
|
|
|
lcd_put_wchar('.');
|
|
|
|
|
|
|
|
if (--chars) {
|
|
|
|
|
|
|
|
// Print a second copy of the message
|
|
|
|
|
|
|
|
lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH - (rlen + 2) * (MENU_FONT_WIDTH));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (last_blink != blink) {
|
|
|
|
|
|
|
|
last_blink = blink;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Adjust by complete UTF8 characters
|
|
|
|
|
|
|
|
if (status_scroll_offset < slen) {
|
|
|
|
|
|
|
|
status_scroll_offset++;
|
|
|
|
|
|
|
|
while (!START_OF_UTF8_CHAR(status_message[status_scroll_offset]))
|
|
|
|
|
|
|
|
status_scroll_offset++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
status_scroll_offset = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#else // !STATUS_MESSAGE_SCROLLING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNUSED(blink);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Just print the string to the LCD
|
|
|
|
|
|
|
|
lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fill the rest with spaces
|
|
|
|
|
|
|
|
for (; slen < LCD_WIDTH; ++slen) lcd_put_wchar(' ');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !STATUS_MESSAGE_SCROLLING
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_GRAPHICAL_LCD && !LIGHTWEIGHT_UI
|
|
|
|
#endif // HAS_GRAPHICAL_LCD && !LIGHTWEIGHT_UI
|
|
|
|