Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plane: Small cleanup to quadplane const (and clarity) #9270

Merged
merged 1 commit into from Sep 4, 2018

Conversation

WickedShell
Copy link
Contributor

This is just a small set of sanity patches to the quadplane code that I came across while trying to address other things. In no particular order it does the following things:

  1. Adds const to a number of functions, primarily intended to help track what can side effect.
  2. Adds a couple of other objects we require to the free memory check.
  3. Extracts a couple of redundant calls to millis()
  4. Simplifies the logic, and marginally improves the speed of QuadPlane::should_relax()

@@ -483,7 +483,7 @@ bool QuadPlane::setup(void)
}

if (hal.util->available_memory() <
4096 + sizeof(*motors) + sizeof(*attitude_control) + sizeof(*pos_control) + sizeof(*wp_nav)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just malloc, check the result then look at the amount of free memory?

if (!motor_at_lower_limit) {
landing_detect.lower_limit_start_ms = 0;
return false;
} else if (landing_detect.lower_limit_start_ms == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pointless else

@tridge tridge merged commit 925d76b into ArduPilot:master Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants