Improvements and fixes to Lulzbot UI (#15490)

2.0.x
Marcio Teixeira 5 years ago committed by Scott Lahteine
parent e6055dce76
commit dc14d4a13c

@ -566,3 +566,7 @@
#define HAS_SDCARD_CONNECTION EITHER(TARGET_LPC1768, ADAFRUIT_GRAND_CENTRAL_M4)
#define HAS_LINEAR_E_JERK (DISABLED(CLASSIC_JERK) && ENABLED(LIN_ADVANCE))
#ifndef SPI_SPEED
#define SPI_SPEED SPI_FULL_SPEED
#endif

@ -861,7 +861,7 @@ void MarlinUI::draw_status_screen() {
uint16_t per;
#if HAS_FAN0
if (true
#if EXTRUDERS
#if EXTRUDERS && ENABLED(ADAPTIVE_FAN_SLOWING)
&& (blink || thermalManager.fan_speed_scaler[0] < 128)
#endif
) {

@ -310,7 +310,9 @@ class CommandProcessor : public CLCD::CommandFifo {
int8_t apply_fit_text(int16_t w, int16_t h, T text) {
using namespace FTDI;
int8_t font = _font;
#ifdef TOUCH_UI_USE_UTF8
const bool is_utf8 = has_utf8_chars(text);
#endif
for (;font >= 26;) {
int16_t width, height;
#ifdef TOUCH_UI_USE_UTF8

@ -21,6 +21,46 @@
#pragma once
/**
* Implementation of hsl_to_rgb as constexpr functions based on:
*
* https://www.rapidtables.com/convert/color/hsl-to-rgb.html
*/
constexpr float _hsl_fmod(float x, float y) {
return x - int(x/y)*y;
}
constexpr float _hsl_c(int, float S, float L) {
return (1.0f - fabs(2*L-1.0f)) * S;
}
constexpr float _hsl_x(int H, float S, float L) {
return _hsl_c(H,S,L) * (1.0f - fabs(_hsl_fmod(float(H)/60, 2) - 1));
}
constexpr float _hsl_m(int H, float S, float L) {
return L - _hsl_c(H,S,L)/2;
}
constexpr float _hsl_rgb(int H, float S, float L, float r, float g, float b) {
return ((uint32_t((r + _hsl_m(H,S,L))*255+0.5) << 16) |
(uint32_t((g + _hsl_m(H,S,L))*255+0.5) << 8) |
(uint32_t((b + _hsl_m(H,S,L))*255+0.5) << 0));
}
constexpr uint32_t hsl_to_rgb(int H, float S, float L) {
return (H < 60) ? _hsl_rgb(H,S,L,_hsl_c(H,S,L), _hsl_x(H,S,L), 0) :
(H < 120) ? _hsl_rgb(H,S,L,_hsl_x(H,S,L), _hsl_c(H,S,L), 0) :
(H < 180) ? _hsl_rgb(H,S,L, 0, _hsl_c(H,S,L), _hsl_x(H,S,L)) :
(H < 240) ? _hsl_rgb(H,S,L, 0, _hsl_x(H,S,L), _hsl_c(H,S,L)) :
(H < 300) ? _hsl_rgb(H,S,L,_hsl_x(H,S,L), 0, _hsl_c(H,S,L)) :
_hsl_rgb(H,S,L,_hsl_c(H,S,L), 0, _hsl_x(H,S,L));
}
/**
* Structure for RGB colors
*/
struct rgb_t {
union {
struct {

@ -123,6 +123,11 @@ namespace ExtUI {
else
ConfirmUserRequestAlertBox::hide();
}
#if HAS_LEVELING && HAS_MESH
void onMeshUpdate(const uint8_t, const uint8_t, const float) {
}
#endif
}
#endif // LULZBOT_TOUCH_UI

@ -47,7 +47,8 @@ BaseNumericAdjustmentScreen::widgets_t::widgets_t(draw_mode_t what) : _what(what
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.colors(normal_btn)
.cmd(COLOR_RGB(bg_text_enabled));
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);
}
cmd.font(font_medium);
@ -126,6 +127,7 @@ void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
CommandProcessor cmd;
_button_style(cmd, TEXT_LABEL);
cmd.font(font_medium)
.tag(0)
.text(
#ifdef TOUCH_UI_PORTRAIT
BTN_POS(1, _line), BTN_SIZE(12,1),
@ -188,7 +190,8 @@ void BaseNumericAdjustmentScreen::widgets_t::increments() {
cmd.font(LAYOUT_FONT);
if (_what & BACKGROUND) {
cmd.text(
_button_style(cmd, TEXT_LABEL);
cmd.tag(0).text(
#ifdef TOUCH_UI_PORTRAIT
BTN_POS(1, _line), BTN_SIZE(4,1),
#else

@ -36,7 +36,8 @@ void MainMenu::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
.cmd(CLEAR(true,true,true));
.cmd(CLEAR(true,true,true))
.tag(0);
}
if (what & FOREGROUND) {

@ -38,7 +38,8 @@ using namespace Theme;
void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char* message) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(COLOR_RGB(bg_text_enabled));
cmd.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);
draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(2,2), message, OPT_CENTER, font_large);
}
}

@ -29,8 +29,6 @@
#include "../ftdi_eve_lib/extras/poly_ui.h"
#include "bio_printer_ui.h"
#define E_TRAVEL_LIMIT 60
#define GRID_COLS 2
#define GRID_ROWS 9
@ -94,11 +92,13 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
cmd.font(font_xlarge)
.cmd(COLOR_RGB(bg_text_enabled));
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) {
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0)
format_temp(bed_str, getTargetTemp_celsius(BED));
else
strcpy_P(bed_str, PSTR(MSG_BED));
ui.bounds(POLY(target_temp), x, y, h, v);
cmd.text(x, y, h, v, bed_str);
}
format_temp(bed_str, getActualTemp_celsius(BED));
ui.bounds(POLY(actual_temp), x, y, h, v);
@ -108,7 +108,11 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
void StatusScreen::draw_syringe(draw_mode_t what) {
int16_t x, y, h, v;
const float fill_level = 1.0 - min(1.0, max(0.0, getAxisPosition_mm(E0) / E_TRAVEL_LIMIT));
#ifdef LULZBOT_E_TRAVEL_LIMIT
const float fill_level = 1.0 - min(1.0, max(0.0, getAxisPosition_mm(E0) / LULZBOT_E_TRAVEL_LIMIT));
#else
const float fill_level = 0.75;
#endif
const bool e_homed = isAxisPositionKnown(E0);
CommandProcessor cmd;
@ -239,8 +243,9 @@ void StatusScreen::loadBitmaps() {
void StatusScreen::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color));
cmd.cmd(CLEAR(true,true,true));
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.tag(0);
}
draw_syringe(what);

@ -31,21 +31,22 @@ using namespace Theme;
using namespace ExtUI;
void TuneMenu::onRedraw(draw_mode_t what) {
#define GRID_ROWS 8
#define GRID_COLS 2
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.font(font_medium);
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0)
.font(font_large)
.text( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(PRINT_MENU));
}
#define GRID_ROWS 8
#define GRID_COLS 2
if (what & FOREGROUND) {
CommandProcessor cmd;
cmd.cmd(COLOR_RGB(bg_text_enabled))
.font(font_large).text ( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(PRINT_MENU))
.colors(normal_btn)
cmd.colors(normal_btn)
.font(font_medium)
.enabled( isPrinting()).tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(PRINT_SPEED))
.tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(BED_TEMPERATURE))

@ -36,6 +36,7 @@
#endif
using namespace FTDI;
using namespace Theme;
void BootScreen::onRedraw(draw_mode_t) {
CommandProcessor cmd;
@ -96,16 +97,16 @@ void BootScreen::onIdle() {
void BootScreen::showSplashScreen() {
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART);
cmd.cmd(CLEAR_COLOR_RGB(0xDEEA5C));
cmd.cmd(CLEAR_COLOR_RGB(logo_bg));
cmd.cmd(CLEAR(true,true,true));
#define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0]))
PolyUI ui(cmd);
cmd.cmd(COLOR_RGB(0xC1D82F));
cmd.cmd(COLOR_RGB(logo_fg));
ui.fill(POLY(logo_green));
cmd.cmd(COLOR_RGB(0x000000));
cmd.cmd(COLOR_RGB(logo_stroke));
ui.fill(POLY(logo_black));
ui.fill(POLY(logo_type));
ui.fill(POLY(logo_mark));

@ -34,7 +34,8 @@ void FilamentMenu::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
.cmd(CLEAR(true,true,true));
.cmd(CLEAR(true,true,true))
.tag(0);
}
if (what & FOREGROUND) {

@ -35,7 +35,7 @@ void JunctionDeviationScreen::onRedraw(draw_mode_t what) {
w.precision(2);
w.units(GET_TEXT_F(UNITS_MM));
w.heading(GET_TEXT_F(JUNC_DEVIATION));
w.color(other) .adjuster( 2, PSTR(""), getJunctionDeviation_mm() );
w.color(other) .adjuster( 2, F(""), getJunctionDeviation_mm() );
w.increments();
}

@ -45,6 +45,7 @@ void LockScreen::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);
}
@ -88,7 +89,6 @@ void LockScreen::onRedraw(draw_mode_t what) {
const uint8_t pressed = EventLoop::get_pressed_tag();
cmd.font(font_large)
.cmd(COLOR_RGB(bg_text_enabled))
#ifdef TOUCH_UI_PORTRAIT
.text(BTN_POS(1,2), BTN_SIZE(1,1), message)
.font(font_xlarge)

@ -33,8 +33,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
CommandProcessor cmd;
cmd.cmd(CLEAR_COLOR_RGB(bg_color))
.cmd(CLEAR(true,true,true))
.font(font_medium);
.cmd(CLEAR(true,true,true));
}
#ifdef TOUCH_UI_PORTRAIT

@ -23,25 +23,52 @@
#pragma once
namespace Theme {
#ifdef LULZBOT_USE_BIOPRINTER_UI
// The Lulzbot Bio uses the color PANTONE 2175C on the case silkscreen.
// This translates to HSL(208°, 100%, 39%) as an accent color on the GUI.
#define COLOR_CORRECTION(rgb) ( \
(uint32_t((((rgb) & 0xFF0000) >> 16) * 1.00) << 16) | \
(uint32_t((((rgb) & 0x00FF00) >> 8) * 1.00) << 8) | \
(uint32_t((((rgb) & 0x0000FF) >> 0) * .75) << 0))
constexpr int accent_hue = 208;
constexpr float accent_sat = 0.5;
#define COLOR_BLEND(a,b,f) COLOR_CORRECTION( \
(uint32_t((((a) & 0xFF0000) >> 16) * f + (((b) & 0xFF0000) >> 16) * (1-f)) << 16) | \
(uint32_t((((a) & 0x00FF00) >> 8) * f + (((b) & 0x00FF00) >> 8) * (1-f)) << 8) | \
(uint32_t((((a) & 0x0000FF) >> 0) * f + (((b) & 0x0000FF) >> 0) * (1-f)) << 0))
constexpr uint32_t logo_bg = 0xffffff;
constexpr uint32_t logo_fg = 0xffffff;
constexpr uint32_t logo_stroke = hsl_to_rgb(accent_hue, 1.0, 0.39);
#else
// The Lulzbot logo uses the color PANTONE 382c.
// This translates to HSL(68°, 68%, 52%) as an accent color on the GUI.
constexpr int accent_hue = 68;
constexpr float accent_sat = 0.68;
constexpr uint32_t logo_bg = hsl_to_rgb(accent_hue, 0.77, 0.64);
constexpr uint32_t logo_fg = hsl_to_rgb(accent_hue, 0.68, 0.52); // Lulzbot Green
constexpr uint32_t logo_stroke = 0x000000;
#endif
// Shades of accent color
constexpr uint32_t lulzbot_bg = 0xDEEA5C;
constexpr uint32_t lulzbot_fg = 0xC1D82F;
constexpr uint32_t accent_color_1 = hsl_to_rgb(accent_hue, accent_sat, 0.26); // Darkest
constexpr uint32_t accent_color_2 = hsl_to_rgb(accent_hue, accent_sat, 0.39);
constexpr uint32_t accent_color_3 = hsl_to_rgb(accent_hue, accent_sat, 0.52);
constexpr uint32_t accent_color_4 = hsl_to_rgb(accent_hue, accent_sat, 0.65);
constexpr uint32_t accent_color_5 = hsl_to_rgb(accent_hue, accent_sat, 0.78);
constexpr uint32_t accent_color_6 = hsl_to_rgb(accent_hue, accent_sat, 0.91); // Lightest
constexpr uint32_t lulzbot_green = COLOR_BLEND(0xC1DB2F,0x788814,0.33);
// Shades of gray
constexpr float gray_sat = 0.14;
constexpr uint32_t gray_color_1 = hsl_to_rgb(accent_hue, gray_sat, 0.26); // Darkest
constexpr uint32_t gray_color_2 = hsl_to_rgb(accent_hue, gray_sat, 0.39);
constexpr uint32_t gray_color_3 = hsl_to_rgb(accent_hue, gray_sat, 0.52);
constexpr uint32_t gray_color_4 = hsl_to_rgb(accent_hue, gray_sat, 0.65);
constexpr uint32_t gray_color_5 = hsl_to_rgb(accent_hue, gray_sat, 0.78);
constexpr uint32_t gray_color_6 = hsl_to_rgb(accent_hue, gray_sat, 0.91); // Lightest
#ifndef LULZBOT_USE_BIOPRINTER_UI
constexpr uint32_t theme_darkest = COLOR_CORRECTION(0x444444);
constexpr uint32_t theme_dark = COLOR_CORRECTION(0x777777);
// Lulzbot TAZ Pro
constexpr uint32_t theme_darkest = gray_color_1;
constexpr uint32_t theme_dark = gray_color_2;
constexpr uint32_t bg_color = theme_darkest;
constexpr uint32_t bg_text_disabled = theme_dark;
@ -49,48 +76,43 @@ namespace Theme {
constexpr uint32_t bg_normal = theme_darkest;
constexpr uint32_t fg_normal = theme_dark;
constexpr uint32_t fg_action = lulzbot_green;
constexpr uint32_t fg_disabled = bg_color;
constexpr uint32_t fg_action = accent_color_2;
constexpr uint32_t fg_disabled = theme_darkest;
#else
constexpr uint32_t theme_darkest = 0x545923;
constexpr uint32_t theme_dark = lulzbot_bg;
// Lulzbot Bio
constexpr uint32_t theme_darkest = accent_color_1;
constexpr uint32_t theme_dark = accent_color_4;
constexpr uint32_t bg_color = 0xFFFFFF;
constexpr uint32_t bg_text_disabled = 0x333333;
constexpr uint32_t bg_text_enabled = theme_darkest;
constexpr uint32_t bg_normal = theme_dark;
constexpr uint32_t fg_normal = theme_darkest;
constexpr uint32_t fg_action = theme_dark;
constexpr uint32_t fg_disabled = 0xEFEFEF;
constexpr uint32_t shadow_rgb = 0xE0E0E0;
constexpr uint32_t fill_rgb = lulzbot_fg;
constexpr uint32_t stroke_rgb = theme_darkest;
constexpr uint32_t syringe_rgb = 0xF1F6C0;
constexpr uint32_t bg_text_disabled = gray_color_1;
constexpr uint32_t bg_text_enabled = accent_color_1;
constexpr uint32_t bg_normal = accent_color_4;
constexpr uint32_t fg_normal = accent_color_1;
constexpr uint32_t fg_action = accent_color_4;
constexpr uint32_t fg_disabled = gray_color_6;
constexpr uint32_t shadow_rgb = gray_color_6;
constexpr uint32_t stroke_rgb = accent_color_1;
constexpr uint32_t fill_rgb = accent_color_3;
constexpr uint32_t syringe_rgb = accent_color_5;
#endif
constexpr uint32_t x_axis = COLOR_CORRECTION(0xFF0000);
constexpr uint32_t y_axis = COLOR_CORRECTION(0x00BB00);
constexpr uint32_t z_axis = COLOR_CORRECTION(0x0000FF);
#ifndef LULZBOT_USE_BIOPRINTER_UI
constexpr uint32_t e_axis = COLOR_CORRECTION(0x777777);
constexpr uint32_t feedrate = COLOR_CORRECTION(0x777777);
constexpr uint32_t other = COLOR_CORRECTION(0x777777);
#else
constexpr uint32_t e_axis = 0x000000;
constexpr uint32_t feedrate = 0x000000;
constexpr uint32_t other = 0x000000;
#endif
constexpr uint32_t x_axis = 0xFF0000;
constexpr uint32_t y_axis = 0x00BB00;
constexpr uint32_t z_axis = 0x0000BF;
constexpr uint32_t e_axis = gray_color_2;
constexpr uint32_t feedrate = gray_color_2;
constexpr uint32_t other = gray_color_2;
// Status screen
constexpr uint32_t progress = theme_dark;
constexpr uint32_t status_msg = theme_dark;
constexpr uint32_t fan_speed = COLOR_CORRECTION(0x3771CB);
constexpr uint32_t temp = COLOR_CORRECTION(0x892ca0);
constexpr uint32_t axis_label = theme_dark;
constexpr uint32_t progress = gray_color_2;
constexpr uint32_t status_msg = gray_color_2;
constexpr uint32_t fan_speed = 0x377198;
constexpr uint32_t temp = 0x892c78;
constexpr uint32_t axis_label = gray_color_2;
constexpr uint32_t disabled_icon = 0x101010;
constexpr uint32_t disabled_icon = gray_color_1;
// Calibration Registers Screen
constexpr uint32_t transformA = 0x3010D0;
@ -105,7 +127,7 @@ namespace Theme {
constexpr btn_colors normal_btn = {.bg = fg_action, .grad = 0xFFFFFF, .fg = fg_normal, .rgb = 0xFFFFFF };
constexpr btn_colors action_btn = {.bg = bg_color, .grad = 0xFFFFFF, .fg = fg_action, .rgb = 0xFFFFFF };
constexpr btn_colors red_btn = {.bg = 0xFF5555, .grad = 0xFFFFFF, .fg = 0xFF0000, .rgb = 0xFFFFFF };
constexpr btn_colors ui_slider = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = lulzbot_green };
constexpr btn_colors ui_slider = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = accent_color_3 };
constexpr btn_colors ui_toggle = {.bg = theme_darkest, .grad = 0xFFFFFF, .fg = theme_dark, .rgb = 0xFFFFFF };
// Temperature color scale

@ -28,6 +28,7 @@
// All displays share the MarlinUI class
#if HAS_DISPLAY
#include "../gcode/queue.h"
#include "ultralcd.h"
#include "fontutils.h"
MarlinUI ui;
@ -93,7 +94,6 @@
#include "../module/planner.h"
#include "../module/printcounter.h"
#include "../module/motion.h"
#include "../gcode/queue.h"
#include "../Marlin.h"

@ -476,12 +476,16 @@ class Temperature {
#if ENABLED(ADAPTIVE_FAN_SLOWING)
static uint8_t fan_speed_scaler[FAN_COUNT];
#else
static constexpr uint8_t fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
#endif
static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
return (fs * uint16_t(fan_speed_scaler[target])) >> 7;
return (fs * uint16_t(
#if ENABLED(ADAPTIVE_FAN_SLOWING)
fan_speed_scaler[target]
#else
128
#endif
)) >> 7;
}
static inline uint8_t scaledFanSpeed(const uint8_t target) {

@ -357,10 +357,6 @@ void CardReader::mount() {
flag.mounted = false;
if (root.isOpen()) root.close();
#ifndef SPI_SPEED
#define SPI_SPEED SPI_FULL_SPEED
#endif
if (!sd2card.init(SPI_SPEED, SDSS)
#if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
&& !sd2card.init(SPI_SPEED, LCD_SDSS)

@ -38,14 +38,15 @@ exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), EXTENSIBLE_UI, S-Curve, many
restore_configs
opt_set MOTHERBOARD BOARD_RADDS
opt_enable USE_XMAX_PLUG USE_YMAX_PLUG BLTOUCH AUTO_BED_LEVELING_BILINEAR \
Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN ENDSTOPPULLUPS
Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN ENDSTOPPULLUPS \
LULZBOT_TOUCH_UI LCD_ALEPHOBJECTS_CLCD_UI OTHER_PIN_LAYOUT
opt_add Z2_MAX_ENDSTOP_INVERTING false
opt_add Z3_MAX_ENDSTOP_INVERTING false
pins_set ramps/RAMPS X_MAX_PIN -1
pins_set ramps/RAMPS Y_MAX_PIN -1
opt_add Z2_MAX_PIN 2
opt_add Z3_MAX_PIN 3
exec_test $1 $2 "RADDS with ABL (Bilinear), Z_TRIPLE_STEPPER_DRIVERS and Z_STEPPER_AUTO_ALIGN"
exec_test $1 $2 "RADDS with Lulzbot Touch UI, Bilinear ABL, Triple-Z and Z Auto-align."
#
# Test SWITCHING_EXTRUDER

Loading…
Cancel
Save