Copter: compassmot format fixes

This commit is contained in:
Randy Mackay 2018-08-02 11:34:11 +09:00
parent 13f96bcb00
commit 6b50a810f6

View File

@ -174,8 +174,6 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan)
for (uint8_t i=0; i<compass.get_count(); i++) { for (uint8_t i=0; i<compass.get_count(); i++) {
compass_base[i] = compass_base[i] * 0.99f + compass.get_field(i) * 0.01f; compass_base[i] = compass_base[i] * 0.99f + compass.get_field(i) * 0.01f;
} }
// causing printing to happen as soon as throttle is lifted
} else { } else {
// calculate diff from compass base and scale with throttle // calculate diff from compass base and scale with throttle
@ -192,7 +190,6 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan)
// adjust the motor compensation to negate the impact // adjust the motor compensation to negate the impact
motor_compensation[i] = motor_compensation[i] * 0.99f - motor_impact_scaled[i] * 0.01f; motor_compensation[i] = motor_compensation[i] * 0.99f - motor_impact_scaled[i] * 0.01f;
} }
updated = true; updated = true;
} else { } else {
// for each compass // for each compass
@ -224,8 +221,8 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan)
// record maximum throttle and current // record maximum throttle and current
throttle_pct_max = MAX(throttle_pct_max, throttle_pct); throttle_pct_max = MAX(throttle_pct_max, throttle_pct);
current_amps_max = MAX(current_amps_max, battery.current_amps()); current_amps_max = MAX(current_amps_max, battery.current_amps());
} }
if (AP_HAL::millis() - last_send_time > 500) { if (AP_HAL::millis() - last_send_time > 500) {
last_send_time = AP_HAL::millis(); last_send_time = AP_HAL::millis();
mavlink_msg_compassmot_status_send(chan, mavlink_msg_compassmot_status_send(chan,
@ -275,4 +272,3 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan)
return MAV_RESULT_ACCEPTED; return MAV_RESULT_ACCEPTED;
#endif // FRAME_CONFIG != HELI_FRAME #endif // FRAME_CONFIG != HELI_FRAME
} }