diff --git a/android/DeviceControlActivity.java b/android/DeviceControlActivity.java index 6415900..90ab35f 100644 --- a/android/DeviceControlActivity.java +++ b/android/DeviceControlActivity.java @@ -130,11 +130,14 @@ public boolean onChildClick(ExpandableListView parent, View v, int groupPosition // abuse A01 characteristics for start/stop Tour-the-Stairs thread if( characteristic.getUuid().toString().equals("9a66fa01-0800-9191-11e4-012d1540cb8e") ) { - if( mTourTheStairs == null || mTourTheStairs.completed() ) { - mTourTheStairs = new TourTheStairs( mBluetoothLeService, mGattCharacteristics ); + if (mTourTheStairs == null || mTourTheStairs.completed()) { + mTourTheStairs = new TourTheStairs(mBluetoothLeService, mGattCharacteristics); mTourTheStairs.start(); } - else { + return true; + } + if( characteristic.getUuid().toString().equals("9a66fa02-0800-9191-11e4-012d1540cb8e") ) { + if (mTourTheStairs != null ) { mTourTheStairs.requestStop(); } return true; diff --git a/android/SampleGattAttributes.java b/android/SampleGattAttributes.java index 4d77b69..a16b366 100644 --- a/android/SampleGattAttributes.java +++ b/android/SampleGattAttributes.java @@ -49,6 +49,7 @@ public class SampleGattAttributes { // Parrot minidrone Rolling Spider specific characteristics attributes.put("9a66fa01-0800-9191-11e4-012d1540cb8e", "Tour the Stairs/Parrot - A01"); // + complete range to A1F (handle 0x22 - 0x7F) + attributes.put("9a66fa02-0800-9191-11e4-012d1540cb8e", " !!! S T O P !!!"); attributes.put("9a66fa0a-0800-9191-11e4-012d1540cb8e", "Parrot - Power Motors"); // handle 0x40 attributes.put("9a66fa0b-0800-9191-11e4-012d1540cb8e", "Parrot - Date/Time"); // handle 0x43, 1:2014-10-29, 2:T223238+0100, 3:0x0 attributes.put("9a66fa0c-0800-9191-11e4-012d1540cb8e", "Parrot - Emergency Stop"); // handle 0x46, send("02 00 04 00") diff --git a/android/TourTheStairs.java b/android/TourTheStairs.java index 957448e..4db8b26 100644 --- a/android/TourTheStairs.java +++ b/android/TourTheStairs.java @@ -221,7 +221,7 @@ public void newInputs( byte[] data ) { public Boolean ver0() { takeoff(); - if( !motors( false, 0, 0, 0, 0, 0.0f, 12 ) ) return false; + if( !motors( false, 0, 0, 0, 0, 0.0f, 18 ) ) return false; if( !motors( true, 0, 100, 0, 0, 0.0f, 6 ) ) return false; emergencyStop(); return motors( false, 0, 0, 0, 0, 0.0f, 10 ); @@ -235,10 +235,12 @@ public Boolean approachStep() { } public void ver1() { - for( int i=0; i < 3; i++ ) { - if( !approachStep() ) + for( int i=0; i < 100; i++ ) { + if( !ver0() ) { + emergencyStop(); break; - if( !ver0() ) + } + if( !approachStep() ) break; } }