Skip to content

Commit

Permalink
Change Infobox background to BMP to allow customization.
Browse files Browse the repository at this point in the history
  • Loading branch information
guruathwal authored and bigtreetech committed Dec 3, 2019
1 parent 4e74418 commit ce2d4b2
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 21 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions TFT/src/User/API/UI/GUI.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,3 +978,12 @@ void GUI_DrawWindow(const WINDOW *window, const uint8_t *title, const uint8_t *i
GUI_SetColor(nowFontColor);
GUI_SetTextMode(nowTextMode);
}

void GUI_RestoreColorDefault(void){

GUI_SetBkColor(BK_COLOR);
GUI_SetColor(FK_COLOR);
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_SetNumMode(GUI_NUMMODE_SPACE);

}
2 changes: 1 addition & 1 deletion TFT/src/User/API/UI/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void GUI_DispStringInRectEOL(int16_t sx, int16_t sy, int16_t ex, int16_t ey, con

void GUI_DispDec(int16_t x, int16_t y,int32_t num, uint8_t len, uint8_t leftOrRight);
void GUI_DispFloat(int16_t x, int16_t y, float num, uint8_t llen, uint8_t rlen, uint8_t leftOrRight);

void GUI_RestoreColorDefault(void);

/**************************************************** Widget *******************************************************************/

Expand Down
3 changes: 1 addition & 2 deletions TFT/src/User/API/UI/touch_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ void TSC_Calibration(void)
F = (Y1*(X3*YL2 - X2*YL3) + Y2*(X1*YL3 - X3*YL1) + Y3*(X2*YL1 - X1*YL2));
}while(calibrationEnsure(LCD_WIDTH/2, LCD_HEIGHT/2)==0);

GUI_SetColor(FK_COLOR);
GUI_SetBkColor(BK_COLOR);
GUI_RestoreColorDefault();
}


Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const char iconBmpName[][32]={
"BLTouchStow", "BLTouchTest", "BLTouchRepeat", "TSCSettings", "MachineSettings", "FeatureSettings", "ProbeOffset", "EEPROMSave", "SilentOn", "ShutDown",
"RGB_Settings", "RGB_Red", "RGB_Green", "RGB_Blue", "RGB_White", "RGB_Off", "Preheat_Both", "Preheat_PLA", "Preheat_PETG", "Preheat_ABS",
"PowerSupply", "Custom", "Custom0", "Custom1", "Custom2", "Custom3", "Custom4", "Custom5", "Custom6", "Home_Move", "Heat_Fan",
"ManualLevel", "CoolDown", "SilentOff","StatusNozzle","StatusBed","StatusFan","MainMenu","StatusSpeed","StatusFlow",
"ManualLevel", "CoolDown", "SilentOff","StatusNozzle","StatusBed","StatusFan","MainMenu","StatusSpeed","StatusFlow","InfoBox_part1", "InfoBox_part2",
};

u8 scanUpdateFile(void)
Expand Down
2 changes: 2 additions & 0 deletions TFT/src/User/API/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ enum
ICON_MAINMENU,
ICON_STATUS_SPEED,
ICON_STATUS_FLOW,
ICON_INFOBOX_PART1,
ICON_INFOBOX_PART2,

// ICON_RESERVE
// Preview should be in the last place
Expand Down
6 changes: 2 additions & 4 deletions TFT/src/User/Menu/SendGcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ void menuSendGcode(void)

loopBackEnd();
}
GUI_SetColor(FK_COLOR);
GUI_SetBkColor(BK_COLOR);
GUI_RestoreColorDefault();
}


Expand Down Expand Up @@ -258,6 +257,5 @@ void menuTerminal(void)

loopBackEnd();
}
GUI_SetColor(FK_COLOR);
GUI_SetBkColor(BK_COLOR);
GUI_RestoreColorDefault();
}
24 changes: 11 additions & 13 deletions TFT/src/User/Menu/StatusScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static float yaxis;
static float zaxis;
static bool gantryCmdWait = false;


TOOL current_Ext = NOZZLE0;
int current_fan = 0;
int current_speedID = 0;
Expand Down Expand Up @@ -166,9 +167,7 @@ void drawTemperature(void)
my_sprintf(tempstr, "X: %.2f Y: %.2f Z: %.2f", xaxis, yaxis, zaxis);
GUI_DispStringInPrect(&RecGantry,(u8 *)tempstr);

