Index: /trunk/mfiles/COM_OpenNXTEx.m
===================================================================
--- /trunk/mfiles/COM_OpenNXTEx.m	(revision 307)
+++ /trunk/mfiles/COM_OpenNXTEx.m	(revision 308)
@@ -58,5 +58,5 @@
 %   
 %
-% Limitations of |COM_CloseNXT|
+% Limitations of COM_CloseNXT
 %   If you call |COM_CloseNXT('all')| after a |clear all| command has been
 %   issued, the function will not be able to close all remaining open USB
Index: /trunk/mfiles/Contents.m
===================================================================
--- /trunk/mfiles/Contents.m	(revision 173)
+++ /trunk/mfiles/Contents.m	(revision 308)
@@ -1,79 +1,89 @@
-% RWTH - Mindstorms NXT Toolbox 
-% Version 2.00beta 17-Jul-2008
+% RWTH - Mindstorms NXT Toolbox
+% Version 2.00 25-Sep-2008
 % Files
-%   checkStatusByte           - Interpretes the status byte of a return package and creates an error message
-%   CloseSensor               - Closes a specified sensor port (e.g. turns off the active light mode of the NXT light sensor)
-%   COM_CloseNXT              - Closes and deletes a specific NXT handle, or clears all existing handles
-%   COM_CollectPacket         - Reads data from a USB or serial/Bluetooth port and retrieves exactly one packet
-%   COM_CreatePacket          - Generates a valid Bluetooth packet ready for transmission (i.e. calculates length)
-%   COM_GetDefaultNXT         - Returns the global default NXT handle if it was previously set
-%   COM_MakeBTConfigFile      - Creates a Bluetooth configuration file which is needed to open a Bluetooth connection.
-%   COM_OpenNXT               - Opens a USB or Bluetooth connection to an NXT device and returns a handle for future use
-%   COM_OpenNXTEx             - Opens a Bluetooth or USB connection to an NXT device and returns a handle for future use
-%   COM_SendPacket            - Sends a communication protocol packet (byte-array) via a USB or Bluetooth channel (serial port)
-%   COM_SetDefaultNXT         - Sets a global default NXT handle that will be used by other functions if no handle is specified.
-%   DebugMode                 - Gets or sets the debug state (i.e. if textOut will print messages to the command window)
-%   GetLight                  - Reads the current value of the NXT light sensor
-%   GetMemoryCount            - Gets the internal NXT memory counter (manual mapping replica)
-%   GetMotor                  - Reads the current motor set by SetMotor(). Raises an error if no motor was set
-%   GetMotorSettings          - Returns the current motor data / settings (e.g. position, speed, etc.) from the specified motor
-%   GetSound                  - Reads the current value of the NXT sound sensor
-%   GetSwitch                 - Reads the current value of the NXT switch / touch sensor
-%   GetUltrasonic             - Reads the current value of the NXT ultrasonic sensor
-%   MAP_GetCommModule         - Reads the IO map of the communication module
-%   MAP_GetInputModule        - Reads the IO map of the input module
-%   MAP_GetOutputModule       - Reads the IO map of the output module
-%   MAP_GetSoundModule        - Reads the IO map of the sound module
-%   MAP_GetUIModule           - Reads the IO map of the user interface module
-%   MAP_SetOutputModule       - Writes the IO map to the output module
-%   MOTOR_A                   - Symbolic constant MOTOR_A (returns 0)
-%   MOTOR_B                   - Symbolic constant MOTOR_B (returns 1)
-%   MOTOR_C                   - Symbolic constant MOTOR_C (returns 2)
-%   MotorRotateAbs            - Rotates a motor to an absolute angle
-%   NXT_GetBatteryLevel       - Returns the current battery level in milli volts
-%   NXT_GetFirmwareVersion    - Returns the protocol and firmware version of the NXT
-%   NXT_GetInputValues        - Processes a complete sensor reading, i.e. requests input values and collects the answer.
-%   NXT_GetOutputState        - Requests and retrieves an output motor state reading
-%   NXT_LSGetStatus           - Gets the number of available bytes from low speed (digital) sensor (e.g. ultrasonic)
-%   NXT_LSRead                - Reads data from a low speed (digital) sensor
-%   NXT_LSWrite               - Writes the given data to a low speed (digital) sensor
-%   NXT_PlaySoundFile         - Plays the given sound file on the NXT Brick
-%   NXT_PlayTone              - Plays a tone with the given frequency and duration 
-%   NXT_ReadIOMap             - Reads the IO map of the given module ID
-%   NXT_ResetInputScaledValue - Resets the sensors ScaledVal back to 0, depends on currently configured mode (see NXT_SetInputMode)
-%   NXT_ResetMotorPosition    - Resets NXT internal counter for specified motor, relative or absolute counter
-%   NXT_SendKeepAlive         - Sends a KeepAlive packet. Optional: requests sleep time limit.
-%   NXT_SetBrickName          - Sets a new name for the NXT Brick (connected to the specified handle)
-%   NXT_SetInputMode          - Sets mode, configures and initializes sensor ready to be read out
-%   NXT_SetOutputState        - Sends previously specified settings to current active motor.
-%   NXT_StartProgram          - Starts the given program on the NXT Brick
-%   NXT_StopProgram           - Stops a specific program on the NXT Brick
-%   NXT_StopSoundPlayback     - Stops the current sound playback
-%   NXT_WriteIOMap            - Writes the IO map to the given module ID
-%   OpenLight                 - Sets the parameter mode of the NXT light sensor
-%   OpenSound                 - Sets the parameter mode of the NXT sound sensor
-%   OpenSwitch                - Sets the parameter mode of the NXT switch / touch sensor
-%   OpenUltrasonic            - Initializes and sets the mode of the NXT ultrasonic sensor
-%   readFromIniFile           - Reads parameters from a configuration file (usually *.ini)
-%   ResetMotorAngle           - Resets the relative angle counter for the given motor
-%   SendMotorSettings         - Sends previously specified settings to current active motor.
-%   SENSOR_1                  - Symbolic constant SENSOR_1 (returns 0)
-%   SENSOR_2                  - Symbolic constant SENSOR_2 (returns 1)
-%   SENSOR_3                  - Symbolic constant SENSOR_3 (returns 2)
-%   SENSOR_4                  - Symbolic constant SENSOR_4 (returns 3)
-%   SetAngleLimit             - Sets the angle limit (in degrees) of the current motor port
-%   SetMemoryCount            - Sets the internal NXT memory counter (manual mapping replica)
-%   SetMotor                  - Sets the current motor to use for motor setting commands
-%   SetPower                  - Sets the power of the current active motor
-%   SetRampMode               - Sets the runstate of the current active motor
-%   SetTurnRatio              - Sets the turn ratio of the current active motor
-%   SpeedRegulation           - Enables / disables the speed regulation mode of the current active motor
-%   StopMotor                 - Stops / brakes specified motor. (Synchronisation will be lost after this)
-%   SwitchLamp                - Switches the LEGO lamp on or off (has to be connected to a motor port)
-%   SyncToMotor               - Enables synchronization regulation for current active and specified motor
-%   textOut                   - Wrapper for fprintf() which can optionally write screen output to a logfile
-%   tictic                    - Similar to MATLAB's tic(), but extended to save "more states"
-%   toctoc                    - Similar to MATLAB's toc(), but extended to save "more states"
-%   USGetSnapshotResults      - Retrieves up to eight echos (distances) stored inside the US sensor
-%   USMakeSnapshot            - Causes the ultrasonic sensor to send one snapshot ("ping") and record the echos
-%   WaitForMotor              - Pauses execution until specific motor is not running anymore. 
+%   CalibrateCompass           - Enables calibration mode of the HiTechnic compass sensor
+%   checkStatusByte            - Interpretes the status byte of a return package and creates an error message
+%   CloseSensor                - Closes a specified sensor port (e.g. turns off the active light mode of the NXT light sensor)
+%   COM_CloseNXT               - Closes and deletes a specific NXT handle, or clears all existing handles
+%   COM_CollectPacket          - Reads data from a USB or serial/Bluetooth port and retrieves exactly one packet
+%   COM_CreatePacket           - Generates a valid Bluetooth packet ready for transmission (i.e. calculates length)
+%   COM_GetDefaultNXT          - Returns the global default NXT handle if it was previously set
+%   COM_MakeBTConfigFile       - Creates a Bluetooth configuration file which is needed to open a Bluetooth connection.
+%   COM_OpenNXT                - Opens a USB or Bluetooth connection to an NXT device and returns a handle for future use
+%   COM_OpenNXTEx              - Opens a Bluetooth or USB connection to an NXT device and returns a handle for future use
+%   COM_ReadI2C                - Requests and reads sensor data via I2C from a correctly configured digital sensor.
+%   COM_SendPacket             - Sends a communication protocol packet (byte-array) via a USB or Bluetooth channel (serial port)
+%   COM_SetDefaultNXT          - Sets a global default NXT handle that will be used by other functions if no handle is specified.
+%   DebugMode                  - Gets or sets the debug state (i.e. if textOut will print messages to the command window)
+%   GetAccelerator             - Reads the current value of the HiTechnic acceleration sensor
+%   GetCompass                 - Reads the current value of the HiTechnic compass sensor
+%   GetInfrared                - Reads the current value of the Hitechnic infrared sensor (infrared seeker)
+%   GetLight                   - Reads the current value of the NXT light sensor
+%   GetMemoryCount             - Gets the internal NXT memory counter (manual mapping replica)
+%   GetMotor                   - Reads the current motor set by SetMotor(). Raises an error if no motor was set
+%   GetMotorSettings           - Returns the current motor data / settings (e.g. position, speed, etc.) from the specified motor
+%   GetSound                   - Reads the current value of the NXT sound sensor
+%   GetSwitch                  - Reads the current value of the NXT switch / touch sensor
+%   GetUltrasonic              - Reads the current value of the NXT ultrasonic sensor
+%   MAP_GetCommModule          - Reads the IO map of the communication module
+%   MAP_GetInputModule         - Reads the IO map of the input module
+%   MAP_GetOutputModule        - Reads the IO map of the output module
+%   MAP_GetSoundModule         - Reads the IO map of the sound module
+%   MAP_GetUIModule            - Reads the IO map of the user interface module
+%   MAP_SetOutputModule        - Writes the IO map to the output module
+%   MOTOR_A                    - Symbolic constant MOTOR_A (returns 0)
+%   MOTOR_B                    - Symbolic constant MOTOR_B (returns 1)
+%   MOTOR_C                    - Symbolic constant MOTOR_C (returns 2)
+%   MotorRotateAbs             - Rotates a motor to an absolute angle
+%   NXT_GetBatteryLevel        - Returns the current battery level in milli volts
+%   NXT_GetFirmwareVersion     - Returns the protocol and firmware version of the NXT
+%   NXT_GetInputValues         - Processes a complete sensor reading, i.e. requests input values and collects the answer.
+%   NXT_GetOutputState         - Requests and retrieves an output motor state reading
+%   NXT_LSGetStatus            - Gets the number of available bytes from low speed (digital) sensor (e.g. ultrasonic)
+%   NXT_LSRead                 - Reads data from a low speed (digital) sensor
+%   NXT_LSWrite                - Writes the given data to a low speed (digital) sensor
+%   NXT_MessageWrite           - Sends a message to NXT
+%   NXT_PlaySoundFile          - Plays the given sound file on the NXT Brick
+%   NXT_PlayTone               - Plays a tone with the given frequency and duration 
+%   NXT_ReadIOMap              - Reads the IO map of the given module ID
+%   NXT_ResetInputScaledValue  - Resets the sensors ScaledVal back to 0, depends on currently configured mode (see NXT_SetInputMode)
+%   NXT_ResetMotorPosition     - Resets NXT internal counter for specified motor, relative or absolute counter
+%   NXT_SendKeepAlive          - Sends a KeepAlive packet. Optional: requests sleep time limit.
+%   NXT_SetBrickName           - Sets a new name for the NXT Brick (connected to the specified handle)
+%   NXT_SetInputMode           - Sets mode, configures and initializes sensor ready to be read out
+%   NXT_SetOutputState         - Sends previously specified settings to current active motor.
+%   NXT_StartProgram           - Starts the given program on the NXT Brick
+%   NXT_StopProgram            - Stops a specific program on the NXT Brick
+%   NXT_StopSoundPlayback      - Stops the current sound playback
+%   NXT_WriteIOMap             - Writes the IO map to the given module ID
+%   OpenAccelerator            - Initializes and sets the mode of the HiTechnic acceleration sensor
+%   OpenCompass                - Initializes and sets the mode of the HiTechnic magnetic compass sensor
+%   OpenInfrared               - Initializes and sets the mode of the HiTechnic infrared seeker sensor
+%   OpenLight                  - Sets the parameter mode of the NXT light sensor
+%   OpenSound                  - Sets the parameter mode of the NXT sound sensor
+%   OpenSwitch                 - Sets the parameter mode of the NXT switch / touch sensor
+%   OpenUltrasonic             - Initializes and sets the mode of the NXT ultrasonic sensor
+%   OptimizeToolboxPerformance - Copies binary versions of typecastc to toolbox for better performance 
+%   readFromIniFile            - Reads parameters from a configuration file (usually *.ini)
+%   ResetMotorAngle            - Resets the relative angle counter for the given motor
+%   SendMotorSettings          - Sends previously specified settings to current active motor.
+%   SENSOR_1                   - Symbolic constant SENSOR_1 (returns 0)
+%   SENSOR_2                   - Symbolic constant SENSOR_2 (returns 1)
+%   SENSOR_3                   - Symbolic constant SENSOR_3 (returns 2)
+%   SENSOR_4                   - Symbolic constant SENSOR_4 (returns 3)
+%   SetAngleLimit              - Sets the angle limit (in degrees) of the current motor port
+%   SetMemoryCount             - Sets the internal NXT memory counter (manual mapping replica)
+%   SetMotor                   - Sets the current motor to use for motor setting commands
+%   SetPower                   - Sets the power of the current active motor
+%   SetRampMode                - Sets the runstate of the current active motor
+%   SetTurnRatio               - Sets the turn ratio of the current active motor
+%   SpeedRegulation            - Enables / disables the speed regulation mode of the current active motor
+%   StopMotor                  - Stops / brakes specified motor. (Synchronisation will be lost after this)
+%   SwitchLamp                 - Switches the LEGO lamp on or off (has to be connected to a motor port)
+%   SyncToMotor                - Enables synchronization regulation for current active and specified motor
+%   textOut                    - Wrapper for fprintf() which can optionally write screen output to a logfile
+%   tictic                     - Similar to MATLAB's tic(), but extended to save "more states"
+%   toctoc                     - Similar to MATLAB's toc(), but extended to save "more states"
+%   USGetSnapshotResults       - Retrieves up to eight echos (distances) stored inside the US sensor
+%   USMakeSnapshot             - Causes the ultrasonic sensor to send one snapshot ("ping") and record the echos
+%   WaitForMotor               - Pauses execution until specific motor is not running anymore. 
Index: /trunk/mfiles/COM_ReadI2C.m
===================================================================
--- /trunk/mfiles/COM_ReadI2C.m	(revision 307)
+++ /trunk/mfiles/COM_ReadI2C.m	(revision 308)
@@ -77,4 +77,20 @@
 %   Copyright: 2007-2008, RWTH Aachen University
 %
