Skip to content

Commit

Permalink
Fix for missing icons in classic menu and minor bug fix for fan speed…
Browse files Browse the repository at this point in the history
… display (bigtreetech#583)
  • Loading branch information
guruathwal authored Apr 25, 2020
1 parent 12cb123 commit 3fb6c1f
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 33 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
44 changes: 34 additions & 10 deletions TFT/src/User/API/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ const GUI_RECT statUpdateRect = {0, (BYTE_HEIGHT*3) + PADDING*3 + ICON_HEIGHT, L

const GUI_RECT labelFailedRect = {0,(BYTE_HEIGHT*4) + PADDING*4 + ICON_HEIGHT, LCD_WIDTH, (BYTE_HEIGHT*5) + PADDING*4 + ICON_HEIGHT};

const u16 skipped_icons[] = {ICON_STATUS_NOZZLE,
ICON_STATUS_BED,
ICON_STATUS_FAN,
ICON_STATUS_FLOW,
ICON_STATUS_SPEED,
ICON_HEAT_FAN,
ICON_HOME_MOVE,
ICON_COOLDOWN
};

GUI_POINT bmp_size;
BMPUPDATE_STAT bmp_stat = BMP_SUCCESS;
Expand All @@ -22,6 +31,16 @@ const char iconBmpName[][32]={
//add new icons in icon_list.inc only
};

bool skipIcon(u16 index)
{
for (int i = 0; i < COUNT(skipped_icons); i++)
{
if (index == skipped_icons[i])
return true;
}
return false;
}

bool bmpDecode(char *bmp, u32 addr)
{
FIL bmpFile;
Expand Down Expand Up @@ -131,6 +150,10 @@ void updateIcon(void)

for (int i = 0; i < COUNT(iconBmpName); i++)
{
#ifndef UNIFIED_MENU
if (skipIcon(i) == true)
continue;
#endif
my_sprintf(nowBmp, BMP_ROOT_DIR "/%s.bmp", iconBmpName[i]);
GUI_ClearPrect(&labelUpdateRect);
GUI_DispString(labelUpdateRect.x0, labelUpdateRect.y0, (u8 *)nowBmp);
Expand All @@ -154,16 +177,17 @@ void updateIcon(void)
my_sprintf(tempstr, "Updated: %d | Not Updated: %d", found, notfound);
GUI_DispString(statUpdateRect.x0, statUpdateRect.y0, (u8 *)tempstr);
}

if (bmpDecode(BMP_ROOT_DIR "/InfoBox.bmp", INFOBOX_ADDR))
{
found++;
}
else
{
notfound++;
dispIconFail((u8 *)(BMP_ROOT_DIR "/InfoBox.bmp"));
}
#ifdef UNIFIED_MENU
if (bmpDecode(BMP_ROOT_DIR "/InfoBox.bmp", INFOBOX_ADDR))
{
found++;
}
else
{
notfound++;
dispIconFail((u8 *)(BMP_ROOT_DIR "/InfoBox.bmp"));
}
#endif
GUI_DispStringInPrect(&statUpdateRect, (u8 *)tempstr);
}

Expand Down
21 changes: 11 additions & 10 deletions TFT/src/User/API/icon_list.inc
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,25 @@ X_ICON (PREHEAT_PLA)
X_ICON (PREHEAT_PETG)
X_ICON (PREHEAT_ABS)
X_ICON (CUSTOM)
X_ICON (HOME_MOVE)
X_ICON (HEAT_FAN)
X_ICON (MANUAL_LEVEL)
X_ICON (COOLDOWN)
X_ICON (SILENT_OFF)
X_ICON (STATUSNOZZLE)
X_ICON (STATUSBED)
X_ICON (STATUSFAN)
X_ICON (MAINMENU)
X_ICON (STATUS_SPEED)
X_ICON (STATUS_FLOW)
X_ICON (PARAMETER)
X_ICON (GLOBAL_NOZZLE)
X_ICON (RESET_VALUE)
X_ICON (GLOBAL_BED)
X_ICON (GLOBAL_NOZZLE)
X_ICON (PRINTING_NOZZLE)
X_ICON (PRINTING_BED)
X_ICON (PRINTING_FAN)
X_ICON (PRINTING_TIMER)
X_ICON (PRINTING_ZLAYER)
X_ICON (PRINTING_SPEED)
X_ICON (PRINTING_FLOW)
X_ICON (MAINMENU)
X_ICON (HOME_MOVE)
X_ICON (HEAT_FAN)
X_ICON (COOLDOWN)
X_ICON (STATUS_NOZZLE)
X_ICON (STATUS_BED)
X_ICON (STATUS_FAN)
X_ICON (STATUS_SPEED)
X_ICON (STATUS_FLOW)
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/BabyStep.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MENUITEMS babyStepItems = {
{ICON_INC, LABEL_INC},
{ICON_EEPROM_SAVE, LABEL_EEPROM_SAVE},
{ICON_01_MM, LABEL_01_MM},
{ICON_NORMAL_SPEED, LABEL_VALUE_ZERO},
{ICON_RESET_VALUE, LABEL_RESET},
{ICON_BACK, LABEL_BACK},}
};

Expand Down
4 changes: 2 additions & 2 deletions TFT/src/User/Menu/Fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void showFanSpeed(void)
#ifdef SHOW_FAN_PERCENTAGE
fs = (fanSpeed[curIndex]*100)/255;
#else
fs = fanSpeed[curIndex]
fs = fanSpeed[curIndex];
#endif
GUI_ClearRect(rect.x0, rect.y0, rect.x1, rect.y1);
GUI_DispStringInPrect(&rect, (u8*)fanID[curIndex]);
Expand All @@ -78,7 +78,7 @@ void fanSpeedReDraw(void)
sprintf(fan_s, "%3d%%", (fanSpeed[curIndex]*100)/255);
GUI_DispString(CENTER_X-BYTE_WIDTH, CENTER_Y, (u8 *)fan_s);
#else
GUI_DispDec(CENTER_X-BYTE_WIDTH, CENTER_Y, fanSpeed[curIndex];, 3, LEFT);
GUI_DispDec(CENTER_X-BYTE_WIDTH, CENTER_Y, fanSpeed[curIndex], 3, LEFT);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/Printing.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void reDrawFan(int icon_pos)
fs = (fanGetSpeed(c_fan)*100)/255;
my_sprintf(tempstr, "%d%%", fs);
#else
fs = fanSpeed[curIndex];
fs = fanGetSpeed(c_fan);
my_sprintf(tempstr, "%d", fs);
#endif

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/ProbeOffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LABEL_Z_OFFSET,
{ICON_INC, LABEL_INC},
{ICON_EEPROM_SAVE, LABEL_EEPROM_SAVE},
{ICON_01_MM, LABEL_01_MM},
{ICON_NORMAL_SPEED, LABEL_VALUE_ZERO},
{ICON_RESET_VALUE, LABEL_RESET},
{ICON_BACK, LABEL_BACK},}
};

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ LABEL_SETTINGS,
{ICON_FEATURE_SETTINGS, LABEL_FEATURE_SETTINGS},
{ICON_SCREEN_INFO, LABEL_SCREEN_INFO},
{ICON_DISCONNECT, LABEL_DISCONNECT},
{ICON_BAUD_RATE, LABEL_BACKGROUND},
{ICON_BAUD_RATE, LABEL_BACKGROUND},
{ICON_BACKGROUND, LABEL_BACKGROUND},
{ICON_BACK, LABEL_BACK},}
};
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 @@ -6,9 +6,9 @@ const MENUITEMS StatusItems = {
// title
LABEL_READY,
// icon label
{{ICON_STATUSNOZZLE, LABEL_BACKGROUND},
{ICON_STATUSBED, LABEL_BACKGROUND},
{ICON_STATUSFAN, LABEL_BACKGROUND},
{{ICON_STATUS_NOZZLE, LABEL_BACKGROUND},
{ICON_STATUS_BED, LABEL_BACKGROUND},
{ICON_STATUS_FAN, LABEL_BACKGROUND},
{ICON_STATUS_SPEED, LABEL_BACKGROUND},
{ICON_MAINMENU, LABEL_MAINMENU},
{ICON_BACKGROUND, LABEL_BACKGROUND},
Expand All @@ -18,9 +18,9 @@ LABEL_READY,

const ITEM ToolItems[3] = {
// icon label
{ICON_STATUSNOZZLE, LABEL_BACKGROUND},
{ICON_STATUSBED, LABEL_BACKGROUND},
{ICON_STATUSFAN, LABEL_BACKGROUND},
{ICON_STATUS_NOZZLE, LABEL_BACKGROUND},
{ICON_STATUS_BED, LABEL_BACKGROUND},
{ICON_STATUS_FAN, LABEL_BACKGROUND},
};
const ITEM SpeedItems[2] = {
// icon label
Expand Down Expand Up @@ -120,7 +120,7 @@ void drawTemperature(void)
fs = (fanGetSpeed(current_fan)*100)/255;
my_sprintf(tempstr, "%d%%", fs);
#else
fs = fanSpeed[current_fan];
fs = fanGetSpeed(current_fan);
my_sprintf(tempstr, "%d", fs);
#endif
GUI_DispStringInPrect(&rectB[2], (u8 *)tempstr); //Fan value
Expand Down

0 comments on commit 3fb6c1f

Please sign in to comment.