Skip to content

Commit

Permalink
Change AnalogInput range to 10V and remove double messages
Browse files Browse the repository at this point in the history
Closes #13
  • Loading branch information
bruno-f-cruz committed Feb 7, 2025
1 parent 2e3bfaa commit 9afe534
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 6 deletions.
104 changes: 104 additions & 0 deletions src/Extensions/HarpAnalogInputDevice.bonsai
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
xmlns:p1="clr-namespace:Harp.AnalogInput;assembly=Harp.AnalogInput"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="rx:BehaviorSubject" TypeArguments="harp:HarpMessage">
<rx:Name>HarpAnalogInputCommands</rx:Name>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="PortName" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:Device">
<harp:OperationMode>Active</harp:OperationMode>
<harp:OperationLed>On</harp:OperationLed>
<harp:DumpRegisters>true</harp:DumpRegisters>
<harp:VisualIndicators>On</harp:VisualIndicators>
<harp:Heartbeat>Enabled</harp:Heartbeat>
<harp:IgnoreErrors>false</harp:IgnoreErrors>
<harp:PortName>COM8</harp:PortName>
</Combinator>
</Expression>
<Expression xsi:type="rx:PublishSubject">
<Name>HarpAnalogInputEvents</Name>
</Expression>
<Expression xsi:type="WorkflowOutput" />
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="TriggerHarpReadDumpSubjectName" />
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>TriggerHarpReadDump</Name>
</Expression>
<Expression xsi:type="harp:CreateMessage">
<harp:MessageType>Write</harp:MessageType>
<harp:Payload xsi:type="harp:CreateOperationControlPayload">
<harp:OperationMode>Active</harp:OperationMode>
<harp:DumpRegisters>true</harp:DumpRegisters>
<harp:MuteReplies>false</harp:MuteReplies>
<harp:VisualIndicators>On</harp:VisualIndicators>
<harp:OperationLed>On</harp:OperationLed>
<harp:Heartbeat>Enabled</harp:Heartbeat>
</harp:Payload>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>HarpAnalogInputCommands</Name>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>HarpAnalogInputEvents</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Take">
<rx:Count>1</rx:Count>
</Combinator>
</Expression>
<Expression xsi:type="p1:CreateMessage">
<harp:MessageType>Write</harp:MessageType>
<harp:Payload xsi:type="p1:CreateSamplingRatePayload">
<p1:SamplingRate>SamplingRate1000Hz</p1:SamplingRate>
</harp:Payload>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>HarpAnalogInputCommands</Name>
</Expression>
<Expression xsi:type="p1:CreateMessage">
<harp:MessageType>Write</harp:MessageType>
<harp:Payload xsi:type="p1:CreateRangeAndFilterPayload">
<p1:RangeAndFilter>Range10VLowPass3000Hz</p1:RangeAndFilter>
</harp:Payload>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>HarpAnalogInputCommands</Name>
</Expression>
<Expression xsi:type="p1:CreateMessage">
<harp:MessageType>Write</harp:MessageType>
<harp:Payload xsi:type="p1:CreateAcquisitionStatePayload">
<p1:AcquisitionState>Enabled</p1:AcquisitionState>
</harp:Payload>
</Expression>
<Expression xsi:type="MulticastSubject">
<Name>HarpAnalogInputCommands</Name>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="2" Label="Source1" />
<Edge From="1" To="2" Label="Source2" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" Label="Source1" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="12" Label="Source1" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="13" To="14" Label="Source1" />
<Edge From="14" To="15" Label="Source1" />
<Edge From="15" To="16" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
14 changes: 8 additions & 6 deletions src/main.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
<SessionPath>C:\git\AllenNeuralDynamics\Aind.Behavior.Device.Olfactometer\local\olfactometer_session.json</SessionPath>
</Expression>
<Expression xsi:type="IncludeWorkflow" Path="Extensions\DeserializeSchemas.bonsai" />
<Expression xsi:type="IncludeWorkflow" Path="Extensions\UserInterface.bonsai" />
<Expression xsi:type="IncludeWorkflow" Path="Extensions\UserInterface.bonsai">
<Span>10</Span>
</Expression>
<Expression xsi:type="GroupWorkflow">
<Name>HarpDevices</Name>
<Workflow>
Expand Down Expand Up @@ -92,7 +94,7 @@
<Property Name="PortName" />
</PropertyMappings>
</Expression>
<Expression xsi:type="IncludeWorkflow" Path="AllenNeuralDynamics.HarpUtils:HarpAnalogInputDevice.bonsai">
<Expression xsi:type="IncludeWorkflow" Path="Extensions\HarpAnalogInputDevice.bonsai">
<PortName>COM8</PortName>
<TriggerHarpReadDumpSubjectName>TriggerHarpReadDump</TriggerHarpReadDumpSubjectName>
</Expression>
Expand Down Expand Up @@ -387,10 +389,10 @@
</Workflow>
</Expression>
<Expression xsi:type="IncludeWorkflow" Path="Extensions\CalibrationLogic.bonsai" />
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Take">
<rx:Count>1</rx:Count>
</Combinator>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Take">
<rx:Count>1</rx:Count>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Delay">
Expand Down

0 comments on commit 9afe534

Please sign in to comment.