Skip to content

Commit 2c1c9eb

Browse files
committed
Disable text boxes in Optical Stimulator when appropriate
- When the number of bursts or pulses is 1, the period and the inter-burst interval are undefined, so these text boxes are disabled
1 parent fec6133 commit 2c1c9eb

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

OpenEphys.Onix1.Design/Headstage64OpticalStimulatorOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ internal void UpdateSequenceParameters(ConfigureHeadstage64OpticalStimulator opt
3333
textBoxMaxCurrent.Text = opticalStimulator.MaxCurrent.ToString();
3434
textBoxPulseDuration.Text = opticalStimulator.PulseDuration.ToString();
3535
textBoxPulsePeriod.Text = opticalStimulator.PulsesPerSecond.ToString();
36+
textBoxPulsePeriod.Enabled = opticalStimulator.PulsesPerBurst > 1;
3637

3738
textBoxChannelOnePercent.Text = opticalStimulator.ChannelOneCurrent.ToString();
3839
trackBarChannelOnePercent.Value = (int)(opticalStimulator.ChannelOneCurrent * channelOneScalingFactor);
@@ -41,6 +42,7 @@ internal void UpdateSequenceParameters(ConfigureHeadstage64OpticalStimulator opt
4142

4243
textBoxPulsesPerBurst.Text = opticalStimulator.PulsesPerBurst.ToString();
4344
textBoxInterBurstInterval.Text = opticalStimulator.InterBurstInterval.ToString();
45+
textBoxInterBurstInterval.Enabled = opticalStimulator.BurstsPerTrain > 1;
4446
textBoxBurstsPerTrain.Text = opticalStimulator.BurstsPerTrain.ToString();
4547
textBoxDelay.Text = opticalStimulator.Delay.ToString();
4648
}

OpenEphys.Onix1.Design/Headstage64OpticalStimulatorSequenceDialog.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,22 @@ public Headstage64OpticalStimulatorSequenceDialog(ConfigureHeadstage64OpticalSti
100100
{ StimulusSequenceOptions.textBoxPulsesPerBurst,
101101
new TextBoxBinding<uint>(
102102
StimulusSequenceOptions.textBoxPulsesPerBurst,
103-
value => { OpticalStimulator.PulsesPerBurst = value; return OpticalStimulator.PulsesPerBurst; },
103+
value =>
104+
{
105+
OpticalStimulator.PulsesPerBurst = value;
106+
StimulusSequenceOptions.textBoxPulsePeriod.Enabled = OpticalStimulator.PulsesPerBurst > 1;
107+
return OpticalStimulator.PulsesPerBurst;
108+
},
104109
uint.Parse) },
105110
{ StimulusSequenceOptions.textBoxBurstsPerTrain,
106111
new TextBoxBinding<uint>(
107112
StimulusSequenceOptions.textBoxBurstsPerTrain,
108-
value => { OpticalStimulator.BurstsPerTrain = value; return OpticalStimulator.BurstsPerTrain; },
113+
value =>
114+
{
115+
OpticalStimulator.BurstsPerTrain = value;
116+
StimulusSequenceOptions.textBoxInterBurstInterval.Enabled = OpticalStimulator.BurstsPerTrain > 1;
117+
return OpticalStimulator.BurstsPerTrain;
118+
},
109119
uint.Parse) }
110120
};
111121

@@ -281,9 +291,9 @@ static bool IsSequenceValid(ConfigureHeadstage64OpticalStimulator sequence, out
281291
reason = "Maximum current is invalid.";
282292
return false;
283293
}
284-
else if (sequence.PulsesPerSecond <= sequence.PulseDuration)
294+
else if (sequence.PulsesPerBurst > 1 && sequence.PulsesPerSecond <= sequence.PulseDuration)
285295
{
286-
reason = "Pulse duration is too short compared to the pulse period.";
296+
reason = "Pulse period is too short compared to the pulse duration.";
287297
return false;
288298
}
289299

0 commit comments

Comments
 (0)