1414********************************************************************/
1515
1616#include < unistd.h>
17- #include < stdio.h> // NULL
18- #include < stdlib.h> // atol(), _itoa()
19- #include < string.h> // strcmp()
20- #include < ctype.h> // isdigit()
17+ #include < stdio.h> // NULL
18+ #include < stdlib.h> // atol(), _itoa()
19+ #include < string.h> // strcmp()
20+ #include < ctype.h> // isdigit()
2121#include < sys/types.h>
2222#include < sys/stat.h>
2323
2424#include " emc.hh"
2525#include " rcs_print.hh"
2626#include " emcIniFile.hh"
27- #include " iniaxis.hh" // these decls
28- #include " emcglb.h" // EMC_DEBUG
29- #include " emccfg.h" // default values for globals
27+ #include " iniaxis.hh" // these decls
28+ #include " emcglb.h" // EMC_DEBUG
29+ #include " emccfg.h" // default values for globals
3030
3131#include " inihal.hh"
3232
@@ -61,27 +61,27 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
6161 double limit;
6262 double maxVelocity;
6363 double maxAcceleration;
64- int lockingjnum = -1 ; // -1 ==> locking joint not used
64+ int lockingjnum = -1 ; // -1 ==> locking joint not used
6565 double maxJerk;
6666
6767 // compose string to match, axis = 0 -> AXIS_X etc.
6868 switch (axis) {
69- case 0 : snprintf (axisString, sizeof (axisString), " AXIS_X" ); break ;
70- case 1 : snprintf (axisString, sizeof (axisString), " AXIS_Y" ); break ;
71- case 2 : snprintf (axisString, sizeof (axisString), " AXIS_Z" ); break ;
72- case 3 : snprintf (axisString, sizeof (axisString), " AXIS_A" ); break ;
73- case 4 : snprintf (axisString, sizeof (axisString), " AXIS_B" ); break ;
74- case 5 : snprintf (axisString, sizeof (axisString), " AXIS_C" ); break ;
75- case 6 : snprintf (axisString, sizeof (axisString), " AXIS_U" ); break ;
76- case 7 : snprintf (axisString, sizeof (axisString), " AXIS_V" ); break ;
77- case 8 : snprintf (axisString, sizeof (axisString), " AXIS_W" ); break ;
69+ case 0 : snprintf (axisString, sizeof (axisString), " AXIS_X" ); break ;
70+ case 1 : snprintf (axisString, sizeof (axisString), " AXIS_Y" ); break ;
71+ case 2 : snprintf (axisString, sizeof (axisString), " AXIS_Z" ); break ;
72+ case 3 : snprintf (axisString, sizeof (axisString), " AXIS_A" ); break ;
73+ case 4 : snprintf (axisString, sizeof (axisString), " AXIS_B" ); break ;
74+ case 5 : snprintf (axisString, sizeof (axisString), " AXIS_C" ); break ;
75+ case 6 : snprintf (axisString, sizeof (axisString), " AXIS_U" ); break ;
76+ case 7 : snprintf (axisString, sizeof (axisString), " AXIS_V" ); break ;
77+ case 8 : snprintf (axisString, sizeof (axisString), " AXIS_W" ); break ;
7878 }
7979
8080 axisIniFile->EnableExceptions (EmcIniFile::ERR_CONVERSION);
81-
81+
8282 try {
8383 // set min position limit
84- limit = -1e99 ; // default
84+ limit = -1e99 ; // default
8585 axisIniFile->Find (&limit, " MIN_LIMIT" , axisString);
8686 if (0 != emcAxisSetMinPositionLimit (axis, limit)) {
8787 if (emc_debug & EMC_DEBUG_CONFIG) {
@@ -92,7 +92,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
9292 old_inihal_data.axis_min_limit [axis] = limit;
9393
9494 // set max position limit
95- limit = 1e99 ; // default
95+ limit = 1e99 ; // default
9696 axisIniFile->Find (&limit, " MAX_LIMIT" , axisString);
9797 if (0 != emcAxisSetMaxPositionLimit (axis, limit)) {
9898 if (emc_debug & EMC_DEBUG_CONFIG) {
@@ -103,26 +103,29 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
103103 old_inihal_data.axis_max_limit [axis] = limit;
104104
105105 ext_offset_a_or_v_ratio[axis] = DEFAULT_A_OR_V_RATIO;
106- axisIniFile->Find (&ext_offset_a_or_v_ratio[axis], " OFFSET_AV_RATIO" , axisString);
106+ axisIniFile->Find (
107+ &ext_offset_a_or_v_ratio[axis], " OFFSET_AV_RATIO" , axisString);
107108
108109#define REPLACE_AV_RATIO 0.1
109- #define MAX_AV_RATIO 0.9
110- if ( (ext_offset_a_or_v_ratio[axis] < 0 )
111- || (ext_offset_a_or_v_ratio[axis] > MAX_AV_RATIO)
112- ) {
113- rcs_print_error (" \n Invalid:[%s]OFFSET_AV_RATIO= %8.5f\n "
114- " Using: [%s]OFFSET_AV_RATIO= %8.5f\n " ,
115- axisString,ext_offset_a_or_v_ratio[axis],
116- axisString,REPLACE_AV_RATIO);
117- ext_offset_a_or_v_ratio[axis] = REPLACE_AV_RATIO;
110+ #define MAX_AV_RATIO 0.9
111+ if ((ext_offset_a_or_v_ratio[axis] < 0 ) ||
112+ (ext_offset_a_or_v_ratio[axis] > MAX_AV_RATIO)) {
113+ rcs_print_error (" \n Invalid:[%s]OFFSET_AV_RATIO= %8.5f\n "
114+ " Using: [%s]OFFSET_AV_RATIO= %8.5f\n " ,
115+ axisString,
116+ ext_offset_a_or_v_ratio[axis],
117+ axisString,
118+ REPLACE_AV_RATIO);
119+ ext_offset_a_or_v_ratio[axis] = REPLACE_AV_RATIO;
118120 }
119121
120122 // set maximum velocities for axis: vel,ext_offset_vel
121123 maxVelocity = DEFAULT_AXIS_MAX_VELOCITY;
122124 axisIniFile->Find (&maxVelocity, " MAX_VELOCITY" , axisString);
123- if (0 != emcAxisSetMaxVelocity (axis,
124- (1 - ext_offset_a_or_v_ratio[axis]) * maxVelocity,
125- ( ext_offset_a_or_v_ratio[axis]) * maxVelocity)) {
125+ if (0 != emcAxisSetMaxVelocity (
126+ axis,
127+ (1 - ext_offset_a_or_v_ratio[axis]) * maxVelocity,
128+ (ext_offset_a_or_v_ratio[axis]) * maxVelocity)) {
126129 if (emc_debug & EMC_DEBUG_CONFIG) {
127130 rcs_print_error (" bad return from emcAxisSetMaxVelocity\n " );
128131 }
@@ -133,9 +136,10 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
133136 // set maximum accels for axis: acc,ext_offset_acc
134137 maxAcceleration = DEFAULT_AXIS_MAX_ACCELERATION;
135138 axisIniFile->Find (&maxAcceleration, " MAX_ACCELERATION" , axisString);
136- if (0 != emcAxisSetMaxAcceleration (axis,
137- (1 - ext_offset_a_or_v_ratio[axis]) * maxAcceleration,
138- ( ext_offset_a_or_v_ratio[axis]) * maxAcceleration)) {
139+ if (0 != emcAxisSetMaxAcceleration (
140+ axis,
141+ (1 - ext_offset_a_or_v_ratio[axis]) * maxAcceleration,
142+ (ext_offset_a_or_v_ratio[axis]) * maxAcceleration)) {
139143 if (emc_debug & EMC_DEBUG_CONFIG) {
140144 rcs_print_error (" bad return from emcAxisSetMaxAcceleration\n " );
141145 }
@@ -150,7 +154,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
150154 }
151155 return -1 ;
152156 }
153-
157+
154158 maxJerk = DEFAULT_AXIS_MAX_JERK;
155159 axisIniFile->Find (&maxJerk, " MAX_JERK" , axisString);
156160 if (0 != emcAxisSetMaxJerk (axis, maxJerk)) {
@@ -163,7 +167,7 @@ static int loadAxis(int axis, EmcIniFile *axisIniFile)
163167 }
164168
165169
166- catch (EmcIniFile::Exception &e){
170+ catch (EmcIniFile::Exception &e) {
167171 e.Print ();
168172 return -1 ;
169173 }
@@ -184,7 +188,7 @@ int iniAxis(int axis, const char *filename)
184188 EmcIniFile::ERR_CONVERSION);
185189
186190 if (axisIniFile.Open (filename) == false ) {
187- return -1 ;
191+ return -1 ;
188192 }
189193
190194 // load its values
0 commit comments