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 status screen flicker after cleanup commit & Fix issues with list mode in setting #263

Merged
merged 3 commits into from
Dec 30, 2019
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
11 changes: 6 additions & 5 deletions TFT/src/User/API/UI/list_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ void DrawListItemPress(const GUI_RECT * rect, bool pressed){
GUI_DrawPrect(rect);

GUI_SetColor(LISTBTN_BKCOLOR);
GUI_DrawLine(rect->x0, rect->y0 , rect->x1, rect->y0 );
GUI_DrawLine(rect->x0, rect->y1 , rect->x1, rect->y1 );
GUI_DrawLine(rect->x0, rect->y0-1 , rect->x1-1, rect->y0-1 );
GUI_DrawLine(rect->x0, rect->y1-1 , rect->x1-1, rect->y1-1 );
}
GUI_RestoreColorDefault();
}
Expand Down Expand Up @@ -482,6 +482,7 @@ void ListItem_Display(const GUI_RECT* rect, uint8_t positon, const LISTITEM * cu

GUI_DispLenString(pos.x , pos.y, textSelect(curitem->titlelabel.index),textarea_width);
pos = getTextStartPoint(rect->x0, rect->y0, rect->x1,rect->y1,RIGHT_CENTER,GET_ICONCHAR[ICONCHAR_TOGGLE_BODY]);
GUI_ClearRect(rect->x1-wy,rect->y0,rect->x1,rect->y1);
ListItem_DisplayToggle(pos.x, pos.y, curitem->icon);
DrawListItemPress(rect,pressed);
break;
Expand Down Expand Up @@ -509,7 +510,7 @@ void ListItem_Display(const GUI_RECT* rect, uint8_t positon, const LISTITEM * cu
case LIST_CUSTOMVALUE:
if(curitem->icon != ICONCHAR_BLANK) {
ListDrawIcon(rect,LEFT_CENTER,curitem->icon,BLACK);
pos.x += (BYTE_HEIGHT + 1);
pos.x += (BYTE_HEIGHT + 3);
}
GUI_DispString(pos.x, pos.y, textSelect(curitem->titlelabel.index));

Expand Down Expand Up @@ -543,7 +544,7 @@ void ListItem_DisplayToggle(uint16_t sx, uint16_t sy, uint8_t iconchar_state)
GUI_DispString(sx, sy, (uint8_t*)GET_ICONCHAR[ICONCHAR_TOGGLE_BODY]);
GUI_SetTextMode(GUI_TEXTMODE_TRANS);

GUI_SetColor(ICON_COLOR[iconchar_state]);
GUI_SetColor(ICON_COLOR[iconchar_state]);
if (iconchar_state == ICONCHAR_TOGGLE_OFF)
{
GUI_DispString(sx, sy, IconCharSelect(ICONCHAR_TOGGLE_SWITCH));
Expand All @@ -560,7 +561,7 @@ void ListItem_DisplayToggle(uint16_t sx, uint16_t sy, uint8_t iconchar_state)
void ListItem_DisplayCustomValue(const GUI_RECT* rect,uint8_t * value)
{

const GUI_RECT rectVal = {rect->x1-BYTE_WIDTH*8 -2,rect->y0+(LISTITEM_HEIGHT-BYTE_HEIGHT)/2,rect->x1-2,rect->y1-(LISTITEM_HEIGHT-BYTE_HEIGHT)/2};
const GUI_RECT rectVal = {rect->x1-BYTE_WIDTH*8 -1,rect->y0+(LISTITEM_HEIGHT-BYTE_HEIGHT)/2,rect->x1-1,rect->y1-(LISTITEM_HEIGHT-BYTE_HEIGHT)/2};
//GUI_POINT pos = getTextStartPoint(rect_of_keyListView.x0, rect->y0, rect->x1,rect->y1, pos, iconchar);

GUI_ClearPrect(&rectVal);
Expand Down
39 changes: 28 additions & 11 deletions TFT/src/User/Menu/FeatureSettings.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
//
void updateFeatureSettings(uint8_t key_val)
{
uint8_t item_index = fe_cur_page*FE_PAGE_COUNT+ key_val;
uint8_t item_index = fe_cur_page*LISTITEM_PER_PAGE+ key_val;
switch (item_index)
{
case SKEY_HIDEACK:
Expand All @@ -273,8 +273,8 @@
break;

case SKEY_INVERT_Z:
infoSettings.invert_yaxis = (infoSettings.invert_yaxis + 1) % 2;
settingPage[item_index].icon = toggleitem[infoSettings.invert_yaxis];
infoSettings.invert_zaxis = (infoSettings.invert_zaxis + 1) % 2;
settingPage[item_index].icon = toggleitem[infoSettings.invert_zaxis];
featureSettingsItems.items[key_val] = settingPage[item_index];
menuDrawListItem(&featureSettingsItems.items[key_val], key_val);
break;
Expand Down Expand Up @@ -316,25 +316,25 @@
void loadFeatureSettings(){
for (uint8_t i = 0; i < LISTITEM_PER_PAGE; i++)
{
uint8_t item_index = fe_cur_page*FE_PAGE_COUNT + i;
uint8_t item_index = fe_cur_page*LISTITEM_PER_PAGE + i;
switch (item_index)
{
case SKEY_HIDEACK:
//item_terminalACK_i = infoSettings.terminalACK;
settingPage[SKEY_HIDEACK].icon = toggleitem[infoSettings.terminalACK];
featureSettingsItems.items[i] = settingPage[SKEY_HIDEACK];
settingPage[item_index].icon = toggleitem[infoSettings.terminalACK];
featureSettingsItems.items[i] = settingPage[item_index];
break;

case SKEY_INVERT_Y:
//item_invert_yaxis_i = infoSettings.invert_yaxis;
settingPage[SKEY_INVERT_Y].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[i] = settingPage[SKEY_INVERT_Y];
settingPage[item_index].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[i] = settingPage[item_index];
break;

case SKEY_INVERT_Z:
//item_invert_zaxis_i = infoSettings.invert_zaxis;
settingPage[SKEY_INVERT_Z].icon = toggleitem[infoSettings.invert_yaxis];
featureSettingsItems.items[i] = settingPage[SKEY_INVERT_Z];
settingPage[item_index].icon = toggleitem[infoSettings.invert_zaxis];
featureSettingsItems.items[i] = settingPage[item_index];
break;

#ifdef PS_ON_PIN
Expand Down Expand Up @@ -362,6 +362,7 @@
case SKEY_SPEED:
featureSettingsItems.items[i] = itemMoveSpeed[infoSettings.move_speed];
break;

default:
settingPage[item_index].icon = ICONCHAR_BACKGROUND;
featureSettingsItems.items[i] = settingPage[item_index];
Expand Down Expand Up @@ -390,9 +391,18 @@
featureSettingsItems.items[6].icon = ICONCHAR_PAGEDOWN;
}
}
//menuDrawListItem(&featureSettingsItems.items[5],5);
//menuDrawListItem(&featureSettingsItems.items[6],6);

}

void refreshItemsDisplay(){
for (uint8_t i = 0; i < ITEM_PER_PAGE; i++)
{
menuDrawListItem(&featureSettingsItems.items[i],i);
}
}

void menuFeatureSettings(void)
{
KEY_VALUES key_num = KEY_IDLE;
Expand All @@ -411,22 +421,29 @@
if (fe_cur_page > 0){
fe_cur_page--;
loadFeatureSettings();
refreshItemsDisplay();
}
}
break;

case KEY_ICON_6:
if(FE_PAGE_COUNT > 1){
if (fe_cur_page < FE_PAGE_COUNT){
if (fe_cur_page < FE_PAGE_COUNT - 1){
fe_cur_page++;
loadFeatureSettings();
refreshItemsDisplay();
}
}
break;

case KEY_ICON_7:
infoMenu.cur--;
break;
default:
if(key_num < LISTITEM_PER_PAGE){
updateFeatureSettings(key_num);
menuDrawListItem(&featureSettingsItems.items[key_num],key_num);
}
break;
}

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/Move.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define LABEL_ZAXIS_UP LABEL_Z_INC
#define LABEL_ZAXIS_DOWN LABEL_Z_DEC
#define ZGCODE_UP "G1 Z%.1f\n"
#define ZGCODE_DOWN "G1 Z%.1f\n"
#define ZGCODE_DOWN "G1 Z-%.1f\n"
#endif

#endif
Expand Down
14 changes: 7 additions & 7 deletions TFT/src/User/Menu/StatusScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ const GUI_RECT RectInfo = {START_X + 1 * ICON_WIDTH + 1 * SPACE_X, ICON_START_Y
const GUI_RECT msgRect ={START_X + 1 * ICON_WIDTH + 1 * SPACE_X + 2, ICON_START_Y + 1 * ICON_HEIGHT + 1 * SPACE_Y + STATUS_MSG_BODY_YOFFSET,
START_X + 3 * ICON_WIDTH + 2 * SPACE_X - 2, ICON_START_Y + 2 * ICON_HEIGHT + 1 * SPACE_Y - STATUS_MSG_BODY_BOTTOM};

const GUI_RECT RecGantry = {START_X, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y,
4*ICON_WIDTH+3*SPACE_X+START_X, 1*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y};
const GUI_RECT RecGantry = {START_X, 1*ICON_HEIGHT+0*SPACE_Y+ICON_START_Y + STATUS_GANTRY_YOFFSET,
4*ICON_WIDTH+3*SPACE_X+START_X, 1*ICON_HEIGHT+1*SPACE_Y+ICON_START_Y - STATUS_GANTRY_YOFFSET};


/*set status icons */
Expand All @@ -99,22 +99,22 @@ void drawTemperature(void)
char tempstr[100];
GUI_SetTextMode(GUI_TEXTMODE_TRANS);
GUI_SetColor(HEADING_COLOR);
menuDrawItem(&ToolItems[0],0); //Ext icon
menuDrawIconOnly(&ToolItems[0],0); //Ext icon
GUI_DispStringRight(pointID[0].x, pointID[0].y, (u8 *)heatDisplayID[current_Ext]); //Ext label

GUI_SetColor(VAL_COLOR);
my_sprintf(tempstr, "%d/%d", heatGetCurrentTemp(current_Ext), heatGetTargetTemp(current_Ext));
GUI_DispStringInPrect(&rectB[0], (u8 *)tempstr); //Ext value

GUI_SetColor(HEADING_COLOR);
menuDrawItem(&ToolItems[1],1); //Bed icon
menuDrawIconOnly(&ToolItems[1],1); //Bed icon
GUI_DispStringRight(pointID[1].x, pointID[1].y, (u8 *)heatDisplayID[BED]); //Bed label
GUI_SetColor(VAL_COLOR);
my_sprintf(tempstr, "%d/%d", heatGetCurrentTemp(BED), heatGetTargetTemp(BED));
GUI_DispStringInPrect(&rectB[1], (u8 *)tempstr); //Bed value

GUI_SetColor(HEADING_COLOR);
menuDrawItem(&ToolItems[2],2); //Fan icon
menuDrawIconOnly(&ToolItems[2],2); //Fan icon
GUI_DispStringRight(pointID[2].x, pointID[2].y, (u8 *)fanID[current_fan]); //Fan label
GUI_SetColor(VAL_COLOR);

Expand All @@ -129,7 +129,7 @@ void drawTemperature(void)
GUI_DispStringInPrect(&rectB[2], (u8 *)tempstr); //Fan value

GUI_SetColor(HEADING_COLOR);
menuDrawItem(&SpeedItems[current_speedID],3); //Speed / flow icon
menuDrawIconOnly(&SpeedItems[current_speedID],3); //Speed / flow icon
GUI_DispStringRight(pointID[3].x, pointID[3].y, (u8 *)SpeedID[current_speedID]); //Speed / flow label
GUI_SetColor(VAL_COLOR);
my_sprintf(tempstr, "%d%s", speedGetPercent(current_speedID),"%");
Expand All @@ -138,7 +138,7 @@ void drawTemperature(void)
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_SetColor(GANTRYLBL_COLOR);
GUI_SetBkColor(GANTRYLBL_BKCOLOR);
my_sprintf(tempstr, "X: %.2f Y: %.2f Z: %.2f", xaxis, yaxis, zaxis);
my_sprintf(tempstr, " X: %.2f Y: %.2f Z: %.2f ", xaxis, yaxis, zaxis);
GUI_DispStringInPrect(&RecGantry,(u8 *)tempstr);

GUI_RestoreColorDefault();
Expand Down
3 changes: 2 additions & 1 deletion TFT/src/User/Menu/StatusScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void gantry_inc(int n, float val);
#define STATUS_MSG_BODY_YOFFSET 59
#define STATUS_MSG_BODY_BOTTOM 6
#define STATUS_TITLE_SHORT 20
#define STATUS_GANTRY_YOFFSET 6


#elif defined(TFT28_V1_0) || defined(TFT24_V1_1)
Expand All @@ -58,7 +59,7 @@ void gantry_inc(int n, float val);
#define STATUS_MSG_BODY_BOTTOM 4
#define STATUS_TITLE_SHORT 10
#define SS_ICON_START_Y 30
#define STATUS_GANTRY_YOFFSET 6
#define STATUS_GANTRY_YOFFSET 4
#endif

#endif
10 changes: 10 additions & 0 deletions TFT/src/User/Menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ void menuDrawItem(const ITEM *item, uint8_t positon)
GUI_DispStringInPrect(rect, content);
}

void menuDrawIconOnly(const ITEM *item, uint8_t positon)
{
uint8_t *content = labelGetAddress(&item->label);
const GUI_RECT *rect = rect_of_key + positon;
if(item->icon != ICON_BACKGROUND)
ICON_ReadDisplay(rect->x0, rect->y0, item->icon);
else
GUI_ClearPrect(rect);
}

void menuDrawListItem(const LISTITEM *item, uint8_t position)
{
const GUI_RECT *rect = rect_of_keyListView + position;
Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/Menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void busyIndicator(SYS_STATUS status);

void GUI_RestoreColorDefault(void);
void menuDrawItem (const ITEM * menuItem, uint8_t positon);
void menuDrawIconOnly(const ITEM *item, uint8_t positon);
void menuDrawListItem(const LISTITEM *item, uint8_t positon);
void menuDrawTitle(const uint8_t *content); //(const MENUITEMS * menuItems);
void menuDrawPage (const MENUITEMS * menuItems);
Expand Down