From 3ef1112779423e6294343f4991dd14e8dc2b157b Mon Sep 17 00:00:00 2001 From: Fabrizio Monti <fabrizio.monti@skywarder.eu> Date: Mon, 24 Apr 2023 20:50:49 +0000 Subject: [PATCH] [SensorFifo] Updated lastFifoLevel to allow bigger fifo. --- src/shared/sensors/Sensor.h | 4 ++-- src/tests/sensors/test-bmx160.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/sensors/Sensor.h b/src/shared/sensors/Sensor.h index 80c6e8e1a..5cba9b216 100644 --- a/src/shared/sensors/Sensor.h +++ b/src/shared/sensors/Sensor.h @@ -116,7 +116,7 @@ class SensorFIFO : public Sensor<Data> { protected: std::array<Data, FifoSize> lastFifo; - uint8_t lastFifoLevel = 1; ///< number of samples in lastFifo + uint16_t lastFifoLevel = 1; ///< number of samples in lastFifo uint64_t lastInterruptTimestamp = 0; uint64_t interruptTimestampDelta = @@ -139,7 +139,7 @@ public: /** * @return number of elements in the last FIFO sampled from the sensor */ - uint8_t getLastFifoSize() const { return lastFifoLevel; } + uint16_t getLastFifoSize() const { return lastFifoLevel; } /** * @brief Called by the interrupt handling routine: provides the timestamp diff --git a/src/tests/sensors/test-bmx160.cpp b/src/tests/sensors/test-bmx160.cpp index 27f3f332f..43e3cc976 100644 --- a/src/tests/sensors/test-bmx160.cpp +++ b/src/tests/sensors/test-bmx160.cpp @@ -103,9 +103,9 @@ int main() printf("Fill: %d\n", sensor->getLastFifoSize()); printf("----------------------------\n"); - uint8_t len = std::min(sensor->getLastFifoSize(), (uint8_t)5); + uint16_t len = std::min(sensor->getLastFifoSize(), (uint16_t)5); - for (uint8_t i = 0; i < len; i++) + for (uint16_t i = 0; i < len; i++) { BMX160Data data = sensor->getFifoElement(i); printf("Mag [%.4f s]:\t%.2f\t%.2f\t%.2f\n", -- GitLab