Use a persistent file* and seek less for log download

Opening/seeking/closing the file for each data chunk was extremely
expensive and drastically slowed the download process as the position
in the file increased. Over USB with large files this change + nuttx
update results in ~ 10x speedup for log downloads.
This commit is contained in:
Nate Weibley
2016-08-03 14:33:01 -04:00
parent 391eb7f8df
commit 547592fddf
2 changed files with 35 additions and 13 deletions
@@ -58,6 +58,7 @@ public:
public:
bool get_entry (int idx, uint32_t& size, uint32_t& date, char* filename = 0);
bool open_for_transmit();
size_t get_log_data (uint8_t len, uint8_t* buffer);
enum {
@@ -75,6 +76,7 @@ public:
uint32_t current_log_size;
uint32_t current_log_data_offset;
uint32_t current_log_data_remaining;
FILE* current_log_filep;
char current_log_filename[128];
private: