refactor(structure): move layered firmware modules from main to components

This commit is contained in:
admin
2026-02-26 10:22:24 +08:00
parent cf1fecb004
commit 044618b4ed
73 changed files with 49 additions and 49 deletions

View File

@@ -1,12 +1,12 @@
# Repository Guidelines # Repository Guidelines
## Project Structure & Layering ## Project Structure & Layering
- `main/platform/{include,internal,src}`: hardware/system abstraction only. - `components/platform/{include,internal,src}`: hardware/system abstraction only.
- `main/domain/{include,internal,src}`: business-domain services. - `components/domain/{include,internal,src}`: business-domain services.
- `main/control_plane/{include,internal,src}`: lifecycle, policy, health, retry/backoff orchestration. - `components/control_plane/{include,internal,src}`: lifecycle, policy, health, retry/backoff orchestration.
- `main/app_composition/{include,internal,src}`: composition boundary; `app_main` only wires modules. - `components/app_composition/{include,internal,src}`: composition boundary; `app_main` only wires modules.
- `main/dependency_whitelist.md`: approved exceptions for unavoidable lateral dependencies. - `main/dependency_whitelist.md`: approved exceptions for unavoidable lateral dependencies.
- `main/third_party/`, `main/domain/assets/fonts/`, `tools/`: vendored code, embedded assets, utility scripts. - `main/third_party/`, `components/domain/assets/fonts/`, `tools/`: vendored code, embedded assets, utility scripts.
- `build/`: generated artifacts only (ignored). - `build/`: generated artifacts only (ignored).
## Mandatory Architecture Constraints ## Mandatory Architecture Constraints
@@ -31,7 +31,7 @@ source $IDF_PATH/export.sh
- `idf.py fullclean && idf.py build`: clear stale artifacts. - `idf.py fullclean && idf.py build`: clear stale artifacts.
## Coding Style & Naming Conventions ## Coding Style & Naming Conventions
- Use 4-space indentation and keep braces/function style consistent with existing `main/*.c`. - Use 4-space indentation and keep braces/function style consistent with existing `components/*/*.c`.
- Prefer `lower_snake_case` for functions and variables; use module-prefixed public APIs. - Prefer `lower_snake_case` for functions and variables; use module-prefixed public APIs.
- Use `UPPER_SNAKE_CASE` for macros/constants (`CMD_SEND_DATA`, `WIFI_CONNECTED_BIT`). - Use `UPPER_SNAKE_CASE` for macros/constants (`CMD_SEND_DATA`, `WIFI_CONNECTED_BIT`).
- Prefix file-local statics with `s_` (for example `s_server`, `s_jobs`) and keep per-file `TAG` logging constants. - Prefix file-local statics with `s_` (for example `s_server`, `s_jobs`) and keep per-file `TAG` logging constants.

View File

@@ -341,8 +341,8 @@ curl -X POST http://<esp-ip>/v1/voice/session/stop
## Font Assets ## Font Assets
Embedded files: Embedded files:
- `main/domain/assets/fonts/cn16_index.bin` - `components/domain/assets/fonts/cn16_index.bin`
- `main/domain/assets/fonts/cn16_glyphs.bin` - `components/domain/assets/fonts/cn16_glyphs.bin`
Regenerate from your own CJK font: Regenerate from your own CJK font:

View File

@@ -1,10 +1,10 @@
idf_component_register( idf_component_register(
SRCS SRCS
"../../main/app_composition/src/app_main.c" "src/app_main.c"
INCLUDE_DIRS INCLUDE_DIRS
"../../main/app_composition/include" "include"
PRIV_INCLUDE_DIRS PRIV_INCLUDE_DIRS
"../../main/app_composition/internal" "internal"
REQUIRES REQUIRES
control_plane control_plane
) )

View File

