uncrustify ArduCopter/setup.pde

This commit is contained in:
uncrustify 2012-08-21 19:19:50 -07:00 committed by Pat Hickey
parent 7f89e6c677
commit bb6e4ac969

View File

@ -773,67 +773,67 @@ static void clear_offsets()
} }
/*static int8_t /*static int8_t
setup_mag_offset(uint8_t argc, const Menu::arg *argv) * setup_mag_offset(uint8_t argc, const Menu::arg *argv)
{ * {
Vector3f _offsets; * Vector3f _offsets;
*
if (!strcmp_P(argv[1].str, PSTR("c"))) { * if (!strcmp_P(argv[1].str, PSTR("c"))) {
clear_offsets(); * clear_offsets();
report_compass(); * report_compass();
return (0); * return (0);
} * }
*
print_hit_enter(); * print_hit_enter();
init_compass(); * init_compass();
*
int16_t _min[3] = {0,0,0}; * int16_t _min[3] = {0,0,0};
int16_t _max[3] = {0,0,0}; * int16_t _max[3] = {0,0,0};
*
compass.read(); * compass.read();
*
while(1){ * while(1){
delay(50); * delay(50);
float heading; * float heading;
*
compass.read(); * compass.read();
heading = compass.calculate_heading(0,0); // roll = 0, pitch = 0 * heading = compass.calculate_heading(0,0); // roll = 0, pitch = 0
*
if(compass.mag_x < _min[0]) _min[0] = compass.mag_x; * if(compass.mag_x < _min[0]) _min[0] = compass.mag_x;
if(compass.mag_y < _min[1]) _min[1] = compass.mag_y; * if(compass.mag_y < _min[1]) _min[1] = compass.mag_y;
if(compass.mag_z < _min[2]) _min[2] = compass.mag_z; * if(compass.mag_z < _min[2]) _min[2] = compass.mag_z;
*
// capture max * // capture max
if(compass.mag_x > _max[0]) _max[0] = compass.mag_x; * if(compass.mag_x > _max[0]) _max[0] = compass.mag_x;
if(compass.mag_y > _max[1]) _max[1] = compass.mag_y; * if(compass.mag_y > _max[1]) _max[1] = compass.mag_y;
if(compass.mag_z > _max[2]) _max[2] = compass.mag_z; * if(compass.mag_z > _max[2]) _max[2] = compass.mag_z;
*
// calculate offsets * // calculate offsets
_offsets.x = (float)(_max[0] + _min[0]) / -2; * _offsets.x = (float)(_max[0] + _min[0]) / -2;
_offsets.y = (float)(_max[1] + _min[1]) / -2; * _offsets.y = (float)(_max[1] + _min[1]) / -2;
_offsets.z = (float)(_max[2] + _min[2]) / -2; * _offsets.z = (float)(_max[2] + _min[2]) / -2;
*
// display all to user * // display all to user
Serial.printf_P(PSTR("Heading: %u, \t (%d, %d, %d), (%4.4f, %4.4f, %4.4f)\n"), * Serial.printf_P(PSTR("Heading: %u, \t (%d, %d, %d), (%4.4f, %4.4f, %4.4f)\n"),
*
(uint16_t)(wrap_360(ToDeg(heading) * 100)) /100, * (uint16_t)(wrap_360(ToDeg(heading) * 100)) /100,
*
compass.mag_x, * compass.mag_x,
compass.mag_y, * compass.mag_y,
compass.mag_z, * compass.mag_z,
*
_offsets.x, * _offsets.x,
_offsets.y, * _offsets.y,
_offsets.z); * _offsets.z);
*
if(Serial.available() > 1){ * if(Serial.available() > 1){
compass.set_offsets(_offsets); * compass.set_offsets(_offsets);
//compass.set_offsets(mag_offset_x, mag_offset_y, mag_offset_z); * //compass.set_offsets(mag_offset_x, mag_offset_y, mag_offset_z);
report_compass(); * report_compass();
return 0; * return 0;
} * }
} * }
return 0; * return 0;
} * }
*/ */
static int8_t static int8_t
@ -1038,13 +1038,13 @@ static void report_gyro()
/***************************************************************************/ /***************************************************************************/
/*static void /*static void
print_PID(PI * pid) * print_PID(PI * pid)
{ * {
Serial.printf_P(PSTR("P: %4.2f, I:%4.2f, IMAX:%ld\n"), * Serial.printf_P(PSTR("P: %4.2f, I:%4.2f, IMAX:%ld\n"),
pid->kP(), * pid->kP(),
pid->kI(), * pid->kI(),
(long)pid->imax()); * (long)pid->imax());
} * }
*/ */
static void static void