- 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
47 lines
1.7 KiB
PowerShell
47 lines
1.7 KiB
PowerShell
#Requires -Version 5.1
|
|
#Requires -RunAsAdministrator
|
|
$ErrorActionPreference = 'Continue'
|
|
|
|
$LogFile = "C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\Logs\dte-commands-test.log"
|
|
New-Item -ItemType Directory -Force -Path (Split-Path $LogFile) | Out-Null
|
|
function Write-Log($Message) {
|
|
$line = "[{0}] {1}" -f (Get-Date -Format 'HH:mm:ss'), $Message
|
|
Write-Host $line
|
|
Add-Content -Path $LogFile -Value $line -Encoding UTF8
|
|
}
|
|
|
|
Write-Log "=== Test DTE command names ==="
|
|
$dte = New-Object -ComObject TcXaeShell.DTE.17.0
|
|
$dte.MainWindow.Visible = $true
|
|
$dte.Solution.Open('C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Secondary\TwinCAT_EL6695_Secondary.sln')
|
|
for ($i=1; $i -le 120; $i++) { Start-Sleep -Seconds 1; if ($dte.Solution.IsOpen) { break } }
|
|
Write-Log "Solution open: $($dte.Solution.IsOpen)"
|
|
|
|
$names = @(
|
|
'TwinCAT.StartTwinCAT',
|
|
'TwinCAT.StartTwinCATInRunMode',
|
|
'TwinCAT.RestartTwinCAT',
|
|
'TwinCAT.RestartTwinCATInRunMode',
|
|
'TwinCAT.RestartTwinCATInConfigMode',
|
|
'TwinCAT.RunMode',
|
|
'TwinCAT.ConfigMode',
|
|
'TwinCAT.Scan',
|
|
'TwinCAT.ScanDevices',
|
|
'TwinCAT.ReloadDevices',
|
|
'TwinCAT.Build',
|
|
'TwinCAT.ActivateConfiguration',
|
|
'TwinCAT.Start'
|
|
)
|
|
foreach ($n in $names) {
|
|
try {
|
|
$cmd = $dte.Commands.Item($n)
|
|
Write-Log "Command $n EXISTS IsAvailable=$($cmd.IsAvailable) Enabled=$($cmd.Enabled)"
|
|
if ($cmd.IsAvailable -and $cmd.Enabled) {
|
|
try { $dte.ExecuteCommand($n); Write-Log " ExecuteCommand($n) OK" } catch { Write-Log " ExecuteCommand($n) ERR: $($_.Exception.Message)" }
|
|
}
|
|
} catch { Write-Log "Command $n NOT FOUND: $($_.Exception.Message)" }
|
|
}
|
|
|
|
try { $dte.Quit() } catch {}
|
|
Write-Log "=== done ==="
|