diff --git a/EXAMPLE.md b/EXAMPLE.md index 4300bc7..ac43e41 100644 --- a/EXAMPLE.md +++ b/EXAMPLE.md @@ -4,7 +4,7 @@ |-----------------|-------------------------------------------------------------------------| | [hello](examples/hello) | Hello filesystem world. | | [fs\_inits](examples/fs_inits) | Examples of file system layout combinations. | -| [multicore\_logger](examples/multicore_logger) | Multi-core 500 Hz sampling rate sensor data stored on SD card | +| [multicore\_logger](examples/multicore_logger) | Multi-core 1kHz sampling rate sensor data stored on SD card | | [elastic\_mqtt\_client](examples/elastic_mqtt_client) |Implements an MQTT client with a local queue to handle network disconnections seamlessly. | | [usb\_logger](examples/usb_logger) | Data logger that mounts littlefs and FAT on flash memory and shares it with a PC via USB mass storage class.| | [benchmark](examples/benchmark)| Data transfer tests with different block devices and different file system combinations.| diff --git a/examples/multicore_logger/CMakeLists.txt b/examples/multicore_logger/CMakeLists.txt index 84f540c..94f50ac 100644 --- a/examples/multicore_logger/CMakeLists.txt +++ b/examples/multicore_logger/CMakeLists.txt @@ -1,4 +1,5 @@ add_executable(multicore_logger main.c fs_init.c) +target_compile_options(multicore_logger PRIVATE -O2) target_link_libraries(multicore_logger PRIVATE pico_stdlib pico_util diff --git a/examples/multicore_logger/main.c b/examples/multicore_logger/main.c index fb45884..cb0da51 100644 --- a/examples/multicore_logger/main.c +++ b/examples/multicore_logger/main.c @@ -15,7 +15,7 @@ #include "filesystem/vfs.h" #if !defined(SAMPLING_RATE_HZ) -#define SAMPLING_RATE_HZ 500 +#define SAMPLING_RATE_HZ 1000 #endif typedef struct { @@ -32,6 +32,8 @@ typedef struct { } sensor_data_t; queue_t sensor_queue; +static char write_buffer[1024 * 64]; + static float normal_random(float mean, float stddev) { static bool has_spare = false; @@ -89,6 +91,8 @@ int main(void) { if (fp == NULL) { printf("fopen failed: %s\n", strerror(errno)); } + setvbuf(fp, write_buffer, _IOFBF, sizeof(write_buffer)); + fprintf(fp, "Time,AccelX,AccelY,AccelZ,GyroX,GyroY,GyroZ,MagX,MagY,Magz\n"); multicore_reset_core1();