Browse Source

Improvements and fixes to Lulzbot UI (#15490)

Marcio Teixeira 5 years ago
parent
commit
dc14d4a13c

+ 4 - 0
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

+ 1 - 1
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
             ) {

+ 3 - 1
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

+ 40 - 0
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 {

+ 5 - 0
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

+ 5 - 2
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

+ 2 - 1
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) {

+ 2 - 1
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);
   }
 }

+ 14 - 9
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);

+ 8 - 7
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))

Some files were not shown because too many files changed in this diff