Skip to content

Commit

Permalink
copter: mode autortate fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKear committed Oct 16, 2024
1 parent 79b9719 commit a26f9b3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions ArduCopter/mode_autorotate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ bool ModeAutorotate::init(bool ignore_checks)
_flags.touch_down_init = false;
_flags.landed_init = false;

// Ensure the surface distance object is enabled. We tidy this up on the mode exit function
copter.rangefinder_state.set_enabled_by_ap(true);

// Setting default starting switches
phase_switch = Autorotation_Phase::ENTRY;

Expand All @@ -62,10 +59,10 @@ bool ModeAutorotate::init(bool ignore_checks)
void ModeAutorotate::run()
{
// Current time
uint32_t now = millis(); //milliseconds
const uint32_t now = millis();

// Set dt in library
float const last_loop_time_s = AP::scheduler().get_last_loop_time_s();
const float last_loop_time_s = AP::scheduler().get_last_loop_time_s();
g2.arot.set_dt(last_loop_time_s);

// Update the height above ground measurement in the autorotation lib
Expand Down Expand Up @@ -180,8 +177,7 @@ void ModeAutorotate::run()

void ModeAutorotate::exit()
{
// Ensure we return the rangefinder state back to how we found it
copter.rangefinder_state.set_enabled_by_ap(false);
g2.arot.exit();
}

#endif

0 comments on commit a26f9b3

Please sign in to comment.