Skip to content

Commit

Permalink
chg: misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rochaferraz committed Feb 11, 2023
1 parent 2d53fb8 commit 2dd2edb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**********************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

/**********************************************************
Expand Down
1 change: 1 addition & 0 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void *>(static_cast<uintptr_t>(endpoint)));
}

Expand Down
5 changes: 4 additions & 1 deletion src/app/clusters/on-off-server/on-off-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/on-off-server/on-off-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
9 changes: 5 additions & 4 deletions src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 2dd2edb

Please sign in to comment.