AP_IOMCU: fixed read packet count
This commit is contained in:
parent
6c761fa864
commit
1711b93602
@ -342,8 +342,6 @@ bool AP_IOMCU_FW::handle_code_read()
|
|||||||
default:
|
default:
|
||||||
return false;
|
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 the offset is at or beyond the end of the page, we have no data */
|
||||||
if (rx_io_packet.offset >= tx_io_packet.count) {
|
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 */
|
/* correct the data pointer and count for the offset */
|
||||||
values += rx_io_packet.offset;
|
values += rx_io_packet.offset;
|
||||||
tx_io_packet.count -= 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);
|
memcpy(tx_io_packet.regs, values, sizeof(uint16_t)*tx_io_packet.count);
|
||||||
tx_io_packet.crc = 0;
|
tx_io_packet.crc = 0;
|
||||||
tx_io_packet.crc = crc_crc8((const uint8_t *)&tx_io_packet, tx_io_packet.get_size());
|
tx_io_packet.crc = crc_crc8((const uint8_t *)&tx_io_packet, tx_io_packet.get_size());
|
||||||
|
@ -84,8 +84,6 @@ private:
|
|||||||
uint32_t sbus_last_ms;
|
uint32_t sbus_last_ms;
|
||||||
uint32_t sbus_interval_ms;
|
uint32_t sbus_interval_ms;
|
||||||
|
|
||||||
uint8_t last_page;
|
|
||||||
uint8_t last_offset;
|
|
||||||
uint32_t fmu_data_received_time;
|
uint32_t fmu_data_received_time;
|
||||||
uint32_t last_heater_ms;
|
uint32_t last_heater_ms;
|
||||||
uint32_t reboot_time;
|
uint32_t reboot_time;
|
||||||
|
Loading…
Reference in New Issue
Block a user