From 5c848d4944a2d90336c6a866a268a44964ebabf5 Mon Sep 17 00:00:00 2001 From: zedamota Date: Sun, 19 Sep 2010 18:34:20 +0000 Subject: [PATCH] OP-21/Flight PC app - Created AbortOperation function. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1692 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../src/experimental/USB_UPLOAD_TOOL/main.cpp | 1 + .../experimental/USB_UPLOAD_TOOL/op_dfu.cpp | 19 +++++++++++++++++-- .../src/experimental/USB_UPLOAD_TOOL/op_dfu.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp b/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp index dc74e2ed6..acaf34265 100644 --- a/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp +++ b/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp @@ -179,6 +179,7 @@ int main(int argc, char *argv[]) ///////////////////////////////////ACTIONS START/////////////////////////////////////////////////// OP_DFU dfu(debug); + dfu.AbortOperation(); if(!dfu.enterDFU(0)) { cout<<"Could not enter DFU mode\n"; diff --git a/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp b/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp index 0c846f5b3..90c416c8b 100644 --- a/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp +++ b/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp @@ -293,6 +293,21 @@ void OP_DFU::ResetDevice(void) buf[9] = 0; int result = hidHandle.send(0,buf, BUF_LEN, 500); } +void OP_DFU::AbortOperation(void) +{ + char buf[BUF_LEN]; + buf[0] =0x02;//reportID + buf[1] = OP_DFU::Abort_Operation;//DFU Command + buf[2] = 0; + buf[3] = 0; + buf[4] = 0; + buf[5] = 0; + buf[6] = 0; + buf[7] = 0; + buf[8] = 0; + buf[9] = 0; + int result = hidHandle.send(0,buf, BUF_LEN, 500); +} void OP_DFU::JumpToApp() { char buf[BUF_LEN]; @@ -323,10 +338,10 @@ OP_DFU::Status OP_DFU::StatusRequest() buf[8] = 0; buf[9] = 0; - int result = hidHandle.send(0,buf, BUF_LEN, 5000); + int result = hidHandle.send(0,buf, BUF_LEN, 10000); if(debug) qDebug() << result << " bytes sent"; - result = hidHandle.receive(0,buf,BUF_LEN,5000); + result = hidHandle.receive(0,buf,BUF_LEN,10000); if(debug) qDebug() << result << " bytes received"; if(buf[1]==OP_DFU::Status_Rep) diff --git a/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.h b/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.h index e7a9edf84..62b590ac5 100644 --- a/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.h +++ b/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.h @@ -125,6 +125,7 @@ public: void test(); int send_delay; bool use_delay; + void AbortOperation(void); private: bool debug; int RWFlags;