make sure to update the reset counters every time the topic updates

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman
2016-11-21 07:29:21 +01:00
parent 9f57ee8564
commit a61b1e089c
2 changed files with 10 additions and 8 deletions
@@ -2293,7 +2293,6 @@ FixedwingPositionControl::task_main()
if (_control_mode.flag_control_manual_enabled) {
if (_control_mode.flag_control_altitude_enabled && _global_pos.alt_reset_counter != _alt_reset_counter) {
_hold_alt += _global_pos.delta_alt;
_alt_reset_counter = _global_pos.alt_reset_counter;
// make TECS accept step in altitude and demanded altitude
_tecs.handle_alt_step(_global_pos.delta_alt, _global_pos.alt);
}
@@ -2304,12 +2303,13 @@ FixedwingPositionControl::task_main()
// reset heading hold flag, which will re-initialise position control
_hdg_hold_enabled = false;
// update reset counter
_pos_reset_counter = _global_pos.lat_lon_reset_counter;
}
}
// update the reset counters in any case
_alt_reset_counter = _global_pos.alt_reset_counter;
_pos_reset_counter = _global_pos.lat_lon_reset_counter;
// XXX add timestamp check
_global_pos_valid = true;