Could you please provide an example of having multiple/several screens in LVGL and navigate from one to another by pressing a button in each screen?
I know you have provided TABs example in the “Learn LVGL” PDF Book, but I don’t want to handle tabs, I want to have individual screens to display different kinds of information and capture user inputs.
Thanks in advance for your help.
Hi.
At the moment, we don’t have any example like that.
I’ll add it to my to-do list and either add it to the next version of the eBook or create a free tutorial about it.
But, it may take some time as we’re currently out of the office and we already have the projects lined up for the next weeks.
Regards,
Rui
Thanks Rui.
I hope it will be soon, as I guess many people would need to do something like this, so it would benefit many of us.
Regards.
Hi Rui and Juan,
I am facing the same problem with CYD and EEZ studio. Multiple screens works well by using buttons to navigate between screens. No problem either to add an event (switch, slider, arc…) operating with the CYD WITH ONLY ONE SCREEN but I get the following error if I use the same function with multiple screens :
In function ‘void setup()’:
92 | lv_obj_add_event_cb(objects.switch_screen_a, switch_event_handler, LV_EVENT_VALUE_CHANGED, objects.off_on);
| ^~~~~~~
exit status 1
Compilation error: ‘objects’ was not declared in this scope
The problem could be specifying the action screen even if the structure in the sketch directory mentions the objects.
If I comment this line 92 in the setup, no issue to load the sketch. I can navigate but, of course, no event/action with the leds/inputs/outputs of the CYD.
typedef struct _objects_t {
lv_obj_t *screen_a;
lv_obj_t *screen_b;
lv_obj_t *screen_c;
lv_obj_t *obj0;
lv_obj_t *obj1;
lv_obj_t *obj2;
lv_obj_t *obj3;
lv_obj_t *obj4;
lv_obj_t *obj5;
lv_obj_t *switch_screen_a;
lv_obj_t *off_on;
lv_obj_t *arc_screen_b;
lv_obj_t *scale_arc_b;
lv_obj_t *led_arc_b;
lv_obj_t *text_arc_b;
} objects_t;
Regards,
Fabrice
Hi.
objects was not declared in this scope, which means they are not created before being called.
Ýou’re creating objects_t, shouldn’t you use that instead of objects?
lv_obj_add_event_cb(objects.switch_screen_a, switch_event_handler, LV_EVENT_VALUE_CHANGED, objects.off_on);
Regards,
Sara
Hi Sara,
Issue still the same with objects_t.
the structure with 1 or more screens is the identical with objects_t.
I tried different codes by specifying screen_a but nothing work.
Regards,
Fabrice
When you say nothing works, what happens exactly?
Do you always get the same error?
Regards,
Sara
Sorry Sara, I was not specific enough.
All the codes I used for the line lv_obj_add_event_cb… did not work. I always get the same error :
Compilation error: ‘objects’ was not declared in this scope.
If I replace “objects” by another item (like screen_a), I get this error “Compilation error: ‘screen_a’ was not declared in this scope.
Without this line, I can upload the code and all the display functions (widgets, screens…) run perfectly but no action with the leds or in/outputs of the CYD of course.
With one screen only, everything runs properly.
With multiple screens, It seems that the code cannot identify the object in the structure.
Hi.
Maybe you have to define your objects separately without being inside a structure and as global variables, outside any functions and before any function definitions or calls.
At the moment, I’m out of the office and I don’t have a way to test this..
Regards,
Sara
Hi Sara,
It would be a pity. That means to loose the benefit of EEZ Studio.
Regards,
Fabrice
Good evening Sara,
I kept going to investigate and my understanding is that the problem comes from EEZ studio.
To manage screens, you must have the tag “actions” and this tag is only available with LVGL and EEZ flow project.
If you use the LVGL (without EEZ flow) project, you don’t have this actions tag.
The same configuration works with LVGL but not with LVGL and EEZ flow. Tricky…
The other solution is to use the scrolling. Either it is a bug from EEZ studio or I am not able to do the appropriate code…
Regards,
Fabrice
Hi Sara,
problem solved with 2 screens and 2 buttons in this example. Designed made with EEZ studio.
in setup :
// Assign a callback to the button_1 to screen_2
lv_obj_add_event_cb(objects.button_1, button_event_handler, LV_EVENT_CLICKED, NULL);
// Assign a callback to the button_2 to screen_1
lv_obj_add_event_cb(objects.button_2, button_event_handler2, LV_EVENT_CLICKED, NULL);
and :
// Callback that is triggered when button1 is clicked
static void button_event_handler(lv_event_t * e) {
lv_event_code_t code = lv_event_get_code(e);
lv_scr_load_anim(objects.screen_2, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
// Callback that is triggered when button2 is clicked
static void button_event_handler2(lv_event_t * e) {
lv_event_code_t code = lv_event_get_code(e);
lv_scr_load_anim(objects.screen_1, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
I lost a lot of time with that because EEZ studio and what I explained in my previous message.
Regards,
Fabrice
Fabrice,
Those are good news !!
Could you please share a basic example of it (2 screens and buttons in each no navigate between screens) with full code, so I can go thorugh it and fully understand it?
Thanks in advance.
Juan,
I did that with EEZ studio. It is a free soft and very useful. You dont need to code every widget LVGL., EEZ does it.
But it creates 12 files to put in the sketch directory with the xxxxx.ino and User_Setup (I use a CYD_3248S035_Capacitive). If you add the EEZ files for the design, it is difficult to write it on this forum.
May be Sara or Rui could help us to send these files.
Hi Fabrice,
I was using EEZ since the beginning, but got the issues mentioned at the top of this chat (that’s why I opened this chat/question), to ask for help and figure out what’s wrong. If I have just one screen, no issues with LVGL, but when I create an extra screen it does not compile, even if there is no Callback method for the buttons.
Could you please send me just the complete .ino file (with all sections: include, setup. loop, …) and the screen files generated by EEZ (screens.h and screens.c)? I think that would be sufficient for me to analize.
Thanks.
// Libraries for the screen
#include "TAMC_GT911.h"
#include <TFT_eSPI.h>
#include <lvgl.h>
#include "ui.h"
TFT_eSPI tft = TFT_eSPI();
/*Screen size*/
static const uint16_t screenWidth = 480;
static const uint16_t screenHeight = 320;
#define BUILTIN_RED 4 // Control RGB LED ESP32-3248S035C
#define BUILTIN_GREEN 16 // Control RGB LED ESP32-3248S035C
#define BUILTIN_BLUE 17 // Control RGB LED ESP32-3248S035C
/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
#define DRAW_BUF_SIZE (screenWidth * screenHeight / 10 * (LV_COLOR_DEPTH / 8))
uint32_t draw_buf[DRAW_BUF_SIZE / 4];
uint32_t lastTick = 0; //Used to track the tick timer
// Defines for the touch part of the screen
#define TOUCH_SDA 33
#define TOUCH_SCL 32
#define TOUCH_INT 21
#define TOUCH_RST 25
#define TOUCH_WIDTH screenHeight
#define TOUCH_HEIGHT screenWidth
// TAMC_GT911 initialize
TAMC_GT911 tp = TAMC_GT911(TOUCH_SDA, TOUCH_SCL, TOUCH_INT, TOUCH_RST, TOUCH_WIDTH, TOUCH_HEIGHT);
/*Read the touchpad*/
void my_touchpad_read (lv_indev_t * indev_driver, lv_indev_data_t * data)
{
tp.read();
if (!tp.isTouched)
{
data->state = LV_INDEV_STATE_REL;
}
else
{
data->state = LV_INDEV_STATE_PR;
data->point.x = tp.points[0].y;
data->point.y = tft.width()-tp.points[0].x;
}
}
void setup() {
Serial.begin(9600);
// initialize digital pin LED_BUILTIN as an output.
pinMode(BUILTIN_BLUE, OUTPUT);
pinMode(BUILTIN_GREEN, OUTPUT);
pinMode(BUILTIN_RED, OUTPUT);
//digitalWrite(BUILTIN_BLUE, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(BUILTIN_BLUE, HIGH); // turn the LED off by making the voltage LOW
//digitalWrite(BUILTIN_GREEN, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(BUILTIN_GREEN, HIGH); // turn the LED off by making the voltage LOW
//digitalWrite(BUILTIN_RED, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(BUILTIN_RED, HIGH); // turn the LED off by making the voltage LOW
// Start LVGL
lv_init();
// Start TFT
tft.begin();
// LVGL Setup
lv_display_t * disp;
disp = lv_tft_espi_create(screenWidth, screenHeight, draw_buf, sizeof(draw_buf));
lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_0);
// Start touch
tp.begin();
tp.setRotation(ROTATION_NORMAL);
// Initialize the (dummy) input device driver
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER); //Touchpad should have POINTER type
lv_indev_set_read_cb(indev, my_touchpad_read);
// Done
Serial.println(“LVGL Setup done”);
//Integrate EEZ Studio GUI
ui_init();
// Assign a callback to the buttons changing screens from MS
lv_obj_add_event_cb(objects.to_screen_a, button_event_handler1, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.to_screen_b, button_event_handler2, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.to_screen_c, button_event_handler3, LV_EVENT_CLICKED, NULL);
// Assign a callback to the buttons changing screens from A
lv_obj_add_event_cb(objects.ato_ms, button_event_handler4, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.ato_b, button_event_handler2, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.ato_c, button_event_handler3, LV_EVENT_CLICKED, NULL);
// Assign a callback to the buttons changing screens from B
lv_obj_add_event_cb(objects.bto_ms, button_event_handler4, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.bto_a, button_event_handler1, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.bto_c, button_event_handler3, LV_EVENT_CLICKED, NULL);
// Assign a callback to the buttons changing screens from C
lv_obj_add_event_cb(objects.cto_ms, button_event_handler4, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.cto_a, button_event_handler1, LV_EVENT_CLICKED, NULL);
lv_obj_add_event_cb(objects.cto_b, button_event_handler2, LV_EVENT_CLICKED, NULL);
//Register event handler switch
lv_obj_add_event_cb(objects.switch_nb1, switch_event_handler1, LV_EVENT_VALUE_CHANGED, objects.label_switch_nb1);
lv_obj_add_event_cb(objects.switch_nb2, switch_event_handler2, LV_EVENT_VALUE_CHANGED, objects.label_switch_nb2);
lv_obj_add_event_cb(objects.switch_nb3, switch_event_handler3, LV_EVENT_VALUE_CHANGED, objects.label_switch_nb3);
//Register event handler arc
lv_obj_add_event_cb(objects.arc_blue, arc_dimmer_event_handler1, LV_EVENT_VALUE_CHANGED, objects.label_dim_value_blue);
lv_obj_add_event_cb(objects.arc_green, arc_dimmer_event_handler2, LV_EVENT_VALUE_CHANGED, objects.label_dim_value_green);
lv_obj_add_event_cb(objects.arc_red, arc_dimmer_event_handler3, LV_EVENT_VALUE_CHANGED, objects.label_dim_value_red);
}
// Callback that is triggered when button is clicked
static void button_event_handler1(lv_event_t * e) {
lv_event_code_t code = lv_event_get_code(e);
lv_scr_load_anim(objects.screen_a, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
// Callback that is triggered when button is clicked
static void button_event_handler2(lv_event_t * e) {
lv_event_code_t code = lv_event_get_code(e);
lv_scr_load_anim(objects.screen_b, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
// Callback that is triggered when button is clicked
static void button_event_handler3(lv_event_t * e) {
lv_event_code_t code = lv_event_get_code(e);
lv_scr_load_anim(objects.screen_c, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
// Callback that is triggered when button is clicked
static void button_event_handler4(lv_event_t * e) {
lv_event_code_t code = lv_event_get_code(e);
lv_scr_load_anim(objects.main, LV_SCR_LOAD_ANIM_FADE_IN, 200, 0, false);
}
static void switch_event_handler1(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e); //Get the event code
lv_obj_t *switch_nb1 = (lv_obj_t *)lv_event_get_target(e); //Switch that generated the event
lv_obj_t *label = (lv_obj_t *)lv_event_get_user_data(e); //Label or other UI elements we want to update (Optional)
if (code == LV_EVENT_VALUE_CHANGED) {
bool isChecked = lv_obj_has_state(switch_nb1, LV_STATE_CHECKED); //Returns true/false
if (isChecked) {
digitalWrite(BUILTIN_BLUE, LOW);
lv_label_set_text(label, “ON”);
} else {
digitalWrite(BUILTIN_BLUE, HIGH);
lv_label_set_text(label, “OFF”);
}
}
}
static void switch_event_handler2(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e); //Get the event code
lv_obj_t *switch_nb2 = (lv_obj_t *)lv_event_get_target(e); //Switch that generated the event
lv_obj_t *label = (lv_obj_t *)lv_event_get_user_data(e); //Label or other UI elements we want to update (Optional)
if (code == LV_EVENT_VALUE_CHANGED) {
bool isChecked = lv_obj_has_state(switch_nb2, LV_STATE_CHECKED); //Returns true/false
if (isChecked) {
digitalWrite(BUILTIN_RED, LOW);
lv_label_set_text(label, “ON 2”);
} else {
digitalWrite(BUILTIN_RED, HIGH);
lv_label_set_text(label, “OFF 2”);
}
}
}
static void switch_event_handler3(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e); //Get the event code
lv_obj_t *switch_nb3 = (lv_obj_t *)lv_event_get_target(e); //Switch that generated the event
lv_obj_t *label = (lv_obj_t *)lv_event_get_user_data(e); //Label or other UI elements we want to update (Optional)
if (code == LV_EVENT_VALUE_CHANGED) {
bool isChecked = lv_obj_has_state(switch_nb3, LV_STATE_CHECKED); //Returns true/false
if (isChecked) {
digitalWrite(BUILTIN_GREEN, LOW);
lv_label_set_text(label, “ON 3”);
} else {
digitalWrite(BUILTIN_GREEN, HIGH);
lv_label_set_text(label, “OFF 3”);
}
}
}
static void arc_dimmer_event_handler1(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e); //Get the event code
lv_obj_t *arc = (lv_obj_t *)lv_event_get_target(e); //Switch that generated the event
lv_obj_t *label = (lv_obj_t *)lv_event_get_user_data(e); //Label or other UI elements we want to update (Optional)
if (code == LV_EVENT_VALUE_CHANGED) {
int brightness = lv_arc_get_value(arc); // 0 to 100 so we need to map it 0 to 255
brightness = map(brightness, 0, 100, 0, 255);
analogWrite(BUILTIN_BLUE, (255 – brightness));
lv_label_set_text_fmt(label, “%d”, brightness);
//Set the LED UI element to be more visible
lv_obj_set_style_bg_opa(objects.led_blue, brightness, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
static void arc_dimmer_event_handler2(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e); //Get the event code
lv_obj_t *arc = (lv_obj_t *)lv_event_get_target(e); //Switch that generated the event
lv_obj_t *label = (lv_obj_t *)lv_event_get_user_data(e); //Label or other UI elements we want to update (Optional)
if (code == LV_EVENT_VALUE_CHANGED) {
int brightness = lv_arc_get_value(arc); // 0 to 100 so we need to map it 0 to 255
brightness = map(brightness, 0, 100, 0, 255);
analogWrite(BUILTIN_GREEN, (255 – brightness));
lv_label_set_text_fmt(label, “%d”, brightness);
//Set the LED UI element to be more visible
lv_obj_set_style_bg_opa(objects.led_green, brightness, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
static void arc_dimmer_event_handler3(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e); //Get the event code
lv_obj_t *arc = (lv_obj_t *)lv_event_get_target(e); //Switch that generated the event
lv_obj_t *label = (lv_obj_t *)lv_event_get_user_data(e); //Label or other UI elements we want to update (Optional)
if (code == LV_EVENT_VALUE_CHANGED) {
int brightness = lv_arc_get_value(arc); // 0 to 100 so we need to map it 0 to 255
brightness = map(brightness, 0, 100, 0, 255);
analogWrite(BUILTIN_RED, (255 – brightness));
lv_label_set_text_fmt(label, “%d”, brightness);
//Set the LED UI element to be more visible
lv_obj_set_style_bg_opa(objects.led_red, brightness, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
void loop() {
lv_tick_inc(millis() – lastTick); //Update the tick timer. Tick is new for LVGL 9
lastTick = millis();
lv_timer_handler(); //Update the UI
delay(5);
}
#ifndef EEZ_LVGL_UI_SCREENS_H
#define EEZ_LVGL_UI_SCREENS_H
#include
#ifdef __cplusplus
extern “C” {
#endif
typedef struct _objects_t {
lv_obj_t *main;
lv_obj_t *screen_a;
lv_obj_t *screen_b;
lv_obj_t *screen_c;
lv_obj_t *switch_nb1;
lv_obj_t *label_switch_nb1;
lv_obj_t *to_screen_a;
lv_obj_t *label_ms_to_a;
lv_obj_t *to_screen_b;
lv_obj_t *label_ms_to_b;
lv_obj_t *to_screen_c;
lv_obj_t *label_ms_to_c;
lv_obj_t *switch_nb3;
lv_obj_t *label_switch_nb3;
lv_obj_t *switch_nb2;
lv_obj_t *label_switch_nb2;
lv_obj_t *ato_ms;
lv_obj_t *label_ato_ms;
lv_obj_t *ato_b;
lv_obj_t *label_ato_b;
lv_obj_t *ato_c;
lv_obj_t *label_ato_c;
lv_obj_t *arc_green;
lv_obj_t *scale_green;
lv_obj_t *led_green;
lv_obj_t *label_dim_value_green;
lv_obj_t *arc_blue;
lv_obj_t *scale_blue;
lv_obj_t *led_blue;
lv_obj_t *label_dim_value_blue;
lv_obj_t *bto_ms;
lv_obj_t *label_bto_ms;
lv_obj_t *bto_a;
lv_obj_t *label_bto_a;
lv_obj_t *bto_c;
lv_obj_t *label_bto_c;
lv_obj_t *arc_red;
lv_obj_t *scale_red;
lv_obj_t *led_red;
lv_obj_t *label_dim_value_red;
lv_obj_t *cto_ms;
lv_obj_t *label_cto_ms;
lv_obj_t *cto_a;
lv_obj_t *label_cto_a;
lv_obj_t *cto_b;
lv_obj_t *label_cto_b;
} objects_t;
extern objects_t objects;
enum ScreensEnum {
SCREEN_ID_MAIN = 1,
SCREEN_ID_SCREEN_A = 2,
SCREEN_ID_SCREEN_B = 3,
SCREEN_ID_SCREEN_C = 4,
};
void create_screen_main();
void tick_screen_main();
void create_screen_screen_a();
void tick_screen_screen_a();
void create_screen_screen_b();
void tick_screen_screen_b();
void create_screen_screen_c();
void tick_screen_screen_c();
void create_screens();
void tick_screen(int screen_index);
#ifdef __cplusplus
}
#endif
#endif /*EEZ_LVGL_UI_SCREENS_H*/
screen.c
#include
#include “screens.h”
#include “images.h”
#include “fonts.h”
#include “actions.h”
#include “vars.h”
#include “styles.h”
#include “ui.h”
#include
objects_t objects;
lv_obj_t *tick_value_change_obj;
void create_screen_main() {
lv_obj_t *obj = lv_obj_create(0);
objects.main = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 480, 320);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 17, 24);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Main screen”);
}
{
// switchNb1
lv_obj_t *obj = lv_switch_create(parent_obj);
objects.switch_nb1 = obj;
lv_obj_set_pos(obj, 62, 103);
lv_obj_set_size(obj, 252, 90);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff3473de), LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffb4eee9), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff1604a0), LV_PART_INDICATOR | LV_STATE_CHECKED);
lv_obj_set_style_bg_grad_color(obj, lv_color_hex(0xff000000), LV_PART_INDICATOR | LV_STATE_CHECKED);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff95e7f4), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(obj, lv_color_hex(0xff240481), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff0c0fdd), LV_PART_MAIN | LV_STATE_CHECKED);
}
{
// labelSwitchNb1
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_switch_nb1 = obj;
lv_obj_set_pos(obj, 116, 208);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “OFF label 1”);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_30, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff071fed), LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// ToScreenA
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.to_screen_a = obj;
lv_obj_set_pos(obj, 380, 50);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// LabelMsToA
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_ms_to_a = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To screen A”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// ToScreenB
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.to_screen_b = obj;
lv_obj_set_pos(obj, 380, 125);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// LabelMsToB
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_ms_to_b = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen B”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// ToScreenC
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.to_screen_c = obj;
lv_obj_set_pos(obj, 380, 200);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelMsToC
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_ms_to_c = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen C”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
}
}
void tick_screen_main() {
}
void create_screen_screen_a() {
lv_obj_t *obj = lv_obj_create(0);
objects.screen_a = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 480, 320);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfff6f3c7), LV_PART_MAIN | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// switchNb3
lv_obj_t *obj = lv_switch_create(parent_obj);
objects.switch_nb3 = obj;
lv_obj_set_pos(obj, 1, 10);
lv_obj_set_size(obj, 288, 105);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff64e677), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(obj, lv_color_hex(0xffb60a0a), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff1ab731), LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffeca4a4), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff037113), LV_PART_INDICATOR | LV_STATE_CHECKED);
}
{
// labelSwitchNb3
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_switch_nb3 = obj;
lv_obj_set_pos(obj, 62, 116);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “OFF label 3”);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff078d0f), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_30, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// switchNb2
lv_obj_t *obj = lv_switch_create(parent_obj);
objects.switch_nb2 = obj;
lv_obj_set_pos(obj, 3, 166);
lv_obj_set_size(obj, 288, 105);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffea7474), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(obj, lv_color_hex(0xffb60a0a), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffec4646), LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xffeca4a4), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff960606), LV_PART_INDICATOR | LV_STATE_CHECKED);
}
{
// labelSwitchNb2
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_switch_nb2 = obj;
lv_obj_set_pos(obj, 64, 273);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “OFF label 2”);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffe41313), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_30, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 396, 10);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Screen_A”);
}
{
// AToMs
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.ato_ms = obj;
lv_obj_set_pos(obj, 380, 50);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelAToMS
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_ato_ms = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Back\nmain screen”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// AToB
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.ato_b = obj;
lv_obj_set_pos(obj, 380, 125);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelAToB
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_ato_b = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen B”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// AToC
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.ato_c = obj;
lv_obj_set_pos(obj, 380, 200);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelAToC
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_ato_c = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen C”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
}
}
void tick_screen_screen_a() {
}
void create_screen_screen_b() {
lv_obj_t *obj = lv_obj_create(0);
objects.screen_b = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 480, 320);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfff4dbf8), LV_PART_MAIN | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// arcGreen
lv_obj_t *obj = lv_arc_create(parent_obj);
objects.arc_green = obj;
lv_obj_set_pos(obj, 8, 10);
lv_obj_set_size(obj, 172, 172);
lv_arc_set_value(obj, 0);
lv_arc_set_bg_start_angle(obj, 135);
lv_arc_set_bg_end_angle(obj, 45);
lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff91ffb3), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_rounded(obj, false, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 20, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_rounded(obj, false, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff079328), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff045109), LV_PART_KNOB | LV_STATE_DEFAULT);
}
{
// scaleGreen
lv_obj_t *obj = lv_scale_create(parent_obj);
objects.scale_green = obj;
lv_obj_set_pos(obj, 24, 26);
lv_obj_set_size(obj, 140, 140);
lv_scale_set_mode(obj, LV_SCALE_MODE_ROUND_INNER);
lv_scale_set_range(obj, 0, 100);
lv_scale_set_total_tick_count(obj, 26);
lv_scale_set_major_tick_every(obj, 5);
lv_scale_set_label_show(obj, true);
lv_obj_set_style_length(obj, 5, LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xffff0000), LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_length(obj, 10, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xff0bf4d3), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffe20000), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff02fffa), LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// ledGreen
lv_obj_t *obj = lv_led_create(parent_obj);
objects.led_green = obj;
lv_obj_set_pos(obj, 62, 64);
lv_obj_set_size(obj, 64, 64);
lv_led_set_color(obj, lv_color_hex(0xff0ac126));
lv_led_set_brightness(obj, 255);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// labelDimValueGreen
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_dim_value_green = obj;
lv_obj_set_pos(obj, 62, 88);
lv_obj_set_size(obj, 64, 16);
lv_label_set_text(obj, “0”);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff00ffff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// arcBlue
lv_obj_t *obj = lv_arc_create(parent_obj);
objects.arc_blue = obj;
lv_obj_set_pos(obj, 180, 125);
lv_obj_set_size(obj, 172, 172);
lv_arc_set_value(obj, 0);
lv_arc_set_bg_start_angle(obj, 135);
lv_arc_set_bg_end_angle(obj, 45);
lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff91ffe6), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_rounded(obj, false, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 20, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_rounded(obj, false, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff000ab1), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff2196f3), LV_PART_KNOB | LV_STATE_DEFAULT);
}
{
// scaleBlue
lv_obj_t *obj = lv_scale_create(parent_obj);
objects.scale_blue = obj;
lv_obj_set_pos(obj, 196, 141);
lv_obj_set_size(obj, 140, 140);
lv_scale_set_mode(obj, LV_SCALE_MODE_ROUND_INNER);
lv_scale_set_range(obj, 0, 100);
lv_scale_set_total_tick_count(obj, 26);
lv_scale_set_major_tick_every(obj, 5);
lv_scale_set_label_show(obj, true);
lv_obj_set_style_length(obj, 5, LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xffff0000), LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_length(obj, 10, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xff0bf4d3), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffe20000), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff02fffa), LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// ledBlue
lv_obj_t *obj = lv_led_create(parent_obj);
objects.led_blue = obj;
lv_obj_set_pos(obj, 234, 179);
lv_obj_set_size(obj, 64, 64);
lv_led_set_color(obj, lv_color_hex(0xff0400ff));
lv_led_set_brightness(obj, 255);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// labelDimValueBlue
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_dim_value_blue = obj;
lv_obj_set_pos(obj, 234, 203);
lv_obj_set_size(obj, 64, 16);
lv_label_set_text(obj, “0”);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff00ffff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 396, 10);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Screen_B”);
}
{
// BToMS
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.bto_ms = obj;
lv_obj_set_pos(obj, 380, 50);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelBToMs
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_bto_ms = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Back\nmain screen”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// BToA
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.bto_a = obj;
lv_obj_set_pos(obj, 380, 125);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelBToA
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_bto_a = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen A”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// BToC
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.bto_c = obj;
lv_obj_set_pos(obj, 380, 200);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelBToC
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_bto_c = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen C”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
}
}
void tick_screen_screen_b() {
}
void create_screen_screen_c() {
lv_obj_t *obj = lv_obj_create(0);
objects.screen_c = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 480, 320);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfff8e7ea), LV_PART_MAIN | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// arcRed
lv_obj_t *obj = lv_arc_create(parent_obj);
objects.arc_red = obj;
lv_obj_set_pos(obj, 108, 79);
lv_obj_set_size(obj, 172, 172);
lv_arc_set_value(obj, 0);
lv_arc_set_bg_start_angle(obj, 135);
lv_arc_set_bg_end_angle(obj, 45);
lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xfff3b2ac), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_rounded(obj, false, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_arc_width(obj, 20, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_rounded(obj, false, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xffe9210d), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xfff34721), LV_PART_KNOB | LV_STATE_DEFAULT);
}
{
// scaleRed
lv_obj_t *obj = lv_scale_create(parent_obj);
objects.scale_red = obj;
lv_obj_set_pos(obj, 124, 95);
lv_obj_set_size(obj, 140, 140);
lv_scale_set_mode(obj, LV_SCALE_MODE_ROUND_INNER);
lv_scale_set_range(obj, 0, 100);
lv_scale_set_total_tick_count(obj, 26);
lv_scale_set_major_tick_every(obj, 5);
lv_scale_set_label_show(obj, true);
lv_obj_set_style_length(obj, 5, LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xffff0000), LV_PART_ITEMS | LV_STATE_DEFAULT);
lv_obj_set_style_length(obj, 10, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_line_color(obj, lv_color_hex(0xff0bf4d3), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffe20000), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_color(obj, lv_color_hex(0xff02fffa), LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// ledRed
lv_obj_t *obj = lv_led_create(parent_obj);
objects.led_red = obj;
lv_obj_set_pos(obj, 162, 133);
lv_obj_set_size(obj, 64, 64);
lv_led_set_color(obj, lv_color_hex(0xffff0100));
lv_led_set_brightness(obj, 255);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
// labelDimValue_Red
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_dim_value_red = obj;
lv_obj_set_pos(obj, 162, 157);
lv_obj_set_size(obj, 64, 16);
lv_label_set_text(obj, “0”);
lv_obj_set_style_text_color(obj, lv_color_hex(0xff00ffff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 396, 10);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Screen_C”);
}
{
// CToMs
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.cto_ms = obj;
lv_obj_set_pos(obj, 380, 50);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// LabelCToMS
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_cto_ms = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “Back\nmain screen”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// CToA
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.cto_a = obj;
lv_obj_set_pos(obj, 380, 125);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelCToA
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_cto_a = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen A”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// CToB
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.cto_b = obj;
lv_obj_set_pos(obj, 380, 200);
lv_obj_set_size(obj, 100, 50);
{
lv_obj_t *parent_obj = obj;
{
// labelCToB
lv_obj_t *obj = lv_label_create(parent_obj);
objects.label_cto_b = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, “To Screen B”);
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
}
}
void tick_screen_screen_c() {
}
void create_screens() {
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);
create_screen_main();
create_screen_screen_a();
create_screen_screen_b();
create_screen_screen_c();
}
typedef void (*tick_screen_func_t)();
tick_screen_func_t tick_screen_funcs[] = {
tick_screen_main,
tick_screen_screen_a,
tick_screen_screen_b,
tick_screen_screen_c,
};
void tick_screen(int screen_index) {
tick_screen_funcs[screen_index]();
}
It is a code for 4 screens with 3 switches and 3 arc-dimmer.
All are managing the RGB leds.
TAMC_GT911.h is the lib for this capacitive CYD 3.5″.
The User Setup is the following :
#define ST7796_DRIVER
#define TFT_WIDTH 320
//#define TFT_ROTATION LV_DISPLAY_ROTATION_0
#defineTFT_HEIGHT480
#define TFT_BL 27 // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
#define TFT_MISO 12
#define TFT_MOSI 13 // In some display driver board, it might be written as “SDA” and so on.
#define TFT_SCLK 14
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST -1 // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL 27 // LED back-light
#define BUILTIN_RED 4 // Control RGB LED ESP32-3248S035C
#define BUILTIN_GREEN 16 // Control RGB LED ESP32-3248S035C
#define BUILTIN_BLUE 17 // Control RGB LED ESP32-3248S035C
#define TOUCH_CS 33 // Chip select pin (T_CS) of touch screen
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 65000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000 //2500000