armstrip, armbus, armedbus

- armstrip, armbus -> boolarraymembers
- armedbus

prelim tests pass for potato
This commit is contained in:
pblivingston 2025-12-02 12:23:06 -05:00
parent f40e0afb0d
commit 9209bbbc65
2 changed files with 51 additions and 4 deletions

View File

@ -5,13 +5,17 @@ class Recorder : IRemote {
Recorder ([Object]$remote) : base ($remote) { Recorder ([Object]$remote) : base ($remote) {
$this.mode = [RecorderMode]::new($remote) $this.mode = [RecorderMode]::new($remote)
$this.armstrip = @() $this.armstrip = @()
0..($remote.kind.p_in + $remote.kind.v_in - 1) | ForEach-Object { $stripCount = $($remote.kind.p_in + $remote.kind.v_in)
$this.armstrip.Add([RecorderArmStrip]::new($_, $remote)) for ($i = 0; $i -lt $stripCount; $i++) {
$this.armstrip.Add([BoolArrayMember]::new($i, 'armstrip', $this))
} }
$this.armbus = @() $this.armbus = @()
0..($remote.kind.p_out + $remote.kind.v_out - 1) | ForEach-Object { $busCount = $($remote.kind.p_out + $remote.kind.v_out)
$this.armbus.Add([RecorderArmBus]::new($_, $remote)) for ($i = 0; $i -lt $busCount; $i++) {
$this.armbus.Add([BoolArrayMember]::new($i, 'armbus', $this))
} }
AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew') AddActionMembers -PARAMS @('play', 'stop', 'pause', 'replay', 'record', 'ff', 'rew')
@ -96,6 +100,26 @@ class Recorder : IRemote {
} }
) )
hidden $_armedbus = $($this | Add-Member ScriptProperty 'armedbus' `
{
foreach ($bus in 0..$($this.remote.kind.p_out + $this.remote.kind.v_out - 1)) {
if ($this.remote.Getter("Recorder.ArmBus[$bus]")) {
break
}
}
return $bus
} `
{
param([int]$arg)
$busMax = $this.remote.kind.p_out + $this.remote.kind.v_out - 1
if ($arg -ge 0 -and $arg -le $busMax) {
$this._armedbus = $this.remote.Setter("Recorder.ArmBus[$arg]", 1)
}
else {
Write-Warning ("Expected a bus index between 0 and $busMax")
}
})
[void] Load ([string]$filename) { [void] Load ([string]$filename) {
$this.Setter('load', $filename) $this.Setter('load', $filename)
} }

View File

@ -160,6 +160,20 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
It 'Should set and get Recorder.loop' { It 'Should set and get Recorder.loop' {
$vmr.recorder.loop = $value $vmr.recorder.loop = $value
} }
It 'Should set and get Recorder.armstrip[i]' -ForEach @(
@{ Index = $phys_in }, @{ Index = $virt_in }
) {
$vmr.recorder.armstrip[$index].set($value)
$vmr.recorder.armstrip[$index].get() | Should -Be $value
}
It 'Should set and get Recorder.armbus[i]' -ForEach @(
@{ Index = $phys_out }, @{ Index = $virt_out }
) {
$vmr.recorder.armbus[$index].set($value)
$vmr.recorder.armbus[$index].get() | Should -Be $value
}
} }
Context 'Command' { Context 'Command' {
@ -603,6 +617,15 @@ Describe -Tag 'higher', -TestName 'All Higher Tests' {
} }
} }
} }
Context 'Recorder' -Skip:$ifBasic {
It 'Should set and get Recorder.armedbus' -ForEach @(
@{ Value = $phys_out }, @{ Value = $virt_out }
) {
$vmr.recorder.armedbus = $value
$vmr.recorder.armedbus | Should -Be $value
}
}
} }
Describe 'String Tests' -Tag 'string' { Describe 'String Tests' -Tag 'string' {