Skip to content
Snippets Groups Projects
Commit b9997682 authored by Vilde Rieker's avatar Vilde Rieker
Browse files

updated latest GUI version to accommodate two filters. Minor visual...

updated latest GUI version to accommodate two filters. Minor visual modifications implemented as suggestions: Either IN or OUT is colored for each filter (green for IN, red for OUT), and wider holder buttons to exploit the dead space around the holder panel.
parent 5b8bd15c
No related branches found
No related tags found
1 merge request!20Doublefilter
......@@ -197,6 +197,9 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
% not possible to generate programattically in AppDesigner
% so it has to be manually maintained (to be sure it's in the right order)...
grabHolderButts = [];
filterINButts = [];
filterOUTButts = [];
end
......@@ -206,8 +209,7 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
disp(['UPDATE: stepper=',num2str(stepper), ...
', grabber=',num2str(grabber), ...
', temp=', num2str(temp), ...
', filter 1=', num2str(filters(1)), ...
', filter 2=', num2str(filters(2))]);
', filter=', num2str(filters)]);
disp(app.conn)
if temp
......@@ -390,26 +392,25 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
end
%Status of the filters
if filters(1)
if filters
if app.conn.filterPos(1) == app.conn.filterInPos(1)
app.Filter1INButton(1).BackgroundColor = 'green';
app.Filter1OUTButton(1).BackgroundColor = 'red';
app.Filter1INButton.BackgroundColor = 'green';
app.Filter1OUTButton.BackgroundColor = [0.96 0.96 0.96];
elseif app.conn.filterPos(1) == app.conn.filterOutPos(1)
app.Filter1INButton(1).BackgroundColor = 'red';
app.Filter1OUTButton(1).BackgroundColor = 'green';
app.Filter1INButton.BackgroundColor = [0.96 0.96 0.96];
app.Filter1OUTButton.BackgroundColor = 'red';
end
end
if filters(2)
if app.conn.filterPos(2) == app.conn.filterInPos(2)
app.Filter2INButton(2).BackgroundColor = 'green';
app.Filter2OUTButton(2).BackgroundColor = 'red';
app.Filter2INButton.BackgroundColor = 'green';
app.Filter2OUTButton.BackgroundColor = [0.96 0.96 0.96];
elseif app.conn.filterPos(2) == app.conn.filterOutPos(2)
app.Filter2INButton(2).BackgroundColor = 'red';
app.Filter2OUTButton(2).BackgroundColor = 'green';
app.Filter2INButton.BackgroundColor = [0.96 0.96 0.96];
app.Filter2OUTButton.BackgroundColor = 'red';
end
end
end
function textCallBack(app,textLine)
......@@ -450,7 +451,9 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
% Code that executes after component creation
function startupFcn(app)
app.conn = robotConnector("172.18.211.7",@(obj,stepper,grabber,temp,filters) app.robotCallBack(stepper,grabber,temp,filters),@(obj,textLine) app.textCallBack(textLine));
%app.conn = robotConnector("172.18.211.7",@(obj,stepper,grabber,temp,filters) app.robotCallBack(stepper,grabber,temp,filters),@(obj,textLine) app.textCallBack(textLine));
app.conn = robotConnector("/dev/ttyACM0",@(obj,stepper,grabber,temp,filters) app.robotCallBack(stepper,grabber,temp,filters),@(obj,textLine) app.textCallBack(textLine));
%List of all holder buttons,
% not possible to generate programattically in AppDesigner
......@@ -467,6 +470,9 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
app.GrabHolder_25, app.GrabHolder_26, app.GrabHolder_27, ...
app.GrabHolder_28, app.GrabHolder_29, app.GrabHolder_30, ...
app.GrabHolder_31, app.GrabHolder_32];
app.filterINButts=[app.Filter1INButton, app.Filter2INButton];
app.filterOUTButts=[app.Filter1OUTButton, app.Filter2OUTButton];
end
......@@ -640,17 +646,35 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
app.conn.grabberClose();
app.conn.updateGrabberStatus();
end
% Button pushed function: FilterINButton
function FilterINButtonPushed(app, event)
app.conn.filterIn;
idx = find(event.Source==app.filterINButts);
if isempty(idx)
error('Internal error: Could not find button in array')
end
app.conn.filterIn(idx);
end
% Button pushed function: FilterOUTButton
function FilterOUTButtonPushed(app, event)
app.conn.filterOut;
idx = find(event.Source==app.filterOUTButts);
if isempty(idx)
error('Internal error: Could not find button in array')
end
app.conn.filterOut(idx);
end
% % Button pushed function: FilterINButton
% function Filter2INButtonPushed(app, event)
% app.conn.filterIn(2);
% end
%
% % Button pushed function: FilterOUTButton
% function Filter2OUTButtonPushed(app, event)
% app.conn.filterOut(2);
% end
end
% Component initialization
......@@ -1453,9 +1477,9 @@ classdef Robot_GUI_exported < matlab.apps.AppBase
% Create Image
%app.Image = uiimage(app.RightPanel);
%app.Image.Position = [33 7 170 123];
%app.Image.ImageSource = 'C-ROBOT_v4.png';
app.Image = uiimage(app.RightPanel);
app.Image.Position = [33 7 170 90];
app.Image.ImageSource = 'C-ROBOT_v4.png';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment