fix bug in W5500 code
This commit is contained in:
@@ -23,7 +23,36 @@ int W5500EthClient::setTimeout(uint32_t seconds)
|
||||
|
||||
size_t W5500EthClient::write(const char *buffer, size_t size)
|
||||
{
|
||||
return _ethClient->write(buffer, size);
|
||||
if(size == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const size_t chunkSize = 2048; // W5100.SSIZE in socket.cpp
|
||||
|
||||
uint32_t index = 0;
|
||||
uint32_t bytesLeft = 0;
|
||||
size_t written = 0;
|
||||
|
||||
do
|
||||
{
|
||||
bytesLeft = size - index;
|
||||
if(bytesLeft >= chunkSize)
|
||||
{
|
||||
_ethClient->write(&buffer[index], chunkSize);
|
||||
index = index + chunkSize;
|
||||
written = written + chunkSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ethClient->write(&buffer[index], bytesLeft);
|
||||
index = index + bytesLeft;
|
||||
written = written + bytesLeft;
|
||||
}
|
||||
} while (bytesLeft > 0);
|
||||
|
||||
return written;
|
||||
// return _ethClient->write(buffer, size);
|
||||
}
|
||||
|
||||
IPAddress W5500EthClient::localIP()
|
||||
|
||||
Reference in New Issue
Block a user