- 8B PDO config: ULINT-sized payload, no 0x1A01 diag PDO on SM3 (device rejected SM3=8 with diag assigned: 'size not allowed, min/max 0xa') - twin_layout_blob_sized(): single 64-bit mapping entry for 8B payloads - Ticker: per-byte XOR 0x5A transform in 8B mode so TwinCAT can verify every byte individually (1KB path unchanged, const-guarded) - TwinCAT automation scripts: deploy with RPC retry, LinkVariables-based whole-array relink (element links only carry 1 byte), ADS watch, diag - Docs: 8B design, verification methodology, test report
44 lines
1.1 KiB
PowerShell
44 lines
1.1 KiB
PowerShell
#Requires -Version 5.1
|
|
<#
|
|
.SYNOPSIS
|
|
Switch the target AMS NetID in the TwinCAT project.
|
|
|
|
.DESCRIPTION
|
|
Opens the solution, calls SetTargetNetId, saves.
|
|
|
|
.PARAMETER NetId
|
|
The new target AMS NetID (e.g. "10.0.0.106.1.1", "10.0.0.111.1.1").
|
|
|
|
.EXAMPLE
|
|
.\tc-switch-target.ps1 -NetId 10.0.0.111.1.1
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory)][string]$NetId,
|
|
[string]$Solution = $null
|
|
)
|
|
. "$PSScriptRoot\tc-common.ps1"
|
|
if (-not $Solution) { $Solution = $script:DefaultSolution }
|
|
|
|
New-Log $script:DefaultLogDir
|
|
$LogFile = Join-Path $script:DefaultLogDir "switch-target.log"
|
|
|
|
Write-Log "=== Switch Target NetId → $NetId ===" $LogFile
|
|
|
|
$dte = Get-Dte -Visible:$false
|
|
try {
|
|
if (-not (Open-Solution -Dte $dte -Solution $Solution)) { throw "Solution did not open" }
|
|
$sysMgr = Get-SysManager -Dte $dte
|
|
|
|
$sysMgr.SetTargetNetId($NetId)
|
|
Write-Log "SetTargetNetId($NetId) OK" $LogFile
|
|
|
|
$sysMgr.SaveConfiguration()
|
|
Write-Log "Saved" $LogFile
|
|
|
|
Write-Log "=== Switch complete ===" $LogFile
|
|
}
|
|
finally {
|
|
try { $dte.Quit() } catch { }
|
|
}
|