Skip to content

Commit

Permalink
Realize LittleFS cannot be used for random writes within a file -- fl…
Browse files Browse the repository at this point in the history
…ushing appears to cost of an order of the remainder of the file -- see: littlefs-project/littlefs#27
  • Loading branch information
danielgjackson committed Sep 14, 2021
1 parent 64fb288 commit 34c1511
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/components/activity/ActivityController.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
#define ACTIVITY_HEADER_SIZE 30
#define ACTIVITY_PAYLOAD_SIZE (ACTIVITY_BLOCK_SIZE - ACTIVITY_HEADER_SIZE - 2) // 480 (512 - 30 bytes header - 2 bytes checksum)
#define ACTIVITY_SAMPLE_SIZE 8
#define ACTIVITY_MAX_SAMPLES (ACTIVITY_PAYLOAD_SIZE / ACTIVITY_SAMPLE_SIZE) // 60 (480 / 8)

#ifdef CUEBAND_MAXIMUM_SAMPLES_PER_BLOCK
// Overridden for debug purposes
#define ACTIVITY_MAX_SAMPLES (((ACTIVITY_PAYLOAD_SIZE / ACTIVITY_SAMPLE_SIZE) < (CUEBAND_MAXIMUM_SAMPLES_PER_BLOCK)) ? (ACTIVITY_PAYLOAD_SIZE / ACTIVITY_SAMPLE_SIZE) : (CUEBAND_MAXIMUM_SAMPLES_PER_BLOCK))
#else
#define ACTIVITY_MAX_SAMPLES (ACTIVITY_PAYLOAD_SIZE / ACTIVITY_SAMPLE_SIZE) // 60 (480 / 8)
#endif

// If streaming resampled data, the buffer needs to hold a whole resampled FIFOs worth -- otherwise the chunks can be small
#ifdef CUEBAND_STREAM_RESAMPLED
Expand Down
7 changes: 6 additions & 1 deletion src/cueband.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@
#define CUEBAND_POSSIBLE_FIX_FS // The value in FS.h for `size` looks incorrect?


#define CUEBAND_WRITE_TEST_FILE 2000 // If defined, create a test file of ACTIVITY_MAXIMUM_BLOCKS using this value as an offset for the logical sectors (set to a new value to recreate the test file)
//#define CUEBAND_WRITE_TEST_FILE 2000 // If defined, create a test file of ACTIVITY_MAXIMUM_BLOCKS using this value as an offset for the logical sectors (set to a new value to recreate the test file)

#if defined(CUEBAND_WRITE_TEST_FILE) // These values for debugging only
#define CUEBAND_ACTIVITY_EPOCH_INTERVAL 2
#define ACTIVITY_MAXIMUM_BLOCKS 512

#define CUEBAND_MAXIMUM_SAMPLES_PER_BLOCK 5 // Only for debugging (normally derived from available space)
#else
#define CUEBAND_ACTIVITY_EPOCH_INTERVAL 60 // 60
#define ACTIVITY_MAXIMUM_BLOCKS 512 // 512 = 128 kB, ~10 days;
Expand Down Expand Up @@ -220,6 +222,9 @@
#if defined(CUEBAND_DEBUG_DUMMY_MISSING_BLOCKS)
#warning "CUEBAND_DEBUG_DUMMY_MISSING_BLOCKS should not normally be defined"
#endif
#if defined(CUEBAND_MAXIMUM_SAMPLES_PER_BLOCK)
#warning "CUEBAND_MAXIMUM_SAMPLES_PER_BLOCK should not normally be defined (usually all available space is used)"
#endif
#endif

// SystemTask.cpp:
Expand Down

0 comments on commit 34c1511

Please # to comment.