From 4cad4de390b9caaff037c2b05ce8b5c4038069bd Mon Sep 17 00:00:00 2001 From: Simon Billemont Date: Mon, 18 Apr 2022 08:37:33 +0200 Subject: [PATCH] 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);