diff --git a/src/buzzuav_closures.cpp b/src/buzzuav_closures.cpp index 6a4ed43..15d0b0f 100644 --- a/src/buzzuav_closures.cpp +++ b/src/buzzuav_closures.cpp @@ -115,8 +115,8 @@ int buzzuav_goto(buzzvm_t vm) { //buzzvm_type_assert(vm, 3, BUZZTYPE_FLOAT); buzzvm_type_assert(vm, 2, BUZZTYPE_FLOAT); buzzvm_type_assert(vm, 1, BUZZTYPE_FLOAT); - float dx = buzzvm_stack_at(vm, 1)->f.value; - float dy = buzzvm_stack_at(vm, 2)->f.value; + float dy = buzzvm_stack_at(vm, 1)->f.value; + float dx = buzzvm_stack_at(vm, 2)->f.value; // float d = sqrt(dx*dx+dy*dy); // float b = atan2(dy,dx); printf(" Vector for Goto: %.7f,%.7f\n",dx,dy); diff --git a/src/test1.bzz b/src/test1.bzz index 0471f22..be28813 100644 --- a/src/test1.bzz +++ b/src/test1.bzz @@ -98,6 +98,9 @@ neighbors.listen("cmd", statef=land } } + if( flight.status == 2 and position.altitude >= TARGET_ALTITUDE-TARGET_ALTITUDE/20.0) + statef=hexagon + ) }