diff options
author | Vladimir Ermakov <vooon341@gmail.com> | 2014-09-09 17:02:25 +0400 |
---|---|---|
committer | Vladimir Ermakov <vooon341@gmail.com> | 2014-09-09 17:02:25 +0400 |
commit | 564c9b7b60aaa1187570e188fe7d1e19945d40b5 (patch) | |
tree | 5ca02cd7ebd85a6ad04770ebdbd755225ced6d69 /src | |
parent | 35a6074419b3dcf567f23db74b8ea53eff20c9d6 (diff) | |
download | px4-firmware-564c9b7b60aaa1187570e188fe7d1e19945d40b5.tar.gz px4-firmware-564c9b7b60aaa1187570e188fe7d1e19945d40b5.tar.bz2 px4-firmware-564c9b7b60aaa1187570e188fe7d1e19945d40b5.zip |
FTP: Add req_opcode field for return request opcode in response message.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/mavlink/mavlink_ftp.cpp | 3 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_ftp.h | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index 72ede8797..ae9246ece 100644 --- a/src/modules/mavlink/mavlink_ftp.cpp +++ b/src/modules/mavlink/mavlink_ftp.cpp @@ -224,12 +224,14 @@ MavlinkFTP::_process_request(Request *req) out: // handle success vs. error if (errorCode == kErrNone) { + payload->req_opcode = payload->opcode; payload->opcode = kRspAck; #ifdef MAVLINK_FTP_DEBUG warnx("FTP: ack\n"); #endif } else { warnx("FTP: nak %u", errorCode); + payload->req_opcode = payload->opcode; payload->opcode = kRspNak; payload->size = 1; payload->data[0] = errorCode; @@ -654,7 +656,6 @@ MavlinkFTP::_payload_crc32(PayloadHeader *payload) payload->crc32 = 0; payload->padding[0] = 0; payload->padding[1] = 0; - payload->padding[2] = 0; uint32_t retCRC = crc32((const uint8_t*)payload, payload->size + sizeof(PayloadHeader)); payload->crc32 = saveCRC; diff --git a/src/modules/mavlink/mavlink_ftp.h b/src/modules/mavlink/mavlink_ftp.h index b4cc154d1..1fb50a17e 100644 --- a/src/modules/mavlink/mavlink_ftp.h +++ b/src/modules/mavlink/mavlink_ftp.h @@ -76,7 +76,8 @@ public: uint8_t session; ///< Session id for read and write commands uint8_t opcode; ///< Command opcode uint8_t size; ///< Size of data - uint8_t padding[3]; ///< 32 bit aligment padding + uint8_t req_opcode; ///< Request opcode returned in kRspAck, kRspNak message + uint8_t padding[2]; ///< 32 bit aligment padding uint32_t crc32; ///< CRC for entire Request structure, with crc32 and padding set to 0 uint32_t offset; ///< Offsets for List and Read commands uint8_t data[]; ///< command data, varies by Opcode |