Changeset 981
- Timestamp:
- 09/30/11 12:21:35 (20 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
doc/m2html/Troubleshooting.m (modified) (1 diff)
-
mfiles/COM_MakeBTConfigFile.m (modified) (5 diffs)
-
mfiles/COM_OpenNXTEx.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/m2html/Troubleshooting.m
r808 r981 46 46 % </html> 47 47 48 %% Windows 64Bit 49 % 50 51 %% 52 % 53 % *Problems with USB-Connection* 54 % 55 % If you have problems connecting your NXT make sure you installed 56 % "libusb_win32" correctly. You have to run "inf-wizard.exe" once for EVERY 57 % NXT. Your NXT is installed correctly if it appears under "libusb-win32 58 % devices" in your Windows Device Manager. 48 59 49 60 -
trunk/mfiles/COM_MakeBTConfigFile.m
r952 r981 21 21 % 22 22 % Signature 23 % Author: Alexander Behrens, Linus Atorf (see AUTHORS)24 % Date: 20 08/07/0923 % Author: Alexander Behrens, Linus Atorf, Martin Staas (see AUTHORS) 24 % Date: 2011/09/30 25 25 % Copyright: 2007-2011, RWTH Aachen University 26 26 % … … 57 57 dlg_title = 'Configuration File Settings'; 58 58 if ispc 59 prompt = {'Filename:', 'SerialPort:', 'BaudRate:', 'DataBits:', 'SendPause:', 'ReceivePause:', 'Timeout:'}; 59 archstr = computer('arch'); 60 Is64Bit = regexp(archstr,'\w*64','match'); %are we running on 64Bit? 61 if isempty(Is64Bit) 62 prompt = {'Filename:', 'SerialPort:', 'BaudRate:', 'DataBits:', 'SendPause:', 'ReceivePause:', 'Timeout:'}; 63 else 64 prompt = {'Filename:', 'SerialPort:', 'BaudRate:', 'DataBits:', 'SendPause:', 'ReceivePause:', 'Timeout:','NXT-Name:','NXT-MAC:','Channel:'}; 65 end 60 66 else 61 67 prompt = {'Filename:', 'SerialPort:', 'SendPause:', 'ReceivePause:', 'Timeout:'}; … … 66 72 67 73 if ispc 68 default_parameters = {'bluetooth.ini','COM3','9600', '8', '5', '25', '2'}; 74 if isempty(Is64Bit) 75 default_parameters = {'bluetooth.ini','COM3','9600', '8', '5', '25', '2'}; 76 else 77 default_parameters = {'bluetooth.ini','COM3','9600', '8', '5', '25', '2','NXT','','1'}; 78 end 69 79 else 70 80 default_parameters = {'bluetooth.ini', '/dev/rfcomm0', '5', '25', '2'}; … … 76 86 filename = my_parameters{1}; 77 87 if ispc 78 port = my_parameters{2}; 79 baudrate = str2double(my_parameters{3}); 80 databits = str2double(my_parameters{4}); 81 sendpause = str2double(my_parameters{5}); 82 receivepause = str2double(my_parameters{6}); 83 timeout = str2double(my_parameters{7}); 88 if isempty(Is64Bit) 89 port = my_parameters{2}; 90 baudrate = str2double(my_parameters{3}); 91 databits = str2double(my_parameters{4}); 92 sendpause = str2double(my_parameters{5}); 93 receivepause = str2double(my_parameters{6}); 94 timeout = str2double(my_parameters{7}); 95 else 96 port = my_parameters{2}; 97 baudrate = str2double(my_parameters{3}); 98 databits = str2double(my_parameters{4}); 99 sendpause = str2double(my_parameters{5}); 100 receivepause = str2double(my_parameters{6}); 101 timeout = str2double(my_parameters{7}); 102 nxtname = my_parameters{8}; 103 nxtmac = my_parameters{9}; 104 channel = str2double(my_parameters{10}); 105 end 84 106 else 85 107 port = my_parameters{2}; … … 119 141 fwrite(h_file, sprintf('Timeout=%d\r\n', timeout)); 120 142 fwrite(h_file, sprintf('\r\n')); 143 144 if ~isempty(Is64Bit) 145 fwrite(h_file, sprintf('NXT-Name=%s\r\n', nxtname)); 146 fwrite(h_file, sprintf('NXT-MAC=%s\r\n', nxtmac)); 147 fwrite(h_file, sprintf('Channel=%d\r\n', channel)); 148 fwrite(h_file, sprintf('\r\n')); 149 end 121 150 122 151 fclose(h_file); -
trunk/mfiles/COM_OpenNXTEx.m
r980 r981 102 102 % 103 103 % Signature 104 % Author: Linus Atorf, Alexander Behrens (see AUTHORS)105 % Date: 2011/09/ 28104 % Author: Linus Atorf, Alexander Behrens, Martin Staas (see AUTHORS) 105 % Date: 2011/09/30 106 106 % Copyright: 2007-2011, RWTH Aachen University 107 107 % … … 413 413 end%if 414 414 if hIn.OSValue == 4 % 64 Bit 415 NXTName = readFromIniFile(inisection, 'NXTName', inifilename); 415 NXTName = readFromIniFile(inisection, 'NXT-Name', inifilename); 416 NXTMac = readFromIniFile(inisection, 'NXT-Mac', inifilename); 416 417 Channel = readFromIniFile(inisection, 'Channel', inifilename); 417 418 end … … 459 460 end%try 460 461 elseif ispc && hIn.OSValue == 4 % 64 Bit 461 handle= Bluetooth(NXTName,str2num(Channel)); 462 fopen(handle); 462 if ~isempty(NXTMac) %open with MAC 463 btMac = strcat( 'btspp://' , NXTMac); 464 handle= Bluetooth(btMac,str2num(Channel)); 465 else %open with name 466 handle = Bluetooth(NXTName,str2num(Channel)); 467 end 468 469 try 470 % Try to open our Bluetooth Handle. This might fail if NXTName 471 % or NXTMac are false or the NXT turned off. 472 fopen(handle); 473 if ~ strcmp(handle.RemoteName,NXTName); %if connection works, check if names match, just to be sure 474 warning('MATLAB:RWTHMindstormsNXT:Bluetooth:namesDontMatch','The Name of the NXT with MAC: "%s" is: "%s" this name does not match the one given in the Bluetooth ini-File: "%s". Using NXT with name: "%s"', NXTMac, handle.RemoteName, NXTName, handle.RemoteName); 475 end 476 catch 477 478 if ~isempty(NXTMac) && ~isempty(NXTName) %maybe we can get the right NXT by name? 479 try 480 warning('MATLAB:RWTHMindstormsNXT:Bluetooth:couldNotOpenConnectionMac','Could not open connection to NXT with MAC: "%s". Trying to open NXT with name "%s" instead.', NXTMac, NXTName); 481 handle = Bluetooth(NXTName,str2num(Channel)); 482 fopen(handle); 483 catch 484 error('MATLAB:RWTHMindstormsNXT:Bluetooth:couldNotOpenConnectionToNXT', 'Could not open bluetooth connection to NXT: %s. Please check your bluetooth ini-File', NXTName ); 485 end 486 else 487 error('MATLAB:RWTHMindstormsNXT:Bluetooth:couldNotOpenConnectionToNXT', 'Could not open bluetooth connection to NXT: %s. Please check your bluetooth ini-File', NXTName ); 488 end 489 end %try 490 463 491 464 492 … … 511 539 512 540 %TODO get NXT's name & mac in here, and compare... 541 %this is already checked above for Windows 64-Bit. 513 542 514 543 end%if … … 779 808 hOut.ConnectionTypeName = 'USB'; 780 809 781 %% Unload libusb (if already in memory) 782 if libisloaded('libusb') 810 811 %% Unload libusb when working with Linux (if already in memory) 812 if libisloaded('libusb') && (hIn.OSValue == 2) 783 813 textOut(sprintf(' - Unloading library "libusb"... ')); 784 814 try
