Skip to content

Commit

Permalink
Level Control Server Cluster fix for level transitions (#19392)
Browse files Browse the repository at this point in the history
* fix: level control server handles its own ticks

* chg: restyle

Change-Id: I7fa4e59bb4bc822220de366139fa315e94b8d369

* chg: now using BitMapObjectPool to maintain list of timers running

* chg: restyle

Change-Id: I09f5b3a2e2139aa2ff6fcf078f34ab84263db7c0

* chg: removed debug logs

* chg: only executes emberAfLevelControlClusterServerTickCallback if event still exists on eventEndpoints

* chg: using timer context to embed the endpoint information

* chg: restyle

Change-Id: Iff5c718dacff7624b7af5543bac812711dd646d9

* chg: cosmetic change

Change-Id: I2384a31c63bdd87e0312184112c1cb682712f9b4

* chg: removed unnecessary scheduling of callback

* chg: removed DeviceControlServer.h and included CHIPDeviceLayer.h

* chg: removal of level cluster references from af-gen-event.h files

* Restyled by clang-format

* chg: missed a reference to the level cluster in af-gen-events.h

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jun 27, 2022
1 parent 0a5eee8 commit 5748770
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 215 deletions.
14 changes: 12 additions & 2 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

#include <app/reporting/reporting.h>
#include <platform/CHIPDeviceConfig.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>

#ifdef EMBER_AF_PLUGIN_SCENES
#include <app/clusters/scenes/scenes.h>
Expand Down Expand Up @@ -129,14 +131,22 @@ static void reallyUpdateCoupledColorTemp(EndpointId endpoint);
#define updateCoupledColorTemp(endpoint)
#endif // IGNORE_LEVEL_CONTROL_CLUSTER_OPTIONS && EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP

void emberAfLevelControlClusterServerTickCallback(EndpointId endpoint);

static void timerCallback(System::Layer *, void * callbackContext)
{
emberAfLevelControlClusterServerTickCallback(static_cast<EndpointId>(reinterpret_cast<uintptr_t>(callbackContext)));
}

static void schedule(EndpointId endpoint, uint32_t delayMs)
{
emberAfScheduleServerTickExtended(endpoint, LevelControl::Id, delayMs, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP);
DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(delayMs), timerCallback,
reinterpret_cast<void *>(endpoint));
}

static void deactivate(EndpointId endpoint)
{
emberAfDeactivateServerTick(endpoint, LevelControl::Id);
DeviceLayer::SystemLayer().CancelTimer(timerCallback, reinterpret_cast<void *>(endpoint));
}

static EmberAfLevelControlState * getState(EndpointId endpoint)
Expand Down
18 changes: 4 additions & 14 deletions zzz_generated/all-clusters-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions zzz_generated/bridge-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions zzz_generated/light-switch-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions zzz_generated/lighting-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 0 additions & 32 deletions zzz_generated/pump-app/zap-generated/af-gen-event.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5748770

Please sign in to comment.