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

Core: Switch to Loiter on disarm if landing on RTL or LAND #1114

Merged
merged 2 commits into from
Oct 2, 2014

Conversation

arthurbenemann
Copy link
Member

Fix issue #1108

@@ -86,7 +86,9 @@ public void setArmed(boolean newState) {
if (newState) {
myDrone.getWaypointManager().getWaypoints();
}else{
changeFlightMode(ApmModes.ROTOR_LOITER); // When disarming set the mode back to loiter so we can do a takeoff in the future.
if (mode == ApmModes.ROTOR_RTL | mode == ApmModes.ROTOR_LAND) {
Copy link
Member

Choose a reason for hiding this comment

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

you're using a bitwise inclusive OR (|) operator where a logical OR (||) operator should be used.

Copy link
Member Author

Choose a reason for hiding this comment

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

damn, looks like I'm doing bit fiddling on C. But It would work all the same :)

Copy link
Member

Choose a reason for hiding this comment

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

not quite the same, the logical operator OR in java allows for short-circuiting, while the bitwise doesn't.

@m4gr3d
Copy link
Member

m4gr3d commented Oct 2, 2014

@arthurbenemann as mentioned in issue #1108, this is not the right way to proceed for this functionality.
If a user triggers land or rtl with the RC controller, while DP is connected, the mode will be set to loiter against the user's wish.

For a lot of users, myself included, that qualifies as a bug because the app is doing something I didn't ask to, and that is not expected.

It was a bitwise OR before, when it should have been a logic OR
@arthurbenemann
Copy link
Member Author

I'm merging this since it's at least better than what's on master now.

arthurbenemann added a commit that referenced this pull request Oct 2, 2014
Core: Switch to Loiter on disarm if landing on RTL or LAND
@arthurbenemann arthurbenemann merged commit 6db4f8c into master Oct 2, 2014
@arthurbenemann arthurbenemann deleted the switchModeWhenLanding branch October 2, 2014 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants