Skip to content

Commit

Permalink
Fix silabs compile - #elif without a condition replaced with #else (
Browse files Browse the repository at this point in the history
project-chip#29319)

* Replace elif with else in macro

* Fix undefined usage of WriteQRCode as well

* Restyle

* Slightly better organization - a single ifdef in the header

* Refuse to compile the QRCodeScreen constant if qr code is not enabled
  • Loading branch information
andy31415 authored Sep 18, 2023
1 parent 627e9b3 commit 63397c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/platform/silabs/display/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ void SilabsLCD::SetScreen(Screen_e screen)
case StatusScreen:
WriteStatus();
break;
#ifdef QR_CODE_ENABLED
case QRCodeScreen:
WriteQRCode();
break;
#endif
default:
break;
}
Expand All @@ -224,7 +226,7 @@ void SilabsLCD::CycleScreens(void)
{
#ifdef QR_CODE_ENABLED
if (mCurrentScreen < QRCodeScreen)
#elif
#else
if (mCurrentScreen < StatusScreen)
#endif
{
Expand Down
6 changes: 5 additions & 1 deletion examples/platform/silabs/display/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class SilabsLCD
{
DemoScreen = 0,
StatusScreen,
#ifdef QR_CODE_ENABLED
QRCodeScreen,
#endif
InvalidScreen,
} Screen_e;

Expand Down Expand Up @@ -74,13 +76,15 @@ class SilabsLCD
bool protocol1 = false; /* data */
} DemoState_t;

void WriteQRCode();
void WriteDemoUI();
void WriteStatus();

#ifdef QR_CODE_ENABLED
void WriteQRCode();
void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1];
#endif

GLIB_Context_t glibContext;

#ifdef SL_DEMO_NAME
Expand Down

0 comments on commit 63397c3

Please sign in to comment.