@@ -251,7 +251,10 @@ void BaseApplicationDelegate::OnCommissioningWindowClosed()
251
251
SilabsLCD::Screen_e screen;
252
252
slLCD.GetScreen (screen);
253
253
VerifyOrReturn (screen == SilabsLCD::Screen_e::QRCodeScreen);
254
- slLCD.SetScreen (SilabsLCD::Screen_e::DemoScreen);
254
+ AppEvent event;
255
+ event.Type = AppEvent::kEventType_LCD ;
256
+ event.Handler = AppTask::GetAppTask ().UpdateDisplayHandler ;
257
+ BaseApplication::PostEvent (&event);
255
258
#endif // QR_CODE_ENABLED
256
259
#endif // DISPLAY_ENABLED
257
260
}
@@ -597,8 +600,6 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
597
600
// - Cycle LCD screen
598
601
CancelFunctionTimer ();
599
602
600
- AppTask::GetAppTask ().UpdateDisplay ();
601
-
602
603
#ifdef SL_WIFI
603
604
if (!ConnectivityMgr ().IsWiFiStationProvisioned ())
604
605
#else
@@ -622,10 +623,21 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
622
623
PlatformMgr ().ScheduleWork ([](intptr_t ) { ICDNotifier::GetInstance ().NotifyNetworkActivityNotification (); });
623
624
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
624
625
}
626
+
627
+ AppEvent event;
628
+ event.Type = AppEvent::kEventType_LCD ;
629
+ event.Handler = AppTask::GetAppTask ().UpdateDisplayHandler ;
630
+ PostEvent (&event);
625
631
}
626
632
}
627
633
}
628
634
635
+ void BaseApplication::UpdateDisplayHandler (AppEvent * aEvent)
636
+ {
637
+ VerifyOrReturn (aEvent->Type == AppEvent::kEventType_LCD );
638
+ AppTask::GetAppTask ().UpdateDisplay ();
639
+ }
640
+
629
641
void BaseApplication::UpdateDisplay ()
630
642
{
631
643
OutputQrCode (false );
@@ -793,14 +805,11 @@ SilabsLCD & BaseApplication::GetLCD(void)
793
805
return slLCD;
794
806
}
795
807
796
- void BaseApplication::UpdateLCDStatusScreen (bool withChipStackLock )
808
+ void BaseApplication::UpdateLCDStatusScreen ()
797
809
{
798
810
SilabsLCD::DisplayStatus_t status;
799
811
bool enabled, attached;
800
- if (withChipStackLock)
801
- {
802
- chip::DeviceLayer::PlatformMgr ().LockChipStack ();
803
- }
812
+ chip::DeviceLayer::PlatformMgr ().LockChipStack ();
804
813
#ifdef SL_WIFI
805
814
enabled = ConnectivityMgr ().IsWiFiStationEnabled ();
806
815
attached = ConnectivityMgr ().IsWiFiStationConnected ();
@@ -825,10 +834,7 @@ void BaseApplication::UpdateLCDStatusScreen(bool withChipStackLock)
825
834
? SilabsLCD::ICDMode_e::SIT
826
835
: SilabsLCD::ICDMode_e::LIT;
827
836
#endif
828
- if (withChipStackLock)
829
- {
830
- chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
831
- }
837
+ chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
832
838
slLCD.SetStatus (status);
833
839
}
834
840
#endif
@@ -935,8 +941,10 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
935
941
// Update the LCD screen with SSID and connected state
936
942
if (screen == SilabsLCD::Screen_e::StatusScreen)
937
943
{
938
- BaseApplication::UpdateLCDStatusScreen (false );
939
- AppTask::GetLCD ().SetScreen (screen);
944
+ AppEvent event;
945
+ event.Type = AppEvent::kEventType_LCD ;
946
+ event.Handler = AppTask::GetAppTask ().UpdateDisplayHandler ;
947
+ PostEvent (&event);
940
948
}
941
949
#endif // DISPLAY_ENABLED
942
950
0 commit comments