From dc14d4a13c1eb80a76237ebcab6d8a512d960391 Mon Sep 17 00:00:00 2001
From: Marcio Teixeira <marcio@alephobjects.com>
Date: Wed, 9 Oct 2019 18:44:49 -0600
Subject: [PATCH] Improvements and fixes to Lulzbot UI (#15490)

---
 Marlin/src/inc/Conditionals_LCD.h             |   4 +
 Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp   |   2 +-
 .../ftdi_eve_lib/extended/command_processor.h |   4 +-
 .../lib/lulzbot/ftdi_eve_lib/extended/rgb_t.h |  40 +++++
 .../lib/lulzbot/marlin_events.cpp             |   5 +
 .../base_numeric_adjustment_screen.cpp        |   7 +-
 .../lib/lulzbot/screens/bio_main_menu.cpp     |   3 +-
 .../screens/bio_printing_dialog_box.cpp       |   3 +-
 .../lib/lulzbot/screens/bio_status_screen.cpp |  23 +--
 .../lib/lulzbot/screens/bio_tune_menu.cpp     |  15 +-
 .../lib/lulzbot/screens/boot_screen.cpp       |   7 +-
 .../lib/lulzbot/screens/filament_menu.cpp     |   5 +-
 .../screens/junction_deviation_screen.cpp     |   2 +-
 .../lib/lulzbot/screens/lock_screen.cpp       |  14 +-
 .../lib/lulzbot/screens/tune_menu.cpp         |   3 +-
 .../extensible_ui/lib/lulzbot/theme/colors.h  | 144 ++++++++++--------
 Marlin/src/lcd/ultralcd.cpp                   |   2 +-
 Marlin/src/module/temperature.h               |  10 +-
 Marlin/src/sd/cardreader.cpp                  |   4 -
 buildroot/share/tests/DUE-tests               |   5 +-
 20 files changed, 194 insertions(+), 108 deletions(-)

diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h
index 70526de342..cd994e2293 100644
--- a/Marlin/src/inc/Conditionals_LCD.h
+++ b/Marlin/src/inc/Conditionals_LCD.h
@@ -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
diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
index 819a5c5bc6..9f34946137 100644
--- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
+++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
@@ -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
             ) {
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/command_processor.h b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/command_processor.h
index a770ebbd24..a6c1f5c918 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/command_processor.h
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/command_processor.h
@@ -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;
-      const bool is_utf8 = has_utf8_chars(text);
+      #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
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/rgb_t.h b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/rgb_t.h
index 07ee957f48..e31c69e605 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/rgb_t.h
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/rgb_t.h
@@ -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 {
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/marlin_events.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/marlin_events.cpp
index 4318ae0a04..38d7c7985f 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/marlin_events.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/marlin_events.cpp
@@ -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
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/base_numeric_adjustment_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/base_numeric_adjustment_screen.cpp
index 1c111b8ab5..c8c500669b 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/base_numeric_adjustment_screen.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/base_numeric_adjustment_screen.cpp
@@ -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
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_main_menu.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_main_menu.cpp
index 222a6d9ff9..448cc29207 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_main_menu.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_main_menu.cpp
@@ -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) {
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_printing_dialog_box.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_printing_dialog_box.cpp
index bcf9fb8550..04d52498af 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_printing_dialog_box.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_printing_dialog_box.cpp
@@ -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);
   }
 }
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp
index 8baa9b580b..cd709a2dc6 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_status_screen.cpp
@@ -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));
-      ui.bounds(POLY(target_temp), x, y, h, v);
-      cmd.text(x, y, h, v, bed_str);
-    }
+    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);
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_tune_menu.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_tune_menu.cpp
index c1f842c5d0..4fa88253c8 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_tune_menu.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/bio_tune_menu.cpp
@@ -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))
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/boot_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/boot_screen.cpp
index 309e46fa0b..117d426999 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/boot_screen.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/boot_screen.cpp
@@ -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));
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/filament_menu.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/filament_menu.cpp
index baaaa9037a..a7fe2bff55 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/filament_menu.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/filament_menu.cpp
@@ -34,12 +34,13 @@ 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) {
     CommandProcessor cmd;
-      cmd.font(font_large)
+    cmd.font(font_large)
     #ifdef TOUCH_UI_PORTRAIT
       #define GRID_ROWS 9
       #define GRID_COLS 2
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/junction_deviation_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/junction_deviation_screen.cpp
index 57c5c8439c..617cdd2510 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/junction_deviation_screen.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/junction_deviation_screen.cpp
@@ -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();
 }
 
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/lock_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/lock_screen.cpp
index 54060d9f56..13b42b8cee 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/lock_screen.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/lock_screen.cpp
@@ -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,29 +89,28 @@ 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
+    #ifdef TOUCH_UI_PORTRAIT
        .text(BTN_POS(1,2), BTN_SIZE(1,1), message)
        .font(font_xlarge)
        .text(BTN_POS(1,4), BTN_SIZE(1,1), screen_data.LockScreen.passcode)
