Skip to content

Commit

Permalink
Merge pull request #45 from sync2brain/44-add-compatibility-with-matl…
Browse files Browse the repository at this point in the history
…ab-r2022b

Add compatibility with MATLAB R2022b
  • Loading branch information
pablorcum committed Nov 5, 2023
2 parents eba7125 + 15c8f58 commit a6bb0af
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ jobs:
strategy:
fail-fast: false # Run with every MATLAB version independently
matrix:
matlabVer: [R2023a, R2023b] # List of MATLAB releases to test
matlabVer: [R2022b, R2023a, R2023b] # List of MATLAB releases to test

runs-on: matlab

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Setup Python
Expand All @@ -76,12 +78,12 @@ jobs:
submodules: 'recursive'
token: ${{ secrets.REPO_READ_TOKEN }}

- name: Cache MATLAB build files
uses: actions/cache@v3
with:
key: matlab-buildtool
path: |
buildUtilities/.buildtool
#- name: Cache MATLAB build files
# uses: actions/cache@v3
# with:
# key: matlab-buildtool
# path: |
# buildUtilities/.buildtool

- name: Download firmware artifact
uses: dawidd6/action-download-artifact@v2
Expand All @@ -96,8 +98,12 @@ jobs:
if_no_artifact_found: fail

- name: Run MATLAB command
timeout-minutes: 30
run: |
&"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); cd('buildUtilities'); buildtool test({'noHW','bdConnected'})"
&"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); updateSGdeps; testTask({'noHW','bdConnected'});"
# MATLAB R2022b does not support input arguments to buildtool
#run: |
# &"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); cd('buildUtilities'); buildtool test({'noHW','bdConnected'});"

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
Expand All @@ -109,6 +115,7 @@ jobs:
results.xml
- name: Upload Speedgoat dependencies as artifacts
if: ${{ github.ref == 'refs/heads/master' }}
uses: actions/upload-artifact@v3
with:
name: speedgoat-deps-${{ matrix.matlabVer }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![CI](https://github.com/sync2brain/bossdevice-api-matlab/actions/workflows/main.yml/badge.svg)](https://github.com/sync2brain/bossdevice-api-matlab/actions/workflows/main.yml) [![GitHub issues by-label](https://img.shields.io/github/issues-raw/sync2brain/bossdevice-api-matlab/bug)](https://github.com/sync2brain/bossdevice-api-matlab/issues?q=is%3Aissue+is%3Aopen+label%3Abug) ![GitHub](https://img.shields.io/github/license/sync2brain/bossdevice-api-matlab) [![View bossdevice-api-matlab on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/133972-bossdevice-api-matlab) [![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=sync2brain/bossdevice-api-matlab&project=Bossdeviceapimatlab.prj)

## Requirements
- MATLAB® Supported releases are R2023a and R2023b in their latest update available.
- MATLAB® R2022b or newer in their latest update available.
- Simulink Real-Time®
- [Simulink Real-Time Target Support Package](https://www.mathworks.com/matlabcentral/fileexchange/76387-simulink-real-time-target-support-package)
- [bossdevice](https://sync2brain.com/) hardware
Expand Down
2 changes: 1 addition & 1 deletion buildUtilities/releaseTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
end
toolboxOptions.OutputFile = fullfile(projObj.RootFolder,"releases/bossdevice-api-installer.mltbx");

toolboxOptions.MinimumMatlabRelease = "R2023a";
toolboxOptions.MinimumMatlabRelease = "R2022b";
% toolboxOptions.MaximumMatlabRelease = "R2023a"; % Won't limit maximum MATLAB release
toolboxOptions.SupportedPlatforms.Glnxa64 = true;
toolboxOptions.SupportedPlatforms.Maci64 = false;
Expand Down
12 changes: 7 additions & 5 deletions tests/commonSetupTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function setupBossdevice(testCase)
testCase.bd = bossdevice;
testCase.bd.targetObject.update;

fprintf('Wait 30s for target to reboot after update and set IP address in secondary interface.\n');
pause(30);
fprintf('Wait 40s for target to reboot after update and set IP address in secondary interface.\n');
pause(40);
% Set Ethernet IP in secondary interface
bossapi.setEthernetInterface(testCase.bd.targetObject,'wm1','192.168.200.255/24');
end
Expand All @@ -33,9 +33,11 @@ function resetSgPath(testCase)
end

function rebootTarget(testCase)
disp('Rebooting bossdevice to teardown test class.');
testCase.bd.targetObject.reboot;
pause(30);
if ~isempty(testCase.bd)
disp('Rebooting bossdevice to teardown test class.');
testCase.bd.targetObject.reboot;
pause(30);
end
end
end

Expand Down
10 changes: 5 additions & 5 deletions toolbox/examples/demo_measure_loop_latency.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
bd.start;

% Prepare instrument object with signals to stream
inst = slrealtime.Instrument;
inst.addSignal('mainmodel/UDP/Decode UDP Packet',3); % Former UDP/raw_mrk
inst.addSignal('mainmodel/Unit Delay',1); % Former gen_running
bd.addInstrument(inst);
instObj = slrealtime.Instrument;
instObj.addSignal('biosignal','BusElement','mrk'); % Former UDP/raw_mrk
instObj.addSignal('mainmodel/Unit Delay',1); % Former gen_running
bd.addInstrument(instObj);

%% Configure scopes in SDI

Expand All @@ -26,7 +26,7 @@
runObj = Simulink.sdi.Run.getLatest;

% Get signal objects and add to subplot
mrkSig = runObj.getSignalsByName('mrk');
mrkSig = runObj.getSignalsByName('biosignal.mrk');
mrkSig.plotOnSubPlot(1,1,true);

genRunSig = runObj.getSignalsByName('gen_running');
Expand Down

0 comments on commit a6bb0af

Please sign in to comment.