Skip to content

Commit

Permalink
🚸 Fix / improve Marlin UI and Color UI
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 30, 2024
1 parent 21fddc1 commit 68a2459
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void menu_info_board() {
START_SCREEN();
STATIC_ITEM_F(F(BOARD_INFO_NAME), SS_DEFAULT|SS_INVERT); // MyPrinterController
#ifdef BOARD_WEBSITE_URL
STATIC_ITEM_F(F(BOARD_WEBSITE_URL), SS_LEFT); // www.my3dprinter.com
STATIC_ITEM_F(F(BOARD_WEBSITE_URL), SS_CENTER); // www.my3dprinter.com
#endif
PSTRING_ITEM(MSG_INFO_BAUDRATE, STRINGIFY(BAUDRATE), SS_CENTER); // Baud: 250000
PSTRING_ITEM(MSG_INFO_PROTOCOL, PROTOCOL_VERSION, SS_CENTER); // Protocol: 1.0
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class MenuItem_bool : public MenuEditItemBase {
* MenuItem_<type>::action(arg3...)
*
* Examples:
* BACK_ITEM(MSG_INFO_SCREEN)
* BACK_ITEM(MSG_PREV_SCREEN)
* MenuItem_back::action(flabel, ...)
* MenuItem_back::draw(sel, row, flabel, ...)
*
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_media.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MenuItem_sdfolder : public MenuItem_sdbase {
static void action(FSTR_P const, CardReader &theCard) {
card.cd(theCard.filename);
encoderTopLine = 0;
ui.encoderPosition = 2 * (ENCODER_STEPS_PER_MENU_ITEM);
ui.encoderPosition = (card.get_num_items() ? 2 : 1) * (ENCODER_STEPS_PER_MENU_ITEM);
ui.screen_changed = true;
TERN_(HAS_MARLINUI_U8GLIB, ui.drawing_screen = false);
ui.refresh();
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ void menu_move() {
#endif

START_MENU();
BACK_ITEM(MSG_TUNE);

#if HAS_X_AXIS
SUBMENU_N(X_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_shaper_x);
Expand Down
68 changes: 34 additions & 34 deletions Marlin/src/lcd/tft/tft_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,40 @@
const tImage NoLogo = { nullptr, 0, 0, NOCOLORS };

const tImage images[imgCount] = {
TERN(SHOW_BOOTSCREEN, BOOTSCREEN_LOGO, NoLogo),
HotEnd_64x64x4,
Bed_64x64x4,
Bed_Heated_64x64x4,
Chamber_64x64x4,
Chamber_Heated_64x64x4,
Fan0_64x64x4,
Fan_Slow0_64x64x4,
Fan_Slow1_64x64x4,
Fan_Fast0_64x64x4,
Fan_Fast1_64x64x4,
Feedrate_32x32x4,
Flowrate_32x32x4,
SD_64x64x4,
Menu_64x64x4,
Settings_64x64x4,
Directory_32x32x4,
Confirm_64x64x4,
Cancel_64x64x4,
Increase_64x64x4,
Decrease_64x64x4,
Back_32x32x4,
Up_32x32x4,
Down_32x32x4,
Left_32x32x4,
Right_32x32x4,
Refresh_32x32x4,
Leveling_32x32x4,
Slider8x16x4,
Home_64x64x4,
BtnRounded_64x52x4,
BtnRounded_42x39x4,
Time_Elapsed_32x32x4,
Time_Remaining_32x32x4,
TERN(SHOW_BOOTSCREEN, BOOTSCREEN_LOGO, NoLogo), // imgBootScreen
HotEnd_64x64x4, // imgHotEnd
Bed_64x64x4, // imgBed
Bed_Heated_64x64x4, // imgBedHeated
Chamber_64x64x4, // imgChamber
Chamber_Heated_64x64x4, // imgChamberHeated
Fan0_64x64x4, // imgFanIdle
Fan_Slow0_64x64x4, // imgFanSlow0
Fan_Slow1_64x64x4, // imgFanSlow1
Fan_Fast0_64x64x4, // imgFanFast0
Fan_Fast1_64x64x4, // imgFanFast1
Feedrate_32x32x4, // imgFeedRate
Flowrate_32x32x4, // imgFlowRate
SD_64x64x4, // imgSD
Menu_64x64x4, // imgMenu
Settings_64x64x4, // imgSettings
Directory_32x32x4, // imgDirectory
Confirm_64x64x4, // imgConfirm
Cancel_64x64x4, // imgCancel
Increase_64x64x4, // imgIncrease
Decrease_64x64x4, // imgDecrease
Back_32x32x4, // imgBack
Up_32x32x4, // imgUp
Down_32x32x4, // imgDown
Left_32x32x4, // imgLeft
Right_32x32x4, // imgRight
Refresh_32x32x4, // imgRefresh
Leveling_32x32x4, // imgLeveling
Slider8x16x4, // imgSlider
Home_64x64x4, // imgHome
BtnRounded_64x52x4, // imgBtn52Rounded
BtnRounded_42x39x4, // imgBtn39Rounded
Time_Elapsed_32x32x4, // imgTimeElapsed
Time_Remaining_32x32x4, // imgTimeRemaining
};

#endif // HAS_GRAPHICAL_TFT
68 changes: 34 additions & 34 deletions Marlin/src/lcd/tft/tft_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,40 @@
#endif

enum MarlinImage : uint8_t {
imgBootScreen = 0x00,
imgHotEnd,
imgBed,
imgBedHeated,
imgChamber,
imgChamberHeated,
imgFanIdle,
imgFanSlow0,
imgFanSlow1,
imgFanFast0,
imgFanFast1,
imgFeedRate,
imgFlowRate,
imgSD,
imgMenu,
imgSettings,
imgDirectory,
imgConfirm,
imgCancel,
imgIncrease,
imgDecrease,
imgBack,
imgUp,
imgDown,
imgLeft,
imgRight,
imgRefresh,
imgLeveling,
imgSlider,
imgHome,
imgBtn52Rounded,
imgBtn39Rounded,
imgTimeElapsed,
imgTimeRemaining,
imgBootScreen = 0x00, // BOOTSCREEN_LOGO / NoLogo
imgHotEnd, // HotEnd_64x64x4
imgBed, // Bed_64x64x4
imgBedHeated, // Bed_Heated_64x64x4
imgChamber, // Chamber_64x64x4
imgChamberHeated, // Chamber_Heated_64x64x4
imgFanIdle, // Fan0_64x64x4
imgFanSlow0, // Fan_Slow0_64x64x4
imgFanSlow1, // Fan_Slow1_64x64x4
imgFanFast0, // Fan_Fast0_64x64x4
imgFanFast1, // Fan_Fast1_64x64x4
imgFeedRate, // Feedrate_32x32x4
imgFlowRate, // Flowrate_32x32x4
imgSD, // SD_64x64x4
imgMenu, // Menu_64x64x4
imgSettings, // Settings_64x64x4
imgDirectory, // Directory_32x32x4
imgConfirm, // Confirm_64x64x4
imgCancel, // Cancel_64x64x4
imgIncrease, // Increase_64x64x4
imgDecrease, // Decrease_64x64x4
imgBack, // Back_32x32x4
imgUp, // Up_32x32x4
imgDown, // Down_32x32x4
imgLeft, // Left_32x32x4
imgRight, // Right_32x32x4
imgRefresh, // Refresh_32x32x4
imgLeveling, // Leveling_32x32x4
imgSlider, // Slider8x16x4
imgHome, // Home_64x64x4
imgBtn52Rounded, // BtnRounded_64x52x4
imgBtn39Rounded, // BtnRounded_42x39x4
imgTimeElapsed, // Time_Elapsed_32x32x4
imgTimeRemaining, // Time_Remaining_32x32x4
// Special values - must be at the end!
imgCount,
noImage = imgCount,
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/tft/themes/theme_ANET_BLACK.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
#define COLOR_SD_ENABLED COLOR_CONTROL_ENABLED
#define COLOR_SD_DISABLED COLOR_CONTROL_DISABLED
#define COLOR_MENU_TEXT COLOR_WHITE
#define COLOR_MENU_STATIC_TEXT COLOR_WHITE
#define COLOR_MENU_BACK_TEXT COLOR_YELLOW
#define COLOR_MENU_VALUE_FONT COLOR_ORANGE2
#define COLOR_SLIDER COLOR_ORANGE2
#define COLOR_INCREASE COLOR_WHITE
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/lcd/tft/themes/theme_BLUE_MARLIN.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
#ifndef COLOR_MENU_TEXT
#define COLOR_MENU_TEXT COLOR_YELLOW
#endif
#ifndef COLOR_MENU_TEXT
#define COLOR_MENU_STATIC_TEXT COLOR_SILVER
#endif
#ifndef COLOR_MENU_BACK_TEXT
#define COLOR_MENU_BACK_TEXT COLOR_CYAN
#endif
#ifndef COLOR_MENU_VALUE
#define COLOR_MENU_VALUE COLOR_WHITE
#endif
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/lcd/tft/themes/theme_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@
#ifndef COLOR_MENU_TEXT
#define COLOR_MENU_TEXT COLOR_YELLOW
#endif
#ifndef COLOR_MENU_STATIC_TEXT
#define COLOR_MENU_STATIC_TEXT COLOR_SILVER
#endif
#ifndef COLOR_MENU_BACK_TEXT
#define COLOR_MENU_BACK_TEXT COLOR_WHITE
#endif
#ifndef COLOR_MENU_VALUE
#define COLOR_MENU_VALUE COLOR_WHITE
#endif
Expand Down
12 changes: 10 additions & 2 deletions Marlin/src/lcd/tft/ui_1024x600.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@

// -------------------------------- Core Parameters --------------------------------

#define MENU_TEXT_X 16
#define MENU_TEXT_X (5 + 32 + 5 + 6)
#define MENU_TEXT_Y tft_string.vcenter(MENU_ITEM_HEIGHT)

#define MENU_ITEM_ICON_X 5
#define MENU_ITEM_ICON_Y 5
#define MENU_ITEM_ICON_SPACE 42
#define MENU_ITEM_ICON_SPACE (5 + 32 + 5)

#ifndef MENU_ITEM_SUBMENU_ICON_X
#define MENU_ITEM_SUBMENU_ICON_X (TFT_WIDTH - 32 - 32)
#endif

#ifndef MENU_ITEM_BACK_LINE_SHIFT
#define MENU_ITEM_BACK_LINE_SHIFT -32
#endif

#define MENU_ITEM_HEIGHT 43
#define MENU_LINE_HEIGHT (MENU_ITEM_HEIGHT + 2)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_320x480.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define MENU_ITEM_ICON_X 5
#define MENU_ITEM_ICON_Y 5
#define MENU_ITEM_ICON_SPACE 42
#define MENU_ITEM_ICON_SPACE (5 + 32 + 5)

#define MENU_ITEM_HEIGHT 43
#define MENU_LINE_HEIGHT (MENU_ITEM_HEIGHT + 2)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_480x272.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define MENU_ITEM_ICON_X 5
#define MENU_ITEM_ICON_Y 5
#define MENU_ITEM_ICON_SPACE 42
#define MENU_ITEM_ICON_SPACE (5 + 32 + 5)

#define MENU_ITEM_HEIGHT 36
#define MENU_LINE_HEIGHT (MENU_ITEM_HEIGHT + 2)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft/ui_480x320.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#define MENU_ITEM_ICON_X 5
#define MENU_ITEM_ICON_Y 5
#define MENU_ITEM_ICON_SPACE 42
#define MENU_ITEM_ICON_SPACE (5 + 32 + 5)

#define MENU_ITEM_HEIGHT 43
#define MENU_LINE_HEIGHT (MENU_ITEM_HEIGHT + 2)
Expand Down
Loading

0 comments on commit 68a2459

Please sign in to comment.