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

[Q] Can the SD Card sort order be changed? #1088

Closed
blueeagle69 opened this issue Sep 15, 2020 · 11 comments
Closed

[Q] Can the SD Card sort order be changed? #1088

blueeagle69 opened this issue Sep 15, 2020 · 11 comments
Labels
question Further information is requested

Comments

@blueeagle69
Copy link

Hi.

When printing from the onboard SD card in Marlin mode, new gcode appears at the top of the list.
However when printing in touch mode, new gcode appears at the bottom of the list.
But be a bit of a pain when you have have a few files on your SD card.
Can this be changed?

Thanks.

@blueeagle69 blueeagle69 added the question Further information is requested label Sep 15, 2020
@zonalimitatore
Copy link
Contributor

No,its a marlin's setting.U need to mod the firmware under config_adv.h

@blueeagle69
Copy link
Author

blueeagle69 commented Sep 19, 2020

In Marlin mode, new Gcode appears at the top.
In TFT mode it appears at the bottom.
In Marlin I have already got #define SDCARD_RATHERRECENTFIRST enabled.
SDCARD sort Alpha is not enabled, as this apparently isn't needed for LPC1768 chipsets.
With these settings Marlin mode shows Gcode in the correct order.
If it works fine in Marlin, changing this would only make things worse.

@zonalimitatore
Copy link
Contributor

Let me check if in config.ini for TFT there is an option

@blueeagle69
Copy link
Author

Cheers, but I didn't notice one when compiling.

@zonalimitatore
Copy link
Contributor

zonalimitatore commented Sep 19, 2020

Sorry. For now I haven't find somethink that tell me how it order the files
Maybe here:
`bool Get_NewestGcode(const TCHAR* path)
{
uint32_t date=0;
FILINFO finfo;
uint16_t len = 0;
DIR dirs;
char status = 0;

if (f_opendir(&dirs, path) != FR_OK) return false;

len=strlen(path);
while (f_readdir(&dirs, &finfo) == FR_OK)
{
if(finfo.fname[0]==0) break;
if((finfo.fattrib&AM_HID) != 0) continue;

if((finfo.fattrib&AM_DIR) == AM_DIR)
{
  char  *nextdirpath = malloc(len+strlen(finfo.fname)+2);
  if(nextdirpath==NULL)                         break;

  strcpy(nextdirpath, path);
  strcat(nextdirpath,"/");
  strcat(nextdirpath, finfo.fname);

  status|=Get_NewestGcode(nextdirpath);
  free(nextdirpath);
  nextdirpath=NULL;
}
else
{
  if(strstr(finfo.fname,".gcode")==NULL)        continue;
  if(((finfo.fdate <<16)|finfo.ftime) < date)   continue;

  date=(finfo.fdate <<16)|finfo.ftime;
  resetInfoFile();

  if(len+strlen(finfo.fname)+2>MAX_PATH_LEN)    break;

  strcpy(infoFile.title,path);
  strcat(infoFile.title,"/");
  strcat(infoFile.title,finfo.fname);
  status = 1;
}

}
return status;
}`

into myfatfs.c

@blueeagle69
Copy link
Author

Cheers for the help.
I'll see if I can get my head around it 👍

@zonalimitatore
Copy link
Contributor

No problem dude

@oldman4U
Copy link
Contributor

Hi. This is a duplicate of #601.

Please help the community and close the ticket once you do not need it anymore. Thank you

@blueeagle69
Copy link
Author

Hi. This is a duplicate of #601.

Please help the community and close the ticket once you do not need it anymore. Thank you

Apologies, I missed that one.
Will close now.

@oldman4U
Copy link
Contributor

oldman4U commented Sep 25, 2020 via email

Copy link

github-actions bot commented Apr 5, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants