From 6e8929c89eac051e7e29405193da7d70c67fa2b3 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 26 Jul 2022 12:32:18 +0200 Subject: [PATCH] Force inline because we do not want to use stack space for this function even if compiler has other preferences --- DCCTimer.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/DCCTimer.h b/DCCTimer.h index caffcd8..fa2b854 100644 --- a/DCCTimer.h +++ b/DCCTimer.h @@ -71,11 +71,12 @@ class DCCTimer { // So even if all of the heap is freed, the reported minimum free // memory will not increase. // -static void inline updateMinimumFreeMemoryISR(unsigned char extraBytes=0) { - int spare = freeMemory()-extraBytes; - if (spare < 0) spare = 0; - if (spare < minimum_free_memory) minimum_free_memory = spare; -} + static void inline updateMinimumFreeMemoryISR(unsigned char extraBytes=0) + __attribute__((always_inline)) { + int spare = freeMemory()-extraBytes; + if (spare < 0) spare = 0; + if (spare < minimum_free_memory) minimum_free_memory = spare; + }; static int getMinimumFreeMemory(); static void reset();