Browse Source

AP_IOMCU: fixed read packet count

master
Andrew Tridgell 6 years ago
parent
commit
1711b93602
  1. 3
      libraries/AP_IOMCU/iofirmware/iofirmware.cpp
  2. 2
      libraries/AP_IOMCU/iofirmware/iofirmware.h

3
libraries/AP_IOMCU/iofirmware/iofirmware.cpp

@ -342,8 +342,6 @@ bool AP_IOMCU_FW::handle_code_read() @@ -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() @@ -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());

2
libraries/AP_IOMCU/iofirmware/iofirmware.h

@ -84,8 +84,6 @@ private: @@ -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;

Loading…
Cancel
Save