Skip to content

Commit

Permalink
Add Status Screen and Update default bitmap (#29195)
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs authored and pull[bot] committed Feb 5, 2024
1 parent bc3ec4a commit 1b99de2
Show file tree
Hide file tree
Showing 9 changed files with 164 additions and 74 deletions.
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ CHIP_ERROR AppTask::Init()
if (!ConnectivityMgr().IsThreadProvisioned())
#endif /* !SL_WIFI */
{
GetLCD().ShowQRCode(true, true);
GetLCD().ShowQRCode(true);
}
#endif // QR_CODE_ENABLED
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ CHIP_ERROR AppTask::Init()
if (!ConnectivityMgr().IsThreadProvisioned())
#endif /* !SL_WIFI */
{
GetLCD().ShowQRCode(true, true);
GetLCD().ShowQRCode(true);
}
#endif // QR_CODE_ENABLED
#endif
Expand Down
17 changes: 13 additions & 4 deletions examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ bool BaseApplication::ActivateStatusLedPatterns()
return isPatternSet;
}

// TODO Move State Monitoring elsewhere
void BaseApplication::LightEventHandler()
{
// Collect connectivity and configuration state from the CHIP stack. Because
Expand All @@ -420,8 +421,17 @@ void BaseApplication::LightEventHandler()
sIsAttached = ConnectivityMgr().IsThreadAttached();
#endif /* CHIP_ENABLE_OPENTHREAD */
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);

#ifdef DISPLAY_ENABLED
SilabsLCD::DisplayStatus_t status;
status.connected = sIsEnabled && sIsAttached;
status.advertising = chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen();
status.nbFabric = chip::Server::GetInstance().GetFabricTable().FabricCount();
slLCD.SetStatus(status);
#endif
PlatformMgr().UnlockChipStack();
}

#endif // CHIP_CONFIG_ENABLE_ICD_SERVER

#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917)))
Expand Down Expand Up @@ -473,9 +483,8 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
mFunction = kFunction_NoneSelected;

OutputQrCode(false);
#ifdef QR_CODE_ENABLED
// TOGGLE QRCode/LCD demo UI
slLCD.ToggleQRCode();
#ifdef DISPLAY_ENABLED
slLCD.CycleScreens();
#endif

#ifdef SL_WIFI
Expand Down Expand Up @@ -732,7 +741,7 @@ void BaseApplication::OutputQrCode(bool refreshLCD)
if (refreshLCD)
{
slLCD.SetQRCode((uint8_t *) setupPayload.data(), setupPayload.size());
slLCD.ShowQRCode(true, true);
slLCD.ShowQRCode(true);
}
#endif // QR_CODE_ENABLED

Expand Down
73 changes: 24 additions & 49 deletions examples/platform/silabs/display/demo-ui-bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,63 +98,38 @@
0x7F, 0xFC, 0xFC, 0xFC, 0xE3, 0xF1, 0x87, 0x87, 0xC7, 0xDE, 0x88, 0x33, 0xC7, 0xCF, 0xFC, 0xFF, 0xFF, 0x03

#ifndef ON_DEMO_BITMAP // Unknown demo....

#define ON_DEMO_BITMAP \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 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xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
#define OFF_DEMO_BITMAP ON_DEMO_BITMAP
#endif

#endif // SILABS_DEMO_UI_BITMAPS_H
110 changes: 97 additions & 13 deletions examples/platform/silabs/display/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,10 @@ int SilabsLCD::Update(void)

void SilabsLCD::WriteDemoUI(bool state)
{
#ifdef QR_CODE_ENABLED
if (mShowQRCode)
if (mCurrentScreen != DemoScreen)
{
mShowQRCode = false;
mCurrentScreen = DemoScreen;
}
#endif
dState.mainState = state;
WriteDemoUI();
}
Expand All @@ -149,11 +147,102 @@ void SilabsLCD::WriteDemoUI()
}
}

void SilabsLCD::WriteStatus()
{
uint8_t lineNb = 0;
char str[20];

GLIB_clear(&glibContext);
sprintf(str, "# Fabrics : %d", mStatus.nbFabric);
GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);

if (strlen(mStatus.networkName) >= sizeof(str))
{
memcpy(str, mStatus.networkName, sizeof(str) - 1);
str[sizeof(str) - 1] = '\0';
}
else
{
memcpy(str, mStatus.networkName, sizeof(str));
}

