@@ -38,7 +38,7 @@ static lv_obj_t *g_focus_last_obj = NULL;
3838static lv_obj_t * g_group_list [3 ] = {0 };
3939
4040LV_IMG_DECLARE (icon_tic_tac_toe )
41- // LV_IMG_DECLARE(icon_app2 )
41+ LV_IMG_DECLARE (icon_wifi_list )
4242// LV_IMG_DECLARE(icon_app3)
4343// LV_IMG_DECLARE(icon_app4)
4444// LV_IMG_DECLARE(icon_app5)
@@ -51,7 +51,7 @@ void ui_app5_start(void (*fn)(void));
5151
5252static item_desc_t item [] = {
5353 { "Tic-Tac-Toe" , (void * ) & icon_tic_tac_toe , ui_app1_start , NULL },
54- { "App2 " , (void * ) & icon_tic_tac_toe , ui_app2_start , NULL },
54+ { "Wi-Fi List " , (void * ) & icon_wifi_list , ui_app2_start , NULL },
5555 { "App3" , (void * ) & icon_tic_tac_toe , ui_app3_start , NULL },
5656 { "App4" , (void * ) & icon_tic_tac_toe , ui_app4_start , NULL },
5757 { "App5" , (void * ) & icon_tic_tac_toe , ui_app5_start , NULL },
@@ -104,10 +104,7 @@ static void ui_button_style_init(void)
104104
105105 lv_style_set_radius (& g_btn_styles .style , 5 );
106106
107- // lv_style_set_bg_opa(&g_btn_styles.style, LV_OPA_100);
108107 lv_style_set_bg_color (& g_btn_styles .style , lv_color_make (255 , 255 , 255 ));
109- // lv_style_set_bg_grad_color(&g_btn_styles.style, lv_color_make(255, 255, 255));
110- // lv_style_set_bg_grad_dir(&g_btn_styles.style, LV_GRAD_DIR_VER);
111108
112109 lv_style_set_border_opa (& g_btn_styles .style , LV_OPA_30 );
113110 lv_style_set_border_width (& g_btn_styles .style , 2 );
@@ -132,12 +129,6 @@ static void ui_button_style_init(void)
132129
133130 lv_style_init (& g_btn_styles .style_focus_no_outline );
134131 lv_style_set_outline_width (& g_btn_styles .style_focus_no_outline , 0 );
135-
136- }
137-
138-
139- static void ui_status_bar_set_visible (bool visible )
140- {
141132}
142133
143134static int8_t menu_direct_probe (lv_obj_t * focus_obj )
@@ -174,6 +165,7 @@ static int8_t menu_direct_probe(lv_obj_t *focus_obj)
174165
175166static void menu_prev_cb (lv_event_t * e )
176167{
168+ bsp_display_lock (0 );
177169 lv_event_code_t code = lv_event_get_code (e );
178170
179171 if (LV_EVENT_RELEASED == code ) {
@@ -186,10 +178,12 @@ static void menu_prev_cb(lv_event_t *e)
186178 lv_img_set_src (g_img_item , item [g_item_index ].img_src );
187179 lv_label_set_text_static (g_lab_item , item [g_item_index ].name );
188180 }
181+ bsp_display_unlock ();
189182}
190183
191184static void menu_next_cb (lv_event_t * e )
192185{
186+ bsp_display_lock (0 );
193187 lv_event_code_t code = lv_event_get_code (e );
194188
195189 if (LV_EVENT_RELEASED == code ) {
@@ -202,11 +196,13 @@ static void menu_next_cb(lv_event_t *e)
202196 lv_img_set_src (g_img_item , item [g_item_index ].img_src );
203197 lv_label_set_text_static (g_lab_item , item [g_item_index ].name );
204198 }
199+ bsp_display_unlock ();
205200}
206201
207202
208203static void ui_led_set_visible (bool visible )
209204{
205+ bsp_display_lock (0 );
210206 for (size_t i = 0 ; i < sizeof (g_led_item ) / sizeof (g_led_item [0 ]); i ++ ) {
211207 if (NULL != g_led_item [i ]) {
212208 if (visible ) {
@@ -216,21 +212,25 @@ static void ui_led_set_visible(bool visible)
216212 }
217213 }
218214 }
215+ bsp_display_unlock ();
219216}
220217
221218
222219void menu_new_item_select (lv_obj_t * obj )
223220{
221+ bsp_display_lock (0 );
224222 int8_t direct = menu_direct_probe (obj );
225223 g_item_index = menu_get_num_offset (g_item_index , g_item_size , direct );
226224
227225 lv_led_on (g_led_item [g_item_index ]);
228226 lv_img_set_src (g_img_item , item [g_item_index ].img_src );
229227 lv_label_set_text_static (g_lab_item , item [g_item_index ].name );
228+ bsp_display_unlock ();
230229}
231230
232231static void menu_enter_cb (lv_event_t * e )
233232{
233+ bsp_display_lock (0 );
234234 lv_event_code_t code = lv_event_get_code (e );
235235 lv_obj_t * obj = lv_event_get_user_data (e );
236236
@@ -250,9 +250,9 @@ static void menu_enter_cb(lv_event_t *e)
250250 lv_obj_del (menu_btn_parent );
251251 g_focus_last_obj = NULL ;
252252
253- ui_status_bar_set_visible (true);
254253 item [g_item_index ].start_fn (item [g_item_index ].end_fn );
255254 }
255+ bsp_display_unlock ();
256256}
257257
258258static void ui_main_menu (int32_t index_id )
@@ -265,7 +265,6 @@ static void ui_main_menu(int32_t index_id)
265265 lv_obj_clear_flag (g_page_menu , LV_OBJ_FLAG_SCROLLABLE );
266266 lv_obj_align_to (g_page_menu , ui_main_get_status_bar (), LV_ALIGN_OUT_BOTTOM_LEFT , 0 , 0 );
267267 }
268- ui_status_bar_set_visible (true);
269268
270269 lv_obj_t * obj = lv_obj_create (g_page_menu );
271270 lv_obj_set_size (obj , 290 , 174 );
@@ -409,19 +408,9 @@ void ui_app5_start(void (*fn)(void))
409408 ota_swich_to_app (4 );
410409}
411410
412- void ui_acquire (void )
413- {
414- bsp_display_lock (0 );
415- }
416-
417- void ui_release (void )
418- {
419- bsp_display_unlock ();
420- }
421-
422411void bootloader_ui (lv_obj_t * scr ) {
423412
424- ui_acquire ( );
413+ bsp_display_lock ( 0 );
425414 lv_obj_set_style_bg_color (lv_scr_act (), lv_color_make (237 , 238 , 239 ), LV_STATE_DEFAULT );
426415 ui_button_style_init ();
427416
@@ -448,9 +437,7 @@ void bootloader_ui(lv_obj_t *scr) {
448437 lv_obj_set_style_shadow_width (g_status_bar , 0 , LV_PART_MAIN );
449438 lv_obj_align (g_status_bar , LV_ALIGN_TOP_MID , 0 , 0 );
450439
451- ui_status_bar_set_visible (0 );
452-
453440 ui_main_menu (g_item_index );
454441
455- ui_release ();
442+ bsp_display_unlock ();
456443}
0 commit comments