Skip to content

Commit

Permalink
Implement Vertical GUI (Portrait Mode) (#2273)
Browse files Browse the repository at this point in the history
  • Loading branch information
radry authored Dec 14, 2021
1 parent 1d65920 commit aaf5def
Show file tree
Hide file tree
Showing 21 changed files with 758 additions and 107 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/buildBinary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
run: platformio run --environment BIGTREE_TFT28_V3_0
- name: Build TFT24 V1.1
run: platformio run --environment BIGTREE_TFT24_V1_1
- name: Build TFT24 V1.1 P
run: platformio run --environment BIGTREE_TFT24_V1_1_P
- name: Build GD_TFT24 V1.1
run: platformio run --environment BIGTREE_GD_TFT24_V1_1
- name: Build MKS TFT32 V1.3
Expand Down Expand Up @@ -84,4 +86,4 @@ jobs:
uses: actions-x/commit@v2
with:
message: Update prebuilt binaries and config
token: ${{ secrets.MY_SECRET_TOKEN }}
token: ${{ secrets.MY_SECRET_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/buildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
run: platformio run --environment BIGTREE_TFT28_V3_0
- name: Build TFT24 V1.1
run: platformio run --environment BIGTREE_TFT24_V1_1
- name: Build TFT24 V1.1
run: platformio run --environment BIGTREE_TFT24_V1_1
- name: Build TFT24 V1.1 P
run: platformio run --environment BIGTREE_TFT24_V1_1_P
- name: Build MKS TFT32 V1.3
run: platformio run --environment MKS_TFT32_V1_3
- name: Build MKS TFT32 V1.4
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/FlashStore.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void readStoredPara(void)
else
{
memcpy(&infoSettings, data + (index += 4), sizeof(SETTINGS));
if ((paraStatus & PARA_TSC_EXIST) == 0) infoSettings.rotated_ui = DISABLED;
// if ((paraStatus & PARA_TSC_EXIST) == 0) infoSettings.rotated_ui = DISABLED; // Unecessarily rotates UI to Default??
}
}

Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/API/HW_Init.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void HW_Init(void)

if (readIsTSCExist() == false) // read settings parameter
{
LCD_RefreshDirection(infoSettings.rotated_ui);
TSC_Calibration();
storePara();
}
Expand Down
6 changes: 5 additions & 1 deletion TFT/src/User/API/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ void initSettings(void)
(FILE_COMMENT_PARSING << INDEX_FILE_COMMENT_PARSING));

// UI Settings
infoSettings.rotated_ui = ROTATED_UI;
#ifdef PORTRAIT
infoSettings.rotated_ui = 3;
#else
infoSettings.rotated_ui = ROTATED_UI;
#endif
infoSettings.language = LANGUAGE;
infoSettings.status_screen = STATUS_SCREEN;
infoSettings.title_bg_color = lcd_colors[TITLE_BACKGROUND_COLOR];
Expand Down
16 changes: 13 additions & 3 deletions TFT/src/User/API/UI/ui_draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ extern "C" {
#include "variants.h"
#include "GUI.h"

#define SPACE_X ((LCD_WIDTH - ICON_WIDTH * 4) / 4)
#ifdef PORTRAIT
#define SPACE_X ((LCD_WIDTH - ICON_WIDTH * 3) / 3)
#define SPACE_X_PER_ICON (LCD_WIDTH / 3)
#else
#define SPACE_X ((LCD_WIDTH - ICON_WIDTH * 4) / 4)
#define SPACE_X_PER_ICON (LCD_WIDTH / 4)
#endif
#define START_X (SPACE_X / 2)
#define SPACE_X_PER_ICON (LCD_WIDTH / 4)

#define SPACE_Y ((LCD_HEIGHT - ICON_START_Y - ICON_HEIGHT * 2) / 2)

#ifdef PORTRAIT
#define SPACE_Y ((LCD_HEIGHT - ICON_START_Y - ICON_HEIGHT * 3) / 3)
#else
#define SPACE_Y ((LCD_HEIGHT - ICON_START_Y - ICON_HEIGHT * 2) / 2)
#endif

// select marlin or bigtree
#define SPACE_SELEX ((LCD_WIDTH - ICON_WIDTH * 2) / 4)
Expand Down
10 changes: 5 additions & 5 deletions TFT/src/User/API/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,11 @@ void parseConfigKey(uint16_t index)
//----------------------------UI Settings

case C_INDEX_ROTATED_UI:
if (infoSettings.rotated_ui != getOnOff())
{
scheduleRotate = true;
infoSettings.rotated_ui = getOnOff();
}
#ifdef PORTRAIT
SET_VALID_INT_VALUE(infoSettings.rotated_ui, 2, 3);
#else
SET_VALID_INT_VALUE(infoSettings.rotated_ui, 0, 1);
#endif
break;

case C_INDEX_LANGUAGE:
Expand Down
375 changes: 328 additions & 47 deletions TFT/src/User/API/menu.c

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions TFT/src/User/API/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ extern "C" {

#define CENTER_Y ((exhibitRect.y1 - exhibitRect.y0) / 2 + exhibitRect.y0)
#define CENTER_X ((exhibitRect.x1 - exhibitRect.x0 - BYTE_WIDTH) / 2 + exhibitRect.x0)
#define LISTITEM_WIDTH (LCD_WIDTH - (3 * START_X) - LIST_ICON_WIDTH)
#define LISTITEM_HEIGHT ((LCD_HEIGHT - ICON_START_Y - START_X) / 5)
#ifdef PORTRAIT
#define LISTITEM_WIDTH (LCD_WIDTH - (3 * START_X))
#define LISTITEM_HEIGHT ((LCD_HEIGHT - ICON_START_Y - START_X) / 6)
#else
#define LISTITEM_WIDTH (LCD_WIDTH - (3 * START_X) - LIST_ICON_WIDTH)
#define LISTITEM_HEIGHT ((LCD_HEIGHT - ICON_START_Y - START_X) / 5)
#endif
#define LISTICON_SPACE_Y ((LCD_HEIGHT - ICON_START_Y - START_X - (3 * LIST_ICON_HEIGHT)) / 2)

typedef enum
Expand Down Expand Up @@ -166,6 +171,7 @@ extern const GUI_RECT rect_of_key[MENU_RECT_COUNT];
extern const GUI_RECT rect_of_keySS[SS_RECT_COUNT];
extern const GUI_RECT rect_of_keyPS[];
extern const GUI_RECT rect_of_keyPS_end[];
extern const GUI_RECT rect_of_keyPS_draw[]; // Used to draw VERTICAL GUI printing menu

extern const GUI_RECT rect_of_titleBar[1];

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Hal/HD44780.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void HD44780_Config(CIRCULAR_QUEUE *queue)
NVIC_InitTypeDef NVIC_InitStructure;

// Connect GPIOB15 to the interrupt line
#if !defined(TFT24_V1_1)
#if !defined(TFT24_V1_1) && !defined(TFT24_V1_1_P)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Enable SYSCFG clock
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource15); // PB15 is connected to interrupt line 15
#else
Expand Down
18 changes: 17 additions & 1 deletion TFT/src/User/Hal/LCD_Driver/ILI9341.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,23 @@
void ILI9341_SetDirection(uint8_t rotate)
{
LCD_WR_REG(0X36);
LCD_WR_DATA(rotate ? ILI9341_180_DEGREE_REG_VALUE : ILI9341_0_DEGREE_REG_VALUE);
switch (rotate)
{
case 0:
LCD_WR_DATA(ILI9341_180_DEGREE_REG_VALUE);
break;
case 1:
LCD_WR_DATA(ILI9341_0_DEGREE_REG_VALUE);
break;
case 2:
LCD_WR_DATA(ILI9341_90_DEGREE_REG_VALUE);
break;
case 3:
LCD_WR_DATA(ILI9341_270_DEGREE_REG_VALUE);
break;
default:
LCD_WR_DATA(ILI9341_180_DEGREE_REG_VALUE);
}
}

void ILI9341_SetWindow(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey)
Expand Down
2 changes: 2 additions & 0 deletions TFT/src/User/Hal/LCD_Driver/ILI9341.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ extern "C" {

#define ILI9341_0_DEGREE_REG_VALUE 0X68
#define ILI9341_180_DEGREE_REG_VALUE 0XA8
#define ILI9341_90_DEGREE_REG_VALUE 0XC8
#define ILI9341_270_DEGREE_REG_VALUE 0X8

uint8_t LCD_DriveIsILI9341(void);
void ILI9341_Init_Sequential(void);
Expand Down
18 changes: 12 additions & 6 deletions TFT/src/User/Menu/Move.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@ void drawXYZ(void)
char tempstr[20];
GUI_SetColor(infoSettings.status_color);

sprintf(tempstr, "X:%.2f ", coordinateGetAxisActual(X_AXIS));
GUI_DispString(START_X + 1 * SPACE_X + 1 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);
#ifdef PORTRAIT
sprintf(tempstr, "X:%.2f Y:%.2f Z:%2.f", coordinateGetAxisActual(X_AXIS), coordinateGetAxisActual(Y_AXIS),
coordinateGetAxisActual(Z_AXIS));
GUI_DispString(START_X + 1 * SPACE_X + 1 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);
#else
sprintf(tempstr, "X:%.2f ", coordinateGetAxisActual(X_AXIS));
GUI_DispString(START_X + 1 * SPACE_X + 1 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);

sprintf(tempstr, "Y:%.2f ", coordinateGetAxisActual(Y_AXIS));
GUI_DispString(START_X + 2 * SPACE_X + 2 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);
sprintf(tempstr, "Y:%.2f ", coordinateGetAxisActual(Y_AXIS));
GUI_DispString(START_X + 2 * SPACE_X + 2 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);

sprintf(tempstr, "Z:%.2f ", coordinateGetAxisActual(Z_AXIS));
GUI_DispString(START_X + 3 * SPACE_X + 3 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);
sprintf(tempstr, "Z:%.2f ", coordinateGetAxisActual(Z_AXIS));
GUI_DispString(START_X + 3 * SPACE_X + 3 * ICON_WIDTH, (ICON_START_Y - BYTE_HEIGHT) / 2, (uint8_t *)tempstr);
#endif

GUI_SetColor(infoSettings.font_color);
}
Expand Down
43 changes: 31 additions & 12 deletions TFT/src/User/Menu/Print.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,41 @@ static bool list_mode = true;

const GUI_RECT titleRect = {10, (TITLE_END_Y - BYTE_HEIGHT) / 2, LCD_WIDTH - 10, (TITLE_END_Y - BYTE_HEIGHT) / 2 + BYTE_HEIGHT};

const GUI_RECT gcodeRect[NUM_PER_PAGE] = {
{BYTE_WIDTH/2+0*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
1*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
#ifdef PORTRAIT
const GUI_RECT gcodeRect[NUM_PER_PAGE] = {
{BYTE_WIDTH/2+0*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
1*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+1*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
2*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
{BYTE_WIDTH/2+1*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
2*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+2*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
3*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
{BYTE_WIDTH/2+2*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
3*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+3*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
4*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
{BYTE_WIDTH/2+0*SPACE_X_PER_ICON, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
1*SPACE_X_PER_ICON-BYTE_WIDTH/2, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+0*SPACE_X_PER_ICON, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
1*SPACE_X_PER_ICON-BYTE_WIDTH/2, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
};
{BYTE_WIDTH/2+1*SPACE_X_PER_ICON, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
2*SPACE_X_PER_ICON-BYTE_WIDTH/2, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
};
#else
const GUI_RECT gcodeRect[NUM_PER_PAGE] = {
{BYTE_WIDTH/2+0*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
1*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+1*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
2*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+2*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
3*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+3*SPACE_X_PER_ICON, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
4*SPACE_X_PER_ICON-BYTE_WIDTH/2, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},

{BYTE_WIDTH/2+0*SPACE_X_PER_ICON, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2,
1*SPACE_X_PER_ICON-BYTE_WIDTH/2, 2*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+(SPACE_Y-BYTE_HEIGHT)/2+BYTE_HEIGHT},
};
#endif

void normalNameDisp(const GUI_RECT *rect, uint8_t *name)
{
Expand Down
65 changes: 48 additions & 17 deletions TFT/src/User/Menu/PrintingMenu.c
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
#include "Printing.h"
#include "includes.h"

const GUI_RECT printinfo_val_rect[6] = {
{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},
#ifdef PORTRAIT
const GUI_RECT printinfo_val_rect[6] = { //LABELS
{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},
{START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_SM_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},
{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, 1*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_SM_EX, 1*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},
{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},
{START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, 1*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_SM_EX, 1*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},
};
#else
const GUI_RECT printinfo_val_rect[6] = { //LABELS
{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_SM_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},
};
{START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_SM_EX, PICON_START_Y+PICON_HEIGHT*0+PICON_SPACE_Y*0+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*0+PICON_SPACE_X*0+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*1+PICON_SPACE_X*1+PICON_VAL_LG_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},

{START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_X, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y,
START_X+PICON_LG_WIDTH*2+PICON_SPACE_X*2+PICON_VAL_SM_EX, PICON_START_Y+PICON_HEIGHT*1+PICON_SPACE_Y*1+PICON_VAL_Y+BYTE_HEIGHT},
};
#endif

#define PROGRESS_BAR_RAW_X0 (START_X) // X0 aligned to first icon
#define PROGRESS_BAR_RAW_X1 (START_X + 4*ICON_WIDTH + 3*SPACE_X) // X1 aligned to last icon
#ifdef PORTRAIT
#define PROGRESS_BAR_RAW_X1 (START_X + 3*ICON_WIDTH + 2*SPACE_X) // X1 aligned to last icon
#else
#define PROGRESS_BAR_RAW_X1 (START_X + 4*ICON_WIDTH + 3*SPACE_X) // X1 aligned to last icon
#endif

#ifdef MARKED_PROGRESS_BAR
#define PROGRESS_BAR_DELTA_X ((PROGRESS_BAR_RAW_X1 - PROGRESS_BAR_RAW_X0) % 10) // use marked progress bar. Width rounding factor multiple of 10 slices
Expand All @@ -37,8 +63,13 @@ const GUI_RECT printinfo_val_rect[6] = {
#define PROGRESS_BAR_FULL_WIDTH (PROGRESS_BAR_X1 - PROGRESS_BAR_X0) // 100% progress bar width
#define PROGRESS_BAR_SLICE_WIDTH (PROGRESS_BAR_FULL_WIDTH / 10) // 10% progress bar width

const GUI_RECT progressBar = {PROGRESS_BAR_X0, PICON_START_Y + PICON_HEIGHT * 2 + PICON_SPACE_Y * 2 + 1,
PROGRESS_BAR_X1, ICON_START_Y + ICON_HEIGHT + SPACE_Y - PICON_SPACE_Y - 1};
#ifdef PORTRAIT
const GUI_RECT progressBar = {PROGRESS_BAR_X0, TITLE_END_Y + 1,
PROGRESS_BAR_X1, PICON_START_Y - PICON_SPACE_Y - 1};
#else
const GUI_RECT progressBar = {PROGRESS_BAR_X0, PICON_START_Y + PICON_HEIGHT * 2 + PICON_SPACE_Y * 2 + 1,
PROGRESS_BAR_X1, ICON_START_Y + ICON_HEIGHT + SPACE_Y - PICON_SPACE_Y - 1};
#endif

enum
{
Expand Down
5 changes: 4 additions & 1 deletion TFT/src/User/Menu/ScreenSettings.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,10 @@ void menuScreenSettings(void)
switch (curIndex)
{
case KEY_ICON_0:
infoSettings.rotated_ui = !infoSettings.rotated_ui;
if (infoSettings.rotated_ui == 0 || infoSettings.rotated_ui == 2) //support VERTICAL GUI
infoSettings.rotated_ui++;
else
infoSettings.rotated_ui--;
LCD_RefreshDirection(infoSettings.rotated_ui);
TSC_Calibration();
menuDrawPage(&screenSettingsItems);
Expand Down
Loading

0 comments on commit aaf5def

Please sign in to comment.