//#define LV_CONF_INCLUDE_SIMPLE 1
//#define LV_CONF_PATH <lv_conf.h>

#include<Arduino.h>
#include <Adafruit_LvGL_Glue.h>
#include <lvgl.h>
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include "ui.h"
#include "lv_conf.h"




static lv_obj_t *meter;

static void set_value(void *indic, int32_t v) {
  lv_meter_set_indicator_value(meter, (lv_meter_indicator_t *)indic, v);
}

void ui_event_Screen1(lv_event_t *e);
lv_obj_t *ui_Screen1;
lv_obj_t *ui_Screen1_Button1;
lv_obj_t *ui_Screen1_Label1;
lv_obj_t *ui_Screen1_Panel1;
lv_obj_t *ui_Screen1_Panel2;
lv_obj_t *ui_Screen1_Panel2_1;
void ui_event_Screen2(lv_event_t *e);
lv_obj_t *ui_Screen2;
lv_obj_t *ui_Screen1_Button2;
lv_obj_t *ui_Screen1_Label2;
lv_obj_t *ui_Screen1_Panel3;
lv_obj_t *ui_Screen1_Panel4;
void ui_event_Screen3(lv_event_t *e);
lv_obj_t *ui_Screen3;
lv_obj_t *ui_Screen1_Button3;
lv_obj_t *ui_Screen1_Label3;
lv_obj_t *ui_Screen1_Panel5;
lv_obj_t *ui_Screen1_Panel6;
void ui_event_Screen4(lv_event_t *e);
lv_obj_t *ui_Screen4;
lv_obj_t *ui_Screen1_Button4;
lv_obj_t *ui_Screen1_Label4;
lv_obj_t *ui_Screen1_Panel7;
lv_obj_t *ui_Screen1_Panel8;
void ui_event_Screen5(lv_event_t *e);
lv_obj_t *ui_Screen5;
lv_obj_t *ui_Screen1_Button5;
lv_obj_t *ui_Screen1_Label5;
lv_obj_t *ui_Screen1_Panel9;
lv_obj_t *ui_Screen1_Panel10;

///Lovyang setup

