From cf0b3aaaf5d69833823b2b5199762526a5684535 Mon Sep 17 00:00:00 2001 From: 13195980010 <1512161085@qq.com> Date: Mon, 9 May 2022 20:40:49 -0700 Subject: [PATCH] keyboardupdate --- src/Djitellowhite/Hardwarelistener.h | 4 ++-- src/Djitellowhite/Triplet.cpp | 2 +- src/Djitellowhite/keyboard.cpp | 7 ++++++- src/Djitellowhite/test | Bin 0 -> 29608 bytes 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100755 src/Djitellowhite/test diff --git a/src/Djitellowhite/Hardwarelistener.h b/src/Djitellowhite/Hardwarelistener.h index 176cde8..599fa82 100644 --- a/src/Djitellowhite/Hardwarelistener.h +++ b/src/Djitellowhite/Hardwarelistener.h @@ -1,6 +1,6 @@ #ifndef _HARDWARELISTENER_H #define _HARDWARELISTENER_H - -int listenkeyboard(); +#include "Djitellowhite.h" +int listenkeyboard(Tello T,sockaddr_in serveraddr); int scanKeyboard(); #endif diff --git a/src/Djitellowhite/Triplet.cpp b/src/Djitellowhite/Triplet.cpp index 1456006..9c0ef65 100644 --- a/src/Djitellowhite/Triplet.cpp +++ b/src/Djitellowhite/Triplet.cpp @@ -40,6 +40,6 @@ int main(void){ //T.land(serveraddr); pthread_join(thread_receive,NULL); - listenkeyboard(); + listenkeyboard(T,serveraddr); return 0; } diff --git a/src/Djitellowhite/keyboard.cpp b/src/Djitellowhite/keyboard.cpp index 3006537..dcf3ade 100644 --- a/src/Djitellowhite/keyboard.cpp +++ b/src/Djitellowhite/keyboard.cpp @@ -2,6 +2,7 @@ #include #include "Hardwarelistener.h" #include + using namespace std; int scanKeyboard() { @@ -26,21 +27,25 @@ int scanKeyboard() } //测试函数 -int listenkeyboard(){ +int listenkeyboard(Tello T, sockaddr_in serveraddr){ while(1){ switch(scanKeyboard()) { case (int)'w': cout << "forward"<< endl; + T.forward(serveraddr); break; case (int)'s': cout << "back" << endl; + T.back(serveraddr); break; case (int)'a': cout << "left" <ey`jy4XTC9sD$oiF}VB$Q5a{&`L`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