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 | 91 +++++++++++++++++++++++++++++++-------------- 1 files changed, 62 insertions(+), 29 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index b32fdb0..6292bd0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,36 +1,69 @@ -# Quick instructions for AI coding agents +--- +alwaysApply: true +--- +# AI鍔╂墜鏍稿績瑙勫垯 -Overview -- STM32H743 (FreeRTOS) firmware for an autonomous lawnmower. Mix of CubeMX HAL, platform glue (HIDO_*), FML functional modules, and APL tasks. +## 涓夐樁娈靛伐浣滄祦 -What to read first -- Entry: `STM32H743/Core/Src/main.c` (MX_* init, `app_main()`, osKernelStart) -- App: `STM32H743/APL/app.c` (`app_task()` initializes modules and polls with a binary semaphore) -- Modules: `STM32H743/FML/*` (GPS, SBUS, Motion, Internet, UDP/TCP) -- Utilities: `STM32H743/HIDOLibrary/Include/` (HIDO_* helpers) +### 闃舵涓�锛氬垎鏋愰棶棰� -Core rules and patterns -- Do not change CubeMX generated code outside `/* USER CODE BEGIN/END */` blocks. If you must regenerate, move logic to `FML/`/`APL/`. -- Init & Poll pattern: implement `Module_Init()` and `Module_Poll()`; call Init in `app_task()` and Poll during app loop. -- UARTs: register HAL handles with `Uart_Register(UART_ID_*, &huartX)` after `MX_USARTX_UART_Init()`; `Uart_Init()` config may require DMA buffers. -- ISR wake: signal `app_task` using `app_trigger_from_isr()`; avoid direct task notification unless you match existing pattern. -- Naming & API: follow `HIDO_*` typedefs and `HIDO_OK/HIDO_ERR` return conventions; use `HIDO_*` timers, queues, and helpers. +**澹版槑鏍煎紡**锛歚銆愬垎鏋愰棶棰樸�慲 -Build & debug -- Two build modes: CubeMX + STM32CubeIDE (edit `.ioc`) or Keil MDK-uVision (`MDK-ARM/STM32H743.uvprojx`). -- Use J-Link to flash; default debug UART: `USART1` (921600). Python telemetry/telemetry tool uses `UART5` (921600). -- DMA/coherency: avoid enabling D-cache while using DMA unless buffer cache maintenance is implemented. +**鐩殑** +鍥犱负鍙兘瀛樺湪澶氫釜鍙�夋柟妗堬紝瑕佸仛鍑烘纭殑鍐崇瓥锛岄渶瑕佽冻澶熺殑渚濇嵁銆� -Safe changes and examples -- Add a new UART-based sensor: - 1) Configure UART in CubeMX / MX_USARTX_UART_Init() in `main.c` (USER CODE blocks) - 2) `Uart_Register(UART_ID_NEW, &huartX)` in `main.c` after init - 3) Add `FML/NewModule_Init()` and `FML/NewModule_Poll()` and call from `app_task()` -- Tuning: adjust motion PID and constants in `STM32H743/FML/motion_config.h` and `APL/global_param.h`. Persist via `save_com_map_to_flash()`. +**蹇呴』鍋氱殑浜�**锛� +- 鐞嗚В鎴戠殑鎰忓浘锛屽鏋滄湁姝т箟璇烽棶鎴� +- 鎼滅储鎵�鏈夌浉鍏充唬鐮� +- 璇嗗埆闂鏍瑰洜 -Notes for AI agents -- Only change generated code inside USER blocks. Prefer to add files in `FML/`/`APL/` and follow `HIDO_` conventions. -- Minimize blocking work in `MotionControl_Task` and `app_task()`; keep real-time paths deterministic. -- For deeper module rules and examples, consult `STM32H743/.github/copilot-instructions.md` and `docs/`. +**涓诲姩鍙戠幇闂** +- 鍙戠幇閲嶅浠g爜 +- 璇嗗埆涓嶅悎鐞嗙殑鍛藉悕 +- 鍙戠幇澶氫綑鐨勪唬鐮併�佺被 +- 鍙戠幇鍙兘杩囨椂鐨勮璁� +- 鍙戠幇杩囦簬澶嶆潅鐨勮璁°�佽皟鐢� +- 鍙戠幇涓嶄竴鑷寸殑绫诲瀷瀹氫箟 +- 杩涗竴姝ユ悳绱唬鐮侊紝鐪嬫槸鍚︽洿澶ц寖鍥村唴鏈夌被浼奸棶棰� -If any section should include deeper examples (UART template, module skeletons, or unit test patterns), tell me which piece to expand. +鍋氬畬浠ヤ笂浜嬮」锛屽氨鍙互鍚戞垜鎻愰棶浜嗐�� + +**缁濆绂佹**锛� +- 鉂� 淇敼浠讳綍浠g爜 +- 鉂� 鎬ヤ簬缁欏嚭瑙e喅鏂规 +- 鉂� 璺宠繃鎼滅储鍜岀悊瑙f楠� +- 鉂� 涓嶅垎鏋愬氨鎺ㄨ崘鏂规 + +**闃舵杞崲瑙勫垯** +鏈樁娈典綘瑕佸悜鎴戞彁闂�� +濡傛灉瀛樺湪澶氫釜浣犳棤娉曟妷鎷╃殑鏂规锛岃闂垜锛屼綔涓烘彁闂殑涓�閮ㄥ垎銆� +濡傛灉娌℃湁闇�瑕侀棶鎴戠殑锛屽垯鐩存帴杩涘叆涓嬩竴闃舵銆� + +### 闃舵浜岋細鍒跺畾鏂规 +**澹版槑鏍煎紡**锛歚銆愬埗瀹氭柟妗堛�慲 + +**鍓嶇疆鏉′欢**锛� +- 鎴戞槑纭洖绛斾簡鍏抽敭鎶�鏈喅绛栥�� + +**蹇呴』鍋氱殑浜�**锛� +- 鍒楀嚭鍙樻洿锛堟柊澧炪�佷慨鏀广�佸垹闄わ級鐨勬枃浠讹紝绠�瑕佹弿杩版瘡涓枃浠剁殑鍙樺寲 +- 娑堥櫎閲嶅閫昏緫锛氬鏋滃彂鐜伴噸澶嶄唬鐮侊紝蹇呴』閫氳繃澶嶇敤鎴栨娊璞℃潵娑堥櫎 +- 纭繚淇敼鍚庣殑浠g爜绗﹀悎DRY鍘熷垯鍜岃壇濂界殑鏋舵瀯璁捐 + +濡傛灉鏂板彂鐜颁簡鍚戞垜鏀堕泦鐨勫叧閿喅绛栵紝鍦ㄨ繖涓樁娈典綘杩樺彲浠ョ户缁棶鎴戯紝鐩村埌娌℃湁涓嶆槑纭殑闂涔嬪悗锛屾湰闃舵缁撴潫銆� +鏈樁娈典笉鍏佽鑷姩鍒囨崲鍒颁笅涓�闃舵銆� + +### 闃舵涓夛細鎵ц鏂规 +**澹版槑鏍煎紡**锛歚銆愭墽琛屾柟妗堛�慲 + +**蹇呴』鍋氱殑浜�**锛� +- 涓ユ牸鎸夌収閫夊畾鏂规瀹炵幇 +- 淇敼鍚庤繍琛岀被鍨嬫鏌� + +**缁濆绂佹**锛� +- 鉂� 鎻愪氦浠g爜锛堥櫎闈炵敤鎴锋槑纭姹傦級 +- 鍚姩寮�鍙戞湇鍔″櫒 + +濡傛灉鍦ㄨ繖涓樁娈靛彂鐜颁簡鎷夸笉鍑嗙殑闂锛岃鍚戞垜鎻愰棶銆� + +鏀跺埌鐢ㄦ埛娑堟伅鏃讹紝涓�鑸粠銆愬垎鏋愰棶棰樸�戦樁娈靛紑濮嬶紝闄ら潪鐢ㄦ埛鏄庣‘鎸囧畾闃舵鐨勫悕瀛椼�� \ No newline at end of file -- Gitblit v1.10.0