Copter: Return value is changed to Enum Value.

This commit is contained in:
murata 2016-10-02 09:25:53 +09:00 committed by Lucas De Marchi
parent 60137e0f0b
commit 7148cc6239
2 changed files with 10 additions and 10 deletions

View File

@ -775,7 +775,7 @@ private:
bool verify_yaw(); bool verify_yaw();
void do_take_picture(); void do_take_picture();
void log_picture(); void log_picture();
uint8_t mavlink_compassmot(mavlink_channel_t chan); MAV_RESULT mavlink_compassmot(mavlink_channel_t chan);
void delay(uint32_t ms); void delay(uint32_t ms);
bool acro_init(bool ignore_checks); bool acro_init(bool ignore_checks);
void acro_run(); void acro_run();

View File

@ -7,11 +7,11 @@
*/ */
// setup_compassmot - sets compass's motor interference parameters // setup_compassmot - sets compass's motor interference parameters
uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan) MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan)
{ {
#if FRAME_CONFIG == HELI_FRAME #if FRAME_CONFIG == HELI_FRAME
// compassmot not implemented for tradheli // compassmot not implemented for tradheli
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
#else #else
int8_t comp_type; // throttle or current based compensation int8_t comp_type; // throttle or current based compensation
Vector3f compass_base[COMPASS_MAX_INSTANCES]; // compass vector when throttle is zero Vector3f compass_base[COMPASS_MAX_INSTANCES]; // compass vector when throttle is zero
@ -30,7 +30,7 @@ uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan)
// exit immediately if we are already in compassmot // exit immediately if we are already in compassmot
if (ap.compass_mot) { if (ap.compass_mot) {
// ignore restart messages // ignore restart messages
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
}else{ }else{
ap.compass_mot = true; ap.compass_mot = true;
} }
@ -44,7 +44,7 @@ uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan)
if (!g.compass_enabled) { if (!g.compass_enabled) {
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Compass disabled"); gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Compass disabled");
ap.compass_mot = false; ap.compass_mot = false;
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
} }
// check compass health // check compass health
@ -53,7 +53,7 @@ uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan)
if (!compass.healthy(i)) { if (!compass.healthy(i)) {
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Check compass"); gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Check compass");
ap.compass_mot = false; ap.compass_mot = false;
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
} }
} }
@ -62,7 +62,7 @@ uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan)
if (!ap.pre_arm_rc_check) { if (!ap.pre_arm_rc_check) {
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "RC not calibrated"); gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "RC not calibrated");
ap.compass_mot = false; ap.compass_mot = false;
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
} }
// check throttle is at zero // check throttle is at zero
@ -70,14 +70,14 @@ uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan)
if (channel_throttle->get_control_in() != 0) { if (channel_throttle->get_control_in() != 0) {
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Throttle not zero"); gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Throttle not zero");
ap.compass_mot = false; ap.compass_mot = false;
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
} }
// check we are landed // check we are landed
if (!ap.land_complete) { if (!ap.land_complete) {
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Not landed"); gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Not landed");
ap.compass_mot = false; ap.compass_mot = false;
return 1; return MAV_RESULT_TEMPORARILY_REJECTED;
} }
// disable cpu failsafe // disable cpu failsafe
@ -273,7 +273,7 @@ uint8_t Copter::mavlink_compassmot(mavlink_channel_t chan)
// flag we have completed // flag we have completed
ap.compass_mot = false; ap.compass_mot = false;
return 0; return MAV_RESULT_ACCEPTED;
#endif // FRAME_CONFIG != HELI_FRAME #endif // FRAME_CONFIG != HELI_FRAME
} }