% ######################################################################### % File : GUI.m % Auteurs : Laurent Jenni, Philipp Hörler % Laboratoire de Systèmes Robotiques, EPFL % % ######################################################################### function varargout = GUI(varargin) % GUI MATLAB code for GUI.fig-+ % GUI, by itself, creates a new GUI or raises the existing % singleton*. % % H = GUI returns the handle to a new GUI or the handle to % the existing singleton*. % % GUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in GUI.M with the given input arguments. % % GUI('Property','Value',...) creates a new GUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before GUI_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to GUI_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help GUI % Last Modified by GUIDE v2.5 05-Apr-2015 11:46:50 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @GUI_OpeningFcn, ... 'gui_OutputFcn', @GUI_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end end % End initialization code - DO NOT EDIT % --- Executes just before GUI is made visible. function GUI_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to GUI (see VARARGIN) % Choose default command line output for GUI handles.output = hObject; %% Options clc; delete(timerfind); addpath(strcat(pwd,'\Functions')); addpath(strcat(pwd,'\ParamFiles')); run('ComProtocolOpt.m'); run('HostRequestList.m'); run('StatusRegBitsList.m'); run('UserVars.m'); handles.COMOPT = COMOPT; handles.USER_VARS = USER_VARS; %% Initialize USART if exist('handles.s') fclose(handles.s); delete(handles.s); clear handles.s; end delete(instrfind); handles.s = serial(handles.COMOPT.USART_PORT); set(handles.s,'BaudRate', handles.COMOPT.USART_BAUDRATE, ... 'Timeout', handles.COMOPT.USART_TIMEOUT , ... 'InputBufferSize',handles.COMOPT.USART_INPUT_BUFFER_SIZE); fopen(handles.s); if(~strcmp(handles.s.Status,'open')) disp(strcat('Unable to open :',handles.COMOPT.USART_PORT)); disp(strcat('Execution stopped')); return; end % Stop Streaming and verify Status usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); pause(0.1); [StatReg,ERR] = getStatusReg(handles.COMOPT,handles.s); if(ERR) disp(strcat('Timeout while : "statusRegRequest" ')); disp(strcat('Verify power supply of the board')); disp(strcat('Execution stopped')); set(handles.ErrorMessageText,'string','Error: The Card doesn''t answer. It probably crashed. You can try to reset it'); return end %Set Timestamp to 0 setVar(0,0,handles.COMOPT,handles.s); % Initialize data reception handles.streaming_vars = bin2dec('00000000000000000000000000000001'); setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); handles.streaming_enable = 0; handles.index = 1; %index handles.DisplayBufferSize = 20000; handles.dataBuffer = nan(handles.DisplayBufferSize, handles.USER_VARS.VAR_NUM); period = 0.5; handles.UsartTimer = timer('BusyMode','drop',... 'ExecutionMode','fixedrate',... 'Period',round(period*1000)/1000,... 'TimerFcn',{@Receive_usart, hObject},... 'ErrorFcn',@(mTimer,event)disp(event.Data.message)); %% Initialize Axes handles.PlotLines = plot(handles.axes1,0,zeros(1,handles.USER_VARS.VAR_NUM),'visible','off'); %26 plotlines %set(handles.axes1,'XLim',[0,20108],'YLim',[0,13824]); %set(handles.PlotLines(4:6),'marker','o','color','r'); xlabel(handles.axes1,'Time [s]'); ylabel(handles.axes1,'Data'); %legend(handles.axes1); set(handles.SaveCheckbox,'Value',false); % Update handles structure guidata(hObject, handles); end % --- Outputs from this function are returned to the command line. function varargout = GUI_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles; end % --- USART Timer function --- function Receive_usart(~, ~, hObject) if ~exist('handles') handles = guidata(hObject); end if(handles.streaming_enable == 1) [Data,ERR] = grabStreamPackets(handles.streaming_vars,handles.COMOPT,handles.s); if(~ERR) handles.dataBuffer(mod(handles.index-1:handles.index+size(Data,1)-1,handles.DisplayBufferSize)+1,:) = [Data; nan(1,handles.USER_VARS.VAR_NUM)]; handles.index = handles.index + size(Data,1); handles.index = mod(handles.index,handles.DisplayBufferSize); if get(handles.SaveCheckbox,'Value') fwrite(handles.savefile,Data','double'); end %Update data for the streamed plotlines Vars_index = 33-find(dec2bin(handles.streaming_vars,32)-'0'); for i = Vars_index(1:end-1) set(handles.PlotLines(i),... 'xdata',handles.dataBuffer(:,1) / 1e6,... 'ydata',handles.dataBuffer(:,i)); end else disp(['Error while grabStreamPackets: ' num2str(ERR)]) end end % Update handles structure guidata(hObject, handles); end % --- Executes on button press in StartStreamingbutton. function StartStreamingbutton_Callback(hObject, eventdata, handles) % hObject handle to StartStreamingbutton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end if handles.streaming_enable == 0 usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); handles.streaming_enable = 1; start(handles.UsartTimer); end % Update handles structure guidata(hObject, handles); end % --- Executes on button press in StopStreamingbutton. function StopStreamingbutton_Callback(hObject, eventdata, handles) % hObject handle to StopStreamingbutton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if handles.streaming_enable == 1 stop(handles.UsartTimer); usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); pause(0.1); % to be sure that the card stopped streaming flushinput(handles.s); handles.streaming_enable = 0; handles.index = 1; handles.dataBuffer = handles.dataBuffer*0; end % Update handles structure guidata(hObject, handles); end % --- Executes on button press in ClearScreenButton. function ClearScreenButton_Callback(hObject, eventdata, handles) % hObject handle to ClearScreenButton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) handles.index = 1; handles.dataBuffer(:) = nan; % Update handles structure guidata(hObject, handles); end % -------------------------------------------------------------------- function FileMenu_Callback(hObject, eventdata, handles) % hObject handle to FileMenu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) end % -------------------------------------------------------------------- function OpenMenuItem_Callback(hObject, eventdata, handles) % hObject handle to OpenMenuItem (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) file = uigetfile('*.fig'); if ~isequal(file, 0) open(file); end end % -------------------------------------------------------------------- function PrintMenuItem_Callback(hObject, eventdata, handles) % hObject handle to PrintMenuItem (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) printdlg(handles.figure1) end % -------------------------------------------------------------------- function CloseMenuItem_Callback(hObject, eventdata, handles) % hObject handle to CloseMenuItem (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) delete(handles.figure1) end % --- Executes during object deletion, before destroying properties. function figure1_DeleteFcn(hObject, eventdata, handles) % hObject handle to figure1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close_function(hObject,eventdata,handles); end function close_function(hObject,eventdata,handles) % Close function to be executed when the GUI is closed stop(handles.UsartTimer); usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); pause(0.1); % to be sure that the card stopped streaming flushinput(handles.s); delete(handles.figure1); delete(handles.UsartTimer); fclose('all'); end % --- Executes on button press in SaveCheckbox. function SaveCheckbox_Callback(hObject, eventdata, handles) % hObject handle to SaveCheckbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of SaveCheckbox if get(handles.SaveCheckbox,'Value') handles.savefile = fopen(['Data\Data_' datestr(now,'yyyy.mm.dd_HH.MM.SS') '.bin'],'a'); else fclose(handles.savefile); end % Update handles structure guidata(hObject, handles); end % --- Executes on button press in KpChkbox. function KpChkbox_Callback(hObject, eventdata, handles) % hObject handle to KpChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_P+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_P+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_P+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_P+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes during object creation, after setting all properties. function KpEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to KpEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in KpSet. function KpSet_Callback(hObject, eventdata, handles) % hObject handle to KpSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.KpEdit,'String')); setVar(handles.USER_VARS.VAR_POS_REG_PID_P,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in KpGet. function KpGet_Callback(hObject, eventdata, handles) % hObject handle to KpGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_PID_P,handles); set(handles.KpText,'String',Value); end % --- Executes on button press in KiChkbox. function KiChkbox_Callback(hObject, eventdata, handles) % hObject handle to KiChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_I+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_I+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_I+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_I+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes during object creation, after setting all properties. function KiEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to KiEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in KiSet. function KiSet_Callback(hObject, eventdata, handles) % hObject handle to KiSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.KiEdit,'String')); setVar(handles.USER_VARS.VAR_POS_REG_PID_I,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in KiGet. function KiGet_Callback(hObject, eventdata, handles) % hObject handle to KiGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_PID_I,handles); set(handles.KiText,'String',Value); end % --- Executes on button press in KdChkbox. function KdChkbox_Callback(hObject, eventdata, handles) % hObject handle to KdChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_D+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_D+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_D+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_D+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function KdEdit_Callback(hObject, eventdata, handles) % hObject handle to KdEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of KdEdit as text % str2double(get(hObject,'String')) returns contents of KdEdit as a double end % --- Executes during object creation, after setting all properties. function KdEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to KdEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in KdSet. function KdSet_Callback(hObject, eventdata, handles) % hObject handle to KdSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.KdEdit,'String')); setVar(handles.USER_VARS.VAR_POS_REG_PID_D,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in KdGet. function KdGet_Callback(hObject, eventdata, handles) % hObject handle to KdGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_PID_D,handles); set(handles.KdText,'String',Value); end % --- Executes on button press in ARWChkbox. function ARWChkbox_Callback(hObject, eventdata, handles) % hObject handle to ARWChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_ARW+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_ARW+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_ARW+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_ARW+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function ARWEdit_Callback(hObject, eventdata, handles) % hObject handle to ARWEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of ARWEdit as text % str2double(get(hObject,'String')) returns contents of ARWEdit as a double end % --- Executes during object creation, after setting all properties. function ARWEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to ARWEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in ARWSet. function ARWSet_Callback(hObject, eventdata, handles) % hObject handle to ARWSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.ARWEdit,'String')); setVar(handles.USER_VARS.VAR_POS_REG_PID_ARW,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in ARWGet. function ARWGet_Callback(hObject, eventdata, handles) % hObject handle to ARWGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_PID_ARW,handles); set(handles.ARWText,'String',Value); end % --- Executes on button press in IntegratorChkbox. function IntegratorChkbox_Callback(hObject, eventdata, handles) % hObject handle to IntegratorChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_INTEGRATOR+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_INTEGRATOR+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_INTEGRATOR+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_INTEGRATOR+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function IntegratorEdit_Callback(hObject, eventdata, handles) % hObject handle to IntegratorEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of IntegratorEdit as text % str2double(get(hObject,'String')) returns contents of IntegratorEdit as a double end % --- Executes during object creation, after setting all properties. function IntegratorEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to IntegratorEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in IntegratorSet. function IntegratorSet_Callback(hObject, eventdata, handles) % hObject handle to IntegratorSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.IntegratorEdit,'String')); setVar(handles.USER_VARS.VAR_POS_REG_PID_INTEGRATOR,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in IntegratorGet. function IntegratorGet_Callback(hObject, eventdata, handles) % hObject handle to IntegratorGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_PID_INTEGRATOR,handles); set(handles.IntegratorText,'String',Value); end % --- Executes on button press in RegOutChkbox. function RegOutChkbox_Callback(hObject, eventdata, handles) % hObject handle to RegOutChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_OUTPUT+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_OUTPUT+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_PID_OUTPUT+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_PID_OUTPUT+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in RegOutGet. function RegOutGet_Callback(hObject, eventdata, handles) % hObject handle to RegOutGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_PID_OUTPUT,handles); set(handles.RegOutText,'String',Value); end % --- Executes on button press in RegPeriodChckbox. function RegPeriodChckbox_Callback(hObject, eventdata, handles) % hObject handle to RegPeriodChckbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_SAMPLING_PERIOD+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_SAMPLING_PERIOD+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_POS_REG_SAMPLING_PERIOD+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_POS_REG_SAMPLING_PERIOD+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function RegPeriodEdit_Callback(hObject, eventdata, handles) % hObject handle to RegPeriodEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of RegPeriodEdit as text % str2double(get(hObject,'String')) returns contents of RegPeriodEdit as a double end % --- Executes during object creation, after setting all properties. function RegPeriodEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to RegPeriodEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in RegPeriodSet. function RegPeriodSet_Callback(hObject, eventdata, handles) % hObject handle to RegPeriodSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.RegPeriodEdit,'String')); setVar(handles.USER_VARS.VAR_POS_REG_SAMPLING_PERIOD,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in RegPeriodGet. function RegPeriodGet_Callback(hObject, eventdata, handles) % hObject handle to RegPeriodGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_POS_REG_SAMPLING_PERIOD,handles); set(handles.RegPeriodText,'String',Value); end % --- Executes on button press in WallPosChkbox. function WallPosChkbox_Callback(hObject, eventdata, handles) % hObject handle to WallPosChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_WALL_POSITION+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_WALL_POSITION+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_WALL_POSITION+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_WALL_POSITION+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function WallPosEdit_Callback(hObject, eventdata, handles) % hObject handle to WallPosEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of WallPosEdit as text % str2double(get(hObject,'String')) returns contents of WallPosEdit as a double end % --- Executes during object creation, after setting all properties. function WallPosEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to WallPosEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in WallPosSet. function WallPosSet_Callback(hObject, eventdata, handles) % hObject handle to WallPosSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Value = str2num(get(handles.WallPosEdit,'String')); setVar(handles.USER_VARS.VAR_WALL_POSITION,int32(Value),handles.COMOPT,handles.s); end % --- Executes on button press in WallPosGet. function WallPosGet_Callback(hObject, eventdata, handles) % hObject handle to WallPosGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_WALL_POSITION,handles); set(handles.WallPosText,'String',Value); end % --- Executes on button press in MeasuredAngleRawChkbox. function MeasuredAngleRawChkbox_Callback(hObject, eventdata, handles) % hObject handle to MeasuredAngleRawChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_MEASURED_ANGLE_RAW+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_MEASURED_ANGLE_RAW+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_MEASURED_ANGLE_RAW+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_MEASURED_ANGLE_RAW+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in MeasuredAngleRawGet. function MeasuredAngleRawGet_Callback(hObject, eventdata, handles) % hObject handle to MeasuredAngleRawGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_MEASURED_ANGLE_RAW,handles); set(handles.MeasuredAngleRawText,'String',Value); end % --- Executes on button press in MeasuredAngleFilteredChkbox. function MeasuredAngleFilteredChkbox_Callback(hObject, eventdata, handles) % hObject handle to MeasuredAngleFilteredChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_MEASURED_ANGLE_FILTERED+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_MEASURED_ANGLE_FILTERED+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_MEASURED_ANGLE_FILTERED+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_MEASURED_ANGLE_FILTERED+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in MeasuredAngleFilteredGet. function MeasuredAngleFilteredGet_Callback(hObject, eventdata, handles) % hObject handle to MeasuredAngleFilteredGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_MEASURED_ANGLE_FILTERED,handles); set(handles.MeasuredAngleFilteredText,'String',Value); end % --- Executes on button press in CommunicationPeriodChkbox. function CommunicationPeriodChkbox_Callback(hObject, eventdata, handles) % hObject handle to CommunicationPeriodChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_COMM_TX_PERIOD+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_COMM_TX_PERIOD+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_COMM_TX_PERIOD+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_COMM_TX_PERIOD+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function CommunicationPeriodEdit_Callback(hObject, eventdata, handles) % hObject handle to CommunicationPeriodEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of CommunicationPeriodEdit as text % str2double(get(hObject,'String')) returns contents of CommunicationPeriodEdit as a double end % --- Executes during object creation, after setting all properties. function CommunicationPeriodEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to CommunicationPeriodEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in CommunicationPeriodSet. function CommunicationPeriodSet_Callback(hObject, eventdata, handles) % hObject handle to CommunicationPeriodSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.CommunicationPeriodEdit,'String')); setVar(handles.USER_VARS.VAR_COMM_TX_PERIOD,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in CommunicationPeriodGet. function CommunicationPeriodGet_Callback(hObject, eventdata, handles) % hObject handle to CommunicationPeriodGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_COMM_TX_PERIOD,handles); set(handles.CommunicationPeriodText,'String',Value); end % --- Executes on button press in ActiveFilterChkbox. function ActiveFilterChkbox_Callback(hObject, eventdata, handles) % hObject handle to ActiveFilterChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_ACTIVE_FILTER+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_ACTIVE_FILTER+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_ACTIVE_FILTER+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_ACTIVE_FILTER+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function ActiveFilterEdit_Callback(hObject, eventdata, handles) % hObject handle to ActiveFilterEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of ActiveFilterEdit as text % str2double(get(hObject,'String')) returns contents of ActiveFilterEdit as a double end % --- Executes during object creation, after setting all properties. function ActiveFilterEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to ActiveFilterEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in ActiveFilterSet. function ActiveFilterSet_Callback(hObject, eventdata, handles) % hObject handle to ActiveFilterSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.ActiveFilterEdit,'String')); setVar(handles.USER_VARS.VAR_ACTIVE_FILTER,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in ActiveFilterGet. function ActiveFilterGet_Callback(hObject, eventdata, handles) % hObject handle to ActiveFilterGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_ACTIVE_FILTER,handles); set(handles.ActiveFilterText,'String',Value); end % --- Executes on button press in FirstOrderFilterTauChkbox. function FirstOrderFilterTauChkbox_Callback(hObject, eventdata, handles) % hObject handle to FirstOrderFilterTauChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_1ST_FILT_TAU+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_1ST_FILT_TAU+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_1ST_FILT_TAU+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_1ST_FILT_TAU+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function FirstOrderFilterTauEdit_Callback(hObject, eventdata, handles) % hObject handle to FirstOrderFilterTauEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of FirstOrderFilterTauEdit as text % str2double(get(hObject,'String')) returns contents of FirstOrderFilterTauEdit as a double end % --- Executes during object creation, after setting all properties. function FirstOrderFilterTauEdit_CreateFcn(hObject, eventdata, handles) % hObject handle to FirstOrderFilterTauEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in FirstOrderFilterTauSet. function FirstOrderFilterTauSet_Callback(hObject, eventdata, handles) % hObject handle to FirstOrderFilterTauSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.FirstOrderFilterTauEdit,'String')); setVar(handles.USER_VARS.VAR_1ST_FILT_TAU,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in FirstOrderFilterTauGet. function FirstOrderFilterTauGet_Callback(hObject, eventdata, handles) % hObject handle to FirstOrderFilterTauGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_1ST_FILT_TAU,handles); set(handles.FirstOrderFilterTauText,'String',Value); end function KpEdit_Callback(hObject, eventdata, handles) % hObject handle to KpEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of KpEdit as text % str2double(get(hObject,'String')) returns contents of KpEdit as a double end function KiEdit_Callback(hObject, eventdata, handles) % hObject handle to KiEdit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of KiEdit as text % str2double(get(hObject,'String')) returns contents of KiEdit as a double end % --- Executes on button press in Dac1Chkbox. function Dac1Chkbox_Callback(hObject, eventdata, handles) % hObject handle to Dac1Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_DAC1_VOLTAGE+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_DAC1_VOLTAGE+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_DAC1_VOLTAGE+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_DAC1_VOLTAGE+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function Dac1Edit_Callback(hObject, eventdata, handles) % hObject handle to Dac1Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of Dac1Edit as text % str2double(get(hObject,'String')) returns contents of Dac1Edit as a double end % --- Executes during object creation, after setting all properties. function Dac1Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to Dac1Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in Dac1Set. function Dac1Set_Callback(hObject, eventdata, handles) % hObject handle to Dac1Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.Dac1Edit,'String')); setVar(handles.USER_VARS.VAR_DAC1_VOLTAGE,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in Dac1Get. function Dac1Get_Callback(hObject, eventdata, handles) % hObject handle to Dac1Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_DAC1_VOLTAGE,handles); set(handles.Dac1Text,'String',Value); end % --- Executes on button press in Dac2Chkbox. function Dac2Chkbox_Callback(hObject, eventdata, handles) % hObject handle to Dac2Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_DAC2_VOLTAGE+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_DAC2_VOLTAGE+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_DAC2_VOLTAGE+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_DAC2_VOLTAGE+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function Dac2Edit_Callback(hObject, eventdata, handles) % hObject handle to Dac2Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of Dac2Edit as text % str2double(get(hObject,'String')) returns contents of Dac2Edit as a double end % --- Executes during object creation, after setting all properties. function Dac2Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to Dac2Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in Dac2Set. function Dac2Set_Callback(hObject, eventdata, handles) % hObject handle to Dac2Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.Dac2Edit,'String')); setVar(handles.USER_VARS.VAR_DAC2_VOLTAGE,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in Dac2Get. function Dac2Get_Callback(hObject, eventdata, handles) % hObject handle to Dac2Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_DAC2_VOLTAGE,handles); set(handles.Dac2Text,'String',Value); end % --- Executes on button press in Adc1Chkbox. function Adc1Chkbox_Callback(hObject, eventdata, handles) % hObject handle to Adc1Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_ADC1_VOLTAGE+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_ADC1_VOLTAGE+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_ADC1_VOLTAGE+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_ADC1_VOLTAGE+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in Adc1Get. function Adc1Get_Callback(hObject, eventdata, handles) % hObject handle to Adc1Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_ADC1_VOLTAGE,handles); set(handles.Adc1Text,'String',Value); end % --- Executes on button press in Adc2Chkbox. function Adc2Chkbox_Callback(hObject, eventdata, handles) % hObject handle to Adc2Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_ADC2_VOLTAGE+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_ADC2_VOLTAGE+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_ADC2_VOLTAGE+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_ADC2_VOLTAGE+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in Adc2Get. function Adc2Get_Callback(hObject, eventdata, handles) % hObject handle to Adc2Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_ADC2_VOLTAGE,handles); set(handles.Adc2Text,'String',Value); end % --- Executes on button press in HallSensorChkbox. function HallSensorChkbox_Callback(hObject, eventdata, handles) % hObject handle to HallSensorChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_HALL_ANGLE+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_HALL_ANGLE+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_HALL_ANGLE+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_HALL_ANGLE+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in HallSensorGet. function HallSensorGet_Callback(hObject, eventdata, handles) % hObject handle to HallSensorGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_HALL_ANGLE,handles); set(handles.HallSensorText,'String',Value); end % --- Executes on button press in TachoSpeedChkbox. function TachoSpeedChkbox_Callback(hObject, eventdata, handles) % hObject handle to TachoSpeedChkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_TACHO_SPEED+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_TACHO_SPEED+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_TACHO_SPEED+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_TACHO_SPEED+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in TachoSpeedGet. function TachoSpeedGet_Callback(hObject, eventdata, handles) % hObject handle to TachoSpeedGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_TACHO_SPEED,handles); set(handles.TachoSpeedText,'String',Value); end % --- Executes on button press in StrainGauge. function StrainGauge_Callback(hObject, eventdata, handles) % hObject handle to StrainGauge (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_STRAIN_GAUGE_FORCE+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_STRAIN_GAUGE_FORCE+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_STRAIN_GAUGE_FORCE+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_STRAIN_GAUGE_FORCE+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end % --- Executes on button press in StrainGaugeGet. function StrainGaugeGet_Callback(hObject, eventdata, handles) % hObject handle to StrainGaugeGet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_STRAIN_GAUGE_FORCE,handles); set(handles.StrainGaugeText,'String',Value); end % --- Executes on button press in UserVar1Chkbox. function UserVar1Chkbox_Callback(hObject, eventdata, handles) % hObject handle to UserVar1Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_1+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_1+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_1+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_1+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function UserVar1Edit_Callback(hObject, eventdata, handles) % hObject handle to UserVar1Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of UserVar1Edit as text % str2double(get(hObject,'String')) returns contents of UserVar1Edit as a double end % --- Executes during object creation, after setting all properties. function UserVar1Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to UserVar1Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in UserVar1Set. function UserVar1Set_Callback(hObject, eventdata, handles) % hObject handle to UserVar1Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.UserVar1Edit,'String')); setVar(handles.USER_VARS.VAR_USER_VAR_1,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in UserVar1Get. function UserVar1Get_Callback(hObject, eventdata, handles) % hObject handle to UserVar1Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_USER_VAR_1,handles); set(handles.UserVar1Text,'String',Value); end % --- Executes on button press in UserVar2Chkbox. function UserVar2Chkbox_Callback(hObject, eventdata, handles) % hObject handle to UserVar2Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_2+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_2+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_2+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_2+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function UserVar2Edit_Callback(hObject, eventdata, handles) % hObject handle to UserVar2Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of UserVar2Edit as text % str2double(get(hObject,'String')) returns contents of UserVar2Edit as a double end % --- Executes during object creation, after setting all properties. function UserVar2Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to UserVar2Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in UserVar2Set. function UserVar2Set_Callback(hObject, eventdata, handles) % hObject handle to UserVar2Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.UserVar2Edit,'String')); setVar(handles.USER_VARS.VAR_USER_VAR_2,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in UserVar2Get. function UserVar2Get_Callback(hObject, eventdata, handles) % hObject handle to UserVar2Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_USER_VAR_2,handles); set(handles.UserVar2Text,'String',Value); end % --- Executes on button press in UserVar3Chkbox. function UserVar3Chkbox_Callback(hObject, eventdata, handles) % hObject handle to UserVar3Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_3+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_3+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_3+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_3+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function UserVar3Edit_Callback(hObject, eventdata, handles) % hObject handle to UserVar3Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of UserVar3Edit as text % str2double(get(hObject,'String')) returns contents of UserVar3Edit as a double end % --- Executes during object creation, after setting all properties. function UserVar3Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to UserVar3Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in UserVar3Set. function UserVar3Set_Callback(hObject, eventdata, handles) % hObject handle to UserVar3Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.UserVar3Edit,'String')); setVar(handles.USER_VARS.VAR_USER_VAR_3,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in UserVar3Get. function UserVar3Get_Callback(hObject, eventdata, handles) % hObject handle to UserVar3Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_USER_VAR_3,handles); set(handles.UserVar3Text,'String',Value); end % --- Executes on button press in UserVar4Chkbox. function UserVar4Chkbox_Callback(hObject, eventdata, handles) % hObject handle to UserVar4Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_4+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_4+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_4+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_4+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function UserVar4Edit_Callback(hObject, eventdata, handles) % hObject handle to UserVar4Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of UserVar4Edit as text % str2double(get(hObject,'String')) returns contents of UserVar4Edit as a double end % --- Executes during object creation, after setting all properties. function UserVar4Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to UserVar4Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in UserVar4Set. function UserVar4Set_Callback(hObject, eventdata, handles) % hObject handle to UserVar4Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.UserVar4Edit,'String')); setVar(handles.USER_VARS.VAR_USER_VAR_4,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in UserVar4Get. function UserVar4Get_Callback(hObject, eventdata, handles) % hObject handle to UserVar4Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_USER_VAR_4,handles); set(handles.UserVar4Text,'String',Value); end % --- Executes on button press in UserVar5Chkbox. function UserVar5Chkbox_Callback(hObject, eventdata, handles) % hObject handle to UserVar5Chkbox (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end usartSendPacket(handles.COMOPT.PC_MESSAGE_STOP_STREAMING,[],handles.COMOPT,handles.s); if get(hObject,'Value') handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_5+1,1); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_5+1),'visible','on'); else handles.streaming_vars = bitset(handles.streaming_vars,handles.USER_VARS.VAR_USER_VAR_5+1,0); set(handles.PlotLines(handles.USER_VARS.VAR_USER_VAR_5+1),'visible','off'); end setStreamedVars(handles.streaming_vars,handles.COMOPT,handles.s); flushinput(handles.s); usartSendPacket(handles.COMOPT.PC_MESSAGE_START_STREAMING,[],handles.COMOPT,handles.s); % Update handles structure guidata(hObject, handles); end function UserVar5Edit_Callback(hObject, eventdata, handles) % hObject handle to UserVar5Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of UserVar5Edit as text % str2double(get(hObject,'String')) returns contents of UserVar5Edit as a double end % --- Executes during object creation, after setting all properties. function UserVar5Edit_CreateFcn(hObject, eventdata, handles) % hObject handle to UserVar5Edit (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end end % --- Executes on button press in UserVar5Set. function UserVar5Set_Callback(hObject, eventdata, handles) % hObject handle to UserVar5Set (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = str2num(get(handles.UserVar5Edit,'String')); setVar(handles.USER_VARS.VAR_USER_VAR_5,single(Value),handles.COMOPT,handles.s); end % --- Executes on button press in UserVar5Get. function UserVar5Get_Callback(hObject, eventdata, handles) % hObject handle to UserVar5Get (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if ~exist('handles') handles = guidata(hObject); end Value = getVar(handles.USER_VARS.VAR_USER_VAR_5,handles); set(handles.UserVar5Text,'String',Value); end