diff --git a/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp b/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp index 27615e928..a1f5de9bd 100644 --- a/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp +++ b/ground/src/experimental/USB_UPLOAD_TOOL/main.cpp @@ -45,11 +45,11 @@ int main(int argc, char *argv[]) cout<<"| |\n"; cout<<"| examples: |\n"; cout<<"| |\n"; - cout<<"| program and verify device #1 |\n"; - cout<<"| OPUploadTool -p c:/OpenPilot.bin -w \"Openpilot Firmware\" -v -d 1 |\n"; + cout<<"| program and verify device #0 |\n"; + cout<<"| OPUploadTool -p c:/OpenPilot.bin -w \"Openpilot Firmware\" -v -d 0 |\n"; cout<<"| |\n"; - cout<<"| Perform a quick compare of FW in file with FW in device #2 |\n"; - cout<<"| OPUploadTool -ch c:/OpenPilot.bin -d 2 |\n"; + cout<<"| Perform a quick compare of FW in file with FW in device #1 |\n"; + cout<<"| OPUploadTool -ch c:/OpenPilot2.bin -d 2 |\n"; cout<<"|________________________________________________________________________|\n"; return 0; @@ -99,8 +99,7 @@ int main(int argc, char *argv[]) cout<<("Device not specified\n"); return -1; } - if(args.contains(VERIFY)) - action=OP_DFU::actionProgramAndVerify; + } else if(args.contains(COMPAREHASH) || args.contains(COMPAREALL)) { @@ -214,7 +213,7 @@ int main(int argc, char *argv[]) } return 0; } - if(device>dfu.numberOfDevices) + if(device>dfu.numberOfDevices-1) { cout<<"Error:Invalid Device"; return -1; diff --git a/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp b/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp index 9df028d15..57d762d89 100644 --- a/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp +++ b/ground/src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp @@ -28,7 +28,7 @@ OP_DFU::OP_DFU(bool _debug): debug(_debug) if(debug) qDebug() << numDevices << " device(s) opened"; } -bool OP_DFU::SaveByteArrayToFile(QString sfile, const QByteArray &array) +bool OP_DFU::SaveByteArrayToFile(QString const & sfile, const QByteArray &array) { QFile file(sfile); //QFile file("in.txt"); @@ -43,7 +43,7 @@ bool OP_DFU::SaveByteArrayToFile(QString sfile, const QByteArray &array) return true; } -bool OP_DFU::enterDFU(int devNumber) +bool OP_DFU::enterDFU(int const &devNumber) { char buf[BUF_LEN]; buf[0] =0x02;//reportID @@ -64,7 +64,7 @@ bool OP_DFU::enterDFU(int devNumber) qDebug() << result << " bytes sent"; return true; } -bool OP_DFU::StartUpload(qint32 numberOfBytes, TransferTypes type) +bool OP_DFU::StartUpload(qint32 const & numberOfBytes, TransferTypes const & type) { int lastPacketCount; qint32 numberOfPackets=numberOfBytes/4/14; @@ -99,7 +99,7 @@ bool OP_DFU::StartUpload(qint32 numberOfBytes, TransferTypes type) } return false; } -bool OP_DFU::UploadData(qint32 numberOfBytes, QByteArray data) +bool OP_DFU::UploadData(qint32 const & numberOfBytes, QByteArray & data) { int lastPacketCount; qint32 numberOfPackets=numberOfBytes/4/14; @@ -156,9 +156,10 @@ bool OP_DFU::UploadData(qint32 numberOfBytes, QByteArray data) // qDebug() << "UPLOAD:"<<"Data="<<(int)buf[6]<<(int)buf[7]<<(int)buf[8]<<(int)buf[9]<<";"< devices; int numberOfDevices; - QString StatusToString(OP_DFU::Status); + QString StatusToString(OP_DFU::Status const & status); OP_DFU::Status CompareFirmware(const QString &sfile, const CompareType &type); private: bool debug;