ardupilot/ArduCopter/setup.cpp

82 lines
2.2 KiB
C++
Raw Permalink Normal View History

#include "Copter.h"
// report_compass - displays compass information. Also called by compassmot.pde
void Copter::report_compass()
{
2017-08-11 01:08:41 -03:00
hal.console->printf("Compass\n");
print_divider();
print_enabled(AP::compass().enabled());
// mag declination
2017-08-11 01:08:41 -03:00
hal.console->printf("Mag Dec: %4.4f\n",
(double)degrees(compass.get_declination()));
// mag offsets
Vector3f offsets;
for (uint8_t i=0; i<compass.get_count(); i++) {
offsets = compass.get_offsets(i);
// mag offsets
2017-08-11 01:08:41 -03:00
hal.console->printf("Mag%d off: %4.4f, %4.4f, %4.4f\n",
(int)i,
(double)offsets.x,
(double)offsets.y,
(double)offsets.z);
}
// motor compensation
2017-08-11 01:08:41 -03:00
hal.console->printf("Motor Comp: ");
if( compass.get_motor_compensation_type() == AP_COMPASS_MOT_COMP_DISABLED ) {
2017-08-11 01:08:41 -03:00
hal.console->printf("Off\n");
}else{
if( compass.get_motor_compensation_type() == AP_COMPASS_MOT_COMP_THROTTLE ) {
2017-08-11 01:08:41 -03:00
hal.console->printf("Throttle");
}
if( compass.get_motor_compensation_type() == AP_COMPASS_MOT_COMP_CURRENT ) {
2017-08-11 01:08:41 -03:00
hal.console->printf("Current");
}
Vector3f motor_compensation;
for (uint8_t i=0; i<compass.get_count(); i++) {
motor_compensation = compass.get_motor_compensation(i);
2017-08-11 01:08:41 -03:00
hal.console->printf("\nComMot%d: %4.2f, %4.2f, %4.2f\n",
(int)i,
(double)motor_compensation.x,
(double)motor_compensation.y,
(double)motor_compensation.z);
}
}
print_blanks(1);
}
void Copter::print_blanks(int16_t num)
{
2012-08-21 23:19:50 -03:00
while(num > 0) {
num--;
2017-08-11 01:08:41 -03:00
hal.console->printf("\n");
2012-08-21 23:19:50 -03:00
}
}
void Copter::print_divider(void)
{
2012-08-21 23:19:50 -03:00
for (int i = 0; i < 40; i++) {
2017-08-11 01:08:41 -03:00
hal.console->printf("-");
2012-08-21 23:19:50 -03:00
}
2017-08-11 01:08:41 -03:00
hal.console->printf("\n");
}
void Copter::print_enabled(bool b)
{
2012-08-21 23:19:50 -03:00
if(b)
2017-08-11 01:08:41 -03:00
hal.console->printf("en");
2012-08-21 23:19:50 -03:00
else
2017-08-11 01:08:41 -03:00
hal.console->printf("dis");
hal.console->printf("abled\n");
}
void Copter::report_version()
{
2017-08-11 01:08:41 -03:00
hal.console->printf("FW Ver: %d\n",(int)(g.k_format_version));
2012-08-21 23:19:50 -03:00
print_divider();
print_blanks(2);
}