slightly enhanced PlusROM display in debugger (keeps last send/receive now)

This commit is contained in:
thrust26 2024-12-13 09:33:15 +01:00
parent 4ba7bfde71
commit 617147a175
2 changed files with 8 additions and 3 deletions

View File

@ -364,7 +364,7 @@ bool PlusROM::load(Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PlusROM::reset() void PlusROM::reset()
{ {
myRxReadPos = myRxWritePos = myTxPos = 0; myRxReadPos = myRxWritePos = myTxPos = myLastRxReadPos = myLastTxPos = 0;
myPendingRequests.clear(); myPendingRequests.clear();
} }
@ -424,6 +424,7 @@ void PlusROM::send()
myTxPos myTxPos
); );
myLastTxPos = myTxPos - 1;
myTxPos = 0; myTxPos = 0;
// We push to the back in order to avoid reverse_iterator in receive() // We push to the back in order to avoid reverse_iterator in receive()
@ -478,6 +479,7 @@ void PlusROM::receive()
// and start over // and start over
const auto [responseSize, response] = (*iter)->getResponse(); const auto [responseSize, response] = (*iter)->getResponse();
myLastRxReadPos = myRxReadPos;
for(size_t i = 0; i < responseSize; ++i) for(size_t i = 0; i < responseSize; ++i)
myRxBuffer[myRxWritePos++] = response[i]; myRxBuffer[myRxWritePos++] = response[i];
@ -497,8 +499,9 @@ void PlusROM::receive()
ByteArray PlusROM::getSend() const ByteArray PlusROM::getSend() const
{ {
ByteArray arr; ByteArray arr;
uInt8 txPos = myTxPos != 0 ? myTxPos : myLastTxPos;
for(int i = 0; i < myTxPos; ++i) for(int i = 0; i < txPos; ++i)
arr.push_back(myTxBuffer[i]); arr.push_back(myTxBuffer[i]);
return arr; return arr;
@ -508,8 +511,9 @@ ByteArray PlusROM::getSend() const
ByteArray PlusROM::getReceive() const ByteArray PlusROM::getReceive() const
{ {
ByteArray arr; ByteArray arr;
uInt8 txReadPos = myRxReadPos != myRxWritePos ? myRxReadPos : myLastRxReadPos;
for(uInt8 i = myRxReadPos; i != myRxWritePos; ++i) for(uInt8 i = txReadPos; i != myRxWritePos; ++i)
arr.push_back(myRxBuffer[i]); arr.push_back(myRxBuffer[i]);
return arr; return arr;

View File

@ -191,6 +191,7 @@ class PlusROM : public Serializable
std::array<uInt8, 256> myRxBuffer{}, myTxBuffer{}; std::array<uInt8, 256> myRxBuffer{}, myTxBuffer{};
uInt8 myRxReadPos{0}, myRxWritePos{0}, myTxPos{0}; uInt8 myRxReadPos{0}, myRxWritePos{0}, myTxPos{0};
uInt8 myLastRxReadPos{0}, myLastTxPos{0};
std::deque<shared_ptr<PlusROMRequest>> myPendingRequests; std::deque<shared_ptr<PlusROMRequest>> myPendingRequests;