1. 新增sqlite文件、协议文档、调试截图、配置ini等各类辅助文件 2. 更新Keil开发包版本与工程配置,调整编译优化等级 3. 重构继电器控制逻辑、串口收发逻辑与线程优先级 4. 新增Modbus寄存器映射、校准结构体与Ymodem升级相关代码 5. 完善南北向协议解析、快充挡位配置与调试日志 6. 修复注释格式、数组越界与线程邮箱溢出问题 7. 新增屏幕控制、功率板调试与协议格式说明文档
2.8 KiB
Repository Guidelines
Project Structure & Module Organization
apps/chrg/ is the primary STM32F405 RT-Thread application: product code lives in applications/, board setup and linker scripts in board/, and build configuration beside them. Keep device-facing code in applications/bsp/, protocol and control helpers in applications/utils/, and long-running tasks in applications/thread/. apps/boot/ is the standalone bootloader. Shared CMSIS and STM32 HAL sources are under libs/; rt-thread/ is vendored upstream code. Hardware specifications and protocol references belong in docs/. Treat build/, Keil Objects/, maps, and firmware binaries as generated output.
Build, Test, and Development Commands
Run charger commands from apps/chrg/:
scons -j4buildschrg.elfandrtthread.binusing the toolchain selected byRTT_CC/RTT_EXEC_PATH(GCC is the default inrtconfig.py).scons --target=mdk5regenerates the Keil MDK project when SCons configuration or source lists change.C:\Keil_v5\UV4\UV4.exe -b chrg.uvprojxperforms a command-line Keil build. Buildapps/boot/boot.uvprojxsimilarly for the bootloader.keilkill.batremoves Keil intermediates; review untracked files before running cleanup scripts.
SCons and an ARM compiler are prerequisites and are not bundled on PATH.
Coding Style & Naming Conventions
Use C99 and follow the surrounding file's indentation; new blocks should use four spaces. Place braces on the next line for functions and keep paired declarations/definitions in .h/.c files. Product symbols use lower snake case with the chrg_ prefix, structs end in _t, and constants/macros use uppercase snake case. Use RT-Thread types and APIs (rt_uint16_t, rt_thread_mdelay) in application code and HAL APIs at the board boundary. Preserve existing file encodings when editing Chinese comments or documentation.
Testing Guidelines
There is no product-level automated test suite or coverage threshold. Every firmware change must compile both affected targets and be exercised on STM32F405 hardware. Record checks for boot/upgrade flow, serial console, Modbus north/south communication, relay behavior, and LCD output as applicable. Tests in rt-thread/tools/testcases/ cover vendored build tooling only; run them when modifying that tooling with python -m unittest discover rt-thread/tools/testcases -p "test_*.py".
Commit & Pull Request Guidelines
History uses short, lowercase, imperative summaries such as fix south ch and add roll thread; keep each commit focused and avoid generated artifacts. Pull requests should describe the affected target and behavior, link the issue, list build and hardware results, and include serial logs or LCD captures for user-visible or protocol changes. Call out changes to register maps, flash layout, linker scripts, or upgrade compatibility explicitly.