From 2dd2edb9a31df718ea7b41c47735aba94e84ec32 Mon Sep 17 00:00:00 2001 From: Doug Ferraz Date: Fri, 10 Feb 2023 18:48:55 +0000 Subject: [PATCH] chg: misc fixes --- .../color-control-server/color-control-server.cpp | 4 +++- .../clusters/color-control-server/color-control-server.h | 2 +- src/app/clusters/level-control/level-control.cpp | 1 + src/app/clusters/on-off-server/on-off-server.cpp | 5 ++++- src/app/clusters/on-off-server/on-off-server.h | 2 +- src/app/util/attribute-storage.cpp | 9 +++++---- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index eb1566aa0363a2..c4a96a0bb4d6b3 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -66,7 +66,9 @@ void ColorControlServer::cancelEndpointTimerCallback(EmberEventControl * control void ColorControlServer::cancelEndpointTimerCallback(EndpointId endpoint) { auto control = ColorControlServer::getEventControl(endpoint); - cancelEndpointTimerCallback(control); + if (control) { + cancelEndpointTimerCallback(control); + } } /********************************************************** diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index c6547e01f6dc83..4321397350b2b1 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -247,7 +247,7 @@ class ColorControlServer Color16uTransitionState colorTempTransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; #endif // EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP - EmberEventControl eventControls[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; + EmberEventControl eventControls[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; }; /********************************************************** diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 728f919ed93bde..e8f3a6819d462a 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -1294,6 +1294,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint) void MatterLevelControlClusterServerShutdownCallback(EndpointId endpoint) { + emberAfOnOffClusterPrintln("Shuting down level control server cluster on endpoint %d", endpoint); DeviceLayer::SystemLayer().CancelTimer(timerCallback, reinterpret_cast(static_cast(endpoint))); } diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 4d9373768c9d6b..11334affe85053 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -88,11 +88,14 @@ void OnOffServer::cancelEndpointTimerCallback(EmberEventControl * control) void OnOffServer::cancelEndpointTimerCallback(EndpointId endpoint) { auto control = OnOffServer::getEventControl(endpoint); - cancelEndpointTimerCallback(control); + if (control) { + cancelEndpointTimerCallback(control); + } } void MatterOnOffClusterServerShutdownCallback(EndpointId endpoint) { + emberAfOnOffClusterPrintln("Shuting down on/off server cluster on endpoint %d", endpoint); OnOffServer::Instance().cancelEndpointTimerCallback(endpoint); } diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index c7f89b36427c1f..7dde74374b8171 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -93,7 +93,7 @@ class OnOffServer *********************************************************/ static OnOffServer instance; - EmberEventControl eventControls[EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT]; + EmberEventControl eventControls[EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; chip::System::Clock::Timestamp nextDesiredOnWithTimedOffTimestamp; }; diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 194317de17f2fd..3306dbf65c303f 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -904,10 +904,6 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) { emAfEndpoints[index].bitmask |= EMBER_AF_ENDPOINT_ENABLED; } - else - { - emAfEndpoints[index].bitmask &= EMBER_AF_ENDPOINT_DISABLED; - } #if defined(EZSP_HOST) ezspSetEndpointFlags(endpoint, (enable ? EZSP_ENDPOINT_ENABLED : EZSP_ENDPOINT_DISABLED)); @@ -943,6 +939,11 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) app::Clusters::Descriptor::Attributes::PartsList::Id); } + if (!enable) + { + emAfEndpoints[index].bitmask &= EMBER_AF_ENDPOINT_DISABLED; + } + return true; }