AP_IOMCU: fixed read packet count

This commit is contained in:
Andrew Tridgell 2018-10-30 08:54:43 +11:00
parent 6c761fa864
commit 1711b93602
2 changed files with 1 additions and 4 deletions

View File

@ -342,8 +342,6 @@ bool AP_IOMCU_FW::handle_code_read()
default:
return false;
}
last_page = rx_io_packet.page;
last_offset = rx_io_packet.offset;
/* if the offset is at or beyond the end of the page, we have no data */
if (rx_io_packet.offset >= tx_io_packet.count) {
@ -353,6 +351,7 @@ bool AP_IOMCU_FW::handle_code_read()
/* correct the data pointer and count for the offset */
values += rx_io_packet.offset;
tx_io_packet.count -= rx_io_packet.offset;
tx_io_packet.count = MIN(tx_io_packet.count, rx_io_packet.count);
memcpy(tx_io_packet.regs, values, sizeof(uint16_t)*tx_io_packet.count);
tx_io_packet.crc = 0;
tx_io_packet.crc = crc_crc8((const uint8_t *)&tx_io_packet, tx_io_packet.get_size());

View File

@ -84,8 +84,6 @@ private:
uint32_t sbus_last_ms;
uint32_t sbus_interval_ms;
uint8_t last_page;
uint8_t last_offset;
uint32_t fmu_data_received_time;
uint32_t last_heater_ms;
uint32_t reboot_time;