From 3b1629d34a7d9455ea233b31873786f6479a40da Mon Sep 17 00:00:00 2001 From: dario Date: Thu, 10 Oct 2024 14:09:34 +0200 Subject: [PATCH] Removed reading from buffer --- include/sta/utils/logger.tpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/include/sta/utils/logger.tpp b/include/sta/utils/logger.tpp index d46b369..b125de9 100644 --- a/include/sta/utils/logger.tpp +++ b/include/sta/utils/logger.tpp @@ -188,17 +188,10 @@ namespace sta uint32_t address = start_ * W25QXX_SECTOR_SIZE + i * sizeof(T); // If the requested element is in the cache, read it from there. - if (address / W25QXX_PAGE_SIZE == address_ / W25QXX_PAGE_SIZE) - { - uint8_t * ptr = buffer_ + address % W25QXX_PAGE_SIZE; - return *reinterpret_cast(ptr); - } - else - { - uint8_t buffer[sizeof(T)]; - flash_->readData(address, buffer, sizeof(T)); - return *reinterpret_cast(buffer); - } + + uint8_t buffer[sizeof(T)]; + flash_->readData(address, buffer, sizeof(T)); + return *reinterpret_cast(buffer); } } // namespace sta