1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

AndroidGCS: As soon as the controller is released set the throttle to -1

This commit is contained in:
James Cotton 2012-08-05 22:14:40 -05:00
parent 8be488b92f
commit ec31f0dc6a

View File

@ -92,10 +92,9 @@ public class Controller extends ObjectManagerActivity {
public void OnMoved(int pan, int tilt) {
pitch = (double) tilt / MOVEMENT_RANGE;
yaw = (double) pan / MOVEMENT_RANGE;
updated = true;
leftJoystickHeld = true;
}
public void OnReleased() { leftJoystickHeld = false; }
public void OnReleased() { leftJoystickHeld = false; throttle = -1; updated = true; }
@Override
public void OnReturnedToCenter() { }
}, new JoystickMovedListener() {
@ -105,10 +104,9 @@ public class Controller extends ObjectManagerActivity {
if (throttle < 0)
throttle = -1;
roll = (double) pan / MOVEMENT_RANGE;
updated = true;
rightJoystickHeld = true;
}
public void OnReleased() { rightJoystickHeld = false; }
public void OnReleased() { rightJoystickHeld = false; throttle = -1; updated = true; }
@Override
public void OnReturnedToCenter() { }
}) ;
@ -117,7 +115,7 @@ public class Controller extends ObjectManagerActivity {
uavobjHandler.post(new Runnable() {
@Override
public void run() {
if (leftJoystickHeld && rightJoystickHeld) {
if ((leftJoystickHeld && rightJoystickHeld) || updated) {
UAVObject gcsReceiver = objMngr.getObject("GCSReceiver");
if (gcsReceiver == null) {
Log.e(TAG, "No GCS Receiver object found");
@ -138,6 +136,8 @@ public class Controller extends ObjectManagerActivity {
gcsReceiver.updated();
updated = false;
if (DEBUG) Log.d(TAG, "Send update" + gcsReceiver.toStringData());
}
updated = false;