-       #else
+    #else
        .text(BTN_POS(1,1), BTN_SIZE(1,1), message)
        .font(font_xlarge)
        .text(BTN_POS(1,2), BTN_SIZE(1,1), screen_data.LockScreen.passcode)
-       #endif
+    #endif
        .font(font_large)
        .colors(normal_btn)
-       #ifdef TOUCH_UI_PASSCODE
+    #ifdef TOUCH_UI_PASSCODE
        .keys(BTN_POS(1,l+1), BTN_SIZE(1,1), F("123"),        pressed)
        .keys(BTN_POS(1,l+2), BTN_SIZE(1,1), F("456"),        pressed)
        .keys(BTN_POS(1,l+3), BTN_SIZE(1,1), F("789"),        pressed)
        .keys(BTN_POS(1,l+4), BTN_SIZE(1,1), F("0.<"),        pressed);
-       #else
+    #else
        .keys(BTN_POS(1,l+1), BTN_SIZE(1,1), F("1234567890"), pressed)
        .keys(BTN_POS(1,l+2), BTN_SIZE(1,1), F("qwertyuiop"), pressed)
        .keys(BTN_POS(1,l+3), BTN_SIZE(1,1), F("asdfghjkl "), pressed)
        .keys(BTN_POS(1,l+4), BTN_SIZE(1,1), F("zxcvbnm!?<"), pressed);
-       #endif
+    #endif
 
     #undef MARGIN_T
     #undef MARGIN_B
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/tune_menu.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/tune_menu.cpp
index a9e1b6dc04..6cb8a27ba0 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/tune_menu.cpp
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/tune_menu.cpp
@@ -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
diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/theme/colors.h b/Marlin/src/lcd/extensible_ui/lib/lulzbot/theme/colors.h
index 1dae8de4b2..055719d99b 100644
--- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/theme/colors.h
+++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/theme/colors.h
@@ -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,64 +76,59 @@ 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;
-  constexpr uint32_t transformB    = 0x4010D0;
-  constexpr uint32_t transformC    = 0x5010D0;
-  constexpr uint32_t transformD    = 0x6010D0;
-  constexpr uint32_t transformE    = 0x7010D0;
-  constexpr uint32_t transformF    = 0x8010D0;
-  constexpr uint32_t transformVal  = 0x104010;
-
-  constexpr btn_colors disabled_btn = {.bg = bg_color,      .grad = fg_disabled, .fg = fg_disabled,  .rgb = fg_disabled };
-  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_toggle    = {.bg = theme_darkest, .grad = 0xFFFFFF,    .fg = theme_dark,   .rgb = 0xFFFFFF };
+  constexpr uint32_t transformA         = 0x3010D0;
+  constexpr uint32_t transformB         = 0x4010D0;
+  constexpr uint32_t transformC         = 0x5010D0;
+  constexpr uint32_t transformD         = 0x6010D0;
+  constexpr uint32_t transformE         = 0x7010D0;
+  constexpr uint32_t transformF         = 0x8010D0;
+  constexpr uint32_t transformVal       = 0x104010;
+
+  constexpr btn_colors disabled_btn     = {.bg = bg_color,      .grad = fg_disabled, .fg = fg_disabled,  .rgb = fg_disabled };
+  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 = accent_color_3 };
+  constexpr btn_colors ui_toggle        = {.bg = theme_darkest, .grad = 0xFFFFFF,    .fg = theme_dark,   .rgb = 0xFFFFFF };
 
   // Temperature color scale
 
diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp
index 9ad92add0d..cb5d8ad8fd 100644
--- a/Marlin/src/lcd/ultralcd.cpp
+++ b/Marlin/src/lcd/ultralcd.cpp
@@ -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"
 
diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h
index 052ac156d6..c294325d9b 100644
--- a/Marlin/src/module/temperature.h
+++ b/Marlin/src/module/temperature.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) {
diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp
index 15ed4bda58..69d63dff1c 100644
--- a/Marlin/src/sd/cardreader.cpp
+++ b/Marlin/src/sd/cardreader.cpp
@@ -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)
diff --git a/buildroot/share/tests/DUE-tests b/buildroot/share/tests/DUE-tests
index ac5c7058ef..844c1054af 100755
--- a/buildroot/share/tests/DUE-tests
+++ b/buildroot/share/tests/DUE-tests
@@ -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
-- 
GitLab