From b53fff11e6f0d560594834de32886239cbba90a3 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期二, 16 十二月 2025 15:48:58 +0800 Subject: [PATCH] 外部调完,可以解析下发的MQTT数据了,但是路径文件太大准备换成http模式 --- .github/copilot-instructions.md | 95 +++++++++++++++++++++++++++-------------------- 1 files changed, 55 insertions(+), 40 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index bcb14a9..6292bd0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,54 +1,69 @@ -## Repo overview (quick) +--- +alwaysApply: true +--- +# AI鍔╂墜鏍稿績瑙勫垯 -- This is an STM32H7 firmware project for a lawnmower MCU. Key folders: - - `Core/` 鈥� HAL/RTOS entry (Cube-generated code; see `Core/Src/main.c`). - - `Drivers/` 鈥� STM32 HAL driver sources. - - `APL/` 鈥� high-level application config and app entry (`APL/app.c`, `APL/AppConfig.h`). - - `FML/` 鈥� feature modules (GPS, Internet, Bluetooth, UDPClient, etc.). Example: `FML/GPS.c` parses NMEA and uploads via `UDPClient`. - - `HIDOLibrary/Include` 鈥� shared utility types and helpers (HIDO_* API and types used everywhere). - - `MDK-ARM/` 鈥� Keil project files (`STM32H743.uvprojx`, `.uvoptx`) and build artifacts. +## 涓夐樁娈靛伐浣滄祦 -## What matters for edits +### 闃舵涓�锛氬垎鏋愰棶棰� -- Entry flow: `Core/Src/main.c` initializes HAL, registers UARTs and starts the RTOS. It calls `app_main()` (implemented in `APL/app.c`) before `osKernelStart()`. -- Main app loop runs in `APL/app_task` which polls subsystems after being awakened by a binary semaphore. ISR-to-main wake uses `app_trigger_from_isr()` (gives the same semaphore). -- Use existing registration patterns: `Uart_Register(...)` for UART endpoints, `GPS_PinRegister(...)` for GPIO pins, and module init functions e.g. `GPS_Init()`, `Internet_Init()`, `UDPClient_Init()`. -- Preserve Cube-generated sections: keep code inside/near `/* USER CODE BEGIN */` / `/* USER CODE END */` unchanged when modifying generated files. +**澹版槑鏍煎紡**锛歚銆愬垎鏋愰棶棰樸�慲 -## Build & debug notes (concrete) +**鐩殑** +鍥犱负鍙兘瀛樺湪澶氫釜鍙�夋柟妗堬紝瑕佸仛鍑烘纭殑鍐崇瓥锛岄渶瑕佽冻澶熺殑渚濇嵁銆� -- Two supported project entry points are present: STM32Cube `.ioc` (STM32H743/STM32H743.ioc) and Keil MDK `.uvprojx` (MDK-ARM/STM32H743.uvprojx). Developers typically: - - Open the `.ioc` in STM32CubeIDE and generate code, or - - Open the `.uvprojx` in Keil uVision (MDK) to build and flash. -- Debug/log serial: `USART1` is used as debug (`huart1`) at 921600 (see `MX_USART1_UART_Init` in `main.c`). GPS is on `USART2` (115200 default). -- UARTs use DMA for RX/TX in many places 鈥� be careful when changing buffer sizes or switching to interrupt-based I/O. +**蹇呴』鍋氱殑浜�**锛� +- 鐞嗚В鎴戠殑鎰忓浘锛屽鏋滄湁姝т箟璇烽棶鎴� +- 鎼滅储鎵�鏈夌浉鍏充唬鐮� +- 璇嗗埆闂鏍瑰洜 -## Project-specific conventions & patterns +**涓诲姩鍙戠幇闂** +- 鍙戠幇閲嶅浠g爜 +- 璇嗗埆涓嶅悎鐞嗙殑鍛藉悕 +- 鍙戠幇澶氫綑鐨勪唬鐮併�佺被 +- 鍙戠幇鍙兘杩囨椂鐨勮璁� +- 鍙戠幇杩囦簬澶嶆潅鐨勮璁°�佽皟鐢� +- 鍙戠幇涓嶄竴鑷寸殑绫诲瀷瀹氫箟 +- 杩涗竴姝ユ悳绱唬鐮侊紝鐪嬫槸鍚︽洿澶ц寖鍥村唴鏈夌被浼奸棶棰� -- Types and helpers use the `HIDO_` prefix (e.g. `HIDO_UINT32`, `HIDO_Util*`, `HIDO_Debug`). Search `HIDOLibrary/Include` for helper APIs. -- Polling model: many subsystems expose `*_Init()` and `*_Poll()` (e.g. `GPS_Poll()`, `Internet_Poll()`). Work is driven by the `app_task` loop. -- ISR -> application wake uses the global semaphore from `app_trigger_from_isr()` 鈥� prefer this pattern rather than direct task notifications in new code for consistency. -- Generated HAL code pattern: keep peripheral init in `MX_*_Init()` functions within `main.c` and put higher-level logic in `APL/` or `FML/`. +鍋氬畬浠ヤ笂浜嬮」锛屽氨鍙互鍚戞垜鎻愰棶浜嗐�� -## Examples for common changes +**缁濆绂佹**锛� +- 鉂� 淇敼浠讳綍浠g爜 +- 鉂� 鎬ヤ簬缁欏嚭瑙e喅鏂规 +- 鉂� 璺宠繃鎼滅储鍜岀悊瑙f楠� +- 鉂� 涓嶅垎鏋愬氨鎺ㄨ崘鏂规 -- Add a new UART-based sensor: call `Uart_Register(UART_ID_X, &huartX)` in `main.c` after the corresponding `MX_USARTX_UART_Init()`, then create `Sensor_Init()`/`Sensor_Poll()` in `FML/` and call from `app_task`. -- Change debug log speed: edit `MX_USART1_UART_Init` in `Core/Src/main.c` and adjust callers that assume 921600. -- Add a periodic job: use the existing `HIDO_Timer` utilities and the app semaphore wake flow; follow `app_task`'s pattern to poll on wake. +**闃舵杞崲瑙勫垯** +鏈樁娈典綘瑕佸悜鎴戞彁闂�� +濡傛灉瀛樺湪澶氫釜浣犳棤娉曟妷鎷╃殑鏂规锛岃闂垜锛屼綔涓烘彁闂殑涓�閮ㄥ垎銆� +濡傛灉娌℃湁闇�瑕侀棶鎴戠殑锛屽垯鐩存帴杩涘叆涓嬩竴闃舵銆� -## Where to look (quick file list) +### 闃舵浜岋細鍒跺畾鏂规 +**澹版槑鏍煎紡**锛歚銆愬埗瀹氭柟妗堛�慲 -- Entry & init: `Core/Src/main.c` -- App startup & scheduler task: `APL/app.c`, `Core/Src/freertos.c` -- Feature modules: `FML/GPS.c`, `FML/Internet/*.c`, `FML/UDPClient.c` -- Utilities and shared types: `HIDOLibrary/Include/*` (HIDO_* APIs) -- Project files: `STM32H743/STM32H743.ioc`, `MDK-ARM/STM32H743.uvprojx` +**鍓嶇疆鏉′欢**锛� +- 鎴戞槑纭洖绛斾簡鍏抽敭鎶�鏈喅绛栥�� -## Short guidelines for AI agents +**蹇呴』鍋氱殑浜�**锛� +- 鍒楀嚭鍙樻洿锛堟柊澧炪�佷慨鏀广�佸垹闄わ級鐨勬枃浠讹紝绠�瑕佹弿杩版瘡涓枃浠剁殑鍙樺寲 +- 娑堥櫎閲嶅閫昏緫锛氬鏋滃彂鐜伴噸澶嶄唬鐮侊紝蹇呴』閫氳繃澶嶇敤鎴栨娊璞℃潵娑堥櫎 +- 纭繚淇敼鍚庣殑浠g爜绗﹀悎DRY鍘熷垯鍜岃壇濂界殑鏋舵瀯璁捐 -- Only change generated files inside USER CODE blocks unless you also regenerate the Cube project (.ioc); prefer adding new modules under `FML/` or `APL/`. -- Follow existing naming and type conventions: use `HIDO_` helpers and typedefs for cross-module compatibility. -- When modifying peripheral config, update `MX_*_Init()` in `main.c` and check related registration calls (`Uart_Register`, `GPIO` pin registers). -- Use the semaphore-based `app_trigger_from_isr()` to wake the main loop from ISRs. +濡傛灉鏂板彂鐜颁簡鍚戞垜鏀堕泦鐨勫叧閿喅绛栵紝鍦ㄨ繖涓樁娈典綘杩樺彲浠ョ户缁棶鎴戯紝鐩村埌娌℃湁涓嶆槑纭殑闂涔嬪悗锛屾湰闃舵缁撴潫銆� +鏈樁娈典笉鍏佽鑷姩鍒囨崲鍒颁笅涓�闃舵銆� -If you'd like, I can convert this into a shorter or longer version, or merge any existing instructions you have. Any areas you want me to expand or examples to add? +### 闃舵涓夛細鎵ц鏂规 +**澹版槑鏍煎紡**锛歚銆愭墽琛屾柟妗堛�慲 + +**蹇呴』鍋氱殑浜�**锛� +- 涓ユ牸鎸夌収閫夊畾鏂规瀹炵幇 +- 淇敼鍚庤繍琛岀被鍨嬫鏌� + +**缁濆绂佹**锛� +- 鉂� 鎻愪氦浠g爜锛堥櫎闈炵敤鎴锋槑纭姹傦級 +- 鍚姩寮�鍙戞湇鍔″櫒 + +濡傛灉鍦ㄨ繖涓樁娈靛彂鐜颁簡鎷夸笉鍑嗙殑闂锛岃鍚戞垜鎻愰棶銆� + +鏀跺埌鐢ㄦ埛娑堟伅鏃讹紝涓�鑸粠銆愬垎鏋愰棶棰樸�戦樁娈靛紑濮嬶紝闄ら潪鐢ㄦ埛鏄庣‘鎸囧畾闃舵鐨勫悕瀛椼�� \ No newline at end of file -- Gitblit v1.10.0