Errors with functions once project exported

What do you want to achieve?

figure out the error in my code that was exported

What have you tried so far?

drinking,crying and more crying

Screenshot or video

code below

Others

  • SquareLine Studio version: lastest
  • Operating system: window
  • Target hardware: esp

hello i have a lot of syntax errors when i complie my freshly imported project files in the functions section for the file,i am new to coding and im wondering if someone could tell me the issue with the code so i can fix it and prevent this error when exporting in the future below is code and here is the error im getting :

C:\Users\howar\OneDrive\Documents\Arduino\ttgo-test-gui\ui.c: In function ‘ui_event_Left_Arrow3’:
ui.c:133:8: error: ‘event’ undeclared (first use in this function)
if(event == LV_EVENT_CLICKED) {
^
C:\Users\howar\OneDrive\Documents\Arduino\ttgo-test-gui\ui.c:133:8: note: each undeclared identifier is reported only once for each function it appears in
Multiple libraries were found for “lvgl.h”
Used: C:\Users\howar\OneDrive\Documents\Arduino\libraries\lvgl
Not used: C:\Users\howar\OneDrive\Documents\Arduino\libraries\lv_arduino
exit status 1
‘event’ undeclared (first use in this function)

and the code is as follow unedited from the export

///////////////////// FUNCTIONS ////////////////////

static void ui_event_number5(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_FIVE_label(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Right_arrow(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_poltergist, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Left_Arrow(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_Screen3, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0);
    }
}
static void ui_event_Right_arrow1(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_open_ears_, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);}

thanks in advance =)

Could you upload your code in .ino file? Did you include lvgl.h and ui.h?

#include <lvgl.h>
#include "ui.h"

yes i did include,my code is here


#include "ui.h"
#include "ui_helpers.h"

///////////////////// VARIABLES ////////////////////
lv_obj_t * ui_passwordterminal;
lv_obj_t * ui_pw_banner;
lv_obj_t * ui_number1;
lv_obj_t * ui_ONE_label_;
lv_obj_t * ui_number2;
lv_obj_t * ui_TWO_label;
lv_obj_t * ui_number3;
lv_obj_t * ui_THREE_label;
lv_obj_t * ui_number4;
lv_obj_t * ui_FOUR_label;
lv_obj_t * ui_number5;
lv_obj_t * ui_FIVE_label;
lv_obj_t * ui_number6;
lv_obj_t * ui_SIX_label;
lv_obj_t * ui_number7;
lv_obj_t * ui_SEVEN_label;
lv_obj_t * ui_number8;
lv_obj_t * ui_EIGHT_label;
lv_obj_t * ui_number9;
lv_obj_t * ui_NINE_label;
lv_obj_t * ui_dead_rats;
lv_obj_t * ui_deadratzicon;
lv_obj_t * ui_Right_arrow;
lv_obj_t * ui_Left_Arrow;
lv_obj_t * ui_poltergist;
lv_obj_t * ui_poltergisticon;
lv_obj_t * ui_Right_arrow1;
lv_obj_t * ui_Left_Arrow1;
lv_obj_t * ui_open_ears_;
lv_obj_t * ui_open_ears_icon;
lv_obj_t * ui_Right_arrow2;
lv_obj_t * ui_Left_Arrow2;
lv_obj_t * ui_Screen3;
lv_obj_t * ui_Right_arrow3;
lv_obj_t * ui_Left_Arrow3;

///////////////////// TEST LVGL SETTINGS ////////////////////
/*#if LV_COLOR_DEPTH != 32
    #error "LV_COLOR_DEPTH should be 32bit to match SquareLine Studio's settings"
#endif
#if LV_COLOR_16_SWAP !=0
    #error "#error LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings"
#endif */


///////////////////// ANIMATIONS ////////////////////

///////////////////// FUNCTIONS ////////////////////
static void ui_event_number5(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_FIVE_label(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Right_arrow(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_poltergist, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Left_Arrow(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_Screen3, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0);
    }
}
static void ui_event_Right_arrow1(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_open_ears_, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Left_Arrow1(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_dead_rats, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0);
    }
}
static void ui_event_Right_arrow2(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_Screen3, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Left_Arrow2(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_poltergist, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0);
    }
}
static void ui_event_Right_arrow3(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_passwordterminal, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
    }
}
static void ui_event_Left_Arrow3(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_open_ears_, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0);
    }
}

///////////////////// SCREENS ////////////////////
void ui_passwordterminal_screen_init(void)
{

    // ui_passwordterminal

    ui_passwordterminal = lv_obj_create(NULL);

    lv_obj_clear_flag(ui_passwordterminal,
                      LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_ELASTIC |
                      LV_OBJ_FLAG_SCROLL_MOMENTUM);

    lv_obj_set_scrollbar_mode(ui_passwordterminal, LV_SCROLLBAR_MODE_OFF);

    // ui_pw_banner

    ui_pw_banner = lv_label_create(ui_passwordterminal);

    lv_obj_set_width(ui_pw_banner, 200);
    lv_obj_set_height(ui_pw_banner, 25);

    lv_obj_set_x(ui_pw_banner, -74);
    lv_obj_set_y(ui_pw_banner, -106);

    lv_obj_set_align(ui_pw_banner, LV_ALIGN_CENTER);

    lv_label_set_long_mode(ui_pw_banner, LV_LABEL_LONG_SCROLL);
    lv_label_set_text(ui_pw_banner, " :      E N T E R                  P A S S W O R D  :");

    lv_obj_clear_flag(ui_pw_banner, LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE |
                      LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM |
                      LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_pw_banner, LV_SCROLLBAR_MODE_OFF);

    lv_obj_set_style_text_decor(ui_pw_banner, LV_TEXT_DECOR_STRIKETHROUGH, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui_pw_banner, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui_pw_banner, lv_color_hex(0x319043), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui_pw_banner, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui_pw_banner, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_border_side(ui_pw_banner, LV_BORDER_SIDE_FULL, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number1

    ui_number1 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number1, 100);
    lv_obj_set_height(ui_number1, 50);

    lv_obj_set_x(ui_number1, -126);
    lv_obj_set_y(ui_number1, -50);

    lv_obj_set_align(ui_number1, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_number1, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM |
                      LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_number1, LV_SCROLLBAR_MODE_OFF);

    lv_obj_set_style_bg_color(ui_number1, lv_color_hex(0x878383), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui_number1, lv_color_hex(0xF6F6F6), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui_number1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_letter_space(ui_number1, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_line_space(ui_number1, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui_number1, LV_TEXT_ALIGN_AUTO, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_decor(ui_number1, LV_TEXT_DECOR_NONE, LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui_number1, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_ONE_label_

    ui_ONE_label_ = lv_label_create(ui_number1);

    lv_obj_set_width(ui_ONE_label_, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_ONE_label_, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_ONE_label_, 0);
    lv_obj_set_y(ui_ONE_label_, 0);

    lv_obj_set_align(ui_ONE_label_, LV_ALIGN_CENTER);

    lv_label_set_text(ui_ONE_label_, "1");

    lv_obj_set_style_text_font(ui_ONE_label_, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number2

    ui_number2 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number2, 100);
    lv_obj_set_height(ui_number2, 50);

    lv_obj_set_x(ui_number2, 2);
    lv_obj_set_y(ui_number2, -50);

    lv_obj_set_align(ui_number2, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number2, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number2, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number2, lv_color_hex(0x34729A), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_TWO_label

    ui_TWO_label = lv_label_create(ui_passwordterminal);

    lv_obj_set_width(ui_TWO_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_TWO_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_TWO_label, 1);
    lv_obj_set_y(ui_TWO_label, -51);

    lv_obj_set_align(ui_TWO_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_TWO_label, "2");

    lv_obj_set_style_text_font(ui_TWO_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number3

    ui_number3 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number3, 100);
    lv_obj_set_height(ui_number3, 50);

    lv_obj_set_x(ui_number3, 127);
    lv_obj_set_y(ui_number3, -50);

    lv_obj_set_align(ui_number3, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number3, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number3, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number3, lv_color_hex(0x878383), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_THREE_label

    ui_THREE_label = lv_label_create(ui_number3);

    lv_obj_set_width(ui_THREE_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_THREE_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_THREE_label, 0);
    lv_obj_set_y(ui_THREE_label, 0);

    lv_obj_set_align(ui_THREE_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_THREE_label, "3");

    lv_obj_set_style_text_font(ui_THREE_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number4

    ui_number4 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number4, 100);
    lv_obj_set_height(ui_number4, 50);

    lv_obj_set_x(ui_number4, -126);
    lv_obj_set_y(ui_number4, 15);

    lv_obj_set_align(ui_number4, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number4, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number4, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number4, lv_color_hex(0x34729A), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_FOUR_label

    ui_FOUR_label = lv_label_create(ui_number4);

    lv_obj_set_width(ui_FOUR_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_FOUR_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_FOUR_label, 0);
    lv_obj_set_y(ui_FOUR_label, 0);

    lv_obj_set_align(ui_FOUR_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_FOUR_label, "4");

    lv_obj_set_style_text_font(ui_FOUR_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number5

    ui_number5 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number5, 100);
    lv_obj_set_height(ui_number5, 50);

    lv_obj_set_x(ui_number5, 2);
    lv_obj_set_y(ui_number5, 15);

    lv_obj_set_align(ui_number5, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number5, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number5, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_add_event_cb(ui_number5, ui_event_number5, LV_EVENT_ALL, NULL);
    lv_obj_set_style_bg_color(ui_number5, lv_color_hex(0x878383), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_FIVE_label

    ui_FIVE_label = lv_label_create(ui_number5);

    lv_obj_set_width(ui_FIVE_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_FIVE_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_FIVE_label, 1);
    lv_obj_set_y(ui_FIVE_label, 0);

    lv_obj_set_align(ui_FIVE_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_FIVE_label, "5");

    lv_obj_add_event_cb(ui_FIVE_label, ui_event_FIVE_label, LV_EVENT_ALL, NULL);
    lv_obj_set_style_text_font(ui_FIVE_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number6

    ui_number6 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number6, 100);
    lv_obj_set_height(ui_number6, 50);

    lv_obj_set_x(ui_number6, 127);
    lv_obj_set_y(ui_number6, 15);

    lv_obj_set_align(ui_number6, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number6, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number6, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number6, lv_color_hex(0x34729A), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number6, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_SIX_label

    ui_SIX_label = lv_label_create(ui_number6);

    lv_obj_set_width(ui_SIX_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_SIX_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_SIX_label, 0);
    lv_obj_set_y(ui_SIX_label, 0);

    lv_obj_set_align(ui_SIX_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_SIX_label, "6");

    lv_obj_set_style_text_font(ui_SIX_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number7

    ui_number7 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number7, 100);
    lv_obj_set_height(ui_number7, 50);

    lv_obj_set_x(ui_number7, -126);
    lv_obj_set_y(ui_number7, 80);

    lv_obj_set_align(ui_number7, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number7, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number7, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number7, lv_color_hex(0x888383), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number7, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_SEVEN_label

    ui_SEVEN_label = lv_label_create(ui_number7);

    lv_obj_set_width(ui_SEVEN_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_SEVEN_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_SEVEN_label, 0);
    lv_obj_set_y(ui_SEVEN_label, 0);

    lv_obj_set_align(ui_SEVEN_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_SEVEN_label, "7");

    lv_obj_set_style_text_font(ui_SEVEN_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number8

    ui_number8 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number8, 100);
    lv_obj_set_height(ui_number8, 50);

    lv_obj_set_x(ui_number8, 2);
    lv_obj_set_y(ui_number8, 80);

    lv_obj_set_align(ui_number8, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number8, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number8, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number8, lv_color_hex(0x34729A), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number8, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_EIGHT_label

    ui_EIGHT_label = lv_label_create(ui_number8);

    lv_obj_set_width(ui_EIGHT_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_EIGHT_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_EIGHT_label, 0);
    lv_obj_set_y(ui_EIGHT_label, 0);

    lv_obj_set_align(ui_EIGHT_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_EIGHT_label, "8");

    lv_obj_set_style_text_font(ui_EIGHT_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_number9

    ui_number9 = lv_btn_create(ui_passwordterminal);

    lv_obj_set_width(ui_number9, 100);
    lv_obj_set_height(ui_number9, 50);

    lv_obj_set_x(ui_number9, 127);
    lv_obj_set_y(ui_number9, 80);

    lv_obj_set_align(ui_number9, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_number9, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
    lv_obj_clear_flag(ui_number9, LV_OBJ_FLAG_SCROLLABLE);

    lv_obj_set_style_bg_color(ui_number9, lv_color_hex(0x888383), LV_PART_MAIN | LV_STATE_DEFAULT);
    lv_obj_set_style_bg_opa(ui_number9, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_NINE_label

    ui_NINE_label = lv_label_create(ui_number9);

    lv_obj_set_width(ui_NINE_label, LV_SIZE_CONTENT);
    lv_obj_set_height(ui_NINE_label, LV_SIZE_CONTENT);

    lv_obj_set_x(ui_NINE_label, 0);
    lv_obj_set_y(ui_NINE_label, 0);

    lv_obj_set_align(ui_NINE_label, LV_ALIGN_CENTER);

    lv_label_set_text(ui_NINE_label, "9");

    lv_obj_set_style_text_font(ui_NINE_label, &lv_font_montserrat_44, LV_PART_MAIN | LV_STATE_DEFAULT);

}
void ui_dead_rats_screen_init(void)
{

    // ui_dead_rats

    ui_dead_rats = lv_obj_create(NULL);

    lv_obj_clear_flag(ui_dead_rats, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK);

    lv_obj_set_scrollbar_mode(ui_dead_rats, LV_SCROLLBAR_MODE_ACTIVE);
    lv_obj_set_scroll_dir(ui_dead_rats, LV_DIR_HOR);

    // ui_deadratzicon

    ui_deadratzicon = lv_btn_create(ui_dead_rats);

    lv_obj_set_width(ui_deadratzicon, 300);
    lv_obj_set_height(ui_deadratzicon, 200);

    lv_obj_set_x(ui_deadratzicon, -1);
    lv_obj_set_y(ui_deadratzicon, -3);

    lv_obj_set_align(ui_deadratzicon, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_deadratzicon, LV_OBJ_FLAG_FLOATING);
    lv_obj_clear_flag(ui_deadratzicon, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLL_ELASTIC |
                      LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_deadratzicon, LV_SCROLLBAR_MODE_ACTIVE);

    lv_obj_set_style_bg_img_src(ui_deadratzicon, &ui_img_992677707, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_Right_arrow

    ui_Right_arrow = lv_btn_create(ui_dead_rats);

    lv_obj_set_width(ui_Right_arrow, 72);
    lv_obj_set_height(ui_Right_arrow, 301);

    lv_obj_set_x(ui_Right_arrow, 230);
    lv_obj_set_y(ui_Right_arrow, 1);

    lv_obj_set_align(ui_Right_arrow, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Right_arrow, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Right_arrow, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Right_arrow, ui_event_Right_arrow, LV_EVENT_ALL, NULL);

    // ui_Left_Arrow

    ui_Left_Arrow = lv_btn_create(ui_dead_rats);

    lv_obj_set_width(ui_Left_Arrow, 72);
    lv_obj_set_height(ui_Left_Arrow, 301);

    lv_obj_set_x(ui_Left_Arrow, -234);
    lv_obj_set_y(ui_Left_Arrow, -3);

    lv_obj_set_align(ui_Left_Arrow, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Left_Arrow, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Left_Arrow, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Left_Arrow, ui_event_Left_Arrow, LV_EVENT_ALL, NULL);

}
void ui_poltergist_screen_init(void)
{

    // ui_poltergist

    ui_poltergist = lv_obj_create(NULL);

    lv_obj_clear_flag(ui_poltergist, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK);

    lv_obj_set_scrollbar_mode(ui_poltergist, LV_SCROLLBAR_MODE_ACTIVE);
    lv_obj_set_scroll_dir(ui_poltergist, LV_DIR_HOR);

    // ui_poltergisticon

    ui_poltergisticon = lv_btn_create(ui_poltergist);

    lv_obj_set_width(ui_poltergisticon, 300);
    lv_obj_set_height(ui_poltergisticon, 184);

    lv_obj_set_x(ui_poltergisticon, -1);
    lv_obj_set_y(ui_poltergisticon, -3);

    lv_obj_set_align(ui_poltergisticon, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_poltergisticon, LV_OBJ_FLAG_FLOATING);
    lv_obj_clear_flag(ui_poltergisticon,
                      LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM |
                      LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_poltergisticon, LV_SCROLLBAR_MODE_ACTIVE);

    lv_obj_set_style_bg_img_src(ui_poltergisticon, &ui_img_1295571113, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_Right_arrow1

    ui_Right_arrow1 = lv_btn_create(ui_poltergist);

    lv_obj_set_width(ui_Right_arrow1, 72);
    lv_obj_set_height(ui_Right_arrow1, 301);

    lv_obj_set_x(ui_Right_arrow1, 234);
    lv_obj_set_y(ui_Right_arrow1, 1);

    lv_obj_set_align(ui_Right_arrow1, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Right_arrow1, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Right_arrow1, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Right_arrow1, ui_event_Right_arrow1, LV_EVENT_ALL, NULL);

    // ui_Left_Arrow1

    ui_Left_Arrow1 = lv_btn_create(ui_poltergist);

    lv_obj_set_width(ui_Left_Arrow1, 72);
    lv_obj_set_height(ui_Left_Arrow1, 301);

    lv_obj_set_x(ui_Left_Arrow1, -230);
    lv_obj_set_y(ui_Left_Arrow1, -3);

    lv_obj_set_align(ui_Left_Arrow1, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Left_Arrow1, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Left_Arrow1, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Left_Arrow1, ui_event_Left_Arrow1, LV_EVENT_ALL, NULL);

}
void ui_open_ears__screen_init(void)
{

    // ui_open_ears_

    ui_open_ears_ = lv_obj_create(NULL);

    lv_obj_clear_flag(ui_open_ears_, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK);

    lv_obj_set_scrollbar_mode(ui_open_ears_, LV_SCROLLBAR_MODE_ACTIVE);
    lv_obj_set_scroll_dir(ui_open_ears_, LV_DIR_HOR);

    // ui_open_ears_icon

    ui_open_ears_icon = lv_btn_create(ui_open_ears_);

    lv_obj_set_width(ui_open_ears_icon, 300);
    lv_obj_set_height(ui_open_ears_icon, 184);

    lv_obj_set_x(ui_open_ears_icon, -1);
    lv_obj_set_y(ui_open_ears_icon, -3);

    lv_obj_set_align(ui_open_ears_icon, LV_ALIGN_CENTER);

    lv_obj_add_flag(ui_open_ears_icon, LV_OBJ_FLAG_FLOATING);
    lv_obj_clear_flag(ui_open_ears_icon,
                      LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM |
                      LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_open_ears_icon, LV_SCROLLBAR_MODE_ACTIVE);

    lv_obj_set_style_bg_img_src(ui_open_ears_icon, &ui_img_191963324, LV_PART_MAIN | LV_STATE_DEFAULT);

    // ui_Right_arrow2

    ui_Right_arrow2 = lv_btn_create(ui_open_ears_);

    lv_obj_set_width(ui_Right_arrow2, 72);
    lv_obj_set_height(ui_Right_arrow2, 301);

    lv_obj_set_x(ui_Right_arrow2, 234);
    lv_obj_set_y(ui_Right_arrow2, 1);

    lv_obj_set_align(ui_Right_arrow2, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Right_arrow2, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Right_arrow2, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Right_arrow2, ui_event_Right_arrow2, LV_EVENT_ALL, NULL);

    // ui_Left_Arrow2

    ui_Left_Arrow2 = lv_btn_create(ui_open_ears_);

    lv_obj_set_width(ui_Left_Arrow2, 72);
    lv_obj_set_height(ui_Left_Arrow2, 301);

    lv_obj_set_x(ui_Left_Arrow2, -230);
    lv_obj_set_y(ui_Left_Arrow2, -3);

    lv_obj_set_align(ui_Left_Arrow2, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Left_Arrow2, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Left_Arrow2, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Left_Arrow2, ui_event_Left_Arrow2, LV_EVENT_ALL, NULL);

}
void ui_Screen3_screen_init(void)
{

    // ui_Screen3

    ui_Screen3 = lv_obj_create(NULL);

    lv_obj_clear_flag(ui_Screen3, LV_OBJ_FLAG_SCROLLABLE);

    // ui_Right_arrow3

    ui_Right_arrow3 = lv_btn_create(ui_Screen3);

    lv_obj_set_width(ui_Right_arrow3, 72);
    lv_obj_set_height(ui_Right_arrow3, 301);

    lv_obj_set_x(ui_Right_arrow3, 234);
    lv_obj_set_y(ui_Right_arrow3, 1);

    lv_obj_set_align(ui_Right_arrow3, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Right_arrow3, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Right_arrow3, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Right_arrow3, ui_event_Right_arrow3, LV_EVENT_ALL, NULL);

    // ui_Left_Arrow3

    ui_Left_Arrow3 = lv_btn_create(ui_Screen3);

    lv_obj_set_width(ui_Left_Arrow3, 72);
    lv_obj_set_height(ui_Left_Arrow3, 301);

    lv_obj_set_x(ui_Left_Arrow3, -230);
    lv_obj_set_y(ui_Left_Arrow3, -3);

    lv_obj_set_align(ui_Left_Arrow3, LV_ALIGN_CENTER);

    lv_obj_clear_flag(ui_Left_Arrow3, LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE |
                      LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN);

    lv_obj_set_scrollbar_mode(ui_Left_Arrow3, LV_SCROLLBAR_MODE_OFF);

    lv_obj_add_event_cb(ui_Left_Arrow3, ui_event_Left_Arrow3, LV_EVENT_ALL, NULL);

}

void ui_init(void)
{
    lv_disp_t * dispp = lv_disp_get_default();
    lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
                                               true, LV_FONT_DEFAULT);
    lv_disp_set_theme(dispp, theme);
    ui_passwordterminal_screen_init();
    ui_dead_rats_screen_init();
    ui_poltergist_screen_init();
    ui_open_ears__screen_init();
    ui_Screen3_screen_init();
    lv_disp_load_scr(ui_passwordterminal);
}

so the error is just with the functions so whatever is wrong with one is wrong with all of them,im just not well versed enough to figure out what

its just the “function” section

I do not think that it is problem with ui.c file. Could you post code in your .ino file?

im not sure how to? do you mean upload the whole sketch folder?

im still new so forgive me but i put the whole thing on github just so you can see everything

the code is just a basic G.U.I. there is no advanced functions yet its basically a test numberic lock screen and a few other screens that act like a menu/app selection with left and right arrow button selection

Thanks :slight_smile:

I think that problem is that LilyGo T-Watch library supports LVGL v7.7.2 but SLS is for LVGL 8.x . :confused:

You can make it probably work with TFT_eSPI and code from SLS, but you have to make your own code for peripherals in the watch.

i have a sketch that includes 8.2.0 lvgl library so shouldn’t it still work with the exported code if it works will the other sketch?

the “event” part of this code(the part within the IF clause) is what is giving me the error i believe as it says it is not defined within the scope but isnt the “event” a pre built function from the library?


static void ui_event_Button6(lv_event_t * e)
{
    lv_event_code_t event = lv_event_get_code(e);
    lv_obj_t * ta = lv_event_get_target(e);
    
    if(event == LV_EVENT_CLICKED) {
        _ui_screen_change(ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0);
        _ui_screen_change(ui_Screen1, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
    }

I tried your code and it does not work because:

  • you are including "ui.c" and "ui_helpers.c" instead of "ui.h" and "ui_helpers.h". You must always include header files.
  • because your are using TTGO library, it is internaly calling callbacks for v7 . This version is part of this library (in src folder)

I converted your code to LVGL v8 and I´m able to compile it.

Here is the code:

//#define LILYGO_WATCH_2020_V1
//#define LILYGO_WATCH_LVGL
//#include <LilyGoWatch.h>
#include <lvgl.h>
#include "ui.h"
#include "ui_helpers.h"
//int screenWidth = 480;
//int screenHeight = 270;

#include <TFT_eSPI.h>

/*Change to your screen resolution*/
static const uint16_t screenWidth = 480;
static const uint16_t screenHeight = 270;

//const int vib = 4;
//
//TTGOClass *ttgo;

static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[screenWidth * 10];

TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */

#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char *buf) {
  Serial.printf(buf);
  Serial.flush();
}
#endif

/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
  uint32_t w = (area->x2 - area->x1 + 1);
  uint32_t h = (area->y2 - area->y1 + 1);

  tft.startWrite();
  tft.setAddrWindow(area->x1, area->y1, w, h);
  tft.pushColors((uint16_t *)&color_p->full, w * h, true);
  tft.endWrite();

  lv_disp_flush_ready(disp);
}

/*Read the touchpad*/
void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) {
  uint16_t touchX, touchY;

  bool touched = tft.getTouch(&touchX, &touchY, 600);

  if (!touched) {
    data->state = LV_INDEV_STATE_REL;
  } else {
    data->state = LV_INDEV_STATE_PR;

    /*Set the coordinates*/
    data->point.x = touchX;
    data->point.y = touchY;

    Serial.print("Data x ");
    Serial.println(touchX);

    Serial.print("Data y ");
    Serial.println(touchY);
  }
}

void setup() {
  // pinMode(vib,OUTPUT);
  //
  //  ttgo = TTGOClass::getWatch();
  //    ttgo->begin();
  //    ttgo->openBL();
  //    ttgo->lvgl_begin();
  //    ttgo->tft->init(TFT_BLACK);
  //    ttgo->tft->setRotation(2);
  //    ui_init();

  Serial.begin(115200); /* prepare for possible serial debug */
  String LVGL_Arduino = "Hello Arduino! ";
  LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();

  Serial.println(LVGL_Arduino);
  Serial.println("I am LVGL_Arduino");

  lv_init();

#if LV_USE_LOG != 0
  lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif

  tft.begin();        /* TFT init */
  tft.setRotation(2); /* Landscape orientation, flipped */

  /*Set the touchscreen calibration data,
     the actual data for your display can be acquired using
     the Generic -> Touch_calibrate example from the TFT_eSPI library*/
  uint16_t calData[5] = { 304, 3504, 368, 3512, 2 };
  tft.setTouch(calData);

  lv_disp_draw_buf_init(&draw_buf, buf, NULL, screenWidth * 10);

  /*Initialize the display*/
  static lv_disp_drv_t disp_drv;
  lv_disp_drv_init(&disp_drv);
  /*Change the following line to your display resolution*/
  disp_drv.hor_res = screenWidth;
  disp_drv.ver_res = screenHeight;
  disp_drv.flush_cb = my_disp_flush;
  disp_drv.draw_buf = &draw_buf;
  lv_disp_drv_register(&disp_drv);

  /*Initialize the (dummy) input device driver*/
  static lv_indev_drv_t indev_drv;
  lv_indev_drv_init(&indev_drv);
  indev_drv.type = LV_INDEV_TYPE_POINTER;
  indev_drv.read_cb = my_touchpad_read;
  lv_indev_drv_register(&indev_drv);

  Serial.println("Setup done");
  ui_init();
}

void loop() {
  lv_timer_handler();
  delay(5);
}

thanks for the code when i compile i do get this error: i have the tft lib downloaded also

C:\Users\howar\OneDrive\Documents\Arduino\ttgo-test-gui\ttgo-test-gui.ino: In function 'void my_touchpad_read(lv_indev_drv_t*, lv_indev_data_t*)':
ttgo-test-gui:50:22: error: 'class TFT_eSPI' has no member named 'getTouch'
   bool touched = tft.getTouch(&touchX, &touchY, 600);
                      ^
C:\Users\howar\OneDrive\Documents\Arduino\ttgo-test-gui\ttgo-test-gui.ino: In function 'void setup()':
ttgo-test-gui:100:7: error: 'class TFT_eSPI' has no member named 'setTouch'
   tft.setTouch(calData);
       ^

i thought that since the c file had that header files referenced within each other it would chain all of them together to include everything? but this is just noob talk

I think that you did not enable touch support/pin in TFT_eSPI config file. Try that or disable function for touch. Be sure to choose right pins and LCD variant in that config as well. :slight_smile:

AFIK you have to include header file, which includes .c file and then, they are chained together. You can read about it for example here.

1 Like

Thanks for much for your help i really appreciate it! im gonna mess with the code today and try to get something rocking and rolling,rock on!

1 Like