diff --git a/source/Brick.m b/source/Brick.m index e952fb7c98c1335f9add58b4e9999cb994e5edc7..3284ae7cd3e6bec2763162cd4a16cd2b6065e87b 100644 --- a/source/Brick.m +++ b/source/Brick.m @@ -102,23 +102,23 @@ classdef Brick < handle properties - % connection handle + % Connection handle conn; - % debug input + % Debug debug; % IO connection type ioType; - % bluetooth brick device name + % Bluetooth brick device name btDevice; - % bluetooth brick communication channel + % Bluetooth brick communication channel btChannel; - % wifi brick IP address + % Wifi brick IP address wfAddr; - % wifi brick TCP port + % Wifi brick TCP port wfPort; - % brick serial number + % Brick serial number wfSN; - % bluetooth serial port + % Bluetooth serial port serPort; end @@ -153,7 +153,7 @@ classdef Brick < handle % - For instrBrickIO (bluetooth) % b = Brick('ioType','instrbt','btDevice','EV3','btChannel',1) - % init the properties + % Init the properties opt.debug = 0; opt.btDevice = 'EV3'; opt.btChannel = 1; @@ -236,8 +236,7 @@ classdef Brick < handle % Example:: % b.send(cmd) - % send the message through the brickIO write function - + % Send the message through the brickIO write function brick.conn.write(cmd.msg); % (MMI) When spamming the brick with commands, at some point, it will start @@ -246,6 +245,8 @@ classdef Brick < handle % (Maybe too many commands screw up the brick's internal command queue?..) % Temporary workaround: Wait 5ms after each sent packet. pause(0.005); + + % Verbose output if brick.debug > 0 fprintf('sent (hex): [ '); for ii=1:length(cmd.msg) @@ -1545,7 +1546,7 @@ classdef Brick < handle % Implemented @ MMI % Still buggy (WIP) - function [speed tacho] = outputRead(brick,layer,no) + function [speed, tacho] = outputRead(brick,layer,no) % Brick.outputRead(layer,no) Get tacho count and speed. % % [speed, tacho] = Brick.outputRead(layer,no) returns the tachometer diff --git a/source/Command.m b/source/Command.m index fa20a019e9cd319f61de337630b116194669f6ac..cc2f4723f7dc77faacdf5f3ed87d3bdda70f20ec 100644 --- a/source/Command.m +++ b/source/Command.m @@ -581,7 +581,7 @@ classdef Command < handle end function GV0(cmd,i) - % Command.GV0 Add a global constant 0 + % Command.GV0 Add a global variable 0 % % Command.GV0(i) adds a global variable 0 to the command % object. diff --git a/source/Motor.m b/source/Motor.m index fc7c25f2515599ad817c6743d25a2680b25ed86e..c3b09d17af34bae8a8b4de584317569818264be4 100644 --- a/source/Motor.m +++ b/source/Motor.m @@ -226,7 +226,7 @@ classdef Motor < handle motor.brick = 0; motor.isConnected = 0; - error('Motor::connect: Aborted connection.'); + error('Motor::connect: Disconnected due to internal error.'); end end diff --git a/source/btBrickIO.m b/source/btBrickIO.m index 56f32fb624b4ec39ab2ba6b1a384a909331408c7..7cd880409687fbb4d4100cfcea7b8ef655521971 100644 --- a/source/btBrickIO.m +++ b/source/btBrickIO.m @@ -52,6 +52,7 @@ classdef btBrickIO < BrickIO brickIO.debug = debug; brickIO.serialPort = serialPort; end + if brickIO.debug > 0 fprintf('btBrickIO init\n'); end diff --git a/source/hidapi.m b/source/hidapi.m index 398c8142478ee5538efc59897e9e4fc79fb2f1c5..1777494bd841812ca7ccecd03c893c8b94566292 100644 --- a/source/hidapi.m +++ b/source/hidapi.m @@ -1,7 +1,7 @@ %hidpi Interface to the hidapi library % % Methods:: -% hidapi Constructor, loads the hidapi library +% hidapi Constructor, loads the hidapi library % delete Destructor, closes any open hid connection % % open Open the hid device with vendor and product ID @@ -64,8 +64,8 @@ classdef hidapi < handle % % Throws:: % LoadingLibraryError Could not load .dll/.dylib/.so-file of hidapi - % InvalidParameterOrFileMissing Either file names given were wrong or the files are missing - % (e.g. thunk files, proto files, ...) + % InvalidFileNameOrFileMissing Either file names given were wrong or the files + % are missing (thunk files, proto files, ...) % % Notes:: % - debug is a flag specifying output printing (0 or 1). @@ -100,9 +100,7 @@ classdef hidapi < handle hid.slib = 'hidapi32'; % Load the library via the proto file loadlibrary(hid.slib,@hidapi32_proto,'alias','hidapiusb') - end - - if (strcmp(mexext,'mexw64')) + elseif (strcmp(mexext,'mexw64')) hid.slib = 'hidapi64'; % Load the library via the proto file loadlibrary(hid.slib,@hidapi64_proto,'alias','hidapiusb') @@ -196,7 +194,7 @@ classdef hidapi < handle % constructor. % % Throws:: - % CommError Error during communication with device + % CommError Error during communication with device % % Notes:: % - The pointer return value from this library call is always @@ -236,7 +234,7 @@ classdef hidapi < handle % when deleting the hid instance. % % Throws:: - % InvalidHandle Handle to USB-device not valid + % InvalidHandle Handle to USB-device not valid % if hid.debug > 0 @@ -262,8 +260,8 @@ classdef hidapi < handle % read bytes. Will print an error if no data was read. % % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % CommError Error during communication with device + % InvalidHandle Handle to USB-device not valid % if hid.debug > 0 @@ -300,8 +298,8 @@ classdef hidapi < handle % number of bytes written. % % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % CommError Error during communication with device + % InvalidHandle Handle to USB-device not valid % if hid.debug > 0 @@ -342,8 +340,8 @@ classdef hidapi < handle % from the hid device % % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % CommError Error during communication with device + % InvalidHandle Handle to USB-device not valid % % Notes:: % - info is the hid information string. @@ -384,8 +382,8 @@ classdef hidapi < handle % the hid device connection. % % Throws:: - % CommError Error during communication with device - % InvalidHandle Handle to USB-device not valid + % CommError Error during communication with device + % InvalidHandle Handle to USB-device not valid % % Notes:: % nonblock - 0 disables nonblocking, 1 enables nonblocking @@ -415,7 +413,7 @@ classdef hidapi < handle % automatically in the library itself with the open function. % % Throws:: - % CommError Error during communication with device + % CommError Error during communication with device % % Notes:: % - You should not have to call this function directly. @@ -442,7 +440,7 @@ classdef hidapi < handle % hid.exit() exits the hidapi library. % % Throws:: - % CommError Error during communication with device + % CommError Error during communication with device % % Notes:: % - You should not have to call this function directly. @@ -470,7 +468,7 @@ classdef hidapi < handle % produced an error. % % Throws:: - % InvalidHandle Handle to USB-device not valid + % InvalidHandle Handle to USB-device not valid % % Notes:: % - This function must be called explicitly if you think an diff --git a/source/usbBrickIO.m b/source/usbBrickIO.m index 91e59d20f0f2eae411c7d9382df8e1c94ffda4d0..309cc05f57f93c835b25f6e6685f7c25471da95c 100644 --- a/source/usbBrickIO.m +++ b/source/usbBrickIO.m @@ -49,9 +49,7 @@ classdef usbBrickIO < BrickIO if nargin == 0 brickIO.debug = 0; - end - - if nargin > 0 + else brickIO.debug = varargin{1}; end @@ -256,4 +254,4 @@ classdef usbBrickIO < BrickIO end end end -end \ No newline at end of file +end