- ticker: --spin mode polls FPRD until payload changes (phase-locks processing to TwinCAT frame arrival instead of free-running ticker), timeout at 1.5 periods keeps loop alive on master stop - verified: 238k cycles, 0 errors, exec=245us (FPWR-bound), TwinCAT PLC task confirmed at 2000.8 Hz (all three tasks 0.5ms; base tick was already 50us - no base-time change needed) - docs: 500us latency plan; scripts: task-rate ADS probe, 2kHz deploy, UI automation experiments (pywinauto) for task cycle inspection
46 lines
1.7 KiB
PowerShell
46 lines
1.7 KiB
PowerShell
#Requires -RunAsAdministrator
|
||
$ErrorActionPreference = 'Continue'
|
||
function Invoke-Com {
|
||
param([scriptblock]$Fn, [int]$Retries = 5, [int]$DelayMs = 2000)
|
||
for ($i = 0; $i -lt $Retries; $i++) {
|
||
try { return & $Fn } catch {
|
||
if ($_.Exception.HResult -eq -2147418111) { Start-Sleep -Milliseconds $DelayMs; continue }
|
||
throw
|
||
}
|
||
}
|
||
return $null
|
||
}
|
||
|
||
$dte = New-Object -ComObject TcXaeShell.DTE.17.0
|
||
$dte.MainWindow.Visible = $true
|
||
try { $dte.SuppressUI = $false } catch {}
|
||
$dte.Solution.Open('C:\Users\tonycao\work\twincat3-auto-cli\TwinCAT_EL6695_Primary_2kHz\TwinCATProject1.sln')
|
||
Write-Host "open issued, waiting 30s..."
|
||
Start-Sleep 30
|
||
|
||
Write-Host "BuildState pre-build: $(Invoke-Com { $dte.Solution.SolutionBuild.BuildState })"
|
||
|
||
Write-Host "issuing build..."
|
||
Invoke-Com { $dte.ExecuteCommand('Build.BuildSolution') } | Out-Null
|
||
for ($i = 0; $i -lt 30; $i++) {
|
||
$bs = Invoke-Com { $dte.Solution.SolutionBuild.BuildState } -Retries 2 -DelayMs 1000
|
||
Write-Host " [$($i*3)s] BuildState=$bs"
|
||
if ($bs -eq 3) { break }
|
||
Start-Sleep 3
|
||
}
|
||
|
||
Write-Host "--- output window (Build pane) ---"
|
||
try {
|
||
$ow = $dte.ToolWindows.OutputWindow
|
||
foreach ($pane in $ow.OutputWindowPanes) {
|
||
if ($pane.Name -match 'Build|<7C><><EFBFBD><EFBFBD>') {
|
||
$td = $pane.TextDocument
|
||
$txt = $td.StartPoint.CreateEditPoint()
|
||
$content = $txt.GetText($td.EndPoint)
|
||
$lines = $content -split "`r?`n"
|
||
Write-Host "pane '$($pane.Name)': $($lines.Count) lines, last 25:"
|
||
$lines | Select-Object -Last 25 | ForEach-Object { Write-Host " $_" }
|
||
}
|
||
}
|
||
} catch { Write-Host "output window err: $_" }
|