@@ -1,18 +1,18 @@
idf_component_register( idf_component_register(
SRCS SRCS
"../../main/control_plane/src/controller_lifecycle.c" "src/controller_lifecycle.c"
"../../main/control_plane/src/rest_server.c" "src/rest_server.c"
"../../main/control_plane/src/rest_server_common.c" "src/rest_server_common.c"
"../../main/control_plane/src/rest_server_ops.c" "src/rest_server_ops.c"
"../../main/control_plane/src/rest_server_print.c" "src/rest_server_print.c"
"../../main/control_plane/src/rest_server_print_image.c" "src/rest_server_print_image.c"
"../../main/control_plane/src/rest_server_print_render.c" "src/rest_server_print_render.c"
"../../main/control_plane/src/rest_server_jobs.c" "src/rest_server_jobs.c"
"../../main/control_plane/src/rest_server_voice.c" "src/rest_server_voice.c"
INCLUDE_DIRS INCLUDE_DIRS
"../../main/control_plane/include" "include"
PRIV_INCLUDE_DIRS PRIV_INCLUDE_DIRS
"../../main/control_plane/internal" "internal"
REQUIRES REQUIRES
domain domain
esp_http_server esp_http_server

View File

@@ -1,26 +1,26 @@
idf_component_register( idf_component_register(
SRCS SRCS
"../../main/domain/src/printer_protocol.c" "src/printer_protocol.c"
"../../main/domain/src/printer_protocol_jobs.c" "src/printer_protocol_jobs.c"
"../../main/domain/src/printer_protocol_worker.c" "src/printer_protocol_worker.c"
"../../main/domain/src/printer_protocol_commands.c" "src/printer_protocol_commands.c"
"../../main/domain/src/raster_tools.c" "src/raster_tools.c"
"../../main/domain/src/raster_tools_image_qr.c" "src/raster_tools_image_qr.c"
"../../main/domain/src/image_generation.c" "src/image_generation.c"
"../../main/domain/src/system_runtime.c" "src/system_runtime.c"
"../../main/domain/src/voice_interaction.c" "src/voice_interaction.c"
"../../main/domain/src/voice_interaction_common.c" "src/voice_interaction_common.c"
"../../main/domain/src/voice_interaction_ws.c" "src/voice_interaction_ws.c"
"../../main/domain/src/voice_interaction_ws_protocol.c" "src/voice_interaction_ws_protocol.c"
"../../main/domain/src/voice_interaction_ws_audio.c" "src/voice_interaction_ws_audio.c"
"../../main/domain/src/voice_interaction_marker.c" "src/voice_interaction_marker.c"
"../../main/domain/src/voice_interaction_tasks.c" "src/voice_interaction_tasks.c"
"../../main/third_party/qrcodegen.c" "../../main/third_party/qrcodegen.c"
INCLUDE_DIRS INCLUDE_DIRS
"../../main/domain/include" "include"
"../../main/third_party" "../../main/third_party"
PRIV_INCLUDE_DIRS PRIV_INCLUDE_DIRS
"../../main/domain/internal" "internal"
REQUIRES REQUIRES
platform platform
esp_http_client esp_http_client
@@ -30,6 +30,6 @@ idf_component_register(
mbedtls mbedtls
esp_coex esp_coex
EMBED_FILES EMBED_FILES
"../../main/domain/assets/fonts/cn16_index.bin" "assets/fonts/cn16_index.bin"
"../../main/domain/assets/fonts/cn16_glyphs.bin" "assets/fonts/cn16_glyphs.bin"
) )

View File

@@ -1,15 +1,15 @@
idf_component_register( idf_component_register(
SRCS SRCS
"../../main/platform/src/platform_bootstrap.c" "src/platform_bootstrap.c"
"../../main/platform/src/wifi_manager.c" "src/wifi_manager.c"
"../../main/platform/src/ble_printer_client.c" "src/ble_printer_client.c"
"../../main/platform/src/voice_audio.c" "src/voice_audio.c"
"../../main/platform/src/runtime_policy.c" "src/runtime_policy.c"
"../../main/platform/src/runtime_diagnostics.c" "src/runtime_diagnostics.c"
INCLUDE_DIRS INCLUDE_DIRS
"../../main/platform/include" "include"
PRIV_INCLUDE_DIRS PRIV_INCLUDE_DIRS
"../../main/platform/internal" "internal"
REQUIRES REQUIRES
bt bt
esp_coex esp_coex