Skip to content

Commit

Permalink
Copter: if target rate changes, update actual rate
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Jun 28, 2024
1 parent 8360957 commit 4bc1428
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ArduCopter/Attitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,14 @@ void Copter::rate_controller_thread()

// check that the CPU is not pegged, if it is drop the attitude rate
if (now_ms - last_rate_check_ms >= 200
&& (get_fast_rate_type() != FastRateType::FAST_RATE_FIXED || !motors->armed())) {
&& (get_fast_rate_type() != FastRateType::FAST_RATE_FIXED || !motors->armed() || target_rate_decimation > rate_decimation)) {
last_rate_check_ms = now_ms;
const uint32_t att_rate = ins.get_raw_gyro_rate_hz()/rate_decimation;
if (running_slow > 5 || AP::scheduler().get_extra_loop_us() > 0
#if HAL_LOGGING_ENABLED
|| AP::logger().in_log_download()
#endif
|| target_rate_decimation > rate_decimation
) {
const uint32_t new_attitude_rate = ins.get_raw_gyro_rate_hz()/(rate_decimation+1);
if (new_attitude_rate > AP::scheduler().get_filtered_loop_rate_hz() * 2) {
Expand Down

0 comments on commit 4bc1428

Please sign in to comment.