From e6b445aea92401eb80a2dd6543215e9a5b945128 Mon Sep 17 00:00:00 2001 From: Arun Padakanti Date: Tue, 10 Oct 2023 16:52:55 +0530 Subject: [PATCH] Fixed LCD animations for window-app --- .../window-app/silabs/include/WindowManager.h | 3 ++- .../window-app/silabs/src/WindowManager.cpp | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/window-app/silabs/include/WindowManager.h b/examples/window-app/silabs/include/WindowManager.h index 0249ddc5e67051..980d2ef3bd21a8 100644 --- a/examples/window-app/silabs/include/WindowManager.h +++ b/examples/window-app/silabs/include/WindowManager.h @@ -160,7 +160,8 @@ class WindowManager LEDWidget mStatusLED; LEDWidget mActionLED; - + // Get QR Code and emulate its content using NFC tag + char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; #ifdef DISPLAY_ENABLED Timer mIconTimer; LcdIcon mIcon = LcdIcon::None; diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index 851a818e9ec485..879d8922e96dbb 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -664,7 +664,7 @@ void WindowManager::UpdateLEDs() #if CHIP_ENABLE_OPENTHREAD if (mState.isThreadProvisioned && mState.isThreadEnabled) #else - if (mState.isWiFiProvisioned && mState.isWiFiEnabled) + if (ConnectivityMgr().IsWiFiStationProvisioned() && ConnectivityMgr().IsWiFiStationEnabled()) #endif { @@ -724,7 +724,8 @@ void WindowManager::UpdateLCD() #if CHIP_ENABLE_OPENTHREAD if (mState.isThreadProvisioned) #else - if (mState.isWiFiProvisioned) + // if (mState.isWiFiProvisioned) + if (ConnectivityMgr().IsWiFiStationProvisioned()) #endif // CHIP_ENABLE_OPENTHREAD { Cover & cover = GetCover(); @@ -738,13 +739,22 @@ void WindowManager::UpdateLCD() Attributes::CurrentPositionTilt::Get(cover.mEndpoint, tilt); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); -#ifdef DISPLAY_ENABLED if (!tilt.IsNull() && !lift.IsNull()) { LcdPainter::Paint(slLCD, type, lift.Value(), tilt.Value(), mIcon); } -#endif } +#ifdef QR_CODE_ENABLED + else + { + chip::MutableCharSpan qrCode(mQRCodeBuffer); + if (GetQRCode(qrCode, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)) == CHIP_NO_ERROR) + { + slLCD.SetQRCode((uint8_t *) qrCode.data(), qrCode.size()); + slLCD.ShowQRCode(true); + } + } +#endif // QR_CODE_ENABLED #endif // DISPLAY_ENABLED }