From 29702f69c3268c4a9fc7dd941c3d6e000b348646 Mon Sep 17 00:00:00 2001 From: Simon Billemont Date: Tue, 19 Apr 2022 09:51:36 +0200 Subject: [PATCH] Fix #191 by initializing the platform pointer in all KnxFacade constructors (#198) * Fix #191 by initializing the platform pointer in all KnxFacade constructors * Revert "Fix #191 by initializing the platform pointer in all KnxFacade constructors" This reverts commit adc05cfaf706be20031dcff8e354f612a46aeaa6. * Alternative fix for #191 by initializing the platform pointer in KnxFacade(&bau) from the platform stored in bau --- src/knx/bau_systemB.cpp | 5 +++++ src/knx/bau_systemB.h | 1 + src/knx_facade.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/knx/bau_systemB.cpp b/src/knx/bau_systemB.cpp index 05765e8..572dd4a 100644 --- a/src/knx/bau_systemB.cpp +++ b/src/knx/bau_systemB.cpp @@ -31,6 +31,11 @@ void BauSystemB::writeMemory() _memory.writeMemory(); } +Platform& BauSystemB::platform() +{ + return _platform; +} + ApplicationProgramObject& BauSystemB::parameters() { return _appProgram; diff --git a/src/knx/bau_systemB.h b/src/knx/bau_systemB.h index 674fb34..dfbced6 100644 --- a/src/knx/bau_systemB.h +++ b/src/knx/bau_systemB.h @@ -21,6 +21,7 @@ class BauSystemB : protected BusAccessUnit virtual bool enabled() = 0; virtual void enabled(bool value) = 0; + Platform& platform(); ApplicationProgramObject& parameters(); DeviceObject& deviceObject(); diff --git a/src/knx_facade.h b/src/knx_facade.h index dbd303a..0b75248 100644 --- a/src/knx_facade.h +++ b/src/knx_facade.h @@ -73,6 +73,7 @@ template class KnxFacade : private SaveRestore KnxFacade(B& bau) : _bau(bau) { + _platformPtr = static_cast(&bau.platform()); manufacturerId(0xfa); bauNumber(platform().uniqueSerialNumber()); _bau.addSaveRestore(this);