Skip to content

Commit 141224f

Browse files
committed
Fix examples accordingly
1 parent cc249e5 commit 141224f

File tree

9 files changed

+4
-36
lines changed

9 files changed

+4
-36
lines changed

examples/Platform_Tutorials/lessons/01-programming-the-braccio-display/01_creating_a_button/01_creating_a_button.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#include <Braccio++.h>
22

33
void customMenu() {
4-
Braccio.lvgl_lock();
54
lv_obj_t * btn1 = lv_btn_create(lv_scr_act());
65
lv_obj_set_size(btn1, 120, 75);
76
lv_obj_t * label1 = lv_label_create(btn1);
87
lv_label_set_text(label1, "BTN 1");
98
lv_obj_align(btn1, LV_ALIGN_CENTER, 0, 0);
109
lv_obj_center(label1);
11-
Braccio.lvgl_unlock();
1210
}
1311

1412
void setup() {

examples/Platform_Tutorials/lessons/01-programming-the-braccio-display/02_designing_the_button/02_designing_the_button.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010

1111
void customMenu() {
12-
Braccio.lvgl_lock();
1312
static lv_style_t style;
1413
lv_style_init(&style);
1514
lv_style_set_bg_color(&style, lv_color_hex(COLOR_WHITE));
@@ -27,7 +26,6 @@ void customMenu() {
2726
lv_obj_center(label1);
2827

2928
lv_obj_add_style(btn1, &style, 0);
30-
Braccio.lvgl_unlock();
3129
}
3230

3331
void setup() {

examples/Platform_Tutorials/lessons/01-programming-the-braccio-display/03_creating_a_menu/03_creating_a_menu.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ static const char * btnm_map[] = {"OPTION 1", "OPTION 2", "\n",
1515
};
1616

1717
void customMenu() {
18-
Braccio.lvgl_lock();
1918
static lv_style_t style_bg;
2019
lv_style_init(&style_bg);
2120
lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL));
@@ -34,7 +33,6 @@ void customMenu() {
3433

3534
lv_obj_add_style(btnm1, &style_bg, 0);
3635
lv_obj_add_style(btnm1, &style_btn, LV_PART_ITEMS);
37-
Braccio.lvgl_unlock();
3836
}
3937

4038
void setup() {

examples/Platform_Tutorials/lessons/01-programming-the-braccio-display/04_testing_it_out/04_testing_it_out.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ static const char * btnm_map[] = {"OPTION 1", "OPTION 2", "OPTION 3", "\n",
1414
};
1515

1616
void customMenu() {
17-
Braccio.lvgl_lock();
1817
static lv_style_t style_bg;
1918
lv_style_init(&style_bg);
2019
lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL));
@@ -34,7 +33,6 @@ void customMenu() {
3433

3534
lv_obj_add_style(btnm1, &style_bg, 0);
3635
lv_obj_add_style(btnm1, &style_btn, LV_PART_ITEMS);
37-
Braccio.lvgl_unlock();
3836
}
3937

4038
void setup() {

examples/Platform_Tutorials/lessons/01-programming-the-braccio-display/05_display_challenge/05_display_challenge.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ static const char * btnm_map[] = {"BTN 1", "\n",
1414
};
1515

1616
void customMenu() {
17-
Braccio.lvgl_lock();
1817
static lv_style_t style_bg;
1918
lv_style_init(&style_bg);
2019
lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_BG));
@@ -34,7 +33,6 @@ void customMenu() {
3433

3534
lv_obj_add_style(btnm1, &style_bg, 0);
3635
lv_obj_add_style(btnm1, &style_btn, LV_PART_ITEMS);
37-
Braccio.lvgl_unlock();
3836
}
3937

4038
void setup() {

examples/Platform_Tutorials/lessons/02-navigatting-the-display-menu/02_handling_events_in_the_menu/02_handling_events_in_the_menu.ino

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ static const char * btnm_map[] = {"Option 1", "Option 2", "\n",
1616
};
1717

1818
static void eventHandler(lv_event_t * e) {
19-
Braccio.lvgl_lock();
2019
lv_event_code_t code = lv_event_get_code(e);
2120
lv_obj_t * obj = lv_event_get_target(e);
2221
if (code == LV_EVENT_PRESSED) {
@@ -26,11 +25,9 @@ static void eventHandler(lv_event_t * e) {
2625
LV_LOG_USER("%s was selected\n", txt);
2726
Serial.println(String(txt) + " was selected.");
2827
}
29-
Braccio.lvgl_unlock();
3028
}
3129

3230
void customMenu() {
33-
Braccio.lvgl_lock();
3431
static lv_style_t style_bg;
3532
lv_style_init(&style_bg);
3633
lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_WHITE));
@@ -59,10 +56,7 @@ void customMenu() {
5956

6057
lv_btnmatrix_set_one_checked(btnm1, true);
6158

62-
lv_obj_add_event_cb(btnm1, eventHandler, LV_EVENT_ALL, NULL);
63-
Braccio.lvgl_unlock();
64-
65-
Braccio.connectJoystickTo(btnm1);
59+
Braccio.connectJoystickTo(btnm1, eventHandler);
6660
}
6761

6862
void setup() {

examples/Platform_Tutorials/lessons/02-navigatting-the-display-menu/03_navigate_challenge_I/03_navigate_challenge_I.ino

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ static const char * btnm_map[] = {"Option 1", "Option 2", "\n",
1616
};
1717

1818
static void eventHandler(lv_event_t * e) {
19-
Braccio.lvgl_lock();
2019
lv_event_code_t code = lv_event_get_code(e);
2120
lv_obj_t * obj = lv_event_get_target(e);
2221
if (code == LV_EVENT_PRESSING) {
@@ -26,11 +25,9 @@ static void eventHandler(lv_event_t * e) {
2625
LV_LOG_USER("%s is pressed\n", txt);
2726
Serial.println(String(txt) + " is pressed.");
2827
}
29-
Braccio.lvgl_unlock();
3028
}
3129

3230
void customMenu() {
33-
Braccio.lvgl_lock();
3431
static lv_style_t style_bg;
3532
lv_style_init(&style_bg);
3633
lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL));
@@ -59,10 +56,7 @@ void customMenu() {
5956

6057
lv_btnmatrix_set_one_checked(btnm1, true);
6158

62-
lv_obj_add_event_cb(btnm1, eventHandler, LV_EVENT_ALL, NULL);
63-
Braccio.lvgl_unlock();
64-
65-
Braccio.connectJoystickTo(btnm1);
59+
Braccio.connectJoystickTo(btnm1, eventHandler);
6660
}
6761

6862
void setup() {

examples/Platform_Tutorials/lessons/02-navigatting-the-display-menu/04_navigate_challenge_II/04_navigate_challenge_II.ino

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ static const char * btnm_map[] = {"Option 1", "Option 2", "\n",
1616
};
1717

1818
static void eventHandler(lv_event_t * e) {
19-
Braccio.lvgl_lock();
2019
lv_event_code_t code = lv_event_get_code(e);
2120
lv_obj_t * obj = lv_event_get_target(e);
2221
if (code == LV_EVENT_RELEASED) {
@@ -26,11 +25,9 @@ static void eventHandler(lv_event_t * e) {
2625
LV_LOG_USER("%s was released\n", txt);
2726
Serial.println(String(txt) + " was released.");
2827
}
29-
Braccio.lvgl_unlock();
3028
}
3129

3230
void customMenu() {
33-
Braccio.lvgl_lock();
3431
static lv_style_t style_bg;
3532
lv_style_init(&style_bg);
3633
lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL));
@@ -59,10 +56,7 @@ void customMenu() {
5956

6057
lv_btnmatrix_set_one_checked(btnm1, true);
6158

62-
lv_obj_add_event_cb(btnm1, eventHandler, LV_EVENT_ALL, NULL);
63-
Braccio.lvgl_unlock();
64-
65-
Braccio.connectJoystickTo(btnm1);
59+
Braccio.connectJoystickTo(btnm1, eventHandler);
6660
}
6761

6862
void setup() {

examples/Platform_Tutorials/projects/p03-learning-mode/01_Braccio_Record_and_Replay/AppState.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ static void event_handler_menu(lv_event_t * e)
5858

5959
void custom_main_menu()
6060
{
61-
Braccio.lvgl_lock();
6261
static lv_style_t style_focus;
6362
lv_style_init(&style_focus);
6463
lv_style_set_outline_color(&style_focus, lv_color_hex(COLOR_ORANGE));
@@ -89,10 +88,7 @@ void custom_main_menu()
8988
lv_label_set_text_fmt(counter, "Counter: %d" , 0);
9089
lv_obj_align(counter, LV_ALIGN_CENTER, 0, 80);
9190

92-
lv_obj_add_event_cb(btnm, event_handler_menu, LV_EVENT_ALL, NULL);
93-
Braccio.lvgl_unlock();
94-
95-
Braccio.connectJoystickTo(btnm);
91+
Braccio.connectJoystickTo(btnm, event_handler_menu);
9692
}
9793

9894
/**************************************************************************************

0 commit comments

Comments
 (0)