Skip to content

Always update socketRecAvailable when called, #259 #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,11 @@ int EthernetClass::socketRecv(uint8_t s, uint8_t *buf, int16_t len)

uint16_t EthernetClass::socketRecvAvailable(uint8_t s)
{
uint16_t ret = state[s].RX_RSR;
if (ret == 0) {
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
uint16_t rsr = getSnRX_RSR(s);
SPI.endTransaction();
ret = rsr - state[s].RX_inc;
state[s].RX_RSR = ret;
//Serial.printf("sockRecvAvailable s=%d, RX_RSR=%d\n", s, ret);
}
return ret;
SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
uint16_t rsr = getSnRX_RSR(s);
SPI.endTransaction();
state[s].RX_RSR = rsr - state[s].RX_inc;
return state[s].RX_RSR;
}

// get the first byte in the receive queue (no checking)
Expand Down
Loading