+;
+%
+% ***********************************************************************************************
+% *  This file is part of the RWTH - Mindstorms NXT Toolbox.                                    *
+% *                                                                                             *
+% *  The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify  *
+% *  it under the terms of the GNU General Public License as published by the Free Software     *
+% *  Foundation, either version 3 of the License, or (at your option) any later version.        *
+% *                                                                                             *
+% *  The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful,       *
+% *  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  *
+% *  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
+% *                                                                                             *
+% *  You should have received a copy of the GNU General Public License along with the           *
+% *  RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>.                 *
+% ***********************************************************************************************
 
 
Index: /trunk/mfiles/COM_OpenNXT.m
===================================================================
--- /trunk/mfiles/COM_OpenNXT.m	(revision 307)
+++ /trunk/mfiles/COM_OpenNXT.m	(revision 308)
@@ -29,5 +29,5 @@
 %
 %
-% Limitations of |COM_CloseNXT|
+% Limitations of COM_CloseNXT
 %   If you call |COM_CloseNXT('all')| after a |clear all| command has been
 %   issued, the function will not be able to close all remaining open USB
Index: /trunk/publishing/scripts/createCategories.py
===================================================================
--- /trunk/publishing/scripts/createCategories.py	(revision 305)
+++ /trunk/publishing/scripts/createCategories.py	(revision 308)
@@ -53,4 +53,5 @@
 MAP_Functions = []
 General_Functions = []
