Skip to content

Commit

Permalink
separate STOP button, contest version
Browse files Browse the repository at this point in the history
  • Loading branch information
martind committed Nov 28, 2014
1 parent 01d8ddb commit 79c896e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
9 changes: 6 additions & 3 deletions android/DeviceControlActivity.java
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions android/SampleGattAttributes.java
Expand Up @@ -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")
Expand Down
10 changes: 6 additions & 4 deletions android/TourTheStairs.java
Expand Up @@ -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 );
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 79c896e

Please sign in to comment.