class LGFX : public lgfx::LGFX_Device {
  lgfx::Panel_ILI9341 _panel_instance;
  lgfx::Bus_SPI _bus_instance;  // SPIバスのインスタンス
  lgfx::Light_PWM _light_instance;
  lgfx::Touch_XPT2046 _touch_instance;

public:
  LGFX(void) {
    {                                          // バス制御の設定を行います。
      auto cfg = _bus_instance.config();       // バス設定用の構造体を取得します。
      cfg.spi_host = HSPI_HOST;                // 使用するSPIを選択  (VSPI_HOST or HSPI_HOST)
      cfg.spi_mode = 0;                        // SPI通信モードを設定 (0 ~ 3)
      cfg.freq_write = 40000000;               // 送信時のSPIクロック (最大80MHz, 80MHzを整数で割った値に丸められます)
      cfg.freq_read = 16000000;                // 受信時のSPIクロック
      cfg.spi_3wire = false;                   // 受信をMOSIピンで行う場合はtrueを設定
      cfg.use_lock = true;                     // トランザクションロックを使用する場合はtrueを設定
      cfg.dma_channel = 1;                     // Set the DMA channel (1 or 2. 0=disable)   使用するDMAチャンネルを設定 (0=DMA不使用)
      cfg.pin_sclk = 18;                       // SPIのSCLKピン番号を設定
      cfg.pin_mosi = 23;                       // SPIのMOSIピン番号を設定
      cfg.pin_miso = 19;                       // SPIのMISOピン番号を設定 (-1 = disable)
      cfg.pin_dc = 16;                         // SPIのD/Cピン番号を設定  (-1 = disable)
      _bus_instance.config(cfg);               // 設定値をバスに反映します。
      _panel_instance.setBus(&_bus_instance);  // バスをパネルにセットします。
    }

    {                                       // 表示パネル制御の設定を行います。
      auto cfg = _panel_instance.config();  // 表示パネル設定用の構造体を取得します。
      cfg.pin_cs = 5;                       // CSが接続されているピン番号   (-1 = disable)
      cfg.pin_rst = -1;                     // RSTが接続されているピン番号  (-1 = disable)
      cfg.pin_busy = -1;                    // BUSYが接続されているピン番号 (-1 = disable)
      cfg.memory_width = 240;               // ドライバICがサポートしている最大の幅
      cfg.memory_height = 320;              // ドライバICがサポートしている最大の高さ
      cfg.panel_width = 240;                // 実際に表示可能な幅
      cfg.panel_height = 320;               // 実際に表示可能な高さ
      cfg.offset_x = 0;                     // パネルのX方向オフセット量
      cfg.offset_y = 0;                     // パネルのY方向オフセット量
      cfg.offset_rotation = 0;              // 回転方向の値のオフセット 0~7 (4~7は上下反転)
      cfg.dummy_read_pixel = 8;             // ピクセル読出し前のダミーリードのビット数
      cfg.dummy_read_bits = 1;              // ピクセル以外のデータ読出し前のダミーリードのビット数
      cfg.readable = true;                  // データ読出しが可能な場合 trueに設定
      cfg.invert = false;                   // パネルの明暗が反転してしまう場合 trueに設定
      cfg.rgb_order = false;                // パネルの赤と青が入れ替わってしまう場合 trueに設定
      cfg.dlen_16bit = false;               // データ長を16bit単位で送信するパネルの場合 trueに設定
      cfg.bus_shared = true;                // SDカードとバスを共有している場合 trueに設定(drawJpgFile等でバス制御を行います)

      _panel_instance.config(cfg);
    }

    {                                       // バックライト制御の設定を行います。(必要なければ削除)
      auto cfg = _light_instance.config();  // バックライト設定用の構造体を取得します。

      cfg.pin_bl = 21;      // バックライトが接続されているピン番号
      cfg.invert = false;   // バックライトの輝度を反転させる場合 true
      cfg.freq = 44100;     // バックライトのPWM周波数
      cfg.pwm_channel = 7;  // 使用するPWMのチャンネル番号

      _light_instance.config(cfg);
      _panel_instance.setLight(&_light_instance);  // バックライトをパネルにセットします。
    }

    {  // タッチスクリーン制御の設定を行います。(必要なければ削除)
      auto cfg = _touch_instance.config();
      cfg.x_min = 0;             // タッチスクリーンから得られる最小のX値(生の値)
      cfg.x_max = 239;           // タッチスクリーンから得られる最大のX値(生の値)
      cfg.y_min = 0;             // タッチスクリーンから得られる最小のY値(生の値)
      cfg.y_max = 319;           // タッチスクリーンから得られる最大のY値(生の値)
      cfg.pin_int = -1;          // INTが接続されているピン番号
      cfg.bus_shared = true;     // 画面と共通のバスを使用している場合 trueを設定
      cfg.offset_rotation = 0;   // 表示とタッチの向きのが一致しない場合の調整 0~7の値で設定
      cfg.spi_host = HSPI_HOST;  // 使用するSPIを選択 (HSPI_HOST or VSPI_HOST)
      cfg.freq = 1000000;        // SPIクロックを設定
      cfg.pin_sclk = 18;         // SCLKが接続されているピン番号
      cfg.pin_mosi = 23;         // MOSIが接続されているピン番号
      cfg.pin_miso = 19;         // MISOが接続されているピン番号
      cfg.pin_cs = 15;           //   CSが接続されているピン番号
      _touch_instance.config(cfg);
      _panel_instance.setTouch(&_touch_instance);  // タッチスクリーンをパネルにセットします。
    }
    setPanel(&_panel_instance);  // 使用するパネルをセットします。
  }
};

LGFX tft;

//Change to your screen resolution

static const uint32_t screenWidth = 240;
static const uint32_t screenHeight = 320;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[screenWidth * 10];

//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.writePixels((lgfx::rgb565_t *)&color_p->full, w * h);
  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);
  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;

    
  }
}





//setup function

void setup(void) {
 
  tft.begin();
  tft.setRotation(2);
  tft.setBrightness(255);
  uint16_t calData[] = { 3964, 3099, 3923, 158, 784, 3069, 935, 138 };
  tft.setTouchCalibrate(calData);

  lv_init();
  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 tft 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);

  ui_init();



}

void loop(void) {
  lv_timer_handler(); /* let the GUI do its work */
  delay(5);
}

