Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Menu Mixer for Color UI #20566

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Marlin/src/lcd/menu/menu_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

#include "../../feature/mixing.h"

#if HAS_GRAPHICAL_TFT
#include "../tft/tft.h"
#endif

#define CHANNEL_MIX_EDITING !HAS_DUAL_MIXING

#if ENABLED(GRADIENT_MIX)
Expand Down Expand Up @@ -67,6 +71,9 @@
mixer.refresh_gradient();
ui.goto_previous_screen();
}
else {
TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());
}
}

void lcd_mixer_edit_gradient_menu() {
Expand Down Expand Up @@ -155,6 +162,8 @@ void lcd_mixer_mix_edit() {
ui.goto_previous_screen();
}

TERN_(HAS_GRAPHICAL_TFT, tft.draw_edit_screen_buttons());

#else

START_MENU();
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/lcd/tft/tft.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_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 void draw_edit_screen_buttons();
};

extern TFT tft;
21 changes: 21 additions & 0 deletions Marlin/src/lcd/tft/ui_320x240.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
#endif
}

tft.draw_edit_screen_buttons();
}

void TFT::draw_edit_screen_buttons() {
#if ENABLED(TOUCH_SCREEN)
add_control(32, 176, DECREASE, imgDecrease);
add_control(224, 176, INCREASE, imgIncrease);
Expand Down Expand Up @@ -648,6 +652,23 @@ void menu_item(const uint8_t row, bool sel ) {
#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() {
}

Expand Down
21 changes: 21 additions & 0 deletions Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
#endif
}

tft.draw_edit_screen_buttons();
}

void TFT::draw_edit_screen_buttons() {
#if ENABLED(TOUCH_SCREEN)
add_control(64, 256, DECREASE, imgDecrease);
add_control(352, 256, INCREASE, imgIncrease);
Expand Down Expand Up @@ -655,6 +659,23 @@ void menu_item(const uint8_t row, bool sel ) {
#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)
#include "../../feature/babystep.h"
#endif
Expand Down