-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Inxton/feature/TargetLoad
Plc cleaning up boot dir and loading testing projects
- Loading branch information
Showing
32 changed files
with
253 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
param( [Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)] | ||
[string] | ||
$TargetAmsId) | ||
|
||
#------------------------------------------- | ||
# Imports | ||
#------------------------------------------- | ||
Import-Module C:\TwinCAT\AdsApi\Powershell\TcXaeMgmt\TcXaeMgmt.psd1 | ||
|
||
#------------------------------------------- | ||
#Set target state into the config mode | ||
#------------------------------------------- | ||
Write-Host "Switching target '$TargetAmsId' into the Config mode" -ForegroundColor Blue | ||
Set-AdsState -NetId $TargetAmsId -State Config -Force | ||
$Session = New-TcSession -NetId $TargetAmsId -Port 10000 | ||
|
||
#------------------------------------------- | ||
#Create cleanup file on target | ||
#------------------------------------------- | ||
Write-Host "Cleaning up the target's boot directory" | ||
|
||
$FileHandle = Send-TcReadWrite -IndexGroup 0x78 -IndexOffset 0x10002 -ReadType UInt32 -ReadLength 4 -WriteValue "C:\Twincat\3.1\Boot\PlcCleanup.bat" -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore | ||
|
||
#Write commands into the cleanup file | ||
$CmdList = New-Object Collections.Generic.List[String] | ||
$CmdList.Add("rmdir /q /s C:\Twincat\3.1\Boot\CurrentConfig") | ||
$CmdList.Add("rmdir /q /s C:\Twincat\3.1\Boot\Plc") | ||
$CmdList.Add("mkdir C:\Twincat\3.1\Boot\Plc") | ||
$CmdList.Add("del C:\Twincat\3.1\Boot\*.* /F /Q") | ||
|
||
|
||
try { | ||
$CmdList | ForEach-Object{ | ||
$CmdLine = $_ + "`r`n" | ||
$WriteLength = $CmdLine.Length+1 | ||
Send-TcReadWrite -IndexGroup 0x7f -IndexOffset $FileHandle -WriteValue $CmdLine -WriteLength $WriteLength -ReadLength 4 -ReadType UInt32 -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore | ||
} | ||
|
||
} | ||
catch { | ||
Write-Host "Error writing file:" | ||
Write-Host $_ | ||
} | ||
finally { | ||
# Close cleanup file on target | ||
Send-TcReadWrite -IndexGroup 0x79 -IndexOffset $FileHandle -ReadLength 4 -ReadType UInt32 -WriteValue "" -WriteLength 1 -NetId $TargetAmsId -Port 10000 -Force -ErrorAction Ignore | ||
Write-Host "Cleanup file has been created and closed on target." | ||
} | ||
|
||
# Prepare data for starting remote process on target | ||
$Enc = [system.Text.Encoding]::UTF8 | ||
$Process = $Enc.GetBytes("C:\TwinCAT\3.1\Boot\PlcCleanup.bat") | ||
$Path = $Enc.GetBytes("C:\TwinCAT\3.1\Boot") | ||
$Data = new-object byte[] 780 | ||
$Data[0] = 0x22 | ||
$Data[4] = 0x13 | ||
$Offset =12 | ||
$Pos = 0 | ||
while($Pos -lt $Process.Count) | ||
{ | ||
$Data[$Offset+$Pos] = $Process[$Pos] | ||
$Pos++ | ||
} | ||
$Offset = $Offset + $Pos + 1 | ||
$Pos = 0 | ||
while($Pos -lt $Path.Count) | ||
{ | ||
$Data[$Offset+$Pos] = $Path[$Pos] | ||
$Pos++ | ||
} | ||
|
||
#Start remote process on target | ||
$Retv = $Session | Write-TcValue -IndexGroup 0x1f4 -IndexOffset 0x0 -Value $Data -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0.115 | ||
0.1.0.118 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0.115 | ||
0.1.0.118 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/TcoIoBeckhoff/src/TcoIoBeckhoffConnector/_meta/version.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0.115 | ||
0.1.0.118 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/TcoPneumatics/src/TcoPneumaticsConnector/_meta/version.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0.115 | ||
0.1.0.118 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.