LogomaticV2: Firmware to append to a single file

Hey guys,

I’ve modified the Logomatic V2 firmware to allow for the option to append to a single file. It is [available here. This adds an option to the LOGCON.txt file called Append. Set Append to Y to continually append to the end of a single file called MainLog.txt. Set Append to N to use the default behavior (sequentially numbered logs). Both types of logs can coexist on the same SDcard so you can switch between Y and N.

It might still be a work in progress, but it’s been working fine for me. Any questions, feedback, concerns, etc. please send them my way!

Quick Start Guide (short version of [this)

  1. Extract

  2. Download and install [WinArm

  3. Open main.c (in the Main folder) in Programmer’s Notepad 2 (right click->Open with…)

  4. Tools → Make All

  5. FW.SFE has been created in the same directory as main.c. Copy it to do an SD card.

  6. Delete any old LOGCON.txt file from the SDcard

  7. Stick the SD card into the Logomatic, press reset.

  8. Happy logging

EDIT: Updated link, March 2011](http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/#winarm)](http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=94)](http://www.mediafire.com/?8nq1np90znspgbq)

Nice work, you have implemented it well :slight_smile:

You could possibly even use the original root_open_file() and open_file_in_dir() functions, and just add a flag which chooses how to open the file. Although this would break any code that uses the functions already, so not so much of a nice solution unless your re-writing the complete source.

I haven’t tested it, but it looks like it should be fine.

Just a tip, you could do a Make>Clean before zipping up files in future, just makes the zip a little smaller, and easier to work with when you first extract it.

Hello all,

Iquaba, you posted an interesting note on appending to a single file.

I am working on a DAQ system where this data append functionality would be great.

Iquaba posted this in June 2009…

Hey guys,

I’ve modified the Logomatic V2 firmware to allow for the option to append to a single file. It is available here.

I clicked on the link for “here” and it went to RPI’s general box, perhaps a broken link?

Is there a way I could find this code elsewhere?

Thanks, appreciate your help.

Any updated links available?

I have the open existing file working but it overwrites the current file info.

Anyone know the function to check the file length and write afterward?

Updated the link, http://www.mediafire.com/?8nq1np90znspgbq

I’d appreciate to hear if people are still finding this useful!

I love you

I’ve been trying to mess with this for a while, after reading and writing to the same file in a sequence, The data starts to overwrite the start of the file after 16384 characters.

Does anyone know of this problem or know of a better way to append data to one file?

It seems this was left out but I’m wondering if it can be made useful.

I really don’t know much about this type of pointer operation “->”

/int32_t offset = fd->pos;

fd = open_file_in_dir(fs,dd,name);

fat16_seek_file(fd, offset, FAT16_SEEK_END);

fd->pos = &offset;

return fd;*/

I’m guessing that when the file allocated the next 16kB cluster, the library loses the place to start writing. It starts to overwrite the previous cluster instead of writing into the new one.

Does anyone make sense of this?

To anyone who wishes to use this in the future, the code below is the working version for appending. Modify the Fat16.c for use.

struct fat16_file_struct* open_file_in_dir_append(struct fat16_fs_struct* fs, struct fat16_dir_struct* dd, const char* name) {  

struct fat16_file_struct* result; 
struct fat16_dir_entry_struct file_entry; 
if(!find_file_in_dir(fs, dd, name, &file_entry))     
    return 0; 
result = fat16_open_file(fs, &file_entry);  
int32_t offset=result->dir_entry.file_size;  
fat16_seek_file(result, &offset, FAT16_SEEK_SET);  
return result; 

}

Hello!

please help me for modifing this firmware for logging in mode 0 with 2 uart (uart 0 and uart1).

Big thanks :slight_smile: