// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.0
// LVGL version: 8.3.11
// Project name: C5_Dual_antenna

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

///////////////////// VARIABLES ////////////////////


// SCREEN: ui_ScreenW
void ui_ScreenW_screen_init(void);
void ui_event_ScreenW(lv_event_t * e);
lv_obj_t * ui_ScreenW;
lv_obj_t * ui_ScreenW_Chart;
lv_obj_t * ui_ScreenW_LabelTitle;
lv_obj_t * ui_ScreenW_LabelPoint;
lv_obj_t * ui_ScreenW_LabelPointSelect;
// CUSTOM VARIABLES


// SCREEN: ui_ScreenWP
void ui_ScreenWP_screen_init(void);
void ui_event_ScreenWP(lv_event_t * e);
lv_obj_t * ui_ScreenWP;
lv_obj_t * ui_ScreenWP_Chart;
lv_obj_t * ui_ScreenWP_LabelTitle;
lv_obj_t * ui_ScreenWP_LabelPoint;
lv_obj_t * ui_ScreenWP_LabelPointSelect;
lv_obj_t * ui_ScreenWP_Container1;
// CUSTOM VARIABLES


// SCREEN: ui_ScreenM
void ui_ScreenM_screen_init(void);
void ui_event_ScreenM(lv_event_t * e);
lv_obj_t * ui_ScreenM;
lv_obj_t * ui_ScreenM_LabelPoint;
lv_obj_t * ui_ScreenM_LabelPointSelect;
lv_obj_t * ui_ScreenM_Button1;
lv_obj_t * ui_ScreenM_Label6;
lv_obj_t * ui_ScreenM_Image1;
void ui_event_ScreenM_Panel1(lv_event_t * e);
lv_obj_t * ui_ScreenM_Panel1;
lv_obj_t * ui_ScreenM_Label1;
// CUSTOM VARIABLES


// SCREEN: ui_ScreenS
void ui_ScreenS_screen_init(void);
void ui_event_ScreenS(lv_event_t * e);
lv_obj_t * ui_ScreenS;
lv_obj_t * ui_ScreenS_LabelPoint;
lv_obj_t * ui_ScreenS_LabelPointSelect;
lv_obj_t * ui_ScreenS_LabelTitle;
lv_obj_t * ui_ScreenS_Container;
lv_obj_t * ui_ScreenS_LabelLIghtTitle;
lv_obj_t * ui_ScreenS_LabelLightNum;
void ui_event_ScreenS_SliderLight(lv_event_t * e);
lv_obj_t * ui_ScreenS_SliderLight;
// CUSTOM VARIABLES

// EVENTS
lv_obj_t * ui____initial_actions0;

// IMAGES AND IMAGE SETS

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

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

///////////////////// FUNCTIONS ////////////////////
void ui_event_ScreenW(lv_event_t * e)
{
    lv_event_code_t event_code = lv_event_get_code(e);

    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenWP, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenWP_screen_init);
    }
    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenS, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenS_screen_init);
    }
}

void ui_event_ScreenWP(lv_event_t * e)
{
    lv_event_code_t event_code = lv_event_get_code(e);

    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenS, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenS_screen_init);
    }
    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenW, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenW_screen_init);
    }
}

void ui_event_ScreenM(lv_event_t * e)
{
    lv_event_code_t event_code = lv_event_get_code(e);

    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenWP, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenWP_screen_init);
    }
    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenS, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenS_screen_init);
    }
}

void ui_event_ScreenM_Panel1(lv_event_t * e)
{
    lv_event_code_t event_code = lv_event_get_code(e);

    if(event_code == LV_EVENT_CLICKED) {
        PhaseCalibration_button(e);
    }
}

void ui_event_ScreenS(lv_event_t * e)
{
    lv_event_code_t event_code = lv_event_get_code(e);

    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenWP, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenWP_screen_init);
    }
    if(event_code == LV_EVENT_GESTURE &&  lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
        lv_indev_wait_release(lv_indev_get_act());
        _ui_screen_change(&ui_ScreenW, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_ScreenW_screen_init);
    }
}

void ui_event_ScreenS_SliderLight(lv_event_t * e)
{
    lv_event_code_t event_code = lv_event_get_code(e);
    lv_obj_t * target = lv_event_get_target(e);

    if(event_code == LV_EVENT_VALUE_CHANGED) {
        _ui_slider_set_text_value(ui_ScreenS_LabelLightNum, target, "", "");
        ScreenSSliderLight_function(e);
    }
}

///////////////////// SCREENS ////////////////////

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),
                                               false, LV_FONT_DEFAULT);
    lv_disp_set_theme(dispp, theme);
    ui_ScreenW_screen_init();
    ui_ScreenWP_screen_init();
    ui_ScreenM_screen_init();
    ui_ScreenS_screen_init();
    ui____initial_actions0 = lv_obj_create(NULL);
    lv_disp_load_scr(ui_ScreenW);
}
