Skip to content

Commit

Permalink
fix u disk preview model function (bigtreetech#746)
Browse files Browse the repository at this point in the history
Co-authored-by: <msq001>
  • Loading branch information
Msq001 authored Jun 2, 2020
1 parent c21f7d8 commit d151740
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions TFT/src/User/Fatfs/myfatfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ FATFS fatfs[FF_VOLUMES]; /* FATFS work area*/
true: mount ok
false: mount failed
*/
bool mountSDCard(void)
bool mountSDCard(void)
{
return (f_mount(&fatfs[VOLUMES_SD_CARD], "SD:", 1) == FR_OK);
}

/*
mount U disk from Fatfs
*/
bool mountUDisk(void)
bool mountUDisk(void)
{
return (f_mount(&fatfs[VOLUMES_U_DISK], "U:", 1)== FR_OK);
}
Expand Down
12 changes: 12 additions & 0 deletions TFT/src/User/Hal/STM32_USB_HOST_Library/Usr/src/usbh_usr.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ uint8_t USBH_UDISK_Read(uint8_t* buf, uint32_t sector, uint32_t cnt)

if (HCD_IsDeviceConnected(&USB_OTG_Core))
{
while(USBH_MSC_BOTXferParam.MSCState != USBH_MSC_DEFAULT_APPLI_STATE)
{
// Precess the unfinished USB event before being called by FatFs
USBH_Process(&USB_OTG_Core, &USB_Host);
}

do
{
status = USBH_MSC_Read10(&USB_OTG_Core, buf, sector,512 * cnt);
Expand All @@ -404,6 +410,12 @@ uint8_t USBH_UDISK_Write(uint8_t* buf, uint32_t sector, uint32_t cnt)

if (HCD_IsDeviceConnected(&USB_OTG_Core))
{
while(USBH_MSC_BOTXferParam.MSCState != USBH_MSC_DEFAULT_APPLI_STATE)
{
// Precess the unfinished USB event before being called by FatFs
USBH_Process(&USB_OTG_Core, &USB_Host);
}

do
{
status = USBH_MSC_Write10(&USB_OTG_Core, buf, sector, 512 * cnt);
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/Print.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void menuPrintFromSource(void)
if(infoHost.connected !=true) break;
if(EnterDir(infoFile.file[key_num + start - infoFile.F_num]) == false) break;

if (infoFile.source == TFT_SD) {
if (infoFile.source != BOARD_SD) {
//load bmp preview in flash if file exists
int16_t gn;
char *gnew;
Expand Down

0 comments on commit d151740

Please sign in to comment.