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;