- A12 单一命令处理器(cmd*.c):一行 JSON 进出、seq 全局判重(32 条按值)、
限幅 / 空槽一律拒 / 拒绝记事件;命令号与错误码冻结(进 flash)。新增 power 命令,
fan 改为只抬不压的下限(t_thermal_set_floor)。rail_set_mv 注明不拿锁,调用方包 xact。
- A13 USB-Serial-JTAG 分帧(ulink*.c):@C / @R 前缀 + CRC-16,日志行首 @ 垫空格,
任意切块可切;关掉 USB 副控制台(它绕开驱动写 FIFO)。PC 端客户端 tools/prlink.py。
- A14 + C1(netcfg / mlink / cmd_net):topic phonerail/<mac>/{cmd,rsp,tele,state},
mqtts(evse-ca 编进固件)、1 s 遥测、遗嘱离线;wifi / mqtt 配置只收 USB、存 NVS,
net 永不回显密码。
- 协议定稿写进需求文档 §10.8(A12 / A13 / A14 三节);N7 撤销改 D7(机架管理前后端)。
宿主机 23 个 ctest / 400 例全绿;板 B 已烧 0.1.0-a14,经 WiFi → 公网 → 8883 TLS 真连网验过。
固件 0xE2220 / 1 MB 分区只剩 12%,C2 前要重排分区表。
Co-Authored-By: Claude Opus 5.5 <[email protected]>
53 行
2.0 KiB
Bash
53 行
2.0 KiB
Bash
#!/usr/bin/env bash
|
|
# 单个测试的「快编快跑」——给并行开工用(R2 迁移期间,别的测试可能还编不过,
|
|
# host/test.sh 的 cmake GLOB 会被它们卡住)。
|
|
#
|
|
# bash host/qtest.sh test_rail_cfg [test_slot ...]
|
|
#
|
|
# 它只编「core 源码 + unity + 你指定的那一个测试」,产物扔进 host/.q/,
|
|
# 不碰 host/build,所以多个会话同时跑互不干扰。
|
|
#
|
|
# ⚠️ 全绿之后仍然要跑一次完整的 `bash host/test.sh` —— 那一份才是 DoD 认的。
|
|
set -u
|
|
cd "$(dirname "$0")/.." || exit 1
|
|
|
|
OUT=host/.q
|
|
mkdir -p "$OUT"
|
|
|
|
INC="-Imain -Icomponents/phonerail_hal/include -Icomponents/phonerail_hal/sim
|
|
-Icomponents/drv/include -Ithird_party/unity"
|
|
|
|
# app_main.c 是 ESP 专用入口,宿主机不编。
|
|
CORE="main/version.c main/rail.c main/rail_cfg.c main/i2cbus.c main/slot.c
|
|
main/sched.c main/tasks.c main/t_safety.c main/t_actuator.c main/evlog.c
|
|
main/cmd_json.c main/cmd.c main/cmd_exec.c main/cmd_report.c main/ulink.c
|
|
main/cmd_net.c main/netcfg.c main/mlink.c"
|
|
[ -f main/t_thermal.c ] && CORE="$CORE main/t_thermal.c"
|
|
|
|
DRV="components/drv/ina226.c components/drv/dac63204.c components/drv/sr595.c
|
|
components/drv/pca9555.c components/drv/tca9548a.c components/drv/ch224a.c"
|
|
|
|
HALDIR=components/phonerail_hal
|
|
SIM="$HALDIR/hal_err.c $HALDIR/hal_i2c_acct.c
|
|
$HALDIR/sim/hal_lock_sim.c $HALDIR/sim/sim_hal.c $HALDIR/sim/hal_i2c_sim.c
|
|
$HALDIR/sim/hal_gpio_sim.c $HALDIR/sim/sim_sr595.c $HALDIR/sim/sim_pca9555.c
|
|
$HALDIR/sim/hal_pwm_sim.c $HALDIR/sim/hal_time_sim.c $HALDIR/sim/hal_store_sim.c"
|
|
|
|
rc=0
|
|
for t in "$@"; do
|
|
src="test/$t.c"
|
|
if [ ! -f "$src" ]; then
|
|
echo "!! 没有 $src"; rc=1; continue
|
|
fi
|
|
echo "=== $t ==="
|
|
# shellcheck disable=SC2086
|
|
if gcc -std=c11 -Wall -Wextra -Werror -g $INC \
|
|
"$src" third_party/unity/unity.c $CORE $DRV $SIM \
|
|
-o "$OUT/$t.exe"; then
|
|
"$OUT/$t.exe" || rc=1
|
|
else
|
|
rc=1
|
|
fi
|
|
done
|
|
exit $rc
|