+General = ["OptimizeToolboxPerformance"]
 
 Sensor_Functions = []
@@ -83,5 +84,5 @@
 				MAP_Functions.append(words)
 				
-			elif command[0].islower():
+			elif command[0].islower() or command in General:
 				General_Functions.append(words)
 				
Index: /trunk/publishing/scripts/publishM2HtmlFiles.m
===================================================================
--- /trunk/publishing/scripts/publishM2HtmlFiles.m	(revision 224)
+++ /trunk/publishing/scripts/publishM2HtmlFiles.m	(revision 308)
@@ -10,6 +10,6 @@
 
 current_dir = pwd;
-input_dir = strcat(current_dir, '../../doc/m2html');
-output_dir = strcat(current_dir, '../output/doc/functions');
+input_dir = strcat(current_dir, '/../../doc/m2html');
+output_dir = strcat(current_dir, '/../output/doc/functions');
 mkdir(output_dir);
 options.outputDir = output_dir;
Index: /trunk/publishing/scripts/create_documents.sh
===================================================================
--- /trunk/publishing/scripts/create_documents.sh	(revision 210)
+++ /trunk/publishing/scripts/create_documents.sh	(revision 308)
@@ -18,7 +18,9 @@
 
 
+# A 
 ###############################
 # start wg_publish_dir to create the html files
 echo
