Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Fixed LCD animations for window-app #29675

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance()));
#endif /* SL_WIFI */

bool sIsProvisioned = false;

#if !(defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER)
bool sIsEnabled = false;
bool sIsAttached = false;
Expand Down Expand Up @@ -148,6 +146,7 @@ Identify gIdentify = {

#endif // EMBER_AF_PLUGIN_IDENTIFY_SERVER
} // namespace
bool BaseApplication::sIsProvisioned = false;

#ifdef DIC_ENABLE
namespace {
Expand Down Expand Up @@ -259,10 +258,10 @@ CHIP_ERROR BaseApplication::Init()

PlatformMgr().AddEventHandler(OnPlatformEvent, 0);
#ifdef SL_WIFI
sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned();
BaseApplication::sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned();
#endif /* SL_WIFI */
#if CHIP_ENABLE_OPENTHREAD
sIsProvisioned = ConnectivityMgr().IsThreadProvisioned();
BaseApplication::sIsProvisioned = ConnectivityMgr().IsThreadProvisioned();
#endif

return err;
Expand Down Expand Up @@ -375,7 +374,7 @@ bool BaseApplication::ActivateStatusLedPatterns()
if (!isPatternSet)
{
// Apply different status feedbacks
if (sIsProvisioned && sIsEnabled)
if (BaseApplication::sIsProvisioned && sIsEnabled)
{
if (sIsAttached)
{
Expand Down Expand Up @@ -413,9 +412,9 @@ void BaseApplication::LightEventHandler()
if (PlatformMgr().TryLockChipStack())
{
#ifdef SL_WIFI
sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned();
sIsEnabled = ConnectivityMgr().IsWiFiStationEnabled();
sIsAttached = ConnectivityMgr().IsWiFiStationConnected();
BaseApplication::sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned();
sIsEnabled = ConnectivityMgr().IsWiFiStationEnabled();
sIsAttached = ConnectivityMgr().IsWiFiStationConnected();
#endif /* SL_WIFI */
#if CHIP_ENABLE_OPENTHREAD
sIsEnabled = ConnectivityMgr().IsThreadEnabled();
Expand Down Expand Up @@ -491,7 +490,7 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
#ifdef SL_WIFI
if (!ConnectivityMgr().IsWiFiStationProvisioned())
#else
if (!sIsProvisioned)
if (!BaseApplication::sIsProvisioned)
#endif /* !SL_WIFI */
{
// Open Basic CommissioningWindow. Will start BLE advertisements
Expand Down Expand Up @@ -722,7 +721,7 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
{
if (event->Type == DeviceEventType::kServiceProvisioningChange)
{
sIsProvisioned = event->ServiceProvisioningChange.IsServiceProvisioned;
BaseApplication::sIsProvisioned = event->ServiceProvisioningChange.IsServiceProvisioned;
}
}

Expand Down Expand Up @@ -752,3 +751,8 @@ void BaseApplication::OutputQrCode(bool refreshLCD)
SILABS_LOG("Getting QR code failed!");
}
}

bool BaseApplication::getWifiProvisionStatus()
{
return BaseApplication::sIsProvisioned;
}
2 changes: 2 additions & 0 deletions examples/platform/silabs/BaseApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class BaseApplication
public:
BaseApplication() = default;
virtual ~BaseApplication(){};
static bool sIsProvisioned;

/**
* @brief Create AppTask task and Event Queue
Expand Down Expand Up @@ -103,6 +104,7 @@ class BaseApplication
* Turns off Status LED before stopping timer
*/
static void StopStatusLEDTimer(void);
static bool getWifiProvisionStatus(void);

#ifdef EMBER_AF_PLUGIN_IDENTIFY_SERVER
// Idenfiy server command callbacks.
Expand Down
1 change: 0 additions & 1 deletion examples/window-app/silabs/include/WindowManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class WindowManager

LEDWidget mStatusLED;
LEDWidget mActionLED;

#ifdef DISPLAY_ENABLED
Timer mIconTimer;
LcdIcon mIcon = LcdIcon::None;
Expand Down
28 changes: 1 addition & 27 deletions examples/window-app/silabs/src/WindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,30 +657,6 @@ void WindowManager::UpdateLEDs()
}
else
{
if (mState.isWinking)
{
mStatusLED.Blink(200, 200);
}
else
#if CHIP_ENABLE_OPENTHREAD
if (mState.isThreadProvisioned && mState.isThreadEnabled)
#else
if (mState.isWiFiProvisioned && mState.isWiFiEnabled)
#endif

{

mStatusLED.Blink(950, 50);
}
else if (mState.haveBLEConnections)
{
mStatusLED.Blink(100, 100);
}
else
{
mStatusLED.Blink(50, 950);
}

// Action LED
NPercent100ths current;
LimitStatus liftLimit = LimitStatus::Intermediate;
Expand Down Expand Up @@ -725,7 +701,7 @@ void WindowManager::UpdateLCD()
#if CHIP_ENABLE_OPENTHREAD
if (mState.isThreadProvisioned)
#else
if (mState.isWiFiProvisioned)
if (BaseApplication::getWifiProvisionStatus())
#endif // CHIP_ENABLE_OPENTHREAD
{
Cover & cover = GetCover();
Expand All @@ -739,12 +715,10 @@ void WindowManager::UpdateLCD()
Attributes::CurrentPositionTilt::Get(cover.mEndpoint, tilt);
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

#ifdef DISPLAY_ENABLED
jmartinez-silabs marked this conversation as resolved.
Show resolved Hide resolved
if (!tilt.IsNull() && !lift.IsNull())
{
LcdPainter::Paint(slLCD, type, lift.Value(), tilt.Value(), mIcon);
}
#endif
}
#endif // DISPLAY_ENABLED
}
Expand Down