diff --git a/Core/Inc/bsp.h b/Core/Inc/bsp.h index 30c5256..e542c09 100644 --- a/Core/Inc/bsp.h +++ b/Core/Inc/bsp.h @@ -332,10 +332,10 @@ void MCB_send_msg(uint32_t id); #include "spi.h" #include "usart.h" /* ---------- Exported types -------------------------------------------------*/ + +/* ---------- Exported constants ---------------------------------------------*/ #define LCD_TFT_SPI_Handle hspi3 #define LCD_TFT_USART_Handle huart1 -/* ---------- Exported constants ---------------------------------------------*/ - /* ---------- Exported variables ---------------------------------------------*/ /* ---------- Exported macros ------------------------------------------------*/ diff --git a/Core/Src/bsp.c b/Core/Src/bsp.c index a9ae1f1..ce176f4 100644 --- a/Core/Src/bsp.c +++ b/Core/Src/bsp.c @@ -477,3 +477,25 @@ void MCB_send_msg(uint32_t id) { } /*---------- Private Functions -----------------------------------------------*/ + +/* LCD TFT SCREEN ILI9488 ####################################################*/ + +/*---------- Private define -----------------.--------------------------------*/ + +/*---------- Private macro ------------------.--------------------------------*/ + +/*---------- Private variables --------------.--------------------------------*/ +enum LCD_TFT_Device{CS, RST, DC, LCD_TFT_Device_NUM}; +static const struct GPIO_Tuple LCD_TFT_Device_to_GPIO_Tuple_map[LCD_TFT_Device_NUM] = { + [CS] = {.GPIO_Port = LCD_TFT_CS_GPIO_OUT_GPIO_Port, .GPIO_Pin = LCD_TFT_CS_GPIO_OUT_Pin}, + [DC] = {.GPIO_Port = LCD_TFT_DC_GPIO_OUT_GPIO_Port, .GPIO_Pin = LCD_TFT_DC_GPIO_OUT_Pin}, + [RST] = {.GPIO_Port = LCD_TFT_RST_GPIO_OUT_GPIO_Port, .GPIO_Pin = LCD_TFT_RST_GPIO_OUT_Pin}, +}; + +/*---------- Private function prototypes ----.--------------------------------*/ + +/*---------- Exported Variables -------------.--------------------------------*/ + +/*---------- Exported Functions ----------------------------------------------*/ + +/*---------- Private Functions -----------------------------------------------*/ diff --git a/Drivers/ILI9488 b/Drivers/ILI9488 index b77ec2d..dd6e548 160000 --- a/Drivers/ILI9488 +++ b/Drivers/ILI9488 @@ -1 +1 @@ -Subproject commit b77ec2d5ca40f2aeb4104ad935a5ce4758e79b90 +Subproject commit dd6e548f8ad89943cd95c4aed445db661e0a0c9f diff --git a/EEZ/ILI9488.eez-project b/EEZ/ILI9488.eez-project index fb0c861..c65f018 100644 --- a/EEZ/ILI9488.eez-project +++ b/EEZ/ILI9488.eez-project @@ -92,7 +92,7 @@ ], "destinationFolder": "src\\ui", "separateFolderForImagesAndFonts": false, - "lvglInclude": "lvgl/lvgl.h", + "lvglInclude": "lvgl.h", "generateSourceCodeForEezFramework": false, "compressFlowDefinition": false, "executionQueueSize": 1000, @@ -348,12 +348,13 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "c2622862-f01c-4455-94c4-23657802a9f8", "definition": { "MAIN": { "DEFAULT": { - "text_color": "#d01d1d", + "text_color": "#1d3dd0", "text_font": "MONTSERRAT_32", "text_align": "CENTER" } @@ -514,14 +515,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "f48893e6-9a03-4fe4-f4fa-6278b4c9c73b", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -566,18 +567,9 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { - "objID": "0c9fd775-abcc-41f3-ae42-39f1d7f24ba5", - "definition": { - "MAIN": { - "DEFAULT": { - "text_font": "MONTSERRAT_32", - "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" - } - } - } + "objID": "0c9fd775-abcc-41f3-ae42-39f1d7f24ba5" }, "group": "", "groupIndex": 0, @@ -826,14 +818,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "000ddc4b-2d88-4d55-d8b2-3fdabf9e0de0", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -878,6 +870,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "8d1127aa-29f0-4e98-9cec-8a408c6dcd18", "definition": { @@ -885,8 +878,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -1138,14 +1130,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "2c485e9c-d5e2-4239-c55a-8755afe778ca", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -1190,6 +1182,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "da1e5849-ba27-4927-ba45-7beda58d7d12", "definition": { @@ -1197,8 +1190,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -1450,14 +1442,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "4f673662-c5fa-41cf-b16a-7b0cda3280ca", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -1502,6 +1494,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "0e4722d4-eef0-4e0b-8b6c-b2c0b9a63ece", "definition": { @@ -1509,8 +1502,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -1896,14 +1888,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "d83936fd-baa0-4fb1-cd70-6f19e86cb7e5", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -1948,6 +1940,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "7ea925ad-58c9-4933-da57-568af6ff21b3", "definition": { @@ -1955,8 +1948,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -2155,14 +2147,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "14e4c5aa-673f-41bf-bbcb-6bdc3b6d4dc1", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -2207,6 +2199,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "8393a05f-5975-4a4f-deff-7bc305194e52", "definition": { @@ -2214,8 +2207,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -2414,14 +2406,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "849b5f16-e0c5-47ea-8022-c6239eee73ec", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -2466,6 +2458,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "40509ed0-31ad-4852-ee64-4ce715eafc79", "definition": { @@ -2473,8 +2466,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -2673,14 +2665,14 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "fd063e4e-9587-4029-96a9-90cbf4b825ab", "definition": { "MAIN": { "DEFAULT": { "text_font": "MONTSERRAT_32", - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -2725,6 +2717,7 @@ "checkedStateType": "literal", "disabledStateType": "literal", "states": "", + "useStyle": "label_red", "localStyles": { "objID": "eaa0a703-4e4c-488f-a91a-d3a76722fa8c", "definition": { @@ -2732,8 +2725,7 @@ "DEFAULT": { "text_font": "MONTSERRAT_32", "pad_left": 2, - "text_align": "CENTER", - "text_color": "#d01d1d" + "text_align": "CENTER" } } } @@ -4955,6 +4947,25 @@ } } } + }, + { + "objID": "6fc7cf12-33a5-4d0d-de72-76f5103383a9", + "name": "label_red", + "forWidgetType": "LVGLLabelWidget", + "childStyles": [], + "definition": { + "objID": "26cb5696-f5a7-48ac-de32-ba7404681a5d", + "definition": { + "MAIN": { + "DEFAULT": { + "text_color": "#1d3dd0", + "text_font": "MONTSERRAT_32", + "pad_left": 2, + "text_align": "CENTER" + } + } + } + } } ], "defaultStyles": { diff --git a/EEZ/ILI9488.eez-project-ui-state b/EEZ/ILI9488.eez-project-ui-state index 47b5f9e..acbdbc8 100644 --- a/EEZ/ILI9488.eez-project-ui-state +++ b/EEZ/ILI9488.eez-project-ui-state @@ -1,7 +1,7 @@ { "navigation": { - "selectedUserPageObject": "[ILI9488.eez-project]:/userPages/2", - "selectedStyleObject": "[ILI9488.eez-project]:/lvglStyles/styles/0", + "selectedUserPageObject": "[ILI9488.eez-project]:/userPages/3", + "selectedStyleObject": "[ILI9488.eez-project]:/lvglStyles/styles/1", "subnavigationSelectedItems": { "variables-tab/sub-navigation/selected-item": "Global" } @@ -25,7 +25,7 @@ { "type": "border", "selected": 0, - "size": 240, + "size": 234.5, "location": "right", "children": [ { @@ -192,11 +192,22 @@ { "type": "tabset", "id": "EDITORS", - "weight": 31.430311907516028, + "weight": 37.925829219534066, "selected": 1, "enableDeleteWhenEmpty": false, "enableClose": false, "children": [ + { + "type": "tab", + "id": "#abb73d2d-1f68-4690-a1a2-c913eda800f2", + "name": "Main", + "component": "editor", + "config": { + "objectPath": "[ILI9488.eez-project]:/userPages/0", + "permanent": true + }, + "icon": "svg:page" + }, { "type": "tab", "id": "#c45d1ff8-d1bd-4dfd-9303-287c11e4cae0", @@ -248,8 +259,8 @@ { "type": "row", "id": "#1fdebd68-1bf4-46a3-977b-2af8c306a7e9", - "weight": 26.60077617538552, - "width": 347, + "weight": 20.105258863367457, + "width": 352, "children": [ { "type": "tabset", @@ -1016,8 +1027,11 @@ "[ILI9488.eez-project]:/userPages/0[flow-state]": { "selection": { "0": { - "0": { - "$selected": true + "0": {}, + "1": { + "2": { + "$selected": true + } } } }, @@ -1036,17 +1050,22 @@ } }, "[ILI9488.eez-project]:/lvglStyles/styles[tree-state]": { - "0": { - "$selected": true - }, - "1": { - "$selected": true - } + "0": {}, + "1": {} }, "[ILI9488.eez-project]:/userPages/1[flow-state]": { "selection": { "0": { - "0": {} + "0": { + "0": {}, + "2": {}, + "4": {}, + "6": { + "1": { + "$selected": true + } + } + } } }, "transform": { @@ -1083,11 +1102,16 @@ "selection": { "0": { "0": { - "0": {} + "0": {}, + "2": {}, + "4": {}, + "6": { + "1": { + "$selected": true + } + } }, - "1": { - "$selected": true - } + "1": {} } }, "transform": { diff --git a/EEZ/src/ui/screens.c b/EEZ/src/ui/screens.c index 392bff5..5388159 100644 --- a/EEZ/src/ui/screens.c +++ b/EEZ/src/ui/screens.c @@ -78,7 +78,8 @@ void create_screen_main() { lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT); lv_label_set_text(obj, "00:00:000"); lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICK_FOCUSABLE|LV_OBJ_FLAG_GESTURE_BUBBLE|LV_OBJ_FLAG_PRESS_LOCK|LV_OBJ_FLAG_SCROLLABLE|LV_OBJ_FLAG_SCROLL_CHAIN_HOR|LV_OBJ_FLAG_SCROLL_CHAIN_VER|LV_OBJ_FLAG_SCROLL_ELASTIC|LV_OBJ_FLAG_SCROLL_MOMENTUM|LV_OBJ_FLAG_SCROLL_WITH_ARROW|LV_OBJ_FLAG_SNAPPABLE); - lv_obj_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); + add_style_label_red(obj); + lv_obj_set_style_text_color(obj, lv_color_hex(0xff1d3dd0), LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT); } @@ -131,20 +132,16 @@ void create_screen_tires() { lv_obj_set_pos(obj, 1, 1); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj1 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); - lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); + add_style_label_red(obj); } } } @@ -174,7 +171,7 @@ void create_screen_tires() { } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj2 = obj; + objects.obj1 = obj; lv_obj_set_pos(obj, 65, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "Bar"); @@ -205,20 +202,19 @@ void create_screen_tires() { lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj3 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -248,7 +244,7 @@ void create_screen_tires() { } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj4 = obj; + objects.obj2 = obj; lv_obj_set_pos(obj, 65, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "Bar"); @@ -279,20 +275,19 @@ void create_screen_tires() { lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj5 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -322,7 +317,7 @@ void create_screen_tires() { } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj6 = obj; + objects.obj3 = obj; lv_obj_set_pos(obj, 65, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "Bar"); @@ -353,20 +348,19 @@ void create_screen_tires() { lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj7 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -396,7 +390,7 @@ void create_screen_tires() { } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj8 = obj; + objects.obj4 = obj; lv_obj_set_pos(obj, 65, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "Bar"); @@ -411,7 +405,7 @@ void create_screen_tires() { } { lv_obj_t *obj = lv_obj_create(parent_obj); - objects.obj9 = obj; + objects.obj5 = obj; lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 480, 320); lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); @@ -420,13 +414,13 @@ void create_screen_tires() { lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - create_user_widget_common_widget(obj, 34); + create_user_widget_common_widget(obj, 30); } } } void tick_screen_tires() { - tick_user_widget_common_widget(34); + tick_user_widget_common_widget(30); } void create_screen_inverters() { @@ -469,20 +463,19 @@ void create_screen_inverters() { lv_obj_set_pos(obj, 1, 1); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj10 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -532,20 +525,19 @@ void create_screen_inverters() { lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj11 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -595,20 +587,19 @@ void create_screen_inverters() { lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj12 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -658,20 +649,19 @@ void create_screen_inverters() { lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 80, LV_SIZE_CONTENT); lv_label_set_text(obj, "00.0"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } { lv_obj_t *obj = lv_label_create(parent_obj); - objects.obj13 = obj; lv_obj_set_pos(obj, 80, 0); lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(obj, "°C"); + add_style_label_red(obj); lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_pad_left(obj, 2, 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_set_style_text_color(obj, lv_color_hex(0xffd01d1d), LV_PART_MAIN | LV_STATE_DEFAULT); } } } @@ -705,7 +695,7 @@ void create_screen_inverters() { } { lv_obj_t *obj = lv_obj_create(parent_obj); - objects.obj14 = obj; + objects.obj6 = obj; lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 480, 320); lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); @@ -714,13 +704,13 @@ void create_screen_inverters() { lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - create_user_widget_common_widget(obj, 56); + create_user_widget_common_widget(obj, 48); } } } void tick_screen_inverters() { - tick_user_widget_common_widget(56); + tick_user_widget_common_widget(48); } void create_screen_extra() { @@ -732,7 +722,7 @@ void create_screen_extra() { lv_obj_t *parent_obj = obj; { lv_obj_t *obj = lv_obj_create(parent_obj); - objects.obj15 = obj; + objects.obj7 = obj; lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 480, 320); lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); @@ -741,7 +731,7 @@ void create_screen_extra() { lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - create_user_widget_common_widget(obj, 66); + create_user_widget_common_widget(obj, 58); } { lv_obj_t *obj = lv_obj_create(parent_obj); @@ -991,7 +981,7 @@ void create_screen_extra() { } void tick_screen_extra() { - tick_user_widget_common_widget(66); + tick_user_widget_common_widget(58); } void create_user_widget_common_widget(lv_obj_t *parent_obj, int startWidgetIndex) { diff --git a/EEZ/src/ui/screens.h b/EEZ/src/ui/screens.h index 18acbad..b284dac 100644 --- a/EEZ/src/ui/screens.h +++ b/EEZ/src/ui/screens.h @@ -26,63 +26,55 @@ typedef struct _objects_t { lv_obj_t *last_time; lv_obj_t *target_time; lv_obj_t *front_left_temp; - lv_obj_t *obj1; lv_obj_t *front_left_bar; - lv_obj_t *obj2; + lv_obj_t *obj1; lv_obj_t *front_right_temp; - lv_obj_t *obj3; lv_obj_t *front_right_bar; - lv_obj_t *obj4; + lv_obj_t *obj2; lv_obj_t *rear_left_temp; - lv_obj_t *obj5; lv_obj_t *rear_left_bar; - lv_obj_t *obj6; + lv_obj_t *obj3; lv_obj_t *rear_right_temp; - lv_obj_t *obj7; lv_obj_t *rear_right_bar; - lv_obj_t *obj8; - lv_obj_t *obj9; - lv_obj_t *obj9__lv_bat_voltage; - lv_obj_t *obj9__hv_soc_est; - lv_obj_t *obj9__sx_status_bar; - lv_obj_t *obj9__dx_status_bar; - lv_obj_t *obj9__sx_map; - lv_obj_t *obj9__lc_ctrl; - lv_obj_t *obj9__tc_ctrl; - lv_obj_t *obj9__tv_ctrl; - lv_obj_t *obj9__dx_map; + lv_obj_t *obj4; + lv_obj_t *obj5; + lv_obj_t *obj5__lv_bat_voltage; + lv_obj_t *obj5__hv_soc_est; + lv_obj_t *obj5__sx_status_bar; + lv_obj_t *obj5__dx_status_bar; + lv_obj_t *obj5__sx_map; + lv_obj_t *obj5__lc_ctrl; + lv_obj_t *obj5__tc_ctrl; + lv_obj_t *obj5__tv_ctrl; + lv_obj_t *obj5__dx_map; lv_obj_t *front_left_temp_inv; - lv_obj_t *obj10; lv_obj_t *front_left_inv_state; lv_obj_t *front_right_temp_inv; - lv_obj_t *obj11; lv_obj_t *front_right_inv_state; lv_obj_t *rear_left_temp_inv; - lv_obj_t *obj12; lv_obj_t *rear_left_inv_state; lv_obj_t *rear_right_temp_inv; - lv_obj_t *obj13; lv_obj_t *rear_right_inv_state; - lv_obj_t *obj14; - lv_obj_t *obj14__lv_bat_voltage; - lv_obj_t *obj14__hv_soc_est; - lv_obj_t *obj14__sx_status_bar; - lv_obj_t *obj14__dx_status_bar; - lv_obj_t *obj14__sx_map; - lv_obj_t *obj14__lc_ctrl; - lv_obj_t *obj14__tc_ctrl; - lv_obj_t *obj14__tv_ctrl; - lv_obj_t *obj14__dx_map; - lv_obj_t *obj15; - lv_obj_t *obj15__lv_bat_voltage; - lv_obj_t *obj15__hv_soc_est; - lv_obj_t *obj15__sx_status_bar; - lv_obj_t *obj15__dx_status_bar; - lv_obj_t *obj15__sx_map; - lv_obj_t *obj15__lc_ctrl; - lv_obj_t *obj15__tc_ctrl; - lv_obj_t *obj15__tv_ctrl; - lv_obj_t *obj15__dx_map; + lv_obj_t *obj6; + lv_obj_t *obj6__lv_bat_voltage; + lv_obj_t *obj6__hv_soc_est; + lv_obj_t *obj6__sx_status_bar; + lv_obj_t *obj6__dx_status_bar; + lv_obj_t *obj6__sx_map; + lv_obj_t *obj6__lc_ctrl; + lv_obj_t *obj6__tc_ctrl; + lv_obj_t *obj6__tv_ctrl; + lv_obj_t *obj6__dx_map; + lv_obj_t *obj7; + lv_obj_t *obj7__lv_bat_voltage; + lv_obj_t *obj7__hv_soc_est; + lv_obj_t *obj7__sx_status_bar; + lv_obj_t *obj7__dx_status_bar; + lv_obj_t *obj7__sx_map; + lv_obj_t *obj7__lc_ctrl; + lv_obj_t *obj7__tc_ctrl; + lv_obj_t *obj7__tv_ctrl; + lv_obj_t *obj7__dx_map; lv_obj_t *cooling_sys_bar; lv_obj_t *cooling_sys_temp; lv_obj_t *throttle_perc; diff --git a/EEZ/src/ui/styles.c b/EEZ/src/ui/styles.c index 6ca7ffb..dc74805 100644 --- a/EEZ/src/ui/styles.c +++ b/EEZ/src/ui/styles.c @@ -31,6 +31,35 @@ void remove_style_label_map_style(lv_obj_t *obj) { lv_obj_remove_style(obj, get_style_label_map_style_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT); }; +// +// Style: label_red +// + +void init_style_label_red_MAIN_DEFAULT(lv_style_t *style) { + lv_style_set_text_color(style, lv_color_hex(0xff1d3dd0)); + lv_style_set_text_font(style, &lv_font_montserrat_32); + lv_style_set_pad_left(style, 2); + lv_style_set_text_align(style, LV_TEXT_ALIGN_CENTER); +}; + +lv_style_t *get_style_label_red_MAIN_DEFAULT() { + static lv_style_t *style; + if (!style) { + style = lv_malloc(sizeof(lv_style_t)); + lv_style_init(style); + init_style_label_red_MAIN_DEFAULT(style); + } + return style; +}; + +void add_style_label_red(lv_obj_t *obj) { + lv_obj_add_style(obj, get_style_label_red_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT); +}; + +void remove_style_label_red(lv_obj_t *obj) { + lv_obj_remove_style(obj, get_style_label_red_MAIN_DEFAULT(), LV_PART_MAIN | LV_STATE_DEFAULT); +}; + // // // @@ -39,6 +68,7 @@ void add_style(lv_obj_t *obj, int32_t styleIndex) { typedef void (*AddStyleFunc)(lv_obj_t *obj); static const AddStyleFunc add_style_funcs[] = { add_style_label_map_style, + add_style_label_red, }; add_style_funcs[styleIndex](obj); } @@ -47,6 +77,7 @@ void remove_style(lv_obj_t *obj, int32_t styleIndex) { typedef void (*RemoveStyleFunc)(lv_obj_t *obj); static const RemoveStyleFunc remove_style_funcs[] = { remove_style_label_map_style, + remove_style_label_red, }; remove_style_funcs[styleIndex](obj); } diff --git a/EEZ/src/ui/styles.h b/EEZ/src/ui/styles.h index 6da1163..2d12a8f 100644 --- a/EEZ/src/ui/styles.h +++ b/EEZ/src/ui/styles.h @@ -12,6 +12,11 @@ lv_style_t *get_style_label_map_style_MAIN_DEFAULT(); void add_style_label_map_style(lv_obj_t *obj); void remove_style_label_map_style(lv_obj_t *obj); +// Style: label_red +lv_style_t *get_style_label_red_MAIN_DEFAULT(); +void add_style_label_red(lv_obj_t *obj); +void remove_style_label_red(lv_obj_t *obj); + #ifdef __cplusplus diff --git a/Lib/LVGL/lvgl_callbacks.c b/Lib/LVGL/lvgl_callbacks.c index 3328462..7175d1b 100644 --- a/Lib/LVGL/lvgl_callbacks.c +++ b/Lib/LVGL/lvgl_callbacks.c @@ -19,25 +19,18 @@ /*---------- Private function prototypes -------------------------------------*/ /*---------- Exported Variables ----------------------------------------------*/ uint8_t buf1[BUFFER_SIZE]; -static volatile uint8_t flush_in_progress = 0; +static volatile uint8_t flush_in_progress = 0; /*---------- Exported Functions ----------------------------------------------*/ void LVGL_CLB_flush_clb(lv_display_t *display, const lv_area_t *area, uint8_t *px_map) { - if (flush_in_progress) { - return; - } - - flush_in_progress = 1; - - ILI9488_set_draw_window(area->x1, area->y1, area->x2, area->y2); + if (flush_in_progress) return; + flush_in_progress = 1; uint32_t width = area->x2 - area->x1 + 1; uint32_t height = area->y2 - area->y1 + 1; uint32_t pixel_count = width * height; - HAL_GPIO_WritePin(LCD_TFT_DC_GPIO_OUT_GPIO_Port, LCD_TFT_DC_GPIO_OUT_Pin, GPIO_PIN_SET); - HAL_GPIO_WritePin(LCD_TFT_CS_GPIO_OUT_GPIO_Port, LCD_TFT_CS_GPIO_OUT_Pin, GPIO_PIN_RESET); - - HAL_SPI_Transmit_DMA(&LCD_TFT_SPI_Handle, px_map, pixel_count * 3); + ILI9488_set_draw_window(area->x1, area->y1, area->x2, area->y2); + ILI9488_SPI_DMA_send(px_map, pixel_count * 3); } /** @@ -55,15 +48,13 @@ void LVGL_CLB_flush_clb(lv_display_t *display, const lv_area_t *area, uint8_t *p */ void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) { if (hspi->Instance == LCD_TFT_SPI_Handle.Instance) { - HAL_GPIO_WritePin(LCD_TFT_CS_GPIO_OUT_GPIO_Port, LCD_TFT_CS_GPIO_OUT_Pin, GPIO_PIN_SET); flush_in_progress = 0; - + ILI9488_CS_set_state(GPIO_PIN_SET); lv_display_flush_ready(lv_disp_get_default()); } } /*---------- Private Functions -----------------------------------------------*/ - /*---------- LCGL LOG CALLBACK ###############################################*/ /*---------- Private define --------------------------------------------------*/ @@ -77,9 +68,8 @@ void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) { /*---------- Exported Variables ----------------------------------------------*/ /*---------- Exported Functions ----------------------------------------------*/ -void LVGL_CLB_log_clb(lv_log_level_t level, const char * buf) -{ - char log_msg[256]; +void LVGL_CLB_log_clb(lv_log_level_t level, const char *buf) { + char log_msg[256]; const char *level_str; switch (level) { @@ -96,14 +86,13 @@ void LVGL_CLB_log_clb(lv_log_level_t level, const char * buf) level_str = "ERROR: "; break; default: - level_str = "LOG: "; + level_str = "LOG: "; break; } - snprintf(log_msg, sizeof(log_msg), "%s%s\r\n", level_str, buf); - HAL_UART_Transmit(&LCD_TFT_USART_Handle, (uint8_t*)log_msg, strlen(log_msg), HAL_MAX_DELAY); + HAL_UART_Transmit(&LCD_TFT_USART_Handle, (uint8_t *)log_msg, strlen(log_msg), HAL_MAX_DELAY); } void LVGL_CLB_mem_usage() { @@ -112,7 +101,8 @@ void LVGL_CLB_mem_usage() { char buffer[256]; - snprintf(buffer, sizeof(buffer), + snprintf(buffer, + sizeof(buffer), "Total memory: %lu bytes\n" "Used memory: %lu bytes\n" "Free memory: %lu bytes\n" @@ -124,6 +114,6 @@ void LVGL_CLB_mem_usage() { mem_mon.used_pct, (unsigned long)mem_mon.free_biggest_size); - HAL_UART_Transmit(&LCD_TFT_USART_Handle, (uint8_t*)buffer, strlen(buffer), HAL_MAX_DELAY); + HAL_UART_Transmit(&LCD_TFT_USART_Handle, (uint8_t *)buffer, strlen(buffer), HAL_MAX_DELAY); } /*---------- Private Functions -----------------------------------------------*/ \ No newline at end of file