1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

OP-21/Flight PC app - Created AbortOperation function.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1692 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
zedamota 2010-09-19 18:34:20 +00:00 committed by zedamota
parent 3ba6372dc4
commit 5c848d4944
3 changed files with 19 additions and 2 deletions

View File

@ -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";

View File

@ -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)

View File

@ -125,6 +125,7 @@ public:
void test();
int send_delay;
bool use_delay;
void AbortOperation(void);
private:
bool debug;
int RWFlags;