GUI_SetBkColor(BK_COLOR);
GUI_SetColor(FK_COLOR);
//GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_RestoreColorDefault();
}

void storegantry(int n, float val){
Expand Down Expand Up @@ -274,33 +273,32 @@ void drawStatusScreenMsg(void)
//GUI_ClearRect(RectInfo.x0,RectInfo.y0,RectInfo.x1,RectInfo.y1);
GUI_SetTextMode(GUI_TEXTMODE_TRANS);

GUI_SetColor(INFOBOX_BKCOLOR);
GUI_FillRect(RectInfo.x0, RectInfo.y0, RectInfo.x1, RectInfo.y1);
//GUI_SetColor(INFOBOX_BKCOLOR);
//GUI_FillRect(RectInfo.x0, RectInfo.y0, RectInfo.x1, RectInfo.y1);

GUI_SetColor(INFOBOX_BORDER);
GUI_DrawRect(RectInfo.x0, RectInfo.y0, RectInfo.x1, RectInfo.y1);
//GUI_SetColor(INFOBOX_BORDER);
//GUI_DrawRect(RectInfo.x0, RectInfo.y0, RectInfo.x1, RectInfo.y1);
lcd_frame_display(RectInfo.x0, RectInfo.y0, INFOBOX_P1_WIDTH, ICON_HEIGHT, ICON_ADDR(ICON_INFOBOX_PART1));
lcd_frame_display(RectInfo.x0+INFOBOX_P1_WIDTH, RectInfo.y0, INFOBOX_P2_WIDTH, ICON_HEIGHT, ICON_ADDR(ICON_INFOBOX_PART2));

GUI_SetColor(INFOMSG_BKCOLOR);
GUI_DispString(RectInfo.x0 + STATUS_MSG_ICON_XOFFSET, RectInfo.y0 + STATUS_MSG_ICON_YOFFSET,IconCharSelect(ICONCHAR_INFO));
GUI_FillRect(RectInfo.x0, msgRect.y0, RectInfo.x1, msgRect.y1); //rectangle for msg scroller
//GUI_FillRect(RectInfo.x0, msgRect.y0, RectInfo.x1, msgRect.y1); //rectangle for msg scroller

GUI_DispString(RectInfo.x0 + BYTE_HEIGHT+ STATUS_MSG_TITLE_XOFFSET,RectInfo.y0 + STATUS_MSG_ICON_YOFFSET,(u8*)msgtitle);
GUI_SetBkColor(INFOMSG_BKCOLOR);
GUI_FillRect(msgRect.x0, msgRect.y0, msgRect.x1, msgRect.y1);

Scroll_CreatePara(&msgScroll, (u8 *)msgbody, &msgRect);

GUI_SetBkColor(BK_COLOR);
GUI_SetColor(FK_COLOR);
GUI_SetTextMode(GUI_TEXTMODE_NORMAL);
GUI_RestoreColorDefault();
}

void scrollMsg(void){
GUI_SetBkColor(INFOMSG_BKCOLOR);
GUI_SetColor(INFOMSG_COLOR);
Scroll_DispString(&msgScroll,CENTER);
GUI_SetBkColor(BK_COLOR);
GUI_SetColor(FK_COLOR);
GUI_RestoreColorDefault();
}

void toggleTool(void)
Expand Down
5 changes: 5 additions & 0 deletions TFT/src/User/Menu/StatusScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ void gantry_inc(int n, float val);
#define STATUS_TITLE_SHORT 20
#define SS_TITLE_END_Y 50
#define STATUS_GANTRY_YOFFSET 8
#define INFOBOX_P1_WIDTH 108
#define INFOBOX_P2_WIDTH 107


#elif defined(TFT28_V1_0) || defined(TFT24_V1_1)

Expand All @@ -64,6 +67,8 @@ void gantry_inc(int n, float val);
#define STATUS_TITLE_SHORT 10
#define SS_TITLE_END_Y 30
#define STATUS_GANTRY_YOFFSET 6
#define INFOBOX_P1_WIDTH 75
#define INFOBOX_P2_WIDTH 75
#endif

#endif

0 comments on commit ce2d4b2

Please sign in to comment.