I’m using a Logomatic V2 board and I’ve been writing my own firmware for some time now.
I’ve been using the Roland Riegel Library but it does not have an append option when you download it. I’ve used another firmware which does implement the append fuction however it only appends to the first cluster in the file.
When it leaves the first cluster and writes to the next, the subsequent write starts over again in the first cluster.
I’m looking for help in developing a check system for the write function to know which cluster it should be writing into.
If anyone has had success in playing around with the clusters in FAT libraries I would definately appreciate some help.
The current append function looks like this;
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);
result->pos = result->dir_entry.file_size; // Find position in cluster
result->pos_cluster = result->dir_entry.cluster; // Doesn’t work??? but my hopes were to find the new cluster.
}