FatFS capability to rename a filename

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It has been a long long time since I have played with FatFs but I think I am going to start again playing with it in not to long a time.

I am making a simple datalogger and as filename I want to use just the actual date and perhaps time, but from the past I know it can take a long time for a GPS receiver to spit out a valid date and time although it then already give the 1 second interval. I want to start recording as soon as possible, so the moment the 1 sec pulses start appearing I want to read the other sensors and start storing the data. then first make the filename "temp" or something like that, then when I get valid date and time information I want to change the filename to the start of logging (more or less)

 

I do know that what I could do is just open a second file and copy paste that data, but I was wondering if there is no command to just simply re-name the file.

This topic has a solution.
Last Edited: Mon. Mar 19, 2018 - 11:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wonder what text or words made the captcha pop........

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I rename the file in my pipe organ controller using fat FS.  The tricky part is dealing with the program space vs code space for the base filename.  It work fine for the log files that are the recordings of the song. Users have a nasty habit of powering of the organ before stopping the recorder.  So I record to a temp file that allocates the FATS,  This gets renamed on file close when the directory slot is written.

There is a bug that I am to lazy to fix that when the code is updated the old code is named with a .BAK extension for some reason the new file does not get renamed to the name of the old file. I think it has something to do with the string memory spaces used.   So I just pop the card and rename it in the host computer.

 

meslomp wrote:

It has been a long long time since I have played with FatFs but I think I am going to start again playing with it in not to long a time.

I am making a simple datalogger and as filename I want to use just the actual date and perhaps time, but from the past I know it can take a long time for a GPS receiver to spit out a valid date and time although it then already give the 1 second interval. I want to start recording as soon as possible, so the moment the 1 sec pulses start appearing I want to read the other sensors and start storing the data. then first make the filename "temp" or something like that, then when I get valid date and time information I want to change the filename to the start of logging (more or less)

 

I do know that what I could do is just open a second file and copy paste that data, but I was wondering if there is no command to just simply re-name the file.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

meslomp wrote:
but I was wondering if there is no command to just simply re-name the file.
You mean this?:

 

http://elm-chan.org/fsw/ff/doc/r...

 

(accessed from the list of available APIs at http://elm-chan.org/fsw/ff/00ind... )

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Cliff,

that seems indeed just what I need.

has some 'limitations' (file needs to be closed) but those are easy managed I guess and hope :D

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meslomp wrote:
has some 'limitations' (file needs to be closed)

Windows requires that!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

meslomp wrote:
has some 'limitations' (file needs to be closed)

Windows requires that!

 

yes, but there the interface is at the discretion of the user.

I want to start logging data even if I do not yet have a valid date(filename) and then on the fly change the name from lets say 'temp.log' to '20180320.log'

to me it seemed easier and less prouwn to problems if the rename was on the fly.

at least I can change the name so now just need to go and see that I can actually do it.

checked yesterday evening last version I used was 0.4 and last one downloaded was 0.7 so can imagine a lot has changed so that will be an interesting exercise.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meslomp wrote:
checked yesterday evening last version I used was 0.4 and last one downloaded was 0.7
You aren't talking about FatFs versions here are you? Current release is 0.13 so even 0.7 is way out of date.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

meslomp wrote:
checked yesterday evening last version I used was 0.4 and last one downloaded was 0.7
You aren't talking about FatFs versions here are you? Current release is 0.13 so even 0.7 is way out of date.

unfortunately.... yes I was talking about FatFs version.

waaaaaai back in time I used version 0.4, then wanted to do an upgrade of my FW as my writing skills had improved somewhat and I downloaded version 0.7 somewhere in the process the "project lost interest and was put on hold as I had other things I needed to do more urgently. Now I have another project that I want to do and that again is based on large amounts of data storage, so finally have time to be "playing" again with FatFs.

 

So I was already going to download the latest when I came to the point were I was going to work on the storage.