+echo "--------------------------------------------------------------"
 echo "Start MATLAB and startPublishing / wg_publish to create html files..."
 matlab -nosplash -r "startPublishing()"
@@ -26,7 +28,9 @@
 
 
+# B
 ###############################
 # remove style sheets from the html files and add header banner
 echo
+echo "--------------------------------------------------------------"
 echo "Remove styles sheets from the html files..." 
 mkdir $mfiles_dir/html_dir/new
@@ -35,4 +39,5 @@
 # remove ; and || and %+ formats in the header description of each m-file
 echo
+echo "--------------------------------------------------------------"
 echo "Remove formats from the m-files..."
 mkdir $mfiles_dir/m_dir $mfiles_dir/m_dir/private
@@ -41,6 +46,10 @@
 
 
+# C
 ###############################
 # copy files from /doc/html/* to toolbox output directory
+echo
+echo "--------------------------------------------------------------"
+echo "Copy files from /doc and /doc/html to toolbox output directory"
 mkdir $output_dir/doc
 cp $doc_dir/* $output_dir/doc
@@ -53,7 +62,9 @@
 
 
+# D
 ###############################
 # move m-files (without formats) to toolbox output directory
 echo
+echo "--------------------------------------------------------------"
 echo "Move m-files (without formats) to toolbox output directory..."
 mv $mfiles_dir/m_dir/* $output_dir/
@@ -67,7 +78,9 @@
 
 
+# E
 ###############################
 # create function lists
 echo 
+echo "--------------------------------------------------------------"
 echo "Create Functions - ABC List..."
 python createABCList.py $mfiles_dir/Contents.m $output_dir/doc/functions
@@ -78,9 +91,12 @@
 
 
+# F
 ###############################
 # create html from m-files in /doc/m2html/ --> doc/functions/ (e.g. Functions Overview etc.)
 echo
-echo "Create html files from /doc/m2html/*.m flies..."
+echo "--------------------------------------------------------------"
+echo "Create html files from /doc/m2html/*.m files..."
 matlab -nosplash -r "publishM2HtmlFiles(); exit;"
+
 
 
@@ -88,4 +104,5 @@
 # create html files from m-files in /demos/ --> doc/examples/
 echo
+echo "--------------------------------------------------------------"
 echo "Create html files for examples/demos..."
 matlab -nosplash -r "publishDemos(); exit;"
@@ -93,4 +110,5 @@
 # copy demos
 echo
+echo "--------------------------------------------------------------"
 echo "Copy demos in toolbox output folder"
 mkdir $output_dir/demos
@@ -98,12 +116,14 @@
 
 # create example index html
+echo
+echo "--------------------------------------------------------------"
 echo "Create example index html..."
-echo
 python createExamples.py $output_dir/doc/examples $demos_dir/*.m
 
 
 ###############################
-# create helpindex.xml
+ create helpindex.xml
 echo
+echo "--------------------------------------------------------------"
 echo "Create helpindex.xml ..."
 python createHelpIndex.py $output_dir/doc/ $output_dir/doc/functions/help/*.html
Index: /trunk/doc/html/functions/CommandLayers.html
===================================================================
--- /trunk/doc/html/functions/CommandLayers.html	(revision 292)
+++ /trunk/doc/html/functions/CommandLayers.html	(revision 308)
@@ -48,5 +48,5 @@
     <td><b>High Level Functions</b></td>
     <td valign="top"><b>SendMotorSettings</b><br>SetMotor<br>SetPower<br>SetAngleLimit<br>SetRampMode<br>SpeedRegulation<br>SyncToMotor<br><br><b>StopMotor</b><br><br><b>GetMotorSettings</b><br>GetMotor<br><br><b>ResetMotorAngle</b><br><br>SetMemoryCount<br>GetMemoryCount</td>
-    <td valign="top"><b>OpenLight<br>OpenSound<br>OpenSwitch<br>OpenUltrasonic<br>OpenAccelerator<br>OpenInfrared<br><br>GetLight<br>GetSound<br>GetSwitch<br>GetAccelerator<br>GetInfrared<br>GetUltrasonic</b><br>USMakeSnapshot<br>USGetSnapshotResults<br><b><br>CloseSensor</b></td>
+    <td valign="top"><b>OpenLight<br>OpenSound<br>OpenSwitch<br>OpenUltrasonic<br>OpenAccelerator<br>OpenInfrared<br>OpenCompass<br><br>GetLight<br>GetSound<br>GetSwitch<br>GetAccelerator<br>GetInfrared<br>GetUltrasonic</b><br>USMakeSnapshot<br>USGetSnapshotResults<br><b>GetCompass</b><br>CalibrateCompass<br><br><b>CloseSensor</b></td>
     <td valign="top">readFromIniFile<br><br>MAP_GetCommModule<br>MAP_GetInputModule<br>MAP_GetOutputModule<br>MAP_GetSoundModule<br>MAP_GetUIModule<br><br>MAP_SetOutputModule</td>
     <td valign="top"><b>COM_OpenNXT</b><br>COM_OpenNXTEx<br><br><b>COM_CloseNXT</b><br><br><b>COM_ReadI2C</b><br></td>
