Browse Source

Fix Menu Mixer for Color UI (#20566)

vanilla_fb_2.0.x
Victor Oliveira 4 years ago
committed by Scott Lahteine
parent
commit
427a2fca4d
  1. 9
      Marlin/src/lcd/menu/menu_mixer.cpp
  2. 1
      Marlin/src/lcd/tft/tft.h
  3. 21
      Marlin/src/lcd/tft/ui_320x240.cpp
  4. 21
      Marlin/src/lcd/tft/ui_480x320.cpp

9
Marlin/src/lcd/menu/menu_mixer.cpp

@ -33,6 +33,10 @@
#include "../../feature/mixing.h" #include "../../feature/mixing.h"
#if HAS_GRAPHICAL_TFT
#include "../tft/tft.h"
#endif
#define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING #define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING
#if ENABLED(GRADIENT_MIX) #if ENABLED(GRADIENT_MIX)
@ -67,6 +71,9 @@
mixer.refresh_gradient(); mixer.refresh_gradient();
ui.goto_previous_screen(); ui.goto_previous_screen();
} }
else {
TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
}
} }
void lcd_mixer_edit_gradient_menu() { void lcd_mixer_edit_gradient_menu() {
@ -155,6 +162,8 @@ void lcd_mixer_mix_edit() {
ui.goto_previous_screen(); ui.goto_previous_screen();
} }
TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
#else #else
START_MENU(); START_MENU();

1
Marlin/src/lcd/tft/tft.h

@ -93,6 +93,7 @@ class TFT {
static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); } static inline void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); }
static inline void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); } static inline void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
static inline void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); } static inline void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
static void draw_edit_screen_buttons();
}; };
extern TFT tft; extern TFT tft;

21
Marlin/src/lcd/tft/ui_320x240.cpp

@ -442,6 +442,10 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
#endif #endif
} }
tft.draw_edit_screen_buttons();
}
void TFT::draw_edit_screen_buttons() {
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
add_control(32, 176, DECREASE, imgDecrease); add_control(32, 176, DECREASE, imgDecrease);
add_control(224, 176, INCREASE, imgIncrease); add_control(224, 176, INCREASE, imgIncrease);
@ -658,6 +662,23 @@ void menu_item(const uint8_t row, bool sel ) {
#endif #endif
} }
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
#define TFT_COL_WIDTH ((TFT_WIDTH) / (LCD_WIDTH))
tft.canvas(col * TFT_COL_WIDTH, 4 + 45 * row, TFT_WIDTH - (col * TFT_COL_WIDTH), 43);
tft.set_background(COLOR_BACKGROUND);
}
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
tft_string.set(utf8_str_P);
tft_string.trim();
tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
return tft_string.width();
}
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
return lcd_put_u8str_max_P(utf8_str, max_length);
}
void MarlinUI::move_axis_screen() { void MarlinUI::move_axis_screen() {
} }

21
Marlin/src/lcd/tft/ui_480x320.cpp

@ -445,6 +445,10 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
#endif #endif
} }
tft.draw_edit_screen_buttons();
}
void TFT::draw_edit_screen_buttons() {
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
add_control(64, 256, DECREASE, imgDecrease); add_control(64, 256, DECREASE, imgDecrease);
add_control(352, 256, INCREASE, imgIncrease); add_control(352, 256, INCREASE, imgIncrease);
@ -661,6 +665,23 @@ void menu_item(const uint8_t row, bool sel ) {
#endif #endif
} }
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
#define TFT_COL_WIDTH ((TFT_WIDTH) / (LCD_WIDTH))
tft.canvas(col * TFT_COL_WIDTH, 4 + 45 * row, TFT_WIDTH - (col * TFT_COL_WIDTH), 43);
tft.set_background(COLOR_BACKGROUND);
}
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
tft_string.set(utf8_str_P);
tft_string.trim();
tft.add_text(MENU_TEXT_X_OFFSET, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
return tft_string.width();
}
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
return lcd_put_u8str_max_P(utf8_str, max_length);
}
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
#include "../../feature/babystep.h" #include "../../feature/babystep.h"
#endif #endif

Loading…
Cancel
Save