diff --git a/EXAMPLE.md b/EXAMPLE.md index 79b94be..4300bc7 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) | Store high sampling rate sensor data on SD cards. | +| [multicore\_logger](examples/multicore_logger) | Multi-core 500 Hz 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/main.c b/examples/multicore_logger/main.c index 61fe629..fb45884 100644 --- a/examples/multicore_logger/main.c +++ b/examples/multicore_logger/main.c @@ -33,16 +33,16 @@ typedef struct { queue_t sensor_queue; -float normal_random(float mean, float stddev) { - static int hasSpare = 0; +static float normal_random(float mean, float stddev) { + static bool has_spare = false; static float spare; - if (hasSpare) { - hasSpare = 0; + if (has_spare) { + has_spare = false; return mean + stddev * spare; } - hasSpare = 1; + has_spare = true; float u, v, s; do { u = (float)rand() / RAND_MAX * 2.0f - 1.0f;