Skip to content

Commit

Permalink
[Silabs] Fix for thermostat app hang issue on 917SoC (project-chip#35721
Browse files Browse the repository at this point in the history
)

* Add ScheduleWork by removing LockChipStack and UnlockChipStack in SensorTimerEventHandler.

* Restyled by clang-format

* Modified the API name as suggested.

* Posting SensorTimerEventHandler as an event to AppTask.

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
arun-silabs and restyled-commits authored Oct 24, 2024
1 parent 8852bbe commit 6ee1913
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/thermostat/silabs/include/SensorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class SensorManager

osTimerId_t mSensorTimer;

// Reads new generated sensor value, stores it, and updates local temperature attribute
static void SensorTimerEventHandler(void * arg);
// Reads new generated sensor value, stores it, and updates local temperature attribute
static void TemperatureUpdateEventHandler(AppEvent * aEvent);

static SensorManager sSensorManager;
};
Expand Down
9 changes: 9 additions & 0 deletions examples/thermostat/silabs/src/SensorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ CHIP_ERROR SensorManager::Init()
}

void SensorManager::SensorTimerEventHandler(void * arg)
{
AppEvent event;
event.Type = AppEvent::kEventType_Timer;
event.Handler = TemperatureUpdateEventHandler;

AppTask::GetAppTask().PostEvent(&event);
}

void SensorManager::TemperatureUpdateEventHandler(AppEvent * aEvent)
{
int16_t temperature = 0;
static int16_t lastTemperature = 0;
Expand Down

0 comments on commit 6ee1913

Please sign in to comment.