refactor(chrg_north): 重构北向通信处理逻辑,增加配置版本校验机制
1. apps/chrg/applications/thread/chrg_comm.c: 新增通道配置版本递增逻辑,避免旧回码干扰新配置
2. apps/chrg/applications/thread/chrg_north.h: 更新config_version注释,补充用途说明
3. apps/chrg/applications/thread/chrg_north.c: 重构帧头解析函数,新增缓冲区操作辅助函数和通道切换复位逻辑
4. apps/chrg/applications/thread/chrg_roll_nor.c:
- 新增超时、重发等宏定义
- 重构协议设置函数,增加返回值处理
- 新增回码匹配校验、邮箱清理、等待响应等辅助函数
- 重构自动请求逻辑,增加重试和配置版本校验
- 简化线程入口处理逻辑,统一回码释放流程
5. apps/chrg/codex_build.log: 记录本次编译的代码尺寸变化
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
# Source CC_CLOSE 协议切换修改说明
|
||||
|
||||
## 修改目标
|
||||
|
||||
修正 Source 北向协议板的命令顺序,避免在 CC 保持 Attached 时直接重配
|
||||
`0xD0`。多通道同时切换时采用共享等待屏障,使保护时间并行发生,不按
|
||||
通道串行累计。
|
||||
|
||||
## 本轮实施步骤
|
||||
|
||||
### 第一步:统一状态命名
|
||||
|
||||
断开 CC 的命令状态命名为 `IDX_SET_SOURCE_CC_CLOSE`,等待状态命名为
|
||||
`IDX_WAIT_SOURCE_CC_CLOSE`。`CC_CLOSE` 固定发送 `0x17=0x03`,不覆盖
|
||||
COM 保存的目标 `CC_Set`。
|
||||
|
||||
### 第二步:调整停止态启动顺序
|
||||
|
||||
Source 从停止状态启动以及 Sink 切换为 Source 时,不发送 `CC_CLOSE`,
|
||||
直接按以下顺序执行:
|
||||
|
||||
```text
|
||||
IDX_SET_SOURCE_PD
|
||||
-> IDX_WAIT_SOURCE_PROTOCOL
|
||||
-> IDX_SET_SOURCE_CC_SET
|
||||
-> IDX_GET_SOURCE_VC
|
||||
```
|
||||
|
||||
即先设置协议,收到 `0xD0` ACK 并完成保护等待后,再连接目标 CC。
|
||||
|
||||
### 第三步:识别必须断开 CC 的切换
|
||||
|
||||
COM 参数生效时,满足以下任一条件进入 `CC_CLOSE`:
|
||||
|
||||
- 新协议为 PD/PPS 或 PD3.1/AVS,并且协议或 CC 线与上次不同。
|
||||
- 上次协议为 PD/PPS 或 PD3.1/AVS,本次切换为非 PD 协议。
|
||||
|
||||
其它协议配置变化从 `IDX_SET_SOURCE_PD` 开始。标准协议仅改变电压、电流
|
||||
时直接更新功率板,不重复下发 `0xD0`。
|
||||
|
||||
### 第四步:执行 CC_CLOSE 命令链
|
||||
|
||||
COM先确定北向`sub`,协议或CC发生变化时进入
|
||||
`SOURCE_WORK_PROTOCOL_SWITCH`,不在COM中调用发送函数。北向轮询线程
|
||||
执行该Source工作状态,负责向南向功率板写入0V;标准协议还会在同一批
|
||||
命令中依次写模式和电流。提交成功后清零`set_volt`并进入
|
||||
`SOURCE_WORK_WAIT`,随后按已经选定的`sub`继续执行。
|
||||
|
||||
需要断开 CC 的通道按以下顺序执行:
|
||||
|
||||
```text
|
||||
IDX_SET_SOURCE_CC_CLOSE 发送 0x17=0x03
|
||||
-> IDX_WAIT_SOURCE_CC_CLOSE 等待共享保护时间
|
||||
-> IDX_SET_SOURCE_PD 发送 0xD0
|
||||
-> IDX_WAIT_SOURCE_PROTOCOL 等待协议 ACK 后保护时间
|
||||
-> IDX_SET_SOURCE_CC_SET 发送 0x17=目标 CC
|
||||
-> IDX_GET_SOURCE_VC 恢复 0x20 查询
|
||||
```
|
||||
|
||||
每条设置命令仍需收到角色、命令、长度和 CRC 均正确的回码后才能推进
|
||||
`sub`;错误回码继续沿用现有丢弃和有限重发逻辑。
|
||||
|
||||
### 第五步:多通道共享 CC_CLOSE 等待
|
||||
|
||||
使用 `pending_mask` 和 `acked_mask` 管理本轮参与切换的 Source 通道。
|
||||
所有已登记通道都收到 `0x17` ACK 后,只启动一次 300 ms 保护等待。
|
||||
一个通道和四个通道的保护等待本身均为 300 ms;四通道只额外产生必要的
|
||||
命令收发时间,不会累计为四次 300 ms。
|
||||
|
||||
### 第六步:握手稳定确认(本轮不修改)
|
||||
|
||||
本轮不增加“连续两次 `0x20` 电压稳定后才进入 RUNNING”的新逻辑,继续
|
||||
使用现有 `chrg_source_parse()` 电压误差和重试规则。
|
||||
|
||||
### 第七步:配置覆盖保护
|
||||
|
||||
继续使用 `config_version` 防止 COM 新配置被旧回码推进。停止、角色切换
|
||||
或不再需要 `CC_CLOSE` 时,会把通道移出共享等待屏障,避免残留状态影响
|
||||
下一次启动。
|
||||
|
||||
### 第八步:完整失败恢复(本轮不修改)
|
||||
|
||||
本轮不增加握手总超时、再次 detach、整套流程最多重试两轮以及故障上报。
|
||||
单条北向命令仍使用现有的三次发送机制。完整恢复流程待单独验证后实施。
|
||||
|
||||
## 时间参数
|
||||
|
||||
| 参数 | 当前值 | 说明 |
|
||||
|---|---:|---|
|
||||
| `SOURCE_CC_CLOSE_WAIT_MS` | 300 ms | 从本轮最后一个有效 `CC_CLOSE` ACK 开始 |
|
||||
| `SOURCE_PROTOCOL_WAIT_MS` | 100 ms | 每通道收到 `0xD0` ACK 后并行等待 |
|
||||
| `NORTH_RESPONSE_TIMEOUT_MS` | 50 ms | 单次北向回码等待 |
|
||||
| `NORTH_REQUEST_MAX_RETRIES` | 2 | 首次发送外最多重发两次 |
|
||||
|
||||
## 建议验证顺序
|
||||
|
||||
1. 单通道停止态启动 PD,确认发送顺序为 `D0 -> 17(目标CC) -> 20`。
|
||||
2. 单通道 PD 改协议或 CC,确认顺序为 `17(03) -> 等待 -> D0 -> 17(目标CC) -> 20`。
|
||||
3. 单通道 PD 切换 QC/FCP/标准,确认切换前先发送 `17(03)`。
|
||||
4. 四通道连续生效,确认四路 `17(03)` 均回码后共享一次约 300 ms 等待。
|
||||
5. 连续执行 20 至 30 轮协议切换,检查是否仍出现 Source 芯片 PD 状态异常。
|
||||
@@ -0,0 +1,310 @@
|
||||
param(
|
||||
[string]$OutputDirectory = 'D:\HC-PMP-SW\Power_ControlPannel\MP_Control_sw_405\拖拽式平台\docs'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function New-Criteria {
|
||||
param([int]$VoltageToleranceMv, [int]$CurrentToleranceMa)
|
||||
[ordered]@{
|
||||
VoltageToleranceMv = $VoltageToleranceMv
|
||||
CurrentToleranceMa = $CurrentToleranceMa
|
||||
ShortVoltageMinMv = 0
|
||||
ShortVoltageMaxMv = 1000
|
||||
ShortCurrentMinMa = 0
|
||||
ShortCurrentMaxMa = 1000
|
||||
OcpVoltageMinMv = 0
|
||||
OcpVoltageMaxMv = 5000
|
||||
OcpCurrentMinMa = 4500
|
||||
OcpCurrentMaxMa = 5500
|
||||
DynamicVpkPlusMinMv = 0
|
||||
DynamicVpkPlusMaxMv = 65535
|
||||
DynamicVpkMinusMinMv = 0
|
||||
DynamicVpkMinusMaxMv = 65535
|
||||
}
|
||||
}
|
||||
|
||||
function New-DmpItem {
|
||||
param(
|
||||
[string]$Name,
|
||||
[int]$Channel,
|
||||
[string]$Protocol,
|
||||
[int]$VoltageMv,
|
||||
[int]$ProtocolCurrentMa,
|
||||
[int]$LoadCurrentMa,
|
||||
[int]$VoltageToleranceMv,
|
||||
[int]$CurrentToleranceMa,
|
||||
[int]$QueryDelayMs,
|
||||
[string]$OutputAction = 'Start',
|
||||
[int]$Gear = 0,
|
||||
[int]$CcSelection = -1,
|
||||
[string]$SinkFunction = 'StandardLoad'
|
||||
)
|
||||
|
||||
[ordered]@{
|
||||
Id = [guid]::NewGuid().ToString()
|
||||
Name = $Name
|
||||
Channel = $Channel
|
||||
Direction = 'Sink'
|
||||
OutputAction = $OutputAction
|
||||
Protocol = $Protocol
|
||||
Mode = 'ConstantCurrent'
|
||||
PdoType = 'Fpdo'
|
||||
SinkFunction = $SinkFunction
|
||||
Gear = $Gear
|
||||
CcSelection = if ($CcSelection -ge 0) { $CcSelection } elseif ($Channel -eq 2) { 1 } else { 0 }
|
||||
MinVoltageMv = 3300
|
||||
VoltageMv = $VoltageMv
|
||||
CurrentMa = $ProtocolCurrentMa
|
||||
LoadVoltageMv = $VoltageMv
|
||||
LoadCurrentMa = $LoadCurrentMa
|
||||
VonVoltageMv = 100
|
||||
ShortHoldTimeMs = 1000
|
||||
HoldAfterTest = $false
|
||||
OcpStartCurrentMa = 1000
|
||||
OcpEndCurrentMa = 5000
|
||||
OcpStepCurrentMa = 100
|
||||
OcpStepTimeMs = 10
|
||||
OcpRecoveryTimeMs = 1000
|
||||
OcpStopVoltageMv = 4000
|
||||
OcpRecoveryWithLoad = $true
|
||||
DynamicCurrent1Ma = 1000
|
||||
DynamicTime1 = 100
|
||||
DynamicCurrent2Ma = 5000
|
||||
DynamicTime2 = 100
|
||||
DynamicRiseSlope = 1
|
||||
DynamicFallSlope = 1
|
||||
ApplyDelayMs = 500
|
||||
QueryDelayMs = $QueryDelayMs
|
||||
DurationMs = 1000
|
||||
StopOnFault = $true
|
||||
Criteria = New-Criteria $VoltageToleranceMv $CurrentToleranceMa
|
||||
Status = 'Pending'
|
||||
Result = ''
|
||||
Verdict = ''
|
||||
MeasuredVoltageMv = $null
|
||||
MeasuredCurrentMa = $null
|
||||
QueryTime = $null
|
||||
Measurements = @()
|
||||
}
|
||||
}
|
||||
|
||||
function New-PortConfig {
|
||||
param(
|
||||
[string]$Port,
|
||||
[int]$Channel,
|
||||
[string]$Protocol,
|
||||
[int]$VoltageMv,
|
||||
[int]$ProtocolCurrentMa,
|
||||
[int]$LoadCurrentMa,
|
||||
[int]$VoltageToleranceMv,
|
||||
[int]$CurrentToleranceMa,
|
||||
[int]$Gear = 0
|
||||
)
|
||||
[pscustomobject]@{
|
||||
Port = $Port
|
||||
Channel = $Channel
|
||||
Protocol = $Protocol
|
||||
VoltageMv = $VoltageMv
|
||||
ProtocolCurrentMa = $ProtocolCurrentMa
|
||||
LoadCurrentMa = $LoadCurrentMa
|
||||
VoltageToleranceMv = $VoltageToleranceMv
|
||||
CurrentToleranceMa = $CurrentToleranceMa
|
||||
Gear = $Gear
|
||||
}
|
||||
}
|
||||
|
||||
function Add-SingleTest {
|
||||
param(
|
||||
[System.Collections.Generic.List[object]]$Items,
|
||||
[string]$Prefix,
|
||||
[pscustomobject]$Config,
|
||||
[int]$CcSelection = -1
|
||||
)
|
||||
$voltage = $Config.VoltageMv / 1000
|
||||
$current = $Config.LoadCurrentMa / 1000
|
||||
$Items.Add((New-DmpItem "$Prefix-$($Config.Port)-$voltage`V-$current`A" $Config.Channel $Config.Protocol `
|
||||
$Config.VoltageMv $Config.ProtocolCurrentMa $Config.LoadCurrentMa `
|
||||
$Config.VoltageToleranceMv $Config.CurrentToleranceMa 10000 'Start' $Config.Gear $CcSelection))
|
||||
$Items.Add((New-DmpItem "$Prefix-$($Config.Port)-停止" $Config.Channel $Config.Protocol `
|
||||
$Config.VoltageMv $Config.ProtocolCurrentMa $Config.LoadCurrentMa 0 0 1000 'Stop' $Config.Gear $CcSelection))
|
||||
}
|
||||
|
||||
function Add-SequencedPortTest {
|
||||
param(
|
||||
[System.Collections.Generic.List[object]]$Items,
|
||||
[string]$Face,
|
||||
[int]$CcSelection,
|
||||
[pscustomobject]$Case,
|
||||
[string]$Port,
|
||||
[int]$Channel
|
||||
)
|
||||
|
||||
$sinkFunction = if ($Case.SinkFunction) { $Case.SinkFunction } else { 'StandardLoad' }
|
||||
$namePrefix = "$Face-$($Case.Label)-$Port"
|
||||
$start = New-DmpItem "$namePrefix-启动" $Channel $Case.Protocol $Case.Voltage `
|
||||
$Case.ProtocolCurrent $Case.LoadCurrent $Case.VTol $Case.ITol 5000 'Start' 0 $CcSelection $sinkFunction
|
||||
if ($sinkFunction -eq 'ShortCircuit') {
|
||||
$start.Criteria.ShortVoltageMinMv = 0
|
||||
$start.Criteria.ShortVoltageMaxMv = 3000
|
||||
$start.Criteria.ShortCurrentMinMa = 0
|
||||
$start.Criteria.ShortCurrentMaxMa = 65535
|
||||
}
|
||||
$Items.Add($start)
|
||||
$Items.Add((New-DmpItem "$namePrefix-停止" $Channel $Case.Protocol $Case.Voltage `
|
||||
$Case.ProtocolCurrent $Case.LoadCurrent 0 0 5000 'Stop' 0 $CcSelection $sinkFunction))
|
||||
}
|
||||
|
||||
function Add-CombinationTest {
|
||||
param(
|
||||
[System.Collections.Generic.List[object]]$Items,
|
||||
[string]$Prefix,
|
||||
[object[]]$Configs
|
||||
)
|
||||
|
||||
foreach ($config in $Configs) {
|
||||
$Items.Add((New-DmpItem "$Prefix-$($config.Port)-配置" $config.Channel $config.Protocol `
|
||||
$config.VoltageMv $config.ProtocolCurrentMa $config.LoadCurrentMa 0 0 100 'Start' $config.Gear))
|
||||
}
|
||||
for ($index = 0; $index -lt $Configs.Count; $index++) {
|
||||
$config = $Configs[$index]
|
||||
$delay = if ($index -eq 0) { 10000 } else { 1000 }
|
||||
$Items.Add((New-DmpItem "$Prefix-$($config.Port)-验证" $config.Channel $config.Protocol `
|
||||
$config.VoltageMv $config.ProtocolCurrentMa $config.LoadCurrentMa `
|
||||
$config.VoltageToleranceMv $config.CurrentToleranceMa $delay 'Start' $config.Gear))
|
||||
}
|
||||
foreach ($config in $Configs) {
|
||||
$Items.Add((New-DmpItem "$Prefix-$($config.Port)-停止" $config.Channel $config.Protocol `
|
||||
$config.VoltageMv $config.ProtocolCurrentMa $config.LoadCurrentMa 0 0 1000 'Stop' $config.Gear))
|
||||
}
|
||||
}
|
||||
|
||||
function Write-Plan {
|
||||
param([string]$FileName, [string]$Name, [System.Collections.Generic.List[object]]$Items)
|
||||
$plan = [ordered]@{
|
||||
ProductId = 'DMP'
|
||||
Name = $Name
|
||||
Communication = [ordered]@{
|
||||
PortName = 'COM6'
|
||||
BaudRate = 115200
|
||||
DataBits = 8
|
||||
Parity = 'None'
|
||||
StopBits = 1
|
||||
SlaveAddress = 1
|
||||
TimeoutMs = 500
|
||||
RetryCount = 2
|
||||
}
|
||||
Items = $Items
|
||||
}
|
||||
$path = Join-Path $OutputDirectory $FileName
|
||||
$json = $plan | ConvertTo-Json -Depth 20
|
||||
[System.IO.File]::WriteAllText($path, $json, [System.Text.UTF8Encoding]::new($false))
|
||||
Get-Item -LiteralPath $path
|
||||
}
|
||||
|
||||
$c1 = 1
|
||||
$c2 = 2
|
||||
$a1 = 3
|
||||
|
||||
# 1. C1/C2同时插入,但依次对单个通道带载。先测A面(CC1),再测B面(CC2)。
|
||||
$items = [System.Collections.Generic.List[object]]::new()
|
||||
$dualCases = @(
|
||||
[pscustomobject]@{ Label = '5V3A'; Protocol = 'Standard'; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 240; ITol = 300; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '5V3.8A过载'; Protocol = 'Standard'; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 3800; VTol = 0; ITol = 0; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '5V0A空载'; Protocol = 'Standard'; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 0; VTol = 240; ITol = 0; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '5V-QC2.0'; Protocol = 'Qc20'; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 0; VTol = 240; ITol = 0; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '5V短路'; Protocol = 'Standard'; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 0; VTol = 0; ITol = 0; SinkFunction = 'ShortCircuit' },
|
||||
[pscustomobject]@{ Label = '5V0A短路恢复'; Protocol = 'Standard'; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 0; VTol = 240; ITol = 0; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '9V3A'; Protocol = 'Pdo'; Voltage = 9000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 440; ITol = 300; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '15V3A'; Protocol = 'Pdo'; Voltage = 15000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 740; ITol = 300; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '20V2.25A'; Protocol = 'Pdo'; Voltage = 20000; ProtocolCurrent = 2250; LoadCurrent = 2250; VTol = 790; ITol = 225; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '20V0A空载'; Protocol = 'Pdo'; Voltage = 20000; ProtocolCurrent = 2250; LoadCurrent = 0; VTol = 790; ITol = 0; SinkFunction = 'StandardLoad' },
|
||||
[pscustomobject]@{ Label = '20V2.82A过载'; Protocol = 'Pdo'; Voltage = 20000; ProtocolCurrent = 2250; LoadCurrent = 2820; VTol = 0; ITol = 0; SinkFunction = 'StandardLoad' }
|
||||
)
|
||||
foreach ($face in @(
|
||||
[pscustomobject]@{ Name = 'A面'; CcSelection = 1 },
|
||||
[pscustomobject]@{ Name = 'B面'; CcSelection = 2 }
|
||||
)) {
|
||||
foreach ($case in $dualCases) {
|
||||
Add-SequencedPortTest $items $face.Name $face.CcSelection $case 'C1' $c1
|
||||
Add-SequencedPortTest $items $face.Name $face.CcSelection $case 'C2' $c2
|
||||
}
|
||||
}
|
||||
Write-Plan '01_C1-C2双口同时插入测试.json' '01 C1/C2双口同时插入、依次单口负载测试' $items
|
||||
|
||||
# 2. A1单口:5V标准,9V/12V使用QC2.0。
|
||||
$items = [System.Collections.Generic.List[object]]::new()
|
||||
$a1Cases = @(
|
||||
[pscustomobject]@{ Label = '264VAC'; Protocol = 'Standard'; Voltage = 5000; Current = 3000; VTol = 240; ITol = 300 },
|
||||
[pscustomobject]@{ Label = '264VAC'; Protocol = 'Qc20'; Voltage = 9000; Current = 2000; VTol = 440; ITol = 200 },
|
||||
[pscustomobject]@{ Label = '264VAC'; Protocol = 'Qc20'; Voltage = 12000; Current = 1500; VTol = 590; ITol = 150 },
|
||||
[pscustomobject]@{ Label = '90VAC'; Protocol = 'Standard'; Voltage = 5000; Current = 3000; VTol = 240; ITol = 300 },
|
||||
[pscustomobject]@{ Label = '90VAC'; Protocol = 'Qc20'; Voltage = 12000; Current = 1500; VTol = 590; ITol = 150 }
|
||||
)
|
||||
foreach ($case in $a1Cases) {
|
||||
Add-SingleTest $items $case.Label (New-PortConfig 'A1' $a1 $case.Protocol $case.Voltage `
|
||||
$case.Current $case.Current $case.VTol $case.ITol)
|
||||
}
|
||||
Add-SingleTest $items 'SCP-10V2.25A' (New-PortConfig 'A1' $a1 'Scp' 10000 2250 2250 490 225)
|
||||
Write-Plan '02_A1单口测试.json' '02 A1单口测试' $items
|
||||
|
||||
# 3. C1/C2单口多协议。先测A面(CC1),再测B面(CC2)。
|
||||
# PPS3-5没有规格值,仅做9V空载握手,避免未确认的大电流带载。
|
||||
$items = [System.Collections.Generic.List[object]]::new()
|
||||
$multiProtocolCases = @(
|
||||
[pscustomobject]@{ Label = '标准5V3A'; Protocol = 'Standard'; Gear = 0; Voltage = 5000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 240; ITol = 300 },
|
||||
[pscustomobject]@{ Label = 'PDO9V3A'; Protocol = 'Pdo'; Gear = 0; Voltage = 9000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 440; ITol = 300 },
|
||||
[pscustomobject]@{ Label = 'PDO15V3A'; Protocol = 'Pdo'; Gear = 0; Voltage = 15000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 740; ITol = 300 },
|
||||
[pscustomobject]@{ Label = 'PDO20V2.25A'; Protocol = 'Pdo'; Gear = 0; Voltage = 20000; ProtocolCurrent = 2250; LoadCurrent = 2250; VTol = 790; ITol = 225 },
|
||||
[pscustomobject]@{ Label = 'PPS1-9V4.5A'; Protocol = 'Pps'; Gear = 1; Voltage = 9000; ProtocolCurrent = 4500; LoadCurrent = 4500; VTol = 450; ITol = 225 },
|
||||
[pscustomobject]@{ Label = 'PPS2-19V2A'; Protocol = 'Pps'; Gear = 2; Voltage = 19000; ProtocolCurrent = 2000; LoadCurrent = 2000; VTol = 950; ITol = 150 },
|
||||
[pscustomobject]@{ Label = 'PPS3-9V空载握手'; Protocol = 'Pps'; Gear = 3; Voltage = 9000; ProtocolCurrent = 1000; LoadCurrent = 0; VTol = 450; ITol = 100 },
|
||||
[pscustomobject]@{ Label = 'PPS4-9V空载握手'; Protocol = 'Pps'; Gear = 4; Voltage = 9000; ProtocolCurrent = 1000; LoadCurrent = 0; VTol = 450; ITol = 100 },
|
||||
[pscustomobject]@{ Label = 'PPS5-9V空载握手'; Protocol = 'Pps'; Gear = 5; Voltage = 9000; ProtocolCurrent = 1000; LoadCurrent = 0; VTol = 450; ITol = 100 }
|
||||
)
|
||||
$avsCases = @(
|
||||
[pscustomobject]@{ Label = 'AVS-9V3A'; Protocol = 'Avs'; Gear = 0; Voltage = 9000; ProtocolCurrent = 3000; LoadCurrent = 3000; VTol = 150; ITol = 300 },
|
||||
[pscustomobject]@{ Label = 'AVS-20V2.25A'; Protocol = 'Avs'; Gear = 0; Voltage = 20000; ProtocolCurrent = 2250; LoadCurrent = 2250; VTol = 650; ITol = 225 }
|
||||
)
|
||||
$cPorts = @([pscustomobject]@{ Name = 'C1'; Channel = $c1 }, [pscustomobject]@{ Name = 'C2'; Channel = $c2 })
|
||||
foreach ($face in @(
|
||||
[pscustomobject]@{ Name = 'A面'; CcSelection = 1 },
|
||||
[pscustomobject]@{ Name = 'B面'; CcSelection = 2 }
|
||||
)) {
|
||||
foreach ($case in $multiProtocolCases) {
|
||||
foreach ($port in $cPorts) {
|
||||
Add-SingleTest $items "$($face.Name)-$($case.Label)" (New-PortConfig $port.Name $port.Channel $case.Protocol `
|
||||
$case.Voltage $case.ProtocolCurrent $case.LoadCurrent $case.VTol $case.ITol $case.Gear) $face.CcSelection
|
||||
}
|
||||
}
|
||||
foreach ($case in $avsCases) {
|
||||
Add-SingleTest $items "$($face.Name)-$($case.Label)" (New-PortConfig 'C1' $c1 $case.Protocol `
|
||||
$case.Voltage $case.ProtocolCurrent $case.LoadCurrent $case.VTol $case.ITol $case.Gear) $face.CcSelection
|
||||
}
|
||||
}
|
||||
Write-Plan '03_C1-C2单口多协议测试.json' '03 C1/C2单口多协议A/B面测试(含PPS1~5、AVS)' $items
|
||||
|
||||
# 4. 两口组合:只有20V项目使用PDO,其余5V均为标准协议。
|
||||
$items = [System.Collections.Generic.List[object]]::new()
|
||||
Add-CombinationTest $items '组合1-C1+C2' @(
|
||||
(New-PortConfig 'C1' $c1 'Pdo' 20000 1500 1500 990 150),
|
||||
(New-PortConfig 'C2' $c2 'Standard' 5000 3000 3000 240 300)
|
||||
)
|
||||
Add-CombinationTest $items '组合2-C1+A1' @(
|
||||
(New-PortConfig 'C1' $c1 'Pdo' 20000 1500 1500 990 150),
|
||||
(New-PortConfig 'A1' $a1 'Standard' 5000 3000 3000 240 300)
|
||||
)
|
||||
Add-CombinationTest $items '组合3-C2+A1' @(
|
||||
(New-PortConfig 'C2' $c2 'Standard' 5000 1500 1500 240 150),
|
||||
(New-PortConfig 'A1' $a1 'Standard' 5000 1500 1500 240 150)
|
||||
)
|
||||
Write-Plan '04_两口组合输出测试.json' '04 两口组合输出测试' $items
|
||||
|
||||
# 5. 三口组合:C1为PD 20V,C2/A1为标准5V。
|
||||
$items = [System.Collections.Generic.List[object]]::new()
|
||||
Add-CombinationTest $items '三口组合-C1+C2+A1' @(
|
||||
(New-PortConfig 'C1' $c1 'Pdo' 20000 1500 1500 990 150),
|
||||
(New-PortConfig 'C2' $c2 'Standard' 5000 1500 1500 240 150),
|
||||
(New-PortConfig 'A1' $a1 'Standard' 5000 1500 1500 240 150)
|
||||
)
|
||||
Write-Plan '05_C1-C2-A1三口组合输出测试.json' '05 C1/C2/A1三口组合输出测试' $items
|
||||
Reference in New Issue
Block a user