Skip to content

Commit b636bdb

Browse files
committed
Fallback to serial port if no context available
1 parent 0adfb3b commit b636bdb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Bonsai.Arduino/PortNameConverter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContex
2020
if (workflowBuilder != null)
2121
{
2222
var portNames = (from builder in workflowBuilder.Workflow.Descendants()
23+
where builder is not DisableBuilder
2324
let createPort = ExpressionBuilder.GetWorkflowElement(builder) as CreateArduino
2425
where createPort != null && !string.IsNullOrEmpty(createPort.PortName)
2526
select !string.IsNullOrEmpty(createPort.Name) ? createPort.Name : createPort.PortName)
2627
.Distinct()
2728
.ToList();
28-
29-
if (portNames.Count > 0) return new StandardValuesCollection(portNames);
30-
else return new StandardValuesCollection(SerialPort.GetPortNames());
29+
if (portNames.Count > 0)
30+
{
31+
return new StandardValuesCollection(portNames);
32+
}
3133
}
3234
}
3335

34-
return base.GetStandardValues(context);
36+
return new StandardValuesCollection(SerialPort.GetPortNames());
3537
}
3638
}
3739
}

0 commit comments

Comments
 (0)