Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

33 changes: 26 additions & 7 deletions CMakeLists.txt
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)

@cubic-dev-ai cubic-dev-ai Bot Apr 7, 2026

Copy link
Copy Markdown

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
Check if this issue is valid — if so, understand the root cause and fix it. At CMakeLists.txt, line 2:

<comment>Forcing CMAKE_C_COMPILER to gcc overrides user/toolchain selection and can break portability for non-gcc environments.</comment>

<file context>
@@ -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)
</file context>
Fix with Cubic

project(lvgl C CXX)
set(CMAKE_BUILD_TYPE Debug)

@cubic-dev-ai cubic-dev-ai Bot Apr 7, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
Check if this issue is valid — if so, understand the root cause and fix it. At CMakeLists.txt, line 4:

<comment>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.</comment>

<file context>
@@ -1,12 +1,12 @@
+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)
 
 # Set the correct FreeRTOS port for your system (e.g., Posix for WSL)
</file context>
Fix with Cubic


# 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)

@cubic-dev-ai cubic-dev-ai Bot Apr 7, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
Check if this issue is valid — if so, understand the root cause and fix it. At CMakeLists.txt, line 9:

<comment>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.</comment>

<file context>
@@ -1,12 +1,12 @@
-set(LVGL_PRO_PROJECT_DIR
-    ""
-    CACHE PATH "Path to LVGL Pro Project folder")
+unset(USE_FREERTOS CACHE)
 
 option(USE_FREERTOS "Enable FreeRTOS" OFF) # Turn this on to enable FreeRTOS
</file context>
Fix with Cubic


option(USE_FREERTOS "Enable FreeRTOS" OFF) # Turn this on to enable FreeRTOS

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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})

Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions Charger_PreDefine.h
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
Binary file added assets/fonts/D-DIN-PRO-600-SemiBold.otf
Binary file not shown.
Binary file added assets/fonts/calibri.ttf
Binary file not shown.
Binary file added assets/fonts/calibrib.ttf
Binary file not shown.
21 changes: 21 additions & 0 deletions assets/fragment/fragment_00001_btn_text.json
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"
}
}
]
}
35 changes: 35 additions & 0 deletions assets/fragment/fragment_00002_btn_language.json
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"
}
}
]
}
20 changes: 20 additions & 0 deletions assets/fragment/fragment_00003_btn_primary.json
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"
}
}
]
}
153 changes: 153 additions & 0 deletions assets/fragment/fragment_00004_connector_quad_card.json
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
}
}
]
}
20 changes: 20 additions & 0 deletions assets/fragment/fragment_00005_connector_no.json
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"
}
}
]
}
Loading