-
Notifications
You must be signed in to change notification settings - Fork 359
Master merge #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Master merge #112
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| cmake_minimum_required(VERSION 3.12.4) | ||
| cmake_minimum_required(VERSION 3.10) | ||
| set(CMAKE_C_COMPILER "gcc" CACHE STRING "C compiler" FORCE) | ||
| project(lvgl C CXX) | ||
| set(CMAKE_BUILD_TYPE Debug) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Unconditionally setting CMAKE_BUILD_TYPE to Debug overrides user/CI build configurations for single-config generators and can force debug builds unexpectedly. Make this conditional so Release/RelWithDebInfo can be chosen externally. Prompt for AI agents |
||
|
|
||
| # Set the correct FreeRTOS port for your system (e.g., Posix for WSL) | ||
| set(FREERTOS_PORT GCC_POSIX CACHE STRING "Port for FreeRTOS on Posix environment") | ||
|
|
||
| set(LVGL_PRO_PROJECT_DIR | ||
| "" | ||
| CACHE PATH "Path to LVGL Pro Project folder") | ||
| unset(USE_FREERTOS CACHE) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Clearing the USE_FREERTOS cache entry before declaring the option overrides any user-provided -DUSE_FREERTOS=ON value, effectively making the FreeRTOS toggle non-configurable via the CMake cache/CLI. Prompt for AI agents |
||
|
|
||
| option(USE_FREERTOS "Enable FreeRTOS" OFF) # Turn this on to enable FreeRTOS | ||
|
|
||
|
|
@@ -38,14 +38,18 @@ else() | |
| endif() | ||
|
|
||
| # Main include files of the project | ||
| include_directories(${PROJECT_SOURCE_DIR}/main/inc) | ||
| include_directories(${PROJECT_SOURCE_DIR}) | ||
| include_directories(${PROJECT_SOURCE_DIR}/src) | ||
| include_directories(${PROJECT_SOURCE_DIR}/i18n) | ||
| include_directories(${PROJECT_SOURCE_DIR}/ioc) | ||
|
|
||
|
|
||
| # Define options for LVGL with default values (OFF) | ||
| option(LV_USE_DRAW_SDL "Use SDL draw unit" OFF) | ||
| option(LV_USE_LIBPNG "Use libpng to decode PNG" OFF) | ||
| option(LV_USE_LIBJPEG_TURBO "Use libjpeg turbo to decode JPEG" OFF) | ||
| option(LV_USE_FFMPEG "Use libffmpeg to display video using lv_ffmpeg" OFF) | ||
| option(LV_USE_FREETYPE "Use freetype library" OFF) | ||
| option(LV_USE_FREETYPE "Use freetype library" ON) | ||
|
|
||
| # Set C and C++ standards | ||
| set(CMAKE_C_STANDARD 99) | ||
|
|
@@ -73,6 +77,20 @@ set(MAIN_SOURCES src/mouse_cursor_icon.c src/hal/hal.c) | |
| set(MAIN_LIBS lvgl lvgl::examples lvgl::demos lvgl::thorvg ${SDL2_LIBRARIES}) | ||
|
|
||
| # Create the main executable, depending on the FreeRTOS option | ||
| file(GLOB_RECURSE SOURCES | ||
| "${PROJECT_SOURCE_DIR}/ioc/*.c" | ||
| "${PROJECT_SOURCE_DIR}/i18n/*.c" | ||
| "${PROJECT_SOURCE_DIR}/pages/*.c" | ||
| "${PROJECT_SOURCE_DIR}/pages_mngr.c" | ||
| ) | ||
|
|
||
| # 排除 zlog 文件夹里的文件 | ||
| foreach(file ${SOURCES}) | ||
| if(file MATCHES ".*/ioc/zlog/.*\\.c$") | ||
| list(REMOVE_ITEM SOURCES ${file}) | ||
| endif() | ||
| endforeach() | ||
|
|
||
| if(USE_FREERTOS) | ||
| list(APPEND MAIN_SOURCES src/freertos_main.c src/freertos/freertos_posix_port.c ${FREERTOS_SOURCES}) | ||
| list(APPEND MAIN_LIBS freertos_config freertos_kernel) | ||
|
|
@@ -141,7 +159,7 @@ if(LVGL_PRO_PROJECT_DIR) | |
| endif() | ||
| endif() | ||
|
|
||
| add_executable(main ${MAIN_SOURCES}) | ||
| add_executable(main ${MAIN_SOURCES} ${SOURCES}) | ||
| target_compile_definitions(main PRIVATE LV_CONF_INCLUDE_SIMPLE) | ||
| target_link_libraries(main ${MAIN_LIBS}) | ||
|
|
||
|
|
@@ -153,6 +171,7 @@ if (WIN32) | |
| else() | ||
| target_link_options(main PRIVATE "-mconsole") | ||
| endif() | ||
| target_link_libraries(main ws2_32) | ||
| endif() | ||
|
|
||
| # Apply additional compile options if the build type is Debug | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
|
|
||
| #ifndef __CHARGER_PRE_DEFINE_H__ | ||
| #define __CHARGER_PRE_DEFINE_H__ | ||
|
|
||
| // 统一编译选项, 把AC/DC, MT7628/AM3354/SSD202合并到一个项目中, 集中处理各种编译选项 | ||
| #define COMPILE_FOR_AC_X86 0 | ||
| #define COMPILE_FOR_AC_MT7628 1 // MT7628主板, 目前用于家用塑壳和商用铁壳/落地 | ||
| #define COMPILE_FOR_DC_AM3354 2 // AM3354主板, 目前用于嘉盛直流桩 | ||
| #define COMPILE_FOR_AC_SSD202 3 // SSD202主板, 目前替代MT7628主板, 后续可能替换直流桩, 待定 | ||
| #define COMPILE_FOR_CABINET_AM3354 4 // AM3354主板, 目前用于分体式直流桩 | ||
| #define COMPILE_FOR_CABINET_SSD202 5 // SSD202控制盒主板, 分体式直流桩的终端控制盒用于小直流和移动桩时使用 | ||
| #define COMPILE_FOR_SSD202_43 6 //4.3寸屏幕 | ||
|
|
||
| #define CHARGER_TYPE_AC_ONLY 1 // 全交流枪充电桩 | ||
| #define CHARGER_TYPE_DC 2 // 直流枪充电桩, 可包含交流(交直流一体) | ||
| #define CHARGER_TYPE_DC_CABINET 3 // 直流分体充电桩(可包含交流终端) 和采用分体架构的小直流等 | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "name": "fragment_btn_text", | ||
| "desc": "帮助按钮类似的130*40按钮, 内置一个文本", | ||
| "type": "button", | ||
| "properties": { | ||
| "style":"style-button-help-language" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "name": "text", | ||
| "desc": "按钮上的文本", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "Help", | ||
| "align": "LV_ALIGN_CENTER", | ||
| "style": "style-text-primary", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "fragment_btn_language", | ||
| "desc": "语言按钮, 包含一个图标和一个文字", | ||
| "type": "button", | ||
| "properties": { | ||
| "style": "style-button-help-language" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "name": "icon", | ||
| "desc": "图标", | ||
| "type": "image", | ||
| "properties": { | ||
| "x_ofs":22, | ||
| "width": 32, | ||
| "height": 32, | ||
| "align": "LV_ALIGN_LEFT_MID", | ||
| "src": "english", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "label", | ||
| "desc": "文字", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "English", | ||
| "x_ofs":56, | ||
| "align": "LV_ALIGN_LEFT_MID", | ||
| "style": "style-text-primary", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "fragment_btn_primary", | ||
| "desc": "close按钮", | ||
| "type": "button", | ||
| "properties": { | ||
| "style": "style-continue_button_session_error" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "name": "btn_label", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "", | ||
| "align" : "LV_ALIGN_CENTER", | ||
| "style": "style-continue_label_session_error", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| { | ||
| "name": "fragment_connector_card_quad", | ||
| "desc": "四枪的单个卡片, 有 Idle/Starting/Charging/Suspend/Finished/Reserved/Fault/Unavailable", | ||
| "type": "button", | ||
| "properties": { | ||
| "style": "style-connector-quad-default", | ||
| "width": 184, | ||
| "height": 123, | ||
| "style_checked": "style-connector-quad-checked" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "name": "conn_card_id", | ||
| "desc": "枪号带背景", | ||
| "type": "fragment", | ||
| "fragment_name" : "fragment_conn_card_id", | ||
|
|
||
| "properties": { | ||
| "x": 14, | ||
| "y": 14 | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_state", | ||
| "desc" : "当前状态, 右对齐, 注意不同语言越界", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "Idle", | ||
| "x_ofs": -14, | ||
| "y_ofs": 19, | ||
| "align": "LV_ALIGN_TOP_RIGHT", | ||
| "style": "style-connector-quad-default-state-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_type", | ||
| "desc": "充电枪类型, 左对齐, Idle/Suspend/Fault/Starting/Stopping/Error/Fault/Unavailable", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "CCS2(DC)", | ||
| "x": 14, | ||
| "y": 65, | ||
| "style": "style-connector-quad-default-type-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_power_rated", | ||
| "desc": "额定功率, 左对齐, Idle/Suspend/Fault/Starting/Stopping/Error/Fault/Unavailable", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "120.0kW", | ||
| "x": 14, | ||
| "y": 89, | ||
| "style": "style-connector-quad-default-power-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_type_icon", | ||
| "desc" : "充电枪类型图标, Idle/Suspend/Fault/Starting/Stopping/Error/Fault/Unavailable", | ||
| "type": "image", | ||
| "properties": { | ||
| "src": "ccs2-dc", | ||
| "width": 47, | ||
| "height": 47, | ||
| "x_ofs": -14, | ||
| "y_ofs": -14, | ||
| "align": "LV_ALIGN_BOTTOM_RIGHT" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_time_title", | ||
| "desc": "计时时间提示信息, Reserved为剩余时间, Finished为占位时间", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "Idle time", | ||
| "x": 14, | ||
| "y": 65, | ||
| "hidden": true, | ||
| "style": "style-connector-quad-default-power-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_time", | ||
| "desc": "计时时间值, Reserved为剩余时间, Finished为占位时间", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "04:24", | ||
| "x": 14, | ||
| "y": 89, | ||
| "hidden": true, | ||
| "style": "style-current_time", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_soc_bar", | ||
| "desc": "充电中SoC进度条", | ||
| "type": "bar", | ||
| "properties": { | ||
| "x_ofs": 14, | ||
| "y_ofs": 65, | ||
| "align": "LV_ALIGN_TOP_LEFT", | ||
| "style": "style-charging_bar_bg_size", | ||
| "style_indic": "style-charging_bar_indic" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_soc", | ||
| "desc": "充电中SoC值", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "12%", | ||
| "x_ofs": 14, | ||
| "y_ofs": 89, | ||
| "width": 50, | ||
| "height": 20, | ||
| "align": "LV_ALIGN_TOP_LEFT", | ||
| "hidden": true, | ||
| "style": "style-connector-quad-default-power-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_power_real", | ||
| "desc": "充电中实时功率, 右对齐", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "102.5kW", | ||
| "x_ofs": -14, | ||
| "y_ofs": 89, | ||
| "align": "LV_ALIGN_TOP_RIGHT", | ||
| "style": "style-connector-quad-default-power-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| }, | ||
| { | ||
| "name": "conn_card_plug_gun_icon", | ||
| "desc" : "插枪提示的绿色图标", | ||
| "type": "image", | ||
| "properties": { | ||
| "src": "icon_connected", | ||
| "width": 20, | ||
| "height": 20, | ||
| "x": 148, | ||
| "y": 91 | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "fragment_conn_card_id", | ||
| "desc": "枪id, 内置一个文本", | ||
| "type": "flex", | ||
| "properties": { | ||
| "style": "style-connector-quad-default-num-border" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "name": "NoText", | ||
| "type": "label", | ||
| "properties": { | ||
| "text": "1", | ||
| "align" : "LV_ALIGN_CENTER", | ||
| "style": "style-connector-quad-default-num-text", | ||
| "text_align": "LV_TEXT_ALIGN_CENTER" | ||
| } | ||
| } | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Forcing CMAKE_C_COMPILER to gcc overrides user/toolchain selection and can break portability for non-gcc environments.
Prompt for AI agents