reference: 早先那版 C 写的装甲板固件(ESP-IDF 工程)

`armor/` 是它的 Rust 改写版,这一份留着当参考:ADC 阈值的 2000 就是从它标定出来的
(`.env.example` 里那句 "same as the reference firmware" 指的就是它),而且它的 README
记着实测设备与 MAC,换硬件时是有用的现场记录。

只收了 20 个源文件。它自带的 `.gitignore` 已经排掉 `build/`(211 MB 的 ESP-IDF 构建产物)
与生成的 `sdkconfig`,所以仓库里不会多出这些东西。

两处顺带处理:
- `reference/armor/.git` 是一个**空的**仓库壳(`git init` 过,零提交、零 remote、零 ref),
  而外层 git 正因为它的存在而拒绝索引 `reference/` 下的任何文件
  (`error: 'reference/armor/' does not have a commit checked out`)。它被挪到
  `desktop/.dev/backup/reference-armor-git`(可逆,且该目录已被忽略),不是删除。
- 它的 README 指着 `../armor-platformio-backup/`,那份备份并不存在。改成明说"没有进仓库",
  免得以后有人照着找一个不存在的目录。

另外把 `/docs/` 加进 .gitignore:那是工作区里另起的一个 Astro 文档站,与本仓库无关。
This commit is contained in:
2026-10-14 19:45:15 +08:00
parent a30eb3200a
commit fd71b83e3a
22 changed files with 1886 additions and 0 deletions
+106
View File
@@ -0,0 +1,106 @@
# =============================================================================
# armor — 文本/二进制归属与行尾(CRLF/LF)策略
# -----------------------------------------------------------------------------
# 规则:仓库里一律存 LF;工作区只在 Windows 原生脚本上使用 CRLF。
# 目的:
# * 避免不同机器(core.autocrlf 开着/关着)之间产生"整文件假改动";
# * 让 diff / blame / 合并只在真正改动的行上出现;
# * .ps1/.bat/.cmd 保持 CRLF,兼容 cmd.exe 与习惯 Windows 的工具链。
#
# 注意:.gitattributes 的 text/eol 属性优先级高于 core.autocrlf。
# 本文件用 "* text=auto eol=lf" 覆盖了所有路径,所以无论别人本机
# core.autocrlf 是 true / false / 未设置,入库结果都完全一致(已实测)。
# 若想改成"工作区也全用 LF"(含 .ps1),只需把第 1 节的
# eol=crlf 全部改成 eol=lf,其余规则不用动。
#
# 核对命令:
# git check-attr -a -- <路径> 查看某路径最终生效的属性
# git ls-files --eol 查看已入库文件的 i/(索引) w/(工作区) 行尾
# =============================================================================
# 默认:内容自动判定是否为文本;文本一律在索引与工作区使用 LF
* text=auto eol=lf
# =============================================================================
# 1. Windows 原生脚本 —— 工作区保持 CRLF
# =============================================================================
# cmd.exe 对纯 LF 的 .bat/.cmd 处理有坑(尤其是带 label/goto 的脚本),
# 必须 CRLF;.ps1/.psm1 按 Windows 惯例也保持 CRLF。
*.ps1 text eol=crlf
*.psm1 text eol=crlf
*.bat text eol=crlf
*.cmd text eol=crlf
# =============================================================================
# 2. 源码与文本配置 —— 显式声明为文本,工作区 LF
# =============================================================================
# 固件源码(main/ 下的 C/C++ 与官方 RMT 编码器)
*.c text eol=lf
*.h text eol=lf
*.cpp text eol=lf
*.hpp text eol=lf
*.cc text eol=lf
*.hh text eol=lf
# 构建系统
CMakeLists.txt text eol=lf
*.cmake text eol=lf
Kconfig text eol=lf
Kconfig.projbuild text eol=lf
# ESP-IDF 配置:sdkconfig 由工具生成(已忽略),defaults 是入库的那份
sdkconfig text eol=lf
sdkconfig.old text eol=lf
sdkconfig.defaults text eol=lf
sdkconfig.ci* text eol=lf
# 文档与数据
*.md text eol=lf
*.rst text eol=lf
*.txt text eol=lf
*.csv text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
# 本仓库自身的元文件与工程级工具配置
.gitignore text eol=lf
.gitattributes text eol=lf
.clangd text eol=lf
# =============================================================================
# 3. 二进制 —— 禁止任何行尾转换与文本合并
# =============================================================================
# 固件/构建产物(已被 .gitignore 排除,这里再兜一层,防止被强制入库时被破坏)
*.bin binary
*.elf binary
*.hex binary
*.a binary
*.o binary
# 图片与压缩包
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.bmp binary
*.svg binary
*.zip binary
*.gz binary
*.tar binary
*.7z binary
# 密钥与证书:绝不能因为行尾转换而改变字节
*.pem binary
*.key binary
*.der binary
*.crt binary
*.p12 binary
*.pfx binary