Skip to content

Commit f8a2aa8

Browse files
committed
Better parsing of custom input signal expressions
1 parent 6f03891 commit f8a2aa8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

LiveSPICE/LiveSimulation.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,12 @@ public LiveSimulation(Circuit.Schematic Simulate, Audio.Device Device, Audio.Cha
213213
{
214214
try
215215
{
216-
inputs[V] = new SignalChannel(combo.Text);
216+
inputs[V] = new SignalChannel(Circuit.Quantity.Parse(combo.Text, Circuit.Units.V));
217217
}
218218
catch (Exception)
219219
{
220+
// If there is an error in the expression, zero out the signal.
221+
inputs[V] = new SignalChannel(0);
220222
}
221223
}));
222224

0 commit comments

Comments
 (0)