#if SL_WIFI
GLIB_drawStringOnLine(&glibContext, "SSID : ", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
#else
GLIB_drawStringOnLine(&glibContext, "PANID : ", lineNb, GLIB_ALIGN_LEFT, 0, 0, true);
GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 64, 0, true);
#if CHIP_DEVICE_CONFIG_THREAD_FTD
GLIB_drawStringOnLine(&glibContext, "OT Type : FTD", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
#else
GLIB_drawStringOnLine(&glibContext, "OT Type : MTD", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
#endif // FTD
#endif
GLIB_drawStringOnLine(&glibContext, "", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
sprintf(str, "Connected : %c", mStatus.connected ? 'Y' : 'N');
GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
sprintf(str, "Advertising : %c", mStatus.advertising ? 'Y' : 'N');
GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
#if CHIP_CONFIG_ENABLE_ICD_SERVER
GLIB_drawStringOnLine(&glibContext, "Is ICD : Y", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
#else
GLIB_drawStringOnLine(&glibContext, "Is ICD : N", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true);
#endif

updateDisplay();
}

void SilabsLCD::SetCustomUI(customUICB cb)
{
customUI = cb;
}

void SilabsLCD::SetScreen(Screen_e screen)
{
if (screen >= InvalidScreen)
{
return;
}

switch (screen)
{
case DemoScreen:
WriteDemoUI();
break;
case StatusScreen:
WriteStatus();
break;
case QRCodeScreen:
WriteQRCode();
break;
default:
break;
}
}

void SilabsLCD::CycleScreens(void)
{
#ifdef QR_CODE_ENABLED
if (mCurrentScreen < QRCodeScreen)
#elif
if (mCurrentScreen < StatusScreen)
#endif
{
mCurrentScreen++;
}
else
{
mCurrentScreen = DemoScreen;
}

SetScreen(static_cast<Screen_e>(mCurrentScreen));
}

void SilabsLCD::SetStatus(DisplayStatus_t & status)
{
mStatus = status;
}

#ifdef QR_CODE_ENABLED
void SilabsLCD::WriteQRCode()
{
Expand Down Expand Up @@ -194,19 +283,14 @@ void SilabsLCD::SetQRCode(uint8_t * str, uint32_t size)
}
}

void SilabsLCD::ShowQRCode(bool show, bool forceRefresh)
void SilabsLCD::ShowQRCode(bool show)
{
if (show != mShowQRCode || forceRefresh)
if (mCurrentScreen != QRCodeScreen)
{
(show) ? WriteQRCode() : WriteDemoUI();
mShowQRCode = show;
mCurrentScreen = QRCodeScreen;
}
}

void SilabsLCD::ToggleQRCode(void)
{
(mShowQRCode) ? WriteDemoUI() : WriteQRCode();
mShowQRCode = !mShowQRCode;
WriteQRCode();
}

void SilabsLCD::LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
Expand Down
28 changes: 25 additions & 3 deletions examples/platform/silabs/display/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ class SilabsLCD
{

public:
typedef enum screen
{
DemoScreen = 0,
StatusScreen,
QRCodeScreen,
InvalidScreen,
} Screen_e;

typedef struct dStatus
{
uint8_t nbFabric = 0;
bool connected = false;
char networkName[50] = { "TODO" };
bool advertising = false;
} DisplayStatus_t;

typedef void (*customUICB)(GLIB_Context_t * context);
CHIP_ERROR Init(uint8_t * name = nullptr, bool initialState = false);
void * Context();
Expand All @@ -42,10 +58,13 @@ class SilabsLCD
void WriteDemoUI(bool state);
void SetCustomUI(customUICB cb);

void SetScreen(Screen_e screen);
void CycleScreens(void);
void SetStatus(DisplayStatus_t & status);

#ifdef QR_CODE_ENABLED
void SetQRCode(uint8_t * str, uint32_t size);
void ShowQRCode(bool show, bool forceRefresh = false);
void ToggleQRCode(void);
void ShowQRCode(bool show);
#endif

private:
Expand All @@ -57,10 +76,10 @@ class SilabsLCD

void WriteQRCode();
void WriteDemoUI();
void WriteStatus();
#ifdef QR_CODE_ENABLED
void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1];
bool mShowQRCode = true;
#endif
GLIB_Context_t glibContext;

Expand All @@ -71,4 +90,7 @@ class SilabsLCD
#endif
customUICB customUI = nullptr;
DemoState_t dState;

DisplayStatus_t mStatus;
uint8_t mCurrentScreen = DemoScreen;
};
2 changes: 1 addition & 1 deletion examples/pump-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CHIP_ERROR AppTask::Init()
if (!ConnectivityMgr().IsThreadProvisioned())
#endif /* !SL_WIFI */
{
GetLCD().ShowQRCode(true, true);
GetLCD().ShowQRCode(true);
}
#endif // QR_CODE_ENABLED
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/smoke-co-alarm-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CHIP_ERROR AppTask::Init()
if (!ConnectivityMgr().IsThreadProvisioned())
#endif /* !SL_WIFI */
{
GetLCD().ShowQRCode(true, true);
GetLCD().ShowQRCode(true);
}
#endif // QR_CODE_ENABLED
#endif
Expand Down
2 changes: 1 addition & 1 deletion examples/window-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ CHIP_ERROR AppTask::Init()
if (!ConnectivityMgr().IsThreadProvisioned())
#endif /* !SL_WIFI */
{
GetLCD().ShowQRCode(true, true);
GetLCD().ShowQRCode(true);
}
#endif // QR_CODE_ENABLED
#endif
Expand Down

0 comments on commit 1b99de2

Please sign in to comment.