diff --git a/examples/tutorials/lessons/01-programming-the-braccio-display/01_creating_a_button/01_creating_a_button.ino b/examples/tutorials/lessons/01-programming-the-braccio-display/01_creating_a_button/01_creating_a_button.ino index a3bef7a..2ee6ed1 100644 --- a/examples/tutorials/lessons/01-programming-the-braccio-display/01_creating_a_button/01_creating_a_button.ino +++ b/examples/tutorials/lessons/01-programming-the-braccio-display/01_creating_a_button/01_creating_a_button.ino @@ -1,12 +1,14 @@ #include void customMenu() { + Braccio.lvgl_lock(); lv_obj_t * btn1 = lv_btn_create(lv_scr_act()); lv_obj_set_size(btn1, 120, 75); lv_obj_t * label1 = lv_label_create(btn1); lv_label_set_text(label1, "BTN 1"); lv_obj_align(btn1, LV_ALIGN_CENTER, 0, 0); lv_obj_center(label1); + Braccio.lvgl_unlock(); } void setup() { diff --git a/examples/tutorials/lessons/01-programming-the-braccio-display/02_designing_the_button/02_designing_the_button.ino b/examples/tutorials/lessons/01-programming-the-braccio-display/02_designing_the_button/02_designing_the_button.ino index c261fd3..295e3eb 100644 --- a/examples/tutorials/lessons/01-programming-the-braccio-display/02_designing_the_button/02_designing_the_button.ino +++ b/examples/tutorials/lessons/01-programming-the-braccio-display/02_designing_the_button/02_designing_the_button.ino @@ -9,6 +9,7 @@ void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style; lv_style_init(&style); lv_style_set_bg_color(&style, lv_color_hex(COLOR_WHITE)); @@ -26,6 +27,7 @@ void customMenu() { lv_obj_center(label1); lv_obj_add_style(btn1, &style, 0); + Braccio.lvgl_unlock(); } void setup() { diff --git a/examples/tutorials/lessons/01-programming-the-braccio-display/03_creating_a_menu/03_creating_a_menu.ino b/examples/tutorials/lessons/01-programming-the-braccio-display/03_creating_a_menu/03_creating_a_menu.ino index 4647025..e5ab044 100644 --- a/examples/tutorials/lessons/01-programming-the-braccio-display/03_creating_a_menu/03_creating_a_menu.ino +++ b/examples/tutorials/lessons/01-programming-the-braccio-display/03_creating_a_menu/03_creating_a_menu.ino @@ -15,6 +15,7 @@ static const char * btnm_map[] = {"OPTION 1", "OPTION 2", "\n", }; void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL)); @@ -33,6 +34,7 @@ void customMenu() { lv_obj_add_style(btnm1, &style_bg, 0); lv_obj_add_style(btnm1, &style_btn, LV_PART_ITEMS); + Braccio.lvgl_unlock(); } void setup() { diff --git a/examples/tutorials/lessons/01-programming-the-braccio-display/04_testing_it_out/04_testing_it_out.ino b/examples/tutorials/lessons/01-programming-the-braccio-display/04_testing_it_out/04_testing_it_out.ino index 1da4f2f..12c0601 100644 --- a/examples/tutorials/lessons/01-programming-the-braccio-display/04_testing_it_out/04_testing_it_out.ino +++ b/examples/tutorials/lessons/01-programming-the-braccio-display/04_testing_it_out/04_testing_it_out.ino @@ -13,7 +13,8 @@ static const char * btnm_map[] = {"OPTION 1", "OPTION 2", "OPTION 3", "\n", "OPTION 4", "OPTION 5", "\0" }; -void customMenu(){ +void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL)); @@ -33,6 +34,7 @@ void customMenu(){ lv_obj_add_style(btnm1, &style_bg, 0); lv_obj_add_style(btnm1, &style_btn, LV_PART_ITEMS); + Braccio.lvgl_unlock(); } void setup() { diff --git a/examples/tutorials/lessons/01-programming-the-braccio-display/05_display_challenge/05_display_challenge.ino b/examples/tutorials/lessons/01-programming-the-braccio-display/05_display_challenge/05_display_challenge.ino index d4fcba7..9209311 100644 --- a/examples/tutorials/lessons/01-programming-the-braccio-display/05_display_challenge/05_display_challenge.ino +++ b/examples/tutorials/lessons/01-programming-the-braccio-display/05_display_challenge/05_display_challenge.ino @@ -14,6 +14,7 @@ static const char * btnm_map[] = {"BTN 1", "\n", }; void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_BG)); @@ -33,6 +34,7 @@ void customMenu() { lv_obj_add_style(btnm1, &style_bg, 0); lv_obj_add_style(btnm1, &style_btn, LV_PART_ITEMS); + Braccio.lvgl_unlock(); } void setup() { diff --git a/examples/tutorials/lessons/02-navigatting-the-display-menu/02_handling_events_in_the_menu/02_handling_events_in_the_menu.ino b/examples/tutorials/lessons/02-navigatting-the-display-menu/02_handling_events_in_the_menu/02_handling_events_in_the_menu.ino index f0f6d88..45c392b 100644 --- a/examples/tutorials/lessons/02-navigatting-the-display-menu/02_handling_events_in_the_menu/02_handling_events_in_the_menu.ino +++ b/examples/tutorials/lessons/02-navigatting-the-display-menu/02_handling_events_in_the_menu/02_handling_events_in_the_menu.ino @@ -15,7 +15,8 @@ static const char * btnm_map[] = {"Option 1", "Option 2", "\n", "Option 5", "Option 6", "\0" }; -static void eventHandler(lv_event_t * e){ +static void eventHandler(lv_event_t * e) { + Braccio.lvgl_lock(); lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if (code == LV_EVENT_PRESSED) { @@ -25,9 +26,11 @@ static void eventHandler(lv_event_t * e){ LV_LOG_USER("%s was selected\n", txt); Serial.println(String(txt) + " was selected."); } + Braccio.lvgl_unlock(); } -void customMenu(){ +void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_WHITE)); @@ -57,7 +60,8 @@ void customMenu(){ lv_btnmatrix_set_one_checked(btnm1, true); lv_obj_add_event_cb(btnm1, eventHandler, LV_EVENT_ALL, NULL); - + Braccio.lvgl_unlock(); + Braccio.connectJoystickTo(btnm1); } diff --git a/examples/tutorials/lessons/02-navigatting-the-display-menu/03_navigate_challenge_I/03_navigate_challenge_I.ino b/examples/tutorials/lessons/02-navigatting-the-display-menu/03_navigate_challenge_I/03_navigate_challenge_I.ino index 557600a..a531642 100644 --- a/examples/tutorials/lessons/02-navigatting-the-display-menu/03_navigate_challenge_I/03_navigate_challenge_I.ino +++ b/examples/tutorials/lessons/02-navigatting-the-display-menu/03_navigate_challenge_I/03_navigate_challenge_I.ino @@ -15,7 +15,8 @@ static const char * btnm_map[] = {"Option 1", "Option 2", "\n", "Option 5", "Option 6", "\0" }; -static void eventHandler(lv_event_t * e){ +static void eventHandler(lv_event_t * e) { + Braccio.lvgl_lock(); lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if (code == LV_EVENT_PRESSING) { @@ -25,9 +26,11 @@ static void eventHandler(lv_event_t * e){ LV_LOG_USER("%s is pressed\n", txt); Serial.println(String(txt) + " is pressed."); } + Braccio.lvgl_unlock(); } -void customMenu(){ +void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL)); @@ -57,6 +60,7 @@ void customMenu(){ lv_btnmatrix_set_one_checked(btnm1, true); lv_obj_add_event_cb(btnm1, eventHandler, LV_EVENT_ALL, NULL); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(btnm1); } diff --git a/examples/tutorials/lessons/02-navigatting-the-display-menu/04_navigate_challenge_II/04_navigate_challenge_II.ino b/examples/tutorials/lessons/02-navigatting-the-display-menu/04_navigate_challenge_II/04_navigate_challenge_II.ino index 5754fce..63358b2 100644 --- a/examples/tutorials/lessons/02-navigatting-the-display-menu/04_navigate_challenge_II/04_navigate_challenge_II.ino +++ b/examples/tutorials/lessons/02-navigatting-the-display-menu/04_navigate_challenge_II/04_navigate_challenge_II.ino @@ -15,7 +15,8 @@ static const char * btnm_map[] = {"Option 1", "Option 2", "\n", "Option 5", "Option 6", "\0" }; -static void eventHandler(lv_event_t * e){ +static void eventHandler(lv_event_t * e) { + Braccio.lvgl_lock(); lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if (code == LV_EVENT_RELEASED) { @@ -25,9 +26,11 @@ static void eventHandler(lv_event_t * e){ LV_LOG_USER("%s was released\n", txt); Serial.println(String(txt) + " was released."); } + Braccio.lvgl_unlock(); } -void customMenu(){ +void customMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_LIGHT_TEAL)); @@ -57,6 +60,7 @@ void customMenu(){ lv_btnmatrix_set_one_checked(btnm1, true); lv_obj_add_event_cb(btnm1, eventHandler, LV_EVENT_ALL, NULL); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(btnm1); } diff --git a/examples/tutorials/lessons/04-integration-of-previous-learnings/01_playing_with_a_joint_angle_gauge/01_playing_with_a_joint_angle_gauge.ino b/examples/tutorials/lessons/04-integration-of-previous-learnings/01_playing_with_a_joint_angle_gauge/01_playing_with_a_joint_angle_gauge.ino index 53d50ea..9bdc746 100644 --- a/examples/tutorials/lessons/04-integration-of-previous-learnings/01_playing_with_a_joint_angle_gauge/01_playing_with_a_joint_angle_gauge.ino +++ b/examples/tutorials/lessons/04-integration-of-previous-learnings/01_playing_with_a_joint_angle_gauge/01_playing_with_a_joint_angle_gauge.ino @@ -23,12 +23,15 @@ lv_meter_indicator_t * indic; static void eventHandlerMeter(lv_event_t * e) { /* Set the meter value */ + Braccio.lvgl_lock(); lv_meter_set_indicator_end_value(meter, indic, (int32_t)angles[motorID - 1]); + Braccio.lvgl_unlock(); } void meterScreen(void) { + Braccio.lvgl_lock(); meter = lv_meter_create(lv_scr_act()); lv_obj_center(meter); @@ -52,6 +55,7 @@ void meterScreen(void) indic = lv_meter_add_arc(meter, scale, 10, lv_color_hex(COLOR_LIGHT_TEAL), 0); lv_obj_add_event_cb(meter, eventHandlerMeter, LV_EVENT_KEY, NULL); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(meter); } diff --git a/examples/tutorials/lessons/04-integration-of-previous-learnings/02_selecting_the_motor_in_the_LCD_menu/02_selecting_the_motor_in_the_LCD_menu.ino b/examples/tutorials/lessons/04-integration-of-previous-learnings/02_selecting_the_motor_in_the_LCD_menu/02_selecting_the_motor_in_the_LCD_menu.ino index 5ecfeff..a682875 100644 --- a/examples/tutorials/lessons/04-integration-of-previous-learnings/02_selecting_the_motor_in_the_LCD_menu/02_selecting_the_motor_in_the_LCD_menu.ino +++ b/examples/tutorials/lessons/04-integration-of-previous-learnings/02_selecting_the_motor_in_the_LCD_menu/02_selecting_the_motor_in_the_LCD_menu.ino @@ -58,6 +58,7 @@ static void eventHandlerMenu(lv_event_t * e) { // Screens functions void meterScreen(void) { + Braccio.lvgl_lock(); meter = lv_meter_create(lv_scr_act()); lv_obj_center(meter); @@ -83,11 +84,13 @@ void meterScreen(void) lv_obj_add_event_cb(meter, eventHandlerMeter, LV_EVENT_KEY, NULL); lv_meter_set_indicator_end_value(meter, indic, (int32_t)angles[motorID - 1]); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(meter); } void motorMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_WHITE)); @@ -116,6 +119,7 @@ void motorMenu() { lv_btnmatrix_set_one_checked(btnm, true); lv_obj_add_event_cb(btnm, eventHandlerMenu, LV_EVENT_PRESSED, NULL); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(btnm); } diff --git a/examples/tutorials/lessons/04-integration-of-previous-learnings/03_learnings_challenge_I/03_learnings_challenge_I.ino b/examples/tutorials/lessons/04-integration-of-previous-learnings/03_learnings_challenge_I/03_learnings_challenge_I.ino index f9f25b2..c09064b 100644 --- a/examples/tutorials/lessons/04-integration-of-previous-learnings/03_learnings_challenge_I/03_learnings_challenge_I.ino +++ b/examples/tutorials/lessons/04-integration-of-previous-learnings/03_learnings_challenge_I/03_learnings_challenge_I.ino @@ -58,6 +58,7 @@ static void eventHandlerMenu(lv_event_t * e) { // Screens functions void meterScreen(void) { + Braccio.lvgl_lock(); meter = lv_meter_create(lv_scr_act()); lv_obj_center(meter); @@ -83,11 +84,13 @@ void meterScreen(void) lv_obj_add_event_cb(meter, eventHandlerMeter, LV_EVENT_KEY, NULL); lv_meter_set_indicator_end_value(meter, indic, (int32_t)angles[motorID - 1]); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(meter); } void motorMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_WHITE)); @@ -116,6 +119,7 @@ void motorMenu() { lv_btnmatrix_set_one_checked(btnm, true); lv_obj_add_event_cb(btnm, eventHandlerMenu, LV_EVENT_PRESSED, NULL); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(btnm); } diff --git a/examples/tutorials/lessons/04-integration-of-previous-learnings/04_learnings_challenge_II/04_learnings_challenge_II.ino b/examples/tutorials/lessons/04-integration-of-previous-learnings/04_learnings_challenge_II/04_learnings_challenge_II.ino index a84e5f5..ade5d8c 100644 --- a/examples/tutorials/lessons/04-integration-of-previous-learnings/04_learnings_challenge_II/04_learnings_challenge_II.ino +++ b/examples/tutorials/lessons/04-integration-of-previous-learnings/04_learnings_challenge_II/04_learnings_challenge_II.ino @@ -58,6 +58,7 @@ static void eventHandlerMenu(lv_event_t * e) { // Screens functions void meterScreen(void) { + Braccio.lvgl_lock(); meter = lv_meter_create(lv_scr_act()); lv_obj_center(meter); @@ -83,11 +84,13 @@ void meterScreen(void) lv_obj_add_event_cb(meter, eventHandlerMeter, LV_EVENT_KEY, NULL); lv_meter_set_indicator_end_value(meter, indic, (int32_t)angles[motorID - 1]); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(meter); } void motorMenu() { + Braccio.lvgl_lock(); static lv_style_t style_bg; lv_style_init(&style_bg); lv_style_set_bg_color(&style_bg, lv_color_hex(COLOR_WHITE)); @@ -116,6 +119,7 @@ void motorMenu() { lv_btnmatrix_set_one_checked(btnm, true); lv_obj_add_event_cb(btnm, eventHandlerMenu, LV_EVENT_PRESSED, NULL); + Braccio.lvgl_unlock(); Braccio.connectJoystickTo(btnm); }