PaxInstruments / t400-firmware

Firmware for the Pax Instruments T400 temperature datalogger
22 stars 5 forks source link

Log file name method #190

Closed charlespax closed 8 years ago

charlespax commented 8 years ago

The log file name function (#157) is a bit too slow once we have around 75 files on the card. We should improve this. Maybe search by tens then by ones.

Here is the relevant code in sd_log.cpp:

bool open(char* fileName) {
  // Create LDxxxx.CSV for the lowest value of x.

  uint16_t i = 0;
  do {
    fileName[2] = (i/1000) % 10 + '0';
    fileName[3] = (i/100)  % 10 + '0';
    fileName[4] = (i/10)   % 10 + '0';
    fileName[5] = i        % 10 + '0';
    i++;
  }
  while(sd.exists(fileName));
protological commented 8 years ago

Added logic to scan by 10s and then go back and search individual. Added in commit 67ccf433cfa80d0bfa6a09b9c7da3d7996ffa6eb