Fix Menu Mixer for Color UI (#20566)

This commit is contained in:
Victor Oliveira 2020-12-28 02:11:36 -03:00 committed by GitHub
parent 2ce9fa4b9c
commit 185e31d322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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() {
} }

View File

@ -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