From 089a9b06c3770c6b4522762076f972d821cd1af6 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 18 Sep 2023 12:03:49 -0400 Subject: [PATCH] Fix silabs compile - `#elif` without a condition replaced with `#else` (#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 --- examples/platform/silabs/display/lcd.cpp | 4 +++- examples/platform/silabs/display/lcd.h | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index 7a18951dd54b06..b4baa7ea63547e 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -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; } @@ -224,7 +226,7 @@ void SilabsLCD::CycleScreens(void) { #ifdef QR_CODE_ENABLED if (mCurrentScreen < QRCodeScreen) -#elif +#else if (mCurrentScreen < StatusScreen) #endif { diff --git a/examples/platform/silabs/display/lcd.h b/examples/platform/silabs/display/lcd.h index 085dd7ef8d6240..9324f068b15742 100644 --- a/examples/platform/silabs/display/lcd.h +++ b/examples/platform/silabs/display/lcd.h @@ -37,7 +37,9 @@ class SilabsLCD { DemoScreen = 0, StatusScreen, +#ifdef QR_CODE_ENABLED QRCodeScreen, +#endif InvalidScreen, } Screen_e; @@ -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