Sub: turn counter improvements

This commit is contained in:
Jacob Walser 2016-10-10 22:59:10 -04:00 committed by Andrew Tridgell
parent 0699acfcf0
commit 2c62158e20

View File

@ -55,8 +55,11 @@ void Sub::update_turn_counter()
break;
}
static int32_t last_turn_count_printed;
if ( quarter_turn_count/4 != last_turn_count_printed ) {
gcs_send_text_fmt(MAV_SEVERITY_INFO,"Tether is turned %i turns %s",int32_t(quarter_turn_count/4),(quarter_turn_count>0)?"to the right":"to the left");
static uint32_t last_turn_announce_ms = 0;
uint32_t tnow = AP_HAL::millis();
if ( quarter_turn_count/4 != last_turn_count_printed && tnow > last_turn_announce_ms + 2000) {
last_turn_announce_ms = tnow;
gcs_send_text_fmt(MAV_SEVERITY_INFO,"Tether is turned %i turns %s",int32_t(abs(quarter_turn_count)/4),(quarter_turn_count>0)?"to the right":"to the left");
last_turn_count_printed = quarter_turn_count/4;
}
last_turn_state = turn_state;