-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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] Adds LCD timeouts for ICD applications #34703
base: master
Are you sure you want to change the base?
[Silabs] Adds LCD timeouts for ICD applications #34703
Conversation
PR #34703: Size comparison from c7f5f65 to cc6b477 Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from 6f84526 to 6519853 Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from bbef51a to f9144fc Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
@@ -234,7 +234,10 @@ CHIP_ERROR AppTask::Init() | |||
GetLCD().ShowQRCode(true); | |||
} | |||
#endif // QR_CODE_ENABLED | |||
#endif | |||
#ifdef SL_ENABLE_ICD_LCD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this define already exist or is it supposed to be added in a .gn file in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be added to the .gn file in this PR, enabled on the sleepy applications as requested.
PR #34703: Size comparison from 653a55f to 2ea2f43 Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from 83dc1c8 to 3f9c68e Full report (84 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from 298b454 to 4713073 Full report (82 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, stm32, telink, tizen)
|
4713073
to
6ca77a7
Compare
PR #34703: Size comparison from 3b90fed to 6ca77a7 Full report (81 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from 3b90fed to 776b15a Full report (81 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
776b15a
to
f315763
Compare
PR #34703: Size comparison from a068855 to f315763 Full report (78 builds for bl602, bl702, bl702l, cyw30739, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
@@ -126,7 +128,30 @@ int SilabsLCD::DrawPixel(void * pContext, int32_t x, int32_t y) | |||
|
|||
int SilabsLCD::Update(void) | |||
{ | |||
return updateDisplay(); | |||
int status = 0; | |||
#ifdef SL_ENABLE_ICD_LCD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this is defined But I'd also suggest a more specific name to what it enables.
SL_MATTER_TIMED_SCREEN_DISPLAY
int status = 0; | ||
#ifdef SL_ENABLE_ICD_LCD | ||
SilabsLCD::TurnOn(); | ||
#endif // SL_ENABLE_ICD_LCD | ||
status = updateDisplay(); | ||
#ifdef SL_ENABLE_ICD_LCD | ||
switch (mCurrentScreen) | ||
{ | ||
case DemoScreen: | ||
SilabsLCD::TurnOff(kActivityLCDTimeout); | ||
break; | ||
case StatusScreen: | ||
SilabsLCD::TurnOff(kActivityLCDTimeout); | ||
break; | ||
#ifdef QR_CODE_ENABLED | ||
case QRCodeScreen: | ||
SilabsLCD::TurnOff(kQRCodeScreenTimeout); | ||
break; | ||
#endif // QR_CODE_ENABLED | ||
default: | ||
break; | ||
} | ||
#endif // SL_ENABLE_ICD_LCD | ||
return status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use #if rather than #ifdef and make sure the define always exist (1/0)
Also to limit the use of #if and simplify the code I suggest making one function that will turn on the screen and start the timer to turn it off and only use 1 Timeout value for all screen activities.
int status = 0; | |
#ifdef SL_ENABLE_ICD_LCD | |
SilabsLCD::TurnOn(); | |
#endif // SL_ENABLE_ICD_LCD | |
status = updateDisplay(); | |
#ifdef SL_ENABLE_ICD_LCD | |
switch (mCurrentScreen) | |
{ | |
case DemoScreen: | |
SilabsLCD::TurnOff(kActivityLCDTimeout); | |
break; | |
case StatusScreen: | |
SilabsLCD::TurnOff(kActivityLCDTimeout); | |
break; | |
#ifdef QR_CODE_ENABLED | |
case QRCodeScreen: | |
SilabsLCD::TurnOff(kQRCodeScreenTimeout); | |
break; | |
#endif // QR_CODE_ENABLED | |
default: | |
break; | |
} | |
#endif // SL_ENABLE_ICD_LCD | |
return status; | |
#if SL_MATTER_TIMED_SCREEN_DISPLAY | |
SilabsLCD::TimedScreenDisplay(kActivityLCDTimeout); | |
#endif | |
return updateDisplay(); |
#ifdef SL_ENABLE_ICD_LCD | ||
CHIP_ERROR SilabsLCD::TurnOff(uint32_t delayInMs) | ||
{ | ||
sl_sleeptimer_restart_timer(&lcdTimerHandle, sl_sleeptimer_ms_to_tick(delayInMs), LcdTimeoutCallback, this, 0, | ||
SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG); | ||
return CHIP_NO_ERROR; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifdef SL_ENABLE_ICD_LCD | |
CHIP_ERROR SilabsLCD::TurnOff(uint32_t delayInMs) | |
{ | |
sl_sleeptimer_restart_timer(&lcdTimerHandle, sl_sleeptimer_ms_to_tick(delayInMs), LcdTimeoutCallback, this, 0, | |
SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG); | |
return CHIP_NO_ERROR; | |
} | |
#if SL_MATTER_TIMED_SCREEN_DISPLAY | |
void SilabsLCD::TimedScreenDisplay(uint32_t screenDisplayDurationMs); | |
{ | |
TurnOn(); | |
sl_sleeptimer_restart_timer(&lcdTimerHandle, sl_sleeptimer_ms_to_tick(screenDisplayDurationMs), LcdTimeoutCallback, this, 0, | |
SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG); | |
} |
DemoState_t dState; | ||
|
||
DisplayStatus_t mStatus; | ||
uint8_t mCurrentScreen = DemoScreen; | ||
|
||
#ifdef SL_ENABLE_ICD_LCD | ||
sl_sleeptimer_timer_handle_t lcdTimerHandle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the advantage of using the sleepTimer vs a cmsisosTimer or a ScheduleWork?
f315763
to
989df66
Compare
PR #34703: Size comparison from 1348a8a to 989df66 Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from f2339f8 to 25258c4 Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #34703: Size comparison from 16e3971 to 3eb6356 Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Improve the LCD usage for ICD applications.
defaultTimeoutMs
(3 seconds)2.1. BTN0 press, if screen is QR code screen then turn off the LCD after
QRCodeTimeoutMs
(10 seconds)2.2. BTN1 press, bring up the state change screen for
activityTimeoutMs
(5 seconds).2.3. Device state change observed due to action from controller, show the state change screen for
activityTimeoutMs
(5 seconds).