Skip to content

Commit 1fa3866

Browse files
authored
Fix: LRW expected working counter is wrong. (#19)
1 parent d2d16bb commit 1fa3866

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Bus.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ namespace kickcat
486486

487487
auto process = [pi_frame](DatagramHeader const*, uint8_t const* data, uint16_t wkc)
488488
{
489-
if (wkc != pi_frame.inputs.size())
489+
if (wkc != (pi_frame.inputs.size() + pi_frame.outputs.size() * 2))
490490
{
491491
DEBUG_PRINT("Invalid working counter\n");
492492
return DatagramState::INVALID_WKC;

unit/bus-t.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ TEST_F(BusTest, logical_cmd)
322322
logical_write = 0x1716151413121110;
323323
std::memcpy(slave.output.data, &logical_write, sizeof(int64_t));
324324
checkSendFrame(Command::LRW, logical_write);
325-
handleReply<int64_t>({logical_read});
325+
handleReply<int64_t>({logical_read}, 3);
326326
bus.processDataReadWrite([](DatagramState const&){});
327327

328328
for (int i = 0; i < 8; ++i)

0 commit comments

Comments
 (0)