Skip to content

Commit 4da3d48

Browse files
authored
Merge pull request #63 from sync2brain/fix_triggersRemaining
Fixes triggers remaining and adds test case
2 parents 0353a7d + 375bb35 commit 4da3d48

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

tests/commonSetupTests.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
function setupBossdevice(testCase)
1515
import matlab.unittest.constraints.Eventually
1616
import matlab.unittest.constraints.IsTrue
17+
import matlab.unittest.fixtures.SuppressedWarningsFixture
18+
19+
testCase.applyFixture(SuppressedWarningsFixture("MATLAB:pfileOlderThanMfile"));
1720

1821
[testCase.isSGinstalled, testCase.sgPath] = bossapi.sg.isSpeedgoatBlocksetInstalled;
1922
if testCase.isSGinstalled

tests/smokeTests.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@
33
methods (Test, TestTags = {'bdConnected'})
44
% Test methods with bossdevice connected and reachable from the host PC
55
function bdInitialization(testCase)
6-
testCase.bd = bossdevice;
76
testCase.bd.initialize;
87
testCase.verifyTrue(testCase.bd.isConnected);
98
testCase.verifyTrue(testCase.bd.isInitialized);
109
testCase.verifyFalse(testCase.bd.isRunning);
1110
testCase.verifyFalse(testCase.bd.isArmed);
1211
testCase.verifyFalse(testCase.bd.isGeneratorRunning);
13-
pause(1);
1412
end
1513

1614
function bdShortRun(testCase)
17-
testCase.bd = bossdevice;
1815
testCase.bd.start;
1916
testCase.verifyTrue(testCase.bd.isRunning);
2017
testCase.bd.stop;
@@ -23,6 +20,11 @@ function bdShortRun(testCase)
2320
pause(1);
2421
testCase.verifyTrue(testCase.bd.isInitialized);
2522
end
23+
24+
function getTriggersRunning(testCase)
25+
testCase.bd.start;
26+
testCase.verifyGreaterThan(testCase.bd.triggers_remaining,0);
27+
end
2628
end
2729

2830
end

toolbox/src/bossdevice.m

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ function stop(obj)
300300
end
301301

302302
function val = get.triggers_remaining(obj)
303-
val = getsignal(obj,'TRG',2);
303+
val = getsignal(obj,{'TRG','TRG/Count Down'},1);
304304
end
305305

306306
function set.triggers_remaining(obj, val)
@@ -505,9 +505,19 @@ function setparam(obj, path, varargin)
505505
end
506506
end
507507

508-
function val = getsignal(obj, path, varargin)
508+
function val = getsignal(obj, path, portIndex)
509+
arguments
510+
obj
511+
path {mustBeText}
512+
portIndex {mustBeScalarOrEmpty}
513+
end
514+
509515
if obj.isInitialized
510-
val = getsignal(obj.targetObject, [obj.appName,'/bosslogic/', path], varargin{:});
516+
if ~iscell(path)
517+
val = getsignal(obj.targetObject, [obj.appName,'/bosslogic/', path], portIndex);
518+
else
519+
val = getsignal(obj.targetObject, [{[obj.appName,'/bosslogic/', path{1}]},path(2:end)], portIndex);
520+
end
511521
end
512522
end
513523

0 commit comments

Comments
 (0)