void ui_event_Screen1(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_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
    _ui_screen_change(ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
  if (event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
    _ui_screen_change(ui_Screen5, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
}
void ui_event_Screen2(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_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
    _ui_screen_change(ui_Screen3, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
  if (event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
    _ui_screen_change(ui_Screen1, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
}
void ui_event_Screen3(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_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
    _ui_screen_change(ui_Screen4, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
  if (event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
    _ui_screen_change(ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
}
void ui_event_Screen4(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_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
    _ui_screen_change(ui_Screen5, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
  if (event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
    _ui_screen_change(ui_Screen3, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
}
void ui_event_Screen5(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_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
    _ui_screen_change(ui_Screen1, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
  if (event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
    _ui_screen_change(ui_Screen4, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0);
  }
}

///////////////////// SCREENS ////////////////////
void ui_Screen1_screen_init(void) {
  ui_Screen1 = lv_obj_create(NULL);
  lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_radius(ui_Screen1, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen1, lv_color_hex(0xFFD35E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_color(ui_Screen1, lv_color_hex(0x6670BD), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_main_stop(ui_Screen1, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_stop(ui_Screen1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_dir(ui_Screen1, LV_GRAD_DIR_VER, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_clip_corner(ui_Screen1, false, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Button1 = lv_btn_create(ui_Screen1);
  lv_obj_set_width(ui_Screen1_Button1, 179);
  lv_obj_set_height(ui_Screen1_Button1, 31);
  lv_obj_set_x(ui_Screen1_Button1, -1);
  lv_obj_set_y(ui_Screen1_Button1, -134);
  lv_obj_set_align(ui_Screen1_Button1, LV_ALIGN_CENTER);
  lv_obj_add_flag(ui_Screen1_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS);  /// Flags
  lv_obj_clear_flag(ui_Screen1_Button1,
                    LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_scrollbar_mode(ui_Screen1_Button1, LV_SCROLLBAR_MODE_OFF);
  lv_obj_set_style_radius(ui_Screen1_Button1, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen1_Button1, lv_color_hex(0x8A8034), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen1_Button1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(ui_Screen1_Button1, lv_color_hex(0xE9DA5E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_opa(ui_Screen1_Button1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(ui_Screen1_Button1, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_color(ui_Screen1_Button1, lv_color_hex(0xC6B528), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_opa(ui_Screen1_Button1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_width(ui_Screen1_Button1, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_pad(ui_Screen1_Button1, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_blend_mode(ui_Screen1_Button1, LV_BLEND_MODE_NORMAL, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Label1 = lv_label_create(ui_Screen1);
  lv_obj_set_width(ui_Screen1_Label1, LV_SIZE_CONTENT);   /// 1
  lv_obj_set_height(ui_Screen1_Label1, LV_SIZE_CONTENT);  /// 1
  lv_obj_set_x(ui_Screen1_Label1, -2);
  lv_obj_set_y(ui_Screen1_Label1, -133);
  lv_obj_set_align(ui_Screen1_Label1, LV_ALIGN_CENTER);
  lv_label_set_text(ui_Screen1_Label1, "Dormitor Mare");
  lv_obj_set_style_text_color(ui_Screen1_Label1, lv_color_hex(0x08F10A), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_opa(ui_Screen1_Label1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_font(ui_Screen1_Label1, &ui_font_cartes20, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel1 = lv_obj_create(ui_Screen1);
  lv_obj_set_width(ui_Screen1_Panel1, 219);
  lv_obj_set_height(ui_Screen1_Panel1, 126);
  lv_obj_set_x(ui_Screen1_Panel1, 0);
  lv_obj_set_y(ui_Screen1_Panel1, -46);
  lv_obj_set_align(ui_Screen1_Panel1, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel1, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel2 = lv_obj_create(ui_Screen1);
  lv_obj_set_width(ui_Screen1_Panel2, 219);
  lv_obj_set_height(ui_Screen1_Panel2, 126);
  lv_obj_set_x(ui_Screen1_Panel2, 0);
  lv_obj_set_y(ui_Screen1_Panel2, 87);
  lv_obj_set_align(ui_Screen1_Panel2, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel2, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);

  lv_obj_add_event_cb(ui_Screen1, ui_event_Screen1, LV_EVENT_ALL, NULL);

  //start adding meter


  meter = lv_meter_create(ui_Screen1_Panel2);
  //lv_obj_center(meter);
  //lv_obj_set_pos(meter, 0, 60);
  lv_obj_align_to(meter,   ui_Screen1_Panel2, LV_ALIGN_BOTTOM_MID, -53,13);
  
  lv_obj_set_size(meter, 239, 239);

  /*Add a scale first*/
  lv_meter_scale_t *scale = lv_meter_add_scale(meter);
  lv_meter_set_scale_range(meter, scale, 0, 100, 180, 180);
  //lv_obj_remove_style(meter, NULL, LV_PART_MAIN);
  lv_meter_set_scale_ticks(meter, scale, 21, 2, 5, lv_palette_main(LV_PALETTE_GREEN));
  lv_meter_set_scale_major_ticks(meter, scale, 5, 2, 15, lv_palette_main(LV_PALETTE_GREEN), 10);

  lv_meter_indicator_t *indic;

  /*Add a blue arc to the start*/
  indic = lv_meter_add_arc(meter, scale, 3, lv_palette_main(LV_PALETTE_BLUE), 0);
  lv_meter_set_indicator_start_value(meter, indic, 0);
  lv_meter_set_indicator_end_value(meter, indic, 20);

  /*Make the tick lines blue at the start of the scale*/
  indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_BLUE),
                                   false, 0);
  lv_meter_set_indicator_start_value(meter, indic, 0);
  lv_meter_set_indicator_end_value(meter, indic, 20);

  /*Add a red arc to the end*/
  indic = lv_meter_add_arc(meter, scale, 3, lv_palette_main(LV_PALETTE_RED), 0);
  lv_meter_set_indicator_start_value(meter, indic, 75);
  lv_meter_set_indicator_end_value(meter, indic, 100);

  /*Make the tick lines red at the end of the scale*/
  indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_RED), lv_palette_main(LV_PALETTE_RED), false,
                                   0);
  lv_meter_set_indicator_start_value(meter, indic, 75);
  lv_meter_set_indicator_end_value(meter, indic, 100);

  /*Add a needle line indicator*/
  indic = lv_meter_add_needle_line(meter, scale, 4, lv_palette_main(LV_PALETTE_GREEN), -10);

  /*Create an animation to set the value*/
  lv_anim_t a;
  lv_anim_init(&a);
  lv_anim_set_exec_cb(&a, set_value);
  lv_anim_set_var(&a, indic);
  lv_anim_set_values(&a, 0, 100);
  lv_anim_set_time(&a, 2000);
  lv_anim_set_repeat_delay(&a, 100);
  lv_anim_set_playback_time(&a, 500);
  lv_anim_set_playback_delay(&a, 100);
  lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
  lv_anim_start(&a);

  //end meter

  ui_Screen1_Panel2_1 = lv_obj_create(ui_Screen1_Panel2);
  lv_obj_set_width(ui_Screen1_Panel2_1, 100);
  lv_obj_set_height(ui_Screen1_Panel2_1,50);
  lv_obj_set_style_bg_color(ui_Screen1_Panel2_1,lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_align_to(ui_Screen1_Panel2_1,   ui_Screen1_Panel2, LV_ALIGN_BOTTOM_MID, 0,13);  
}
void ui_Screen2_screen_init(void) {
  ui_Screen2 = lv_obj_create(NULL);
  lv_obj_clear_flag(ui_Screen2, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_radius(ui_Screen2, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen2, lv_color_hex(0xFFD35E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_color(ui_Screen2, lv_color_hex(0x6670BD), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_main_stop(ui_Screen2, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_stop(ui_Screen2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_dir(ui_Screen2, LV_GRAD_DIR_VER, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_clip_corner(ui_Screen2, false, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Button2 = lv_btn_create(ui_Screen2);
  lv_obj_set_width(ui_Screen1_Button2, 179);
  lv_obj_set_height(ui_Screen1_Button2, 31);
  lv_obj_set_x(ui_Screen1_Button2, -1);
  lv_obj_set_y(ui_Screen1_Button2, -134);
  lv_obj_set_align(ui_Screen1_Button2, LV_ALIGN_CENTER);
  lv_obj_add_flag(ui_Screen1_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS);  /// Flags
  lv_obj_clear_flag(ui_Screen1_Button2,
                    LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_scrollbar_mode(ui_Screen1_Button2, LV_SCROLLBAR_MODE_OFF);
  lv_obj_set_style_radius(ui_Screen1_Button2, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen1_Button2, lv_color_hex(0x8A8034), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen1_Button2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(ui_Screen1_Button2, lv_color_hex(0xE9DA5E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_opa(ui_Screen1_Button2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(ui_Screen1_Button2, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_color(ui_Screen1_Button2, lv_color_hex(0xC6B528), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_opa(ui_Screen1_Button2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_width(ui_Screen1_Button2, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_pad(ui_Screen1_Button2, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_blend_mode(ui_Screen1_Button2, LV_BLEND_MODE_NORMAL, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Label2 = lv_label_create(ui_Screen2);
  lv_obj_set_width(ui_Screen1_Label2, LV_SIZE_CONTENT);   /// 1
  lv_obj_set_height(ui_Screen1_Label2, LV_SIZE_CONTENT);  /// 1
  lv_obj_set_x(ui_Screen1_Label2, -2);
  lv_obj_set_y(ui_Screen1_Label2, -133);
  lv_obj_set_align(ui_Screen1_Label2, LV_ALIGN_CENTER);
  lv_label_set_text(ui_Screen1_Label2, "Dormitor Mic");
  lv_obj_set_style_text_color(ui_Screen1_Label2, lv_color_hex(0x08F10A), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_opa(ui_Screen1_Label2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_font(ui_Screen1_Label2, &ui_font_cartes20, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel3 = lv_obj_create(ui_Screen2);
  lv_obj_set_width(ui_Screen1_Panel3, 219);
  lv_obj_set_height(ui_Screen1_Panel3, 126);
  lv_obj_set_x(ui_Screen1_Panel3, 0);
  lv_obj_set_y(ui_Screen1_Panel3, -46);
  lv_obj_set_align(ui_Screen1_Panel3, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel3, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel3, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel4 = lv_obj_create(ui_Screen2);
  lv_obj_set_width(ui_Screen1_Panel4, 219);
  lv_obj_set_height(ui_Screen1_Panel4, 126);
  lv_obj_set_x(ui_Screen1_Panel4, 0);
  lv_obj_set_y(ui_Screen1_Panel4, 87);
  lv_obj_set_align(ui_Screen1_Panel4, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel4, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel4, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  lv_obj_add_event_cb(ui_Screen2, ui_event_Screen2, LV_EVENT_ALL, NULL);
}
void ui_Screen3_screen_init(void) {
  ui_Screen3 = lv_obj_create(NULL);
  lv_obj_clear_flag(ui_Screen3, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_radius(ui_Screen3, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen3, lv_color_hex(0xFFD35E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_color(ui_Screen3, lv_color_hex(0x6670BD), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_main_stop(ui_Screen3, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_stop(ui_Screen3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_dir(ui_Screen3, LV_GRAD_DIR_VER, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_clip_corner(ui_Screen3, false, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Button3 = lv_btn_create(ui_Screen3);
  lv_obj_set_width(ui_Screen1_Button3, 179);
  lv_obj_set_height(ui_Screen1_Button3, 31);
  lv_obj_set_x(ui_Screen1_Button3, -1);
  lv_obj_set_y(ui_Screen1_Button3, -134);
  lv_obj_set_align(ui_Screen1_Button3, LV_ALIGN_CENTER);
  lv_obj_add_flag(ui_Screen1_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS);  /// Flags
  lv_obj_clear_flag(ui_Screen1_Button3,
                    LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_scrollbar_mode(ui_Screen1_Button3, LV_SCROLLBAR_MODE_OFF);
  lv_obj_set_style_radius(ui_Screen1_Button3, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen1_Button3, lv_color_hex(0x8A8034), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen1_Button3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(ui_Screen1_Button3, lv_color_hex(0xE9DA5E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_opa(ui_Screen1_Button3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(ui_Screen1_Button3, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_color(ui_Screen1_Button3, lv_color_hex(0xC6B528), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_opa(ui_Screen1_Button3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_width(ui_Screen1_Button3, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_pad(ui_Screen1_Button3, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_blend_mode(ui_Screen1_Button3, LV_BLEND_MODE_NORMAL, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Label3 = lv_label_create(ui_Screen3);
  lv_obj_set_width(ui_Screen1_Label3, LV_SIZE_CONTENT);   /// 1
  lv_obj_set_height(ui_Screen1_Label3, LV_SIZE_CONTENT);  /// 1
  lv_obj_set_x(ui_Screen1_Label3, -2);
  lv_obj_set_y(ui_Screen1_Label3, -133);
  lv_obj_set_align(ui_Screen1_Label3, LV_ALIGN_CENTER);
  lv_label_set_text(ui_Screen1_Label3, "Living");
  lv_obj_set_style_text_color(ui_Screen1_Label3, lv_color_hex(0x08F10A), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_opa(ui_Screen1_Label3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_font(ui_Screen1_Label3, &ui_font_cartes20, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel5 = lv_obj_create(ui_Screen3);
  lv_obj_set_width(ui_Screen1_Panel5, 219);
  lv_obj_set_height(ui_Screen1_Panel5, 126);
  lv_obj_set_x(ui_Screen1_Panel5, 0);
  lv_obj_set_y(ui_Screen1_Panel5, -46);
  lv_obj_set_align(ui_Screen1_Panel5, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel5, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel5, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel6 = lv_obj_create(ui_Screen3);
  lv_obj_set_width(ui_Screen1_Panel6, 219);
  lv_obj_set_height(ui_Screen1_Panel6, 126);
  lv_obj_set_x(ui_Screen1_Panel6, 0);
  lv_obj_set_y(ui_Screen1_Panel6, 87);
  lv_obj_set_align(ui_Screen1_Panel6, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel6, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel6, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  lv_obj_add_event_cb(ui_Screen3, ui_event_Screen3, LV_EVENT_ALL, NULL);
}
void ui_Screen4_screen_init(void) {
  ui_Screen4 = lv_obj_create(NULL);
  lv_obj_clear_flag(ui_Screen4, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_radius(ui_Screen4, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen4, lv_color_hex(0xFFD35E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_color(ui_Screen4, lv_color_hex(0x6670BD), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_main_stop(ui_Screen4, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_stop(ui_Screen4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_dir(ui_Screen4, LV_GRAD_DIR_VER, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_clip_corner(ui_Screen4, false, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Button4 = lv_btn_create(ui_Screen4);
  lv_obj_set_width(ui_Screen1_Button4, 179);
  lv_obj_set_height(ui_Screen1_Button4, 31);
  lv_obj_set_x(ui_Screen1_Button4, -1);
  lv_obj_set_y(ui_Screen1_Button4, -134);
  lv_obj_set_align(ui_Screen1_Button4, LV_ALIGN_CENTER);
  lv_obj_add_flag(ui_Screen1_Button4, LV_OBJ_FLAG_SCROLL_ON_FOCUS);  /// Flags
  lv_obj_clear_flag(ui_Screen1_Button4,
                    LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_scrollbar_mode(ui_Screen1_Button4, LV_SCROLLBAR_MODE_OFF);
  lv_obj_set_style_radius(ui_Screen1_Button4, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen1_Button4, lv_color_hex(0x8A8034), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen1_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(ui_Screen1_Button4, lv_color_hex(0xE9DA5E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_opa(ui_Screen1_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(ui_Screen1_Button4, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_color(ui_Screen1_Button4, lv_color_hex(0xC6B528), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_opa(ui_Screen1_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_width(ui_Screen1_Button4, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_pad(ui_Screen1_Button4, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_blend_mode(ui_Screen1_Button4, LV_BLEND_MODE_NORMAL, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Label4 = lv_label_create(ui_Screen4);
  lv_obj_set_width(ui_Screen1_Label4, LV_SIZE_CONTENT);   /// 1
  lv_obj_set_height(ui_Screen1_Label4, LV_SIZE_CONTENT);  /// 1
  lv_obj_set_x(ui_Screen1_Label4, -2);
  lv_obj_set_y(ui_Screen1_Label4, -133);
  lv_obj_set_align(ui_Screen1_Label4, LV_ALIGN_CENTER);
  lv_label_set_text(ui_Screen1_Label4, "Bucatarie");
  lv_obj_set_style_text_color(ui_Screen1_Label4, lv_color_hex(0x08F10A), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_opa(ui_Screen1_Label4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_font(ui_Screen1_Label4, &ui_font_cartes20, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel7 = lv_obj_create(ui_Screen4);
  lv_obj_set_width(ui_Screen1_Panel7, 219);
  lv_obj_set_height(ui_Screen1_Panel7, 126);
  lv_obj_set_x(ui_Screen1_Panel7, 0);
  lv_obj_set_y(ui_Screen1_Panel7, -46);
  lv_obj_set_align(ui_Screen1_Panel7, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel7, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel7, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel8 = lv_obj_create(ui_Screen4);
  lv_obj_set_width(ui_Screen1_Panel8, 219);
  lv_obj_set_height(ui_Screen1_Panel8, 126);
  lv_obj_set_x(ui_Screen1_Panel8, 0);
  lv_obj_set_y(ui_Screen1_Panel8, 87);
  lv_obj_set_align(ui_Screen1_Panel8, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel8, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel8, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  lv_obj_add_event_cb(ui_Screen4, ui_event_Screen4, LV_EVENT_ALL, NULL);
}
void ui_Screen5_screen_init(void) {
  ui_Screen5 = lv_obj_create(NULL);
  lv_obj_clear_flag(ui_Screen5, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_radius(ui_Screen5, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen5, lv_color_hex(0xFFD35E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_color(ui_Screen5, lv_color_hex(0x6670BD), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_main_stop(ui_Screen5, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_stop(ui_Screen5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_grad_dir(ui_Screen5, LV_GRAD_DIR_VER, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_clip_corner(ui_Screen5, false, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Button5 = lv_btn_create(ui_Screen5);
  lv_obj_set_width(ui_Screen1_Button5, 179);
  lv_obj_set_height(ui_Screen1_Button5, 31);
  lv_obj_set_x(ui_Screen1_Button5, -1);
  lv_obj_set_y(ui_Screen1_Button5, -134);
  lv_obj_set_align(ui_Screen1_Button5, LV_ALIGN_CENTER);
  lv_obj_add_flag(ui_Screen1_Button5, LV_OBJ_FLAG_SCROLL_ON_FOCUS);  /// Flags
  lv_obj_clear_flag(ui_Screen1_Button5,
                    LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_scrollbar_mode(ui_Screen1_Button5, LV_SCROLLBAR_MODE_OFF);
  lv_obj_set_style_radius(ui_Screen1_Button5, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_color(ui_Screen1_Button5, lv_color_hex(0x8A8034), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(ui_Screen1_Button5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(ui_Screen1_Button5, lv_color_hex(0xE9DA5E), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_opa(ui_Screen1_Button5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(ui_Screen1_Button5, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_color(ui_Screen1_Button5, lv_color_hex(0xC6B528), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_opa(ui_Screen1_Button5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_width(ui_Screen1_Button5, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_outline_pad(ui_Screen1_Button5, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_blend_mode(ui_Screen1_Button5, LV_BLEND_MODE_NORMAL, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Label5 = lv_label_create(ui_Screen5);
  lv_obj_set_width(ui_Screen1_Label5, LV_SIZE_CONTENT);   /// 1
  lv_obj_set_height(ui_Screen1_Label5, LV_SIZE_CONTENT);  /// 1
  lv_obj_set_x(ui_Screen1_Label5, -2);
  lv_obj_set_y(ui_Screen1_Label5, -133);
  lv_obj_set_align(ui_Screen1_Label5, LV_ALIGN_CENTER);
  lv_label_set_text(ui_Screen1_Label5, "Afara");
  lv_obj_set_style_text_color(ui_Screen1_Label5, lv_color_hex(0x08F10A), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_opa(ui_Screen1_Label5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_font(ui_Screen1_Label5, &ui_font_cartes20, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel9 = lv_obj_create(ui_Screen5);
  lv_obj_set_width(ui_Screen1_Panel9, 219);
  lv_obj_set_height(ui_Screen1_Panel9, 126);
  lv_obj_set_x(ui_Screen1_Panel9, 0);
  lv_obj_set_y(ui_Screen1_Panel9, -46);
  lv_obj_set_align(ui_Screen1_Panel9, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel9, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel9, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  ui_Screen1_Panel10 = lv_obj_create(ui_Screen5);
  lv_obj_set_width(ui_Screen1_Panel10, 219);
  lv_obj_set_height(ui_Screen1_Panel10, 126);
  lv_obj_set_x(ui_Screen1_Panel10, 0);
  lv_obj_set_y(ui_Screen1_Panel10, 87);
  lv_obj_set_align(ui_Screen1_Panel10, LV_ALIGN_CENTER);
  lv_obj_clear_flag(ui_Screen1_Panel10, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_opa(ui_Screen1_Panel10, 25, LV_PART_MAIN | LV_STATE_DEFAULT);

  lv_obj_add_event_cb(ui_Screen5, ui_event_Screen5, 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_Screen1_screen_init();
  ui_Screen2_screen_init();
  ui_Screen3_screen_init();
  ui_Screen4_screen_init();
  ui_Screen5_screen_init();
  lv_disp_load_scr(ui_Screen1);
}

void _ui_screen_change(lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) {
  lv_scr_load_anim(target, fademode, spd, delay, false);
}