From bff25a5ab17e05cb21703f6474001a1c378c42c1 Mon Sep 17 00:00:00 2001 From: George Stuyt <15712782+ogeesan@users.noreply.github.com> Date: Mon, 24 Nov 2025 23:14:49 +1100 Subject: [PATCH 1/3] Move finals settings check to after path setup --- .../+BpodObject/+setup/updatePathAndSettings.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Functions/+BpodLib/+BpodObject/+setup/updatePathAndSettings.m b/Functions/+BpodLib/+BpodObject/+setup/updatePathAndSettings.m index f51d533e..18184c3b 100644 --- a/Functions/+BpodLib/+BpodObject/+setup/updatePathAndSettings.m +++ b/Functions/+BpodLib/+BpodObject/+setup/updatePathAndSettings.m @@ -117,11 +117,6 @@ function updatePathAndSettings(BpodSystem, varargin) try BpodSystem.CalibrationTables.LiquidCal = BpodLib.calibration.liquid.io.load('BpodSystem', BpodSystem, 'LocalDir', LocalDir, 'type', 'statemachine'); - if strcmp(BpodLib.calibration.liquid.utils.checkCOM(BpodSystem), 'no') - if p.Results.verbose - BpodLib.calibration.liquid.ui.VerifyCOMGUI(BpodSystem); - end - end catch err if strcmp(err.identifier, 'BpodLib:LiquidCalibrationLoad:FileNotFound') BpodSystem.CalibrationTables.LiquidCal = []; @@ -227,4 +222,13 @@ function updatePathAndSettings(BpodSystem, varargin) % I don't see why this would happen, but if it does it's going to be a problem. end +%% -- Final verifications +% Functions that require BpodSystem to be fully setup can be called here. +if strcmp(BpodLib.calibration.liquid.utils.checkCOM(BpodSystem), 'no') + if p.Results.verbose + BpodLib.calibration.liquid.ui.VerifyCOMGUI(BpodSystem); + end +end + + end \ No newline at end of file From b90c770a2f646474fc4cbe7d1e2ad9b8618201f4 Mon Sep 17 00:00:00 2001 From: George Stuyt <15712782+ogeesan@users.noreply.github.com> Date: Mon, 24 Nov 2025 23:15:13 +1100 Subject: [PATCH 2/3] Remove assertion --- Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m b/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m index aba6ab52..98ae4f7e 100644 --- a/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m +++ b/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m @@ -27,7 +27,6 @@ function VerifyCOMGUI(BpodSystem) along with this program. If not, see . %} -assert(strcmp(BpodLib.calibration.liquid.utils.checkCOM(BpodSystem), 'no')) LiquidCal = BpodSystem.CalibrationTables.LiquidCal; % the handle is extracted for convenience if BpodLib.multi.isMultiSetup(BpodSystem) From c7481e6d017687dfa5faffa7cfb9511abc2dbf35 Mon Sep 17 00:00:00 2001 From: George Stuyt <15712782+ogeesan@users.noreply.github.com> Date: Mon, 24 Nov 2025 23:15:20 +1100 Subject: [PATCH 3/3] Improve messaging --- .../+calibration/+liquid/+ui/VerifyCOMGUI.m | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m b/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m index 98ae4f7e..d1d0d30e 100644 --- a/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m +++ b/Functions/+BpodLib/+calibration/+liquid/+ui/VerifyCOMGUI.m @@ -34,13 +34,23 @@ function VerifyCOMGUI(BpodSystem) % Multi setup - ask user which machine to import from. prompt = { - sprintf('The Bpod COM port (%s) does not match the', BpodLib.utils.getCurrentCOM(BpodSystem)); + sprintf('The Bpod COM port (%s) does not match', BpodLib.utils.getCurrentCOM(BpodSystem)); sprintf('liquid calibration file''s COM port (%s).', LiquidCal.metadata.COM); 'Please select which COM to copy in the liquid'; 'calibration file from:' }; ignoreOption = 'I will remember to recalibrate. (ignore)'; - options = [{ignoreOption}, availableMachines']; + machineNames = [{ignoreOption}, availableMachines']; + options = machineNames; + + % Replace thisMachineName with '(current machine)' in the list + [~, thisMachineName] = fileparts(BpodLib.path.getPath('config', BpodSystem)) + for i = 1:length(options) + if strcmp(options{i}, thisMachineName) + options{i} = sprintf('%s (use existing file)', thisMachineName); + break + end + end [selectionIdx, ok] = listdlg('PromptString', prompt, ... 'SelectionMode', 'single', ... @@ -51,7 +61,7 @@ function VerifyCOMGUI(BpodSystem) return end - selectedMachine = options{selectionIdx}; + selectedMachine = machineNames{selectionIdx}; if strcmp(selectedMachine, ignoreOption) return end