Skip to content

Commit 89e47d4

Browse files
committed
Better documentation; update arg name to update_frequency; removed redundant obj input parsing
1 parent 4223632 commit 89e47d4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Functions/Modules/Analog Input/BpodAnalogIn.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -893,24 +893,24 @@ function scope(obj)
893893
end
894894

895895
function scope_StartStop(obj, varargin)
896-
% scope_StartStop() toggles data acquisition by the scope()
897-
% GUI. It is called by a start button on the GUI, but it can also be
898-
% called from a user protocol file to start analog data logging with
899-
% online monitoring.
896+
% scope_StartStop This function toggles data acquisition when using the oscilloscope functionality of the AnalogIn module.
897+
% The function is called by the start button on the oscilloscope GUI, but can also be called from a
898+
% user protocol to start recording data with online monitoring via the GUI.
899+
900+
% :param update_frequency: Update frequency, in seconds (s), for the oscilloscope GUI during data acquisition, defaults to 0.05 (50 ms)
901+
% :type update_frequency: float, optional
902+
900903

901904
% Default GUI update time is 0.05s
902905
default_update_time = 0.05;
903-
oscope_time = 0;
906+
update_frequency = 0;
904907

905908
ip = inputParser;
906909
valid_update_time = @(time) isfloat(time) && isscalar(time) && (time > 0); % Update time must be a float, scalar, and greater than zero
907-
valid_obj = @(x) isa(x, 'BpodAnalogIn'); % Have to also check obj is an instance of BpodAnalogIn
908-
909-
addRequired(ip, 'obj', valid_obj); % instance is a required argument
910-
addOptional(ip, 'oscope_time', default_update_time, valid_update_time); % oscope_time is optional, if the passed value is invalid, the default is used
910+
addOptional(ip, 'update_frequency', default_update_time, valid_update_time); % update_frequency is optional, if the passed value is invalid, the default is used
911911

912-
parse(ip, obj, varargin{:}); % parse the args
913-
oscope_time = ip.Results.oscope_time; % assuming all is well, grab the value from the parser
912+
parse(ip, varargin{:}); % parse the args
913+
update_frequency = ip.Results.update_frequency; % assuming all is well, grab the value from the parser
914914

915915
scopeReady = 1;
916916
if ~isfield(obj.UIhandles, 'OscopeFig')
@@ -942,7 +942,7 @@ function scope_StartStop(obj, varargin)
942942
end
943943
obj.UIdata.SweepPos = 1;
944944
obj.startUSBStream;
945-
obj.Timer = timer('TimerFcn',@(h,e)obj.updatePlot(), 'ExecutionMode', 'fixedRate', 'Period', oscope_time);
945+
obj.Timer = timer('TimerFcn',@(h,e)obj.updatePlot(), 'ExecutionMode', 'fixedRate', 'Period', update_frequency);
946946
start(obj.Timer);
947947
else
948948
stop(obj.Timer);

0 commit comments

Comments
 (0)