diff --git a/src/Bus.cc b/src/Bus.cc index 8737fa45..96684305 100644 --- a/src/Bus.cc +++ b/src/Bus.cc @@ -486,7 +486,7 @@ namespace kickcat auto process = [pi_frame](DatagramHeader const*, uint8_t const* data, uint16_t wkc) { - if (wkc != pi_frame.inputs.size()) + if (wkc != (pi_frame.inputs.size() + pi_frame.outputs.size() * 2)) { DEBUG_PRINT("Invalid working counter\n"); return DatagramState::INVALID_WKC; diff --git a/unit/bus-t.cc b/unit/bus-t.cc index bb70f826..33fe83fe 100644 --- a/unit/bus-t.cc +++ b/unit/bus-t.cc @@ -322,7 +322,7 @@ TEST_F(BusTest, logical_cmd) logical_write = 0x1716151413121110; std::memcpy(slave.output.data, &logical_write, sizeof(int64_t)); checkSendFrame(Command::LRW, logical_write); - handleReply({logical_read}); + handleReply({logical_read}, 3); bus.processDataReadWrite([](DatagramState const&){}); for (int i = 0; i < 8; ++i)