Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -4824,7 +4824,9 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
propertyPath: m_Text
value: Connect
value: 'Connect

'
objectReference: {fileID: 0}
- target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
Expand Down Expand Up @@ -4904,7 +4906,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
propertyPath: m_SizeDelta.x
value: 180.69582
value: 200.6693
objectReference: {fileID: 0}
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
propertyPath: m_SizeDelta.y
Expand Down Expand Up @@ -4940,7 +4942,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
propertyPath: m_AnchoredPosition.x
value: 1037.5765
value: 1046.1573
objectReference: {fileID: 0}
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
propertyPath: m_AnchoredPosition.y
Expand Down Expand Up @@ -4995,7 +4997,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 180
m_MinWidth: 200
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
Expand Down
27 changes: 17 additions & 10 deletions Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
using UnityEngine.UI;

// using Process = KS.Diagnostics.Process;
Expand Down Expand Up @@ -75,6 +74,11 @@ private void OnEnable()
UpdateConnectionPanel();
}

private void OnDestroy()
{
KillEphysLinkProcess();
}

#endregion

#region UI Functions
Expand Down Expand Up @@ -171,8 +175,8 @@ public void OnLaunchEphysLinkPressed()
_ => "sensapex"
};

// Make args string.
var args = $"-t {manipulatorTypeString}";
// Make args string (ignore updates, select type).
var args = $"-i -t {manipulatorTypeString}";

// Add Pathfinder port if selected.
if (_manipulatorTypeDropdown.value == 2)
Expand All @@ -195,6 +199,7 @@ public void OnLaunchEphysLinkPressed()
_manipulatorTypeDropdown.interactable = false;
_launchEphysLinkButton.interactable = false;
_connectButton.SetActive(true);
_connectButtonText.text = "Connecting...";

// Attempt to connect to server.
var attempts = 0;
Expand Down Expand Up @@ -269,13 +274,7 @@ public void OnConnectDisconnectPressed()

CommunicationManager.Instance.DisconnectFromServer(() =>
{
// Kill internally started Ephys Link process
if (_ephysLinkProcess != null)
{
_ephysLinkProcess.Kill(true);
_ephysLinkProcess.Dispose();
}

KillEphysLinkProcess();
UpdateConnectionPanel();
});
};
Expand Down Expand Up @@ -352,6 +351,14 @@ private void UpdateConnectionPanel()
UpdateManipulatorPanels();
}

private void KillEphysLinkProcess()
{
if (_ephysLinkProcess == null) return;
_ephysLinkProcess.Kill(true);
_ephysLinkProcess.Dispose();
_ephysLinkProcess = null;
}

#endregion
}
}