From 596b301e4b6acc89c9828c2d3245bfc34b9126d8 Mon Sep 17 00:00:00 2001 From: elral <3263285+elral@users.noreply.github.com> Date: Mon, 19 Dec 2022 09:40:40 +0100 Subject: [PATCH] faulty init on startup, check for available memory --- src/MF_DigInMux/DigInMux.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MF_DigInMux/DigInMux.cpp b/src/MF_DigInMux/DigInMux.cpp index 1f6d2af9..238be323 100644 --- a/src/MF_DigInMux/DigInMux.cpp +++ b/src/MF_DigInMux/DigInMux.cpp @@ -29,11 +29,14 @@ namespace DigInMux if (digInMuxRegistered == MAX_DIGIN_MUX) return; MFDigInMux *dip; + if (!FitInMemory(sizeof(MFDigInMux))) { + // Error Message to Connector + cmdMessenger.sendCmd(kStatus, F("DigInMux does not fit in Memory")); + return; + } dip = new (allocateMemory(sizeof(MFDigInMux))) MFDigInMux(&MUX, name); digInMux[digInMuxRegistered] = dip; dip->attach(dataPin, (nRegs == 1), name); - dip->clear(); - // MFDigInMux::setMux(&MUX); MFDigInMux::attachHandler(handlerOnDigInMux); digInMuxRegistered++;