mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-06 21:54:15 +01:00
AndroidGCS: As soon as the controller is released set the throttle to -1
This commit is contained in:
parent
8be488b92f
commit
ec31f0dc6a
@ -92,10 +92,9 @@ public class Controller extends ObjectManagerActivity {
|
|||||||
public void OnMoved(int pan, int tilt) {
|
public void OnMoved(int pan, int tilt) {
|
||||||
pitch = (double) tilt / MOVEMENT_RANGE;
|
pitch = (double) tilt / MOVEMENT_RANGE;
|
||||||
yaw = (double) pan / MOVEMENT_RANGE;
|
yaw = (double) pan / MOVEMENT_RANGE;
|
||||||
updated = true;
|
|
||||||
leftJoystickHeld = true;
|
leftJoystickHeld = true;
|
||||||
}
|
}
|
||||||
public void OnReleased() { leftJoystickHeld = false; }
|
public void OnReleased() { leftJoystickHeld = false; throttle = -1; updated = true; }
|
||||||
@Override
|
@Override
|
||||||
public void OnReturnedToCenter() { }
|
public void OnReturnedToCenter() { }
|
||||||
}, new JoystickMovedListener() {
|
}, new JoystickMovedListener() {
|
||||||
@ -105,10 +104,9 @@ public class Controller extends ObjectManagerActivity {
|
|||||||
if (throttle < 0)
|
if (throttle < 0)
|
||||||
throttle = -1;
|
throttle = -1;
|
||||||
roll = (double) pan / MOVEMENT_RANGE;
|
roll = (double) pan / MOVEMENT_RANGE;
|
||||||
updated = true;
|
|
||||||
rightJoystickHeld = true;
|
rightJoystickHeld = true;
|
||||||
}
|
}
|
||||||
public void OnReleased() { rightJoystickHeld = false; }
|
public void OnReleased() { rightJoystickHeld = false; throttle = -1; updated = true; }
|
||||||
@Override
|
@Override
|
||||||
public void OnReturnedToCenter() { }
|
public void OnReturnedToCenter() { }
|
||||||
}) ;
|
}) ;
|
||||||
@ -117,7 +115,7 @@ public class Controller extends ObjectManagerActivity {
|
|||||||
uavobjHandler.post(new Runnable() {
|
uavobjHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (leftJoystickHeld && rightJoystickHeld) {
|
if ((leftJoystickHeld && rightJoystickHeld) || updated) {
|
||||||
UAVObject gcsReceiver = objMngr.getObject("GCSReceiver");
|
UAVObject gcsReceiver = objMngr.getObject("GCSReceiver");
|
||||||
if (gcsReceiver == null) {
|
if (gcsReceiver == null) {
|
||||||
Log.e(TAG, "No GCS Receiver object found");
|
Log.e(TAG, "No GCS Receiver object found");
|
||||||
@ -138,6 +136,8 @@ public class Controller extends ObjectManagerActivity {
|
|||||||
|
|
||||||
gcsReceiver.updated();
|
gcsReceiver.updated();
|
||||||
|
|
||||||
|
updated = false;
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "Send update" + gcsReceiver.toStringData());
|
if (DEBUG) Log.d(TAG, "Send update" + gcsReceiver.toStringData());
|
||||||
}
|
}
|
||||||
updated = false;
|
updated = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user