From d874cf84b4cb1e503e468ea6690247a17f91e54a Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Wed, 8 Nov 2023 20:39:28 +0100 Subject: [PATCH] Beta - Fix memory overlap in DeviceBuffer (#272) * fix memory overlap in deviceBuffer * correct size also for picos --- src/allocateMem.cpp | 6 +++--- src/allocateMem.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/allocateMem.cpp b/src/allocateMem.cpp index 2fcf2d49..0e2c3789 100644 --- a/src/allocateMem.cpp +++ b/src/allocateMem.cpp @@ -15,9 +15,9 @@ std::size_t deviceBuffer[MF_MAX_DEVICEMEM] = {0}; uint16_t nextPointer = 0; #if defined (ARDUINO_ARCH_AVR) -uint8_t *allocateMemory(uint8_t size) +uint8_t *allocateMemory(uint16_t size) #else -std::size_t *allocateMemory(uint8_t size) +std::size_t *allocateMemory(uint16_t size) #endif { uint16_t actualPointer = nextPointer; @@ -49,7 +49,7 @@ uint16_t GetAvailableMemory() return MF_MAX_DEVICEMEM - nextPointer; } -bool FitInMemory(uint8_t size) +bool FitInMemory(uint16_t size) { if (nextPointer + size > MF_MAX_DEVICEMEM) return false; diff --git a/src/allocateMem.h b/src/allocateMem.h index e9d6f857..4ffb3e04 100644 --- a/src/allocateMem.h +++ b/src/allocateMem.h @@ -9,13 +9,13 @@ #include #if defined (ARDUINO_ARCH_AVR) -uint8_t *allocateMemory(uint8_t size); +uint8_t *allocateMemory(uint16_t size); #else -std::size_t *allocateMemory(uint8_t size); +std::size_t *allocateMemory(uint16_t size); #endif void ClearMemory(); uint16_t GetAvailableMemory(); -bool FitInMemory(uint8_t size); +bool FitInMemory(uint16_t size); // allocatemem.h