mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
uncrustify ArduCopter/setup.pde
This commit is contained in:
parent
7f89e6c677
commit
bb6e4ac969
@ -773,67 +773,67 @@ static void clear_offsets()
|
||||
}
|
||||
|
||||
/*static int8_t
|
||||
setup_mag_offset(uint8_t argc, const Menu::arg *argv)
|
||||
{
|
||||
Vector3f _offsets;
|
||||
|
||||
if (!strcmp_P(argv[1].str, PSTR("c"))) {
|
||||
clear_offsets();
|
||||
report_compass();
|
||||
return (0);
|
||||
}
|
||||
|
||||
print_hit_enter();
|
||||
init_compass();
|
||||
|
||||
int16_t _min[3] = {0,0,0};
|
||||
int16_t _max[3] = {0,0,0};
|
||||
|
||||
compass.read();
|
||||
|
||||
while(1){
|
||||
delay(50);
|
||||
float heading;
|
||||
|
||||
compass.read();
|
||||
heading = compass.calculate_heading(0,0); // roll = 0, pitch = 0
|
||||
|
||||
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_z < _min[2]) _min[2] = compass.mag_z;
|
||||
|
||||
// capture max
|
||||
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_z > _max[2]) _max[2] = compass.mag_z;
|
||||
|
||||
// calculate offsets
|
||||
_offsets.x = (float)(_max[0] + _min[0]) / -2;
|
||||
_offsets.y = (float)(_max[1] + _min[1]) / -2;
|
||||
_offsets.z = (float)(_max[2] + _min[2]) / -2;
|
||||
|
||||
// display all to user
|
||||
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,
|
||||
|
||||
compass.mag_x,
|
||||
compass.mag_y,
|
||||
compass.mag_z,
|
||||
|
||||
_offsets.x,
|
||||
_offsets.y,
|
||||
_offsets.z);
|
||||
|
||||
if(Serial.available() > 1){
|
||||
compass.set_offsets(_offsets);
|
||||
//compass.set_offsets(mag_offset_x, mag_offset_y, mag_offset_z);
|
||||
report_compass();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
* setup_mag_offset(uint8_t argc, const Menu::arg *argv)
|
||||
* {
|
||||
* Vector3f _offsets;
|
||||
*
|
||||
* if (!strcmp_P(argv[1].str, PSTR("c"))) {
|
||||
* clear_offsets();
|
||||
* report_compass();
|
||||
* return (0);
|
||||
* }
|
||||
*
|
||||
* print_hit_enter();
|
||||
* init_compass();
|
||||
*
|
||||
* int16_t _min[3] = {0,0,0};
|
||||
* int16_t _max[3] = {0,0,0};
|
||||
*
|
||||
* compass.read();
|
||||
*
|
||||
* while(1){
|
||||
* delay(50);
|
||||
* float heading;
|
||||
*
|
||||
* compass.read();
|
||||
* heading = compass.calculate_heading(0,0); // roll = 0, pitch = 0
|
||||
*
|
||||
* 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_z < _min[2]) _min[2] = compass.mag_z;
|
||||
*
|
||||
* // capture max
|
||||
* 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_z > _max[2]) _max[2] = compass.mag_z;
|
||||
*
|
||||
* // calculate offsets
|
||||
* _offsets.x = (float)(_max[0] + _min[0]) / -2;
|
||||
* _offsets.y = (float)(_max[1] + _min[1]) / -2;
|
||||
* _offsets.z = (float)(_max[2] + _min[2]) / -2;
|
||||
*
|
||||
* // display all to user
|
||||
* 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,
|
||||
*
|
||||
* compass.mag_x,
|
||||
* compass.mag_y,
|
||||
* compass.mag_z,
|
||||
*
|
||||
* _offsets.x,
|
||||
* _offsets.y,
|
||||
* _offsets.z);
|
||||
*
|
||||
* if(Serial.available() > 1){
|
||||
* compass.set_offsets(_offsets);
|
||||
* //compass.set_offsets(mag_offset_x, mag_offset_y, mag_offset_z);
|
||||
* report_compass();
|
||||
* return 0;
|
||||
* }
|
||||
* }
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
|
||||
static int8_t
|
||||
@ -1038,13 +1038,13 @@ static void report_gyro()
|
||||
/***************************************************************************/
|
||||
|
||||
/*static void
|
||||
print_PID(PI * pid)
|
||||
{
|
||||
Serial.printf_P(PSTR("P: %4.2f, I:%4.2f, IMAX:%ld\n"),
|
||||
pid->kP(),
|
||||
pid->kI(),
|
||||
(long)pid->imax());
|
||||
}
|
||||
* print_PID(PI * pid)
|
||||
* {
|
||||
* Serial.printf_P(PSTR("P: %4.2f, I:%4.2f, IMAX:%ld\n"),
|
||||
* pid->kP(),
|
||||
* pid->kI(),
|
||||
* (long)pid->imax());
|
||||
* }
|